/* Podium League · slate on white
   Layout: single column, phone-first, max 560px on desktop. One slate block
   for the thing that matters; pale cards for everything else. */
:root {
  --bg: #FFFFFF;
  --ink: #14213D;
  --muted: #5B6B7A;
  --line: #DCE3EE;
  --pale: #E8EEF6;          /* secondary cards */
  --slate: #2B3A55;         /* the one strong block */
  --slate-ink: #FFFFFF;
  --slate-muted: #B5C2D8;
  --slate-line: #4A5B7A;
  --accent: #5EB1FF;        /* sky blue: actions on slate */
  --accent-ink: #14213D;
  --score: #F2742B;         /* orange: points and nudges */
  --gold: #E3B341;
  --good: #1D8A4E;
  --warn: #B45309;
  --danger: #C62828;
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --radius: 16px;
  --radius-lg: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141B2B; --ink: #F4F7FB; --muted: #AAB6C8; --line: #2C3850;
    --pale: #1F2A3F; --slate: #3A4C6E; --slate-line: #56698C;
    --accent-ink: #14213D; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100%;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0; }
.num { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Header */
.top { padding-top: env(safe-area-inset-top, 0px); }
.top-inner {
  max-width: 560px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; color: var(--slate); }
.who { display: flex; align-items: center; gap: 8px; background: var(--pale); border-radius: 999px; padding: 4px 4px 4px 12px; font-weight: 600; font-size: 14px; }
.who-rank { font-family: var(--font-display); font-weight: 800; font-size: 13px; color: var(--slate-ink); background: var(--slate); padding: 4px 9px; border-radius: 999px; }
.who-rank:empty { display: none; }

/* Main */
.view {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding-block: 8px 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 16px;
}
.section { display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }

/* Cards */
.card { background: var(--pale); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
.card.link { cursor: pointer; }
.card.link:focus-visible, .card.link:hover { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.slate { background: var(--slate); color: var(--slate-ink); border-radius: var(--radius-lg); padding: 18px; }
.card.slate .eyebrow { color: var(--slate-muted); }
.card.slate .muted { color: var(--slate-muted); }
.card.slate .divider { border-color: var(--slate-line); }
.card.flat { background: transparent; padding: 0; }
.divider { border-top: 1px solid var(--line); padding-top: 12px; }
.list { background: var(--pale); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.list > * { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }
.list .head { padding: 10px 16px 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 0; }
.list a:hover, .list a:focus-visible { background: color-mix(in srgb, var(--pale) 70%, var(--accent) 30%); outline: none; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.pill.accent { background: var(--accent); color: var(--accent-ink); }
.pill.score { background: var(--score); color: #fff; }
.pill.slate { background: var(--slate); color: var(--slate-ink); }
.pill.ghost { background: var(--pale); color: var(--ink); }
.pill.good { background: #DDF5E6; color: var(--good); }
.pill.warn { background: #FFF1DC; color: var(--warn); }
.pill.danger { background: #FFE3E5; color: var(--danger); }
.rank { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 13px; background: var(--slate); color: var(--slate-ink); flex-shrink: 0; }
.rank.gold { background: var(--gold); color: #14213D; }
.rank.silver { background: #C9D1DC; color: #14213D; }
.rank.bronze { background: #D9A066; color: #14213D; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px; border: 0; border-radius: 999px; font-family: var(--font-display); font-weight: 700; font-size: 16px; background: var(--slate); color: var(--slate-ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--pale); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--line); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.input { height: 48px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 0 14px; font-size: 16px; width: 100%; }
.input:focus { outline: none; border-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; }
form { display: flex; flex-direction: column; gap: 14px; }

/* Segmented tabs */
.seg { display: flex; background: var(--pale); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 38px; border: 0; border-radius: 999px; background: transparent; font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--slate); color: var(--slate-ink); }

/* Pick slots */
.slot { display: flex; align-items: center; gap: 12px; background: var(--pale); border: 1.5px solid transparent; border-radius: 14px; padding: 8px 10px; position: relative; }
.slot.active { border-color: var(--accent); background: var(--bg); }
.slot .pos { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #14213D; flex-shrink: 0; }
.slot .pos.p1 { background: var(--gold); } .slot .pos.p2 { background: #C9D1DC; } .slot .pos.p3 { background: #D9A066; }
.slot input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font-size: 17px; font-weight: 600; color: var(--ink); }
.slot input:focus { outline: none; }
.slot .chosen { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slot .chosen b { font-size: 17px; font-weight: 600; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg); border: 1.5px solid var(--accent); border-radius: 14px; overflow: hidden; z-index: 5; box-shadow: 0 8px 24px rgba(20,33,61,0.12); }
.sugg button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 16px; font-weight: 600; }
.sugg button:last-child { border-bottom: 0; }
.sugg button:hover, .sugg button:focus-visible { background: var(--pale); outline: none; }
.sugg button span { color: var(--muted); font-weight: 400; font-size: 13px; }

/* Podium */
.podium { display: flex; gap: 8px; align-items: flex-end; }
.podium > div { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; min-width: 0; }
.podium .name { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.2; }
.podium .step { width: 100%; border-radius: 10px 10px 0 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 24px; color: #14213D; }
.podium .s1 { height: 76px; background: var(--gold); } .podium .s2 { height: 56px; background: #C9D1DC; } .podium .s3 { height: 44px; background: #D9A066; }
.verdict { font-weight: 600; font-size: 14px; }
.verdict.exact { color: var(--good); } .verdict.podium { color: var(--warn); } .verdict.miss { color: var(--muted); }
.big-score { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; color: var(--score); }

/* Table */
.tbl { display: grid; grid-template-columns: 32px minmax(0, 1fr) 48px 48px 56px; gap: 8px; align-items: center; font-variant-numeric: tabular-nums; }
.tbl .r { text-align: right; }
.tbl.me { background: color-mix(in srgb, var(--pale) 60%, var(--accent) 40%); }

/* Bottom tabs */
.tabs { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); display: flex; gap: 6px; padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.tabs a.active { background: var(--slate); color: var(--slate-ink); }
@media (min-width: 600px) { .tabs { max-width: 560px; margin: 0 auto; border-radius: 24px 24px 0 0; border: 1px solid var(--line); border-bottom: 0; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--slate); color: var(--slate-ink); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(20,33,61,0.2); z-index: 20; max-width: calc(100% - 32px); }
.toast.bad { background: var(--danger); color: #fff; }

/* Misc */
.center { text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--pale); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 26px; line-height: 1; }
.skin-note { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.skin-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--slate); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
