/* ==========================================================================
   Cachino Tracker — design system
   The same system as Cachino Online (cachino.online): its fonts, its colours, its radii and its buttons. Light is
   Cachino Online's "Bar" theme (cream panels, the blue shell bar), dark is its "Night" theme. The page follows the
   device unless someone picks one. Every colour below is one of Cachino Online's own tokens; nothing is invented
   here, so a change there is one copy away from here.
   Win and loss differ in lightness as well as hue, and every amount also carries its sign, so they stay apart for
   colour-blind players.
   ========================================================================== */
@font-face {
  font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url('/assets/fonts/figtree-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Figtree'; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url('/assets/fonts/figtree-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('/assets/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('/assets/fonts/bricolage-grotesque-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-display: swap; font-weight: 100 800;
  src: url('/assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
}

/* Light: Cachino Online's Bar theme. */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --font: 'Figtree', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Bricolage Grotesque', 'Figtree', ui-sans-serif, system-ui, sans-serif;

  --shell: #1d4f9c; --shell-deep: #173f7e; --shell-ink: #f6f2e8; --shell-ink-2: #c4d3ec;
  --link: #1d4f9c;
  --accent: #b8322a; --accent-2: #9c2821; --accent-ink: #fff7f0;

  /* Light and warm, the same as cachino.online's Cachino theme: a clean warm white. */
  --bg:        #f8f6f1;   /* ground */
  --surface:   #fefdfa;   /* panel */
  --surface-2: #f8f6f1;   /* panel-2 */
  --surface-3: #ebe7de;
  --line:   rgba(30, 26, 18, 0.13);
  --line-2: rgba(30, 26, 18, 0.26);

  --ink:   #1e1d1a;
  --ink-2: #4a463f;
  --muted: #5c5850;

  --pos: #287647; --neg: #b8322a;
  --pos-text: #287647; --neg-text: #b8322a;
  --pos-soft: rgba(44, 122, 75, 0.12); --neg-soft: rgba(184, 50, 42, 0.12);

  --gold: #a26e14; --silver: #6f767a; --bronze: #9a5f35;

  --grid: rgba(32, 37, 39, 0.08);
  --axis: rgba(32, 37, 39, 0.22);

  /* up to four highlighted players: Cachino Online's blue first, then hues kept clear of win and loss. */
  --s1: #1d4f9c; --s2: #b07a0b; --s3: #b13a92; --s4: #2a7f86;
  --others: rgba(32, 37, 39, 0.16);
  --card-face: #fbf9f3; --card-red: #c02a22; --card-black: #1d2224;

  --good: #2c7a4b; --warning: #a26e14; --critical: #b8322a;
  --focus: #e4a83a;

  --r-lg: 16px;
  --r:    10px;
  --r-sm: 6px;
  --tap:  44px;
  --shadow: 0 1px 2px rgba(22, 25, 26, 0.08), 0 8px 24px -12px rgba(22, 25, 26, 0.14);
  --shadow-lift: 0 2px 4px rgba(22, 25, 26, 0.16), 0 16px 40px rgba(22, 25, 26, 0.22);
  --overlay: rgba(22, 25, 26, 0.42);
  --header-h: var(--cs-h);
}

/* Dark: Cachino Online's Night theme. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --shell: #0f1c33; --shell-deep: #0a1426; --shell-ink: #ece7da; --shell-ink-2: #8fa3c4;
  --link: #8fb4ff;
  --accent: #ca372b; --accent-2: #b13026; --accent-ink: #fff6ef;

  --bg:        #121618;
  --surface:   #171c1f;
  --surface-2: #20272a;
  --surface-3: #2a3236;
  --line:   rgba(231, 229, 222, 0.11);
  --line-2: rgba(231, 229, 222, 0.22);

  --ink:   #e7e5de;
  --ink-2: #a3abaf;
  --muted: #8b9398;

  --pos: #4fb07a; --neg: #d6493e;
  --pos-text: #5cc089; --neg-text: #e5675d;
  --pos-soft: rgba(79, 176, 122, 0.14); --neg-soft: rgba(214, 73, 62, 0.16);

  --gold: #e4b04a; --silver: #a3abaf; --bronze: #c98a5a;

  --grid: rgba(231, 229, 222, 0.06);
  --axis: rgba(231, 229, 222, 0.2);

  --s1: #8fb4ff; --s2: #e4b04a; --s3: #e98bd0; --s4: #6fd0d6;
  --others: rgba(231, 229, 222, 0.16);
  --card-face: #e9e7e0; --card-red: #b8261f; --card-black: #1b2023;

  --good: #4fb07a; --warning: #e4b04a; --critical: #d6493e;
  --focus: #e4b04a;
  --shadow: none;
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 16px 40px rgba(0, 0, 0, 0.5);
  --overlay: rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14px; line-height: 1.45;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;

}
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; border-radius: 6px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos-text); }
.neg { color: var(--neg-text); }
.muted { color: var(--muted); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 24px 56px; }

/* ------------------------------------------------------------------ header */
.header {
  position: sticky; top: 0; z-index: 40; height: var(--cs-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-item {
  border: 0; background: none; cursor: pointer; border-radius: var(--r-sm);
  padding: 7px 12px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  transition: color .15s, background .15s;
}
.nav-item:hover { color: var(--ink-2); }
.nav-item[aria-selected="true"] { color: var(--ink); background: var(--surface-2); }

.header-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  cursor: pointer; padding: 0; flex: none; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: color-mix(in srgb, var(--gold) 10%, transparent); }

.sync { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--muted); }
.sync:hover { border-color: var(--line-2); color: var(--ink-2); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: block; flex: none; }
.sync[data-state="synced"] i { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.sync[data-state="dirty"] i, .sync[data-state="checking"] i { background: var(--gold); }
.sync[data-state="error"] i, .sync[data-state="conflict"] i { background: var(--neg); box-shadow: 0 0 0 3px var(--neg-soft); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font-size: 13.5px; font-weight: 550; transition: background .15s, border-color .15s, opacity .15s, transform .06s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--neg-text); border-color: color-mix(in srgb, var(--neg) 40%, transparent); }
.btn.danger:hover { background: var(--neg-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .38; cursor: not-allowed; transform: none; }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.link:hover { color: var(--ink); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 12.5px; font-weight: 550; height: 26px; padding: 0 11px; border-radius: 7px; white-space: nowrap;
}
.seg button:hover { color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.18); }

/* ------------------------------------------------------------------ layout */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 4px 0 2px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-head .spacer { margin-left: auto; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
/* sections are spaced by the panel's gap; a sibling-margin rule would also push down
   every card after the first inside a row, which is what misaligned them before */
[role="tabpanel"] { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid { align-items: stretch; }
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .fill { flex: 1 1 auto; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; }
.c4 { grid-column: span 4; }  .c3 { grid-column: span 3; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow); min-width: 0;
}
.card.pad-0 { padding: 0; }
.card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-height: 30px; flex-wrap: wrap; }
.card-h h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .act { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-f { display: flex; justify-content: center; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k-label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .k-label svg { width: 14px; height: 14px; opacity: .8; }
.kpi .k-value { margin-top: 8px; font-size: 26px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { margin-top: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ avatars */
.av {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
  border: 1px solid var(--line-2);
}
.av.lg { width: 52px; height: 52px; font-size: 17px; }
.av.sm { width: 24px; height: 24px; font-size: 9.5px; }
.av.r1 { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); color: var(--gold); }
.av.r2 { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--silver); }
.av.r3 { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--bronze); }
.av-stack { display: flex; }
.av-stack .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.av-stack .av:first-child { margin-left: 0; }
.av-stack .more { font-size: 11px; color: var(--muted); margin-left: 6px; align-self: center; }

/* ------------------------------------------------------------------ leaderboard */
.lb { width: 100%; }
.lb-row {
  display: grid; align-items: center; column-gap: 14px;
  grid-template-columns: 26px minmax(150px, 1.6fr) 64px 70px 58px 84px 84px 84px 64px 150px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 0; background: none;
  width: 100%; text-align: left; font-family: var(--font); color: var(--ink);
}
.lb-row + .lb-row { border-top: 1px solid var(--line); border-radius: 0; }
.lb-row:hover { background: var(--surface-2); border-radius: 10px; }
.lb-row:hover + .lb-row { border-top-color: transparent; }
.lb-head { cursor: default; padding-top: 0; padding-bottom: 8px; }
.lb-head:hover { background: none; }
.lb-head span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lb-head [data-sort] { cursor: pointer; user-select: none; }
.lb-head [data-sort]:hover, .lb-head [aria-sort="descending"], .lb-head [aria-sort="ascending"] { color: var(--ink); }
.lb-head [aria-sort="descending"]::after { content: " ↓"; }
.lb-head [aria-sort="ascending"]::after { content: " ↑"; }
.lb-rank { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; text-align: center; }
.lb-player { display: flex; align-items: center; gap: 11px; min-width: 0; }
.lb-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meta { display: none; font-size: 12px; color: var(--muted); }
.lb-cell { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.lb-net { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.lb-net b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.lb-bar { position: relative; width: 100%; height: 4px; border-radius: 2px; background: var(--surface-3); }
.lb-bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.lb-bar::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }

/* form: filled = win, ring = loss, dash = level — shape carries the result, not just colour */
.form { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.form i { width: 8px; height: 8px; border-radius: 50%; display: block; }
.form i.w { background: var(--pos); }
.form i.l { border: 1.5px solid var(--neg); }
.form i.e { width: 8px; height: 2px; border-radius: 1px; background: var(--muted); }

/* ------------------------------------------------------------------ insight cards */
.insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.insight { display: flex; gap: 13px; align-items: flex-start; }
.insight .ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.insight .ic svg { width: 16px; height: 16px; }
.insight .ic.gold { color: var(--gold); }
.insight .ic.pos  { color: var(--pos-text); }
.insight .ic.neg  { color: var(--neg-text); }
.insight .i-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.insight .i-value { font-size: 15.5px; font-weight: 650; letter-spacing: -0.015em; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight .i-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight > div { min-width: 0; }

/* ------------------------------------------------------------------ charts */
.chart-host { position: relative; }
.chart-host svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); }
.legend-item .key { width: 14px; height: 3px; border-radius: 2px; flex: none; }

.tip {
  position: absolute; pointer-events: none; z-index: 30; top: 0; left: 0; min-width: 140px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 9px 11px; font-size: 12.5px; box-shadow: 0 12px 32px -12px rgba(0,0,0,.55);
  opacity: 0; transition: opacity .1s;
}
.tip[data-show="1"] { opacity: 1; }
.tip .tt-title { font-weight: 600; margin-bottom: 5px; }
.tip .tt-sub { color: var(--muted); font-weight: 400; }
.tip .tt-row { display: flex; align-items: center; gap: 8px; padding: 1.5px 0; }
.tip .tt-row .key { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip .tt-row .nm { color: var(--ink-2); }
.tip .tt-row .vl { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; font-weight: 650; }

/* ------------------------------------------------------------------ session rows */
.srows { display: flex; flex-direction: column; }
.srow {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 16px; align-items: center; gap: 14px;
  padding: 11px 10px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
  border-radius: 10px; font-family: var(--font); color: var(--ink);
}
.srow + .srow { border-top: 1px solid var(--line); border-radius: 0; }
.srow:hover { background: var(--surface-2); border-radius: 10px; }
.srow:hover + .srow { border-top-color: transparent; }
.dateblk {
  width: 46px; height: 46px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.dateblk b { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dateblk span { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 4px; }
.s-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.s-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-title span { color: var(--muted); font-weight: 500; }
.s-right { text-align: right; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.s-right b { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.s-right small { font-size: 12px; color: var(--muted); white-space: nowrap; }
.kdot { display: inline-block; width: 9px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; position: relative; top: -1px; }
.chev { color: var(--muted); display: grid; place-items: center; }
.chev svg { width: 14px; height: 14px; }

.srows .srow.menu-row { grid-template-columns: 40px minmax(0, 1fr) 16px; }
.srows .srow.menu-row .chev { display: grid; }
.menu-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.menu-ic svg { width: 18px; height: 18px; }

.sgroup + .sgroup { margin-top: 18px; }
.sgroup-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 10px 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
}
.sgroup-h h3 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.sgroup-h span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ player header */
.phero { display: flex; align-items: center; gap: 16px; }
.phero .who { min-width: 0; }
.phero h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; }
.phero .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.rank-badge {
  font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink-2); letter-spacing: 0;
}
.rank-badge.r1 { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.phero .act { margin-left: auto; display: flex; gap: 8px; }

.pick-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px;
  border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer;
  text-align: left; font-family: var(--font); color: var(--ink);
}
.pick-btn:hover { background: var(--surface-3); }
.pick-btn .p-label { font-size: 11px; color: var(--muted); display: block; }
.pick-btn .p-name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.pick-btn .p-net { margin-left: auto; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pick-btn .chev svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ records + rivals */
.rivals { display: flex; flex-direction: column; }
/* rows are the same height as session rows so side-by-side cards line up */
.rival { display: grid; grid-template-columns: minmax(0, 1fr) 64px 120px; align-items: center; gap: 14px; padding: 11px 10px; min-height: 72px; }
.rival + .rival { border-top: 1px solid var(--line); }
.rival .r-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rival .r-who .av { width: 46px; height: 46px; border-radius: 11px; font-size: 13px; }
.rival .r-name { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rival .r-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.rival .r-rec { font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.split { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.split i { display: block; height: 100%; }
.split .a { background: var(--pos); border-radius: 3px 0 0 3px; }
.split .b { background: var(--neg); border-radius: 0 3px 3px 0; margin-left: auto; }

/* ------------------------------------------------------------------ head to head */
.h2h-pick { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; }
.vs { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.h2h-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 4px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.h2h-side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.h2h-side.b { flex-direction: row-reverse; text-align: right; }
.h2h-side .nm { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h2h-side .nt { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.h2h-side .key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin: 0 6px; }
.tug { display: grid; grid-template-columns: 96px minmax(0, 1fr) 96px; gap: 14px; align-items: center; padding: 10px 0; }
.tug + .tug { border-top: 1px solid var(--line); }
.tug .va, .tug .vb { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tug .va { text-align: right; } .tug .vb { text-align: left; }
.tug .va.lose, .tug .vb.lose { color: var(--muted); font-weight: 500; }
.tug .mid { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.tug .lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; }
.tug .track { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); }
.tug .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.tug .track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.callout { margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.callout strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ modal / sheet */
.scrim { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 24px; overscroll-behavior: contain; animation: fade .15s ease-out; }
.modal {
  width: min(560px, 100%); max-height: min(90vh, 880px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 32px 80px -24px rgba(0,0,0,.7); animation: rise .18s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.015em; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.modal-head .spacer { margin-left: auto; }
.modal-body { padding: 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
.modal-foot .spacer { margin-left: auto; }
.grab { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 5px; }
.input, .field input, .field select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; font-size: 16px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
}
.input:focus, .field input:focus { outline: none; border-color: var(--s1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s1) 22%, transparent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note { font-size: 12.5px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
h4.sec { margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }

.pot-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.pot-bar .pl { font-size: 12px; color: var(--muted); }
.pot-bar b { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.pot-bar .pc { margin-left: auto; font-size: 12px; color: var(--muted); }

.pgrid { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.phead { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px 28px; gap: 8px; padding: 7px 12px; background: var(--surface-2); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.phead span:nth-child(2), .phead span:nth-child(3) { text-align: right; }
.prow { display: grid; align-items: center; gap: 8px; padding: 7px 12px; min-height: 52px; background: var(--surface); }
.prow + .prow { border-top: 1px solid var(--line); }
.prow.io { grid-template-columns: minmax(0, 1fr) 72px 72px 28px; }
.prow.net { grid-template-columns: minmax(0, 1fr) 36px 96px 28px; }
.psign {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--ink-2); cursor: pointer; font-size: 17px; font-weight: 600; line-height: 1; padding: 0;
}
.psign:hover { background: var(--surface-3); color: var(--ink); }
.pmeta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pmeta .pn { min-width: 0; display: flex; flex-direction: column; }
.pname { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnet { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.pnet.pos { color: var(--pos-text); } .pnet.neg { color: var(--neg-text); }
.prow .amt {
  width: 100%; height: 36px; padding: 0 9px; border-radius: 8px; text-align: right; font-size: 16px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font-variant-numeric: tabular-nums;
}
.prow .amt:focus { outline: none; border-color: var(--s1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s1) 22%, transparent); }
.prm { width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.prm:hover { background: var(--neg-soft); color: var(--neg-text); }
.prm svg { width: 12px; height: 12px; }

.addrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.chip-add {
  height: 32px; padding: 0 12px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 550;
  border: 1px dashed var(--line-2); background: transparent; color: var(--ink-2);
}
.chip-add:hover { border-style: solid; background: var(--surface-2); color: var(--ink); }
.chip-add.new { border-style: solid; color: var(--ink); background: var(--surface-2); }
.newp { display: flex; gap: 6px; width: 100%; margin-top: 2px; }
.newp .input { height: 36px; }

.balance { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 11px 13px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line); }
.balance svg { width: 16px; height: 16px; flex: none; }
.balance[data-ok="1"] { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 28%, transparent); }
.balance[data-ok="1"] svg { color: var(--pos-text); }
.balance[data-ok="0"] { background: color-mix(in srgb, var(--gold) 10%, transparent); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.balance[data-ok="0"] svg { color: var(--gold); }
.balance .b-val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }

.settle { margin-top: 14px; }
.settle-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.settle-head h4 { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.settle-head .btn { margin-left: auto; }
.settle-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.settle-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 12px; font-size: 13.5px; background: var(--surface); }
.settle-row + .settle-row { border-top: 1px solid var(--line); }
.settle-row .who { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.settle-row .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-row .arr { color: var(--muted); display: grid; place-items: center; }
.settle-row .arr svg { width: 14px; height: 14px; }
.settle-row .amt { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; padding-left: 12px; border-left: 1px solid var(--line); }
.settle-none { padding: 12px; font-size: 13px; color: var(--muted); background: var(--surface); }
.pay {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 650; text-decoration: none; white-space: nowrap;
}
.pay:hover { opacity: .88; }
.pay:active { transform: translateY(1px); }
.pay svg { width: 13px; height: 13px; }
.pay-none { color: var(--muted); width: 32px; text-align: center; }

.det-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.det-head, .det-row { display: grid; grid-template-columns: minmax(0, 1fr) 70px 70px 90px; gap: 10px; align-items: center; padding: 9px 12px; }
.det-head { background: var(--surface-2); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.det-head span:not(:first-child), .det-row .dr { text-align: right; }
.det-row { background: var(--surface); font-size: 13.5px; }
.det-row + .det-row { border-top: 1px solid var(--line); }
.det-row .dw { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.det-row .dw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-row .dr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }
.det-row .dr.net { color: inherit; font-size: 14px; font-weight: 650; }
.det-list.netonly .det-head, .det-list.netonly .det-row { grid-template-columns: minmax(0, 1fr) 90px; }
.det-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.det-meta div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.det-meta span { display: block; font-size: 11.5px; color: var(--muted); }
.det-meta b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

.mgr-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; }
.mgr-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; }
.mgr-meta { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mgr-row + .mgr-row { border-top: 1px solid var(--line); }
.mgr-row .input { height: 36px; font-size: 14.5px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 550;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.6); max-width: calc(100vw - 32px); text-align: center; animation: rise .18s ease-out;
}
.empty { padding: 24px 8px; text-align: center; color: var(--muted); font-size: 13px; }

/* bottom navigation — phones only */
.bottom-nav { display: none; }

/* ------------------------------------------------------------------ tablet */
@media (max-width: 1099px) {
  .lb-row { grid-template-columns: 26px minmax(140px, 1.6fr) 60px 66px 56px 80px 60px 130px; }
  .lb-row .x-best, .lb-row .x-worst { display: none; }
  .insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ phone */
@media (max-width: 859px) {
  
  body { font-size: 14px; }
  .wrap { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  .nav, .sync .sync-label, #addBtn .lbl { display: none; }
  #addBtn { width: 36px; padding: 0; }
  .sync { width: 36px; padding: 0; justify-content: center; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line);
  }
  .bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    height: 50px; border: 0; background: none; cursor: pointer; border-radius: 12px;
    font-size: 10.5px; font-weight: 600; color: var(--muted); font-family: var(--font);
  }
  .bn-item svg { width: 21px; height: 21px; }
  .bn-item[aria-selected="true"] { color: var(--ink); }
  .bn-item[aria-selected="true"] svg { color: var(--gold); }

  .page-head { margin: 2px 0 0; }
  .page-head h1 { font-size: 21px; }
  .grid { gap: 12px; }
  [role="tabpanel"] { gap: 12px; }
  .c8, .c6, .c4, .c3 { grid-column: span 12; }
  .card { padding: 14px; border-radius: 14px; }
  .card-h { margin-bottom: 10px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; border-radius: 14px; }
  .kpi .k-value { font-size: 21px; margin-top: 5px; }
  .kpi .k-sub { font-size: 11.5px; }
  .insights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .insights .card { padding: 12px; }
  .insight { flex-direction: column; gap: 9px; }
  .insight .ic { width: 30px; height: 30px; border-radius: 9px; }
  .insight .i-value { font-size: 14.5px; }

  .lb-row { grid-template-columns: 20px minmax(0, 1fr) auto; column-gap: 10px; padding: 10px 4px; }
  .lb-row > .x { display: none; }
  .lb-meta { display: block; }
  .lb-head { display: none; }
  .lb-net { min-width: 92px; }
  .lb-row:hover { border-radius: 0; background: none; }

  .srow { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; padding: 10px 4px; }
  .srow .chev { display: none; }
  .srow:hover { background: none; }
  .dateblk { width: 42px; height: 42px; border-radius: 10px; }
  .dateblk b { font-size: 15px; }
  .sgroup-h { padding: 0 4px 8px; }

  .phero { flex-wrap: wrap; gap: 12px; }
  .phero .who { flex: 1 1 0; }          /* keep the name beside the avatar */
  .phero .meta { font-size: 12.5px; }
  .phero h1 { font-size: 20px; }
  .phero .av.lg { width: 46px; height: 46px; font-size: 15px; }
  .phero .act { margin-left: 0; width: 100%; }
  .phero .act .switch-btn { flex: 1 1 auto; }

  .h2h-pick { grid-template-columns: 1fr; gap: 8px; }
  .h2h-pick .vs { justify-self: center; width: 32px; height: 32px; font-size: 10.5px; }
  .h2h-side .av.lg { width: 40px; height: 40px; font-size: 13px; }
  .h2h-side .nm { font-size: 14.5px; }
  .h2h-side .nt { font-size: 17px; }
  .h2h-hero { gap: 8px; }
  .h2h-hero .vs { width: 28px; height: 28px; font-size: 9.5px; }
  .tug { grid-template-columns: 76px minmax(0, 1fr) 76px; gap: 10px; }
  .tug .va, .tug .vb { font-size: 13px; }

  .rival { grid-template-columns: minmax(0, 1fr) 56px 80px; gap: 10px; }

  .scrim { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: sheet .22s ease-out; }
  .grab { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 0; }
  .modal-head { padding: 12px 16px 14px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .det-head, .det-row { grid-template-columns: minmax(0, 1fr) 58px 58px 80px; gap: 8px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(40px); opacity: .6; } }

@media (max-width: 380px) {
  .kpi .k-value { font-size: 19px; }
  .prow.io, .phead { grid-template-columns: minmax(0, 1fr) 64px 64px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .header, .bottom-nav, .header-actions { display: none !important; }
  body { background: #fff; }
  .card, .kpi { break-inside: avoid; }
}

/* ------------------------------------------------------------------ photos */
.av { overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.av[data-avatar-ring] {
  border-radius: 50%;
  outline: 2px solid var(--signet-ink);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px var(--signet-ground), 0 0 7px color-mix(in srgb, var(--signet-ink) 22%, transparent);
}
.av[data-avatar-ring='founder'] {
  outline-color: #e5c07d;
  box-shadow: 0 0 0 2px #745029, 0 0 0 4px #e5c07d, 0 0 10px 2px #eabb696e;
}
.av-btn { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
.av-btn .cam {
  position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--bg); border: 2px solid var(--surface);
}
.av-btn .cam svg { width: 11px; height: 11px; }
.photo-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 4px; }
.photo-hero .av { width: 128px; height: 128px; font-size: 38px; }
.photo-hero .note { text-align: center; max-width: 34ch; }

/* ------------------------------------------------------------------ player picker sheet */
.pk-search { position: relative; margin-bottom: 10px; }
.pk-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pk-search .input { padding-left: 38px; }
.pk-list { display: flex; flex-direction: column; }
.pk-row {
  display: grid; grid-template-columns: 22px 40px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 8px 10px; border: 0; background: none; border-radius: 12px;
  cursor: pointer; text-align: left; font-family: var(--font); color: var(--ink);
}
.pk-row + .pk-row { margin-top: 2px; }
.pk-row:hover, .pk-row:focus-visible { background: var(--surface-2); outline: none; }
.pk-row[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pk-row .pk-rank { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.pk-row .av { width: 40px; height: 40px; font-size: 13px; }
.pk-row .pk-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-row .pk-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-row .pk-net { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.pk-row .pk-rank svg { width: 16px; height: 16px; color: var(--gold); display: block; margin: 0 auto; }
.pk-empty { padding: 20px; text-align: center; color: var(--muted); }

/* the trigger on a profile */
.switch-btn { min-width: 170px; justify-content: flex-start; }
.switch-btn .chev-i { margin-left: auto; padding-left: 10px; display: grid; place-items: center; color: var(--muted); }
.switch-btn .chev-i svg { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ chart player toggles */
.pchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pchip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); cursor: pointer;
  font-size: 13px; font-weight: 550; font-family: var(--font); transition: background .15s, border-color .15s, color .15s;
}
.pchip .av { width: 26px; height: 26px; font-size: 9.5px; }
.pchip:hover { background: var(--surface-2); color: var(--ink); }
.pchip[aria-pressed="true"] { color: var(--ink); background: var(--surface-2); border-color: var(--chip, var(--line-2)); box-shadow: inset 0 0 0 1px var(--chip, transparent); }
.pchip .key { width: 14px; height: 3px; border-radius: 2px; background: var(--chip, transparent); }
.pchip[aria-pressed="false"] .key { background: var(--others); }
.pchips .pchip-tools { display: inline-flex; gap: 6px; margin-left: auto; align-items: center; }
@media (max-width: 859px) {
  .pchips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .pchips::-webkit-scrollbar { display: none; }
  .pchip { flex: none; }
  .pchips .pchip-tools { margin-left: 0; }
  .switch-btn { min-width: 0; }
  .pk-row { grid-template-columns: 18px 40px minmax(0, 1fr) auto; gap: 10px; }
  .mgr-fields { grid-template-columns: 1fr; }
  .mgr-meta .note { display: none; }
  .settle-row { padding: 10px; gap: 8px; }
  .pay { padding: 0 11px; }
}

/* ==========================================================================
   At the table — turn timer and hand rankings
   The clock is sized from one variable (--d) so the number always fills the
   ring; every layout below just changes --d.
   ========================================================================== */
.timer { --d: min(300px, 76vw); display: flex; align-items: center; justify-content: center; gap: 26px; flex-wrap: wrap; padding: 4px 0 2px; }

/* the clock itself is the main control: tapping it starts or pauses */
.tm-clock {
  position: relative; display: grid; place-items: center; border: 0; background: none; padding: 0;
  cursor: pointer; width: var(--d); height: var(--d); flex: none; color: var(--ink);
  font-family: var(--font); border-radius: 50%;
}
.tm-clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-clock .ring-track { stroke: var(--surface-3); }
.tm-clock .ring-fill { stroke: var(--s1); transition: stroke-dashoffset .12s linear, stroke .2s; stroke-linecap: round; }
.tm-clock .tm-inner { display: grid; place-items: center; }
.tm-clock .tm-time {
  font-size: calc(var(--d) * 0.42); font-weight: 600; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums; line-height: .92;
}
.tm-clock .tm-state {
  margin-top: calc(var(--d) * 0.04); font-size: calc(var(--d) * 0.052); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.timer.warn .ring-fill { stroke: var(--gold); }
.timer.over .ring-fill { stroke: var(--neg); }
.timer.over .tm-time { color: var(--neg-text); }
.timer.over .tm-clock { animation: tm-flash 1s ease-in-out infinite; }
@keyframes tm-flash { 50% { opacity: .45; } }

.tm-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1 1 250px; max-width: 380px; }
.tm-buttons { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.tm-buttons .btn { height: 50px; font-size: 14.5px; }

/* the turn length collapses to a single chip once it has been chosen */
.tm-len {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 38px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--ink-2);
  font-family: var(--font); font-size: 13px; font-weight: 600; padding: 0 14px; align-self: center;
}
.tm-len:hover { background: var(--surface-2); color: var(--ink); }
.tm-len .tm-len-v { color: var(--ink); font-variant-numeric: tabular-nums; }
.tm-len .tm-len-k { color: var(--muted); font-weight: 500; }
.tm-len svg { width: 13px; height: 13px; opacity: .6; }
.tm-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.tm-preset {
  height: 38px; min-width: 56px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums;
}
.tm-preset:hover { background: var(--surface-2); color: var(--ink); }
.tm-preset[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tm-custom { display: flex; align-items: center; gap: 6px; }
.tm-custom .input { height: 38px; width: 70px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.tm-hint { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- hand rankings
   Ten rows that fit on one screen: rank, name, and the example hand with the
   cards that actually make it at full strength. */
.hands {
  --pc: 32px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.hand {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 7px 12px; background: var(--surface); min-width: 0;
}
.hand .h-rank { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.hand .h-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hand .h-cards { display: flex; gap: 4px; flex: none; }
.hand.best { background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.hand.best .h-name { color: var(--gold); }
.hand.best .h-rank { color: var(--gold); }

.pcard {
  display: grid; place-items: center; flex: none; line-height: 1;
  height: var(--pc); width: calc(var(--pc) * 0.74); border-radius: calc(var(--pc) * 0.14);
  background: var(--card-face); border: 1px solid var(--line-2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
}
.pcard b { font-size: calc(var(--pc) * 0.36); font-weight: 700; letter-spacing: -0.04em; }
.pcard i { font-size: calc(var(--pc) * 0.30); font-style: normal; margin-top: 1px; }
.pcard.red { color: var(--card-red); }
.pcard.black { color: var(--card-black); }
.pcard.off { opacity: .3; }          /* cards that are not part of the hand */

/* ------------------------------------------------------------------ full screen */
.fs-layer {
  position: fixed; inset: 0; z-index: 130; background: var(--bg); display: flex; flex-direction: column;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); overflow: hidden; animation: fade .15s ease-out;
}
.fs-head { display: flex; align-items: center; gap: 10px; flex: none; margin-bottom: 8px; }
.fs-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-2); }
.fs-head .fs-sp { flex: 1 1 auto; }
.fs-head .act { display: flex; gap: 6px; }
.fs-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.fs-body > * { min-height: 0; }
.fs-body .timer { --d: min(66vh, 86vw); gap: 30px; }
.fs-body .tm-buttons .btn { height: 56px; font-size: 16px; }
.fs-body .tm-side { max-width: 460px; }

/* The rankings fill the screen exactly — ten equal rows, no scrolling. The card
   size is capped by width as well as height so the hand names never truncate. */
.fs-body .hands { --pc: min(5.6vh, 9.5vw, 58px); height: 100%; grid-template-rows: repeat(10, minmax(0, 1fr)); }
.fs-body .hand { padding: 0 12px; gap: 8px; }
.fs-body .hand .h-rank { font-size: clamp(11px, 1.8vh, 18px); }
.fs-body .hand .h-name { font-size: clamp(13px, min(2.4vh, 4.2vw), 26px); }
body.fs-open { overflow: hidden; }

/* two columns when there is width to spare: 1–5 on the left, 6–10 on the right */
@media (min-width: 760px) {
  .hands { --pc: 34px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(5, auto); grid-auto-flow: column; }
  .hand { padding: 9px 14px; }
  .fs-body .hands {
    --pc: min(10vh, 4.6vw, 76px); grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr)); grid-auto-flow: column;
  }
  .fs-body .hand .h-name { font-size: clamp(13px, min(3vh, 2.1vw), 30px); }
}

/* ------------------------------------------------------- phone, portrait */
@media (max-width: 859px) {
  .timer { gap: 16px; }
  .tm-side { flex: 1 1 100%; max-width: none; }
  /* keep each card's buttons on the title row instead of wrapping below it */
  #panel-table .card-h { flex-wrap: nowrap; margin-bottom: 10px; }
  #panel-table .card-h .sub { display: none; }
  .tm-buttons .btn { height: 52px; }      /* big, thumb-friendly at the table */
  .fs-layer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .bn-item .bn-label.counting { color: var(--gold); font-variant-numeric: tabular-nums; }
}

/* --------------------------------------------- phone, held sideways
   Short and wide: the clock goes beside the controls and takes the height. */
@media (max-height: 560px) and (orientation: landscape) {
  .timer { --d: min(74vh, 40vw); flex-wrap: nowrap; gap: 20px; align-items: center; }
  .tm-side { flex: 1 1 auto; max-width: 420px; gap: 8px; }
  .tm-buttons .btn { height: 44px; font-size: 14px; }
  .tm-len, .tm-preset, .tm-custom .input { height: 34px; }
  .fs-body .timer { --d: min(80vh, 44vw); gap: 24px; }
  .fs-body .tm-buttons .btn { height: 46px; font-size: 15px; }
  .fs-layer { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); }
  .fs-head { margin-bottom: 4px; }

  /* the rankings split into two columns so all ten still fit the short screen */
  .fs-body .hands {
    --pc: min(12vh, 4.4vw, 54px); grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr)); grid-auto-flow: column;
  }
  .fs-body .hand { padding: 0 10px; }
  .fs-body .hand .h-name { font-size: clamp(12px, min(3.4vh, 2vw), 22px); }
}

/* ==========================================================================
   Cachino Online's components, on top of the layout above (2.0)
   ========================================================================== */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--link); text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* The display face for titles, as on Cachino Online; Figtree for everything else and every number. */
.page-head h1, .phero h1, .modal-head h3, .fs-head h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; }
.page-head h1 { font-size: 26px; }
.card-h h2 { font-size: 14.5px; font-weight: 700; }

/* The top bar is Cachino Online's: the shell colour, cream ink, the chip mark and the name. Everything inside it
   reads in the shell's own colours, so its buttons and status need no styles of their own. */
.header {
  background: var(--shell); border-bottom: 0;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  --ink: var(--shell-ink); --ink-2: var(--shell-ink-2); --muted: var(--shell-ink-2);
  --line: rgba(246, 242, 232, 0.22); --line-2: rgba(246, 242, 232, 0.36);
  --surface-2: rgba(255, 255, 255, 0.12); --surface-3: rgba(255, 255, 255, 0.18);
  color: var(--shell-ink);
}
:root[data-theme="dark"] .header { --line: rgba(236, 231, 218, 0.16); --line-2: rgba(236, 231, 218, 0.28); }
.logo-face { fill: var(--shell-ink); }
.logo-ink { fill: var(--shell); }
.logo-red { fill: var(--accent); }
.logo-ring { fill: none; stroke: var(--shell); stroke-width: 2; }
/* The tracker's sections: a row of tabs on one hairline, under the shared bar. The current one is in ink, with a
   2px rule, the same mark as the current app in the bar. */
.subnav { display: flex; gap: 24px; margin: -8px 0 24px; border-bottom: 1px solid var(--line); }
.subnav .nav-item {
  padding: 12px 0; margin-bottom: -1px; border-radius: 0; background: none;
  color: var(--muted); font-weight: 600; font-size: 14px; box-shadow: inset 0 -2px 0 transparent;
}
.subnav .nav-item:hover { color: var(--ink); background: none; }
.subnav .nav-item[aria-selected="true"] { color: var(--ink); background: none; box-shadow: inset 0 -2px 0 var(--ink); }
@media (max-width: 859px) { .subnav { display: none; } }
.header .btn.primary { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }

/* Buttons: Cachino Online's. Primary is the accent red with its own ink. */
.btn { border-radius: var(--r); font-weight: 600; background: var(--surface); }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.header .btn { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); opacity: 1; }
.btn.danger { background: var(--surface); }
.btn.ghost { background: transparent; }
.btn.sm { border-radius: var(--r-sm); }
.seg { border-radius: var(--r); }
.seg button { border-radius: var(--r-sm); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 25, 26, 0.16); }
.icon-btn { border-radius: var(--r); }
.input, .field input, .field select { border-radius: var(--r); background: var(--surface); }
.input:focus, .field input:focus, .field select:focus { border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 22%, transparent); }
.modal { border-radius: var(--r-lg); box-shadow: var(--shadow-lift); }
.bn-item[aria-selected="true"] svg { color: var(--link); }
.bottom-nav { background: color-mix(in srgb, var(--surface) 92%, transparent); }

/* The leaderboard: games and buy-ins beside the rest (overridden below). */
.lb-row { grid-template-columns: 26px minmax(150px, 1.6fr) 56px 64px 54px 80px 64px 72px 80px 80px 64px 140px; }
@media (max-width: 1239px) {
  .lb-row { grid-template-columns: 26px minmax(140px, 1.6fr) 56px 64px 54px 78px 64px 72px 64px 130px; }
  .lb-row .x-best, .lb-row .x-worst { display: none; }
}
@media (max-width: 1099px) {
  .lb-row { grid-template-columns: 26px minmax(130px, 1.6fr) 52px 60px 52px 76px 60px 120px; }
  .lb-row .x-in, .lb-row .x-best, .lb-row .x-worst { display: none; }
}
#records { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Finding sessions: one row of filters, wrapping on a phone. */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 12px; }
.filters .input { height: 36px; padding: 0 10px; font-size: 13.5px; width: auto; }
.filters select.input { padding-right: 28px; max-width: 180px; }
.search { position: relative; flex: 1 1 200px; min-width: 160px; display: block; }
.search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--muted); pointer-events: none; }
.search .input { width: 100%; padding-left: 32px; }

/* A session's tags: the game, the blinds, where it was played. */
.tag { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 650; line-height: 18px; vertical-align: 1px; white-space: nowrap; }
.det-about { margin: -2px 0 6px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.det-from { margin: 0 0 12px; }

/* Empty and no-match states say what to do next. */
.empty { display: grid; gap: 4px; justify-items: center; padding: 28px 12px; }
.empty b { color: var(--ink); font-size: 14.5px; }
.empty .link { color: var(--link); font-size: inherit; text-decoration: underline; }
.callout.bad { border-color: color-mix(in srgb, var(--neg) 45%, transparent); background: var(--neg-soft); }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout.dup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }

/* The editor: the game and its blinds side by side. */
.blinds { display: flex; align-items: center; gap: 6px; }
.blinds input { min-width: 0; }
.blinds i { color: var(--muted); font-style: normal; }
.field small { font-weight: 400; color: var(--muted); }

/* Importing a game: the check, then who each player is. */
.imp-text { width: 100%; min-height: 140px; padding: 10px 12px; font: 12.5px/1.45 var(--mono); resize: vertical; }
.imp-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.imp-game { margin-top: 14px; }
.imp-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.imp-h span { color: var(--muted); font-size: 12.5px; }
.imp-list .det-head, .imp-list .det-row { grid-template-columns: minmax(0, 1fr) minmax(120px, 160px) 64px 64px 76px; }
.imp-is { display: grid; gap: 2px; text-align: left !important; }
.input.sm { height: 32px; padding: 0 8px; font-size: 13px; }

/* Merging two players. */
.merge-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.merge-row .input { flex: 1 1 140px; width: auto; height: 36px; }

/* The footer: whose app this is, and where the games are played. */
.site-foot { max-width: 1240px; margin: 0 auto; padding: 4px 24px 32px; display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 12.5px; }
.site-foot a { margin-left: auto; color: var(--link); font-weight: 600; text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

@media (max-width: 859px) {
  .page-head h1 { font-size: 22px; }
  #records { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters select.input { flex: 1 1 120px; max-width: none; }
  .imp-list .det-head, .imp-list .det-row { grid-template-columns: minmax(0, 1fr) minmax(104px, 130px) 64px; }
  .imp-list .det-head span:nth-child(3), .imp-list .det-head span:nth-child(4),
  .imp-list .det-row > span:nth-child(3), .imp-list .det-row > span:nth-child(4) { display: none; }
  .wrap { padding-bottom: 16px; }
  .site-foot { padding: 0 14px calc(92px + env(safe-area-inset-bottom)); }
}

/* ==========================================================================
   2.1 — editorial pass. Hierarchy from type, whitespace and 1px hairlines: no shadowed cards, no icon tiles, no
   coloured status dots. Numbers in tabular figures.
   ========================================================================== */
.card,
.kpi,
.grid > .card {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  padding: 16px 0 8px;
}
.card + .card,
.kpis + .card,
.insights + .card,
.card + .insights,
.card + .grid,
.grid + .card {
  margin-top: 32px;
}
.card-h h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.page-head h1 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

/* The four league numbers: one ruled row, no boxes, no icons. */
.kpis {
  gap: 0;
  border-top: 1px solid var(--line-2, var(--line));
  border-bottom: 1px solid var(--line);
}
.kpis .kpi {
  border-top: 0;
  padding: 16px 16px 16px 0;
}
.kpis .kpi + .kpi {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.kpi .k-label svg,
.insight .ic {
  display: none;
}
.kpi .k-label {
  font-size: 12.5px;
  letter-spacing: 0.01em;
}
.kpi .k-value,
.lb .num,
.kpi .k-sub {
  font-variant-numeric: tabular-nums;
}
.kpi .k-value {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.035em;
}

/* Hot hand, cold run…: the same ruled row. */
.insights {
  gap: 0;
  margin-top: 32px;
  border-bottom: 1px solid var(--line);
}
.insights > .card {
  padding: 14px 16px 14px 0;
}
.insights > .card + .card {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  margin-top: 0;
}
@media (max-width: 760px) {
  .kpis,
  .insights {
    grid-template-columns: 1fr 1fr;
  }
  .kpis .kpi:nth-child(odd),
  .insights > .card:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }
  .kpis .kpi:nth-child(n + 3),
  .insights > .card:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* Recent form: a short bar per game, filled for a win, outlined for a loss. Not dots. */
.form i {
  width: 4px;
  height: 12px;
  border-radius: 1px;
}
.form i.l {
  border-width: 1px;
}

/* Saving state, in words, only when there is something to say. Up to date says nothing. */
.sync i {
  display: none;
}
.sync[data-state='idle'],
.sync[data-state='synced'],
.sync[data-state='checking'] {
  display: none;
}
.sync {
  height: 30px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}

/* Claim profile, in the header. Once claimed: who this device claimed as. */
.claim-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2, var(--line));
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.claim-btn:active {
  transform: scale(0.98);
}
.claim-btn:hover {
  border-color: var(--ink-2);
}
.claim-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pos-text, var(--pos));
}
.claim-who {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .claim-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
  }
  .claim-btn .claim-who {
    display: none;
  }
}
.claim-lede,
.claim-found,
.claim-preview {
  margin: 0 0 16px;
  max-width: 60ch;
  line-height: 1.5;
}
.claim-preview {
  color: var(--ink-2);
  font-size: 13.5px;
}
.claim-id {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
.claim-err {
  color: var(--neg-text, var(--neg));
  font-size: 13px;
  margin: 0 0 12px;
}
.claim-games {
  display: grid;
  border-top: 1px solid var(--line);
  margin-bottom: 12px;
}
.claim-game {
  display: grid;
  grid-template-columns: 20px 56px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.claim-game input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}
.cg-date {
  color: var(--muted);
  font-size: 13px;
}
.cg-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cg-name small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
.cg-net {
  font-weight: 650;
}
.num,
.cg-net,
.cg-date {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2.2 — one header for every page (the same palette theme button as cachino.online and Events),
   Cachino's four rooms, the leaderboard down to what says who's winning, and tighter spacing.
   ========================================================================== */
:root[data-room='felt'] {
  --shell: #13392a; --shell-deep: #0d2a1f; --shell-ink: #f1ead6; --shell-ink-2: #a9c2b3;
  --link: #8fd3ae;
  --accent: #cf3223; --accent-2: #b42c1f; --accent-ink: #fff6ef;
  --bg: #0f1613; --surface: #141c18; --surface-2: #1b2420; --surface-3: #26302b;
  --line: rgba(236, 233, 222, 0.1); --line-2: rgba(236, 233, 222, 0.2);
  --ink: #ece9de; --ink-2: #a4b0a9; --muted: #839089;
  --pos: #7fd19e; --pos-text: #7fd19e; --neg: #e0574a; --neg-text: #ef7a6f;
  --s1: #8fd3ae;
}
:root[data-room='formal'] {
  --shell: #101318; --shell-deep: #0b0d10; --shell-ink: #f5f7f9; --shell-ink-2: #9aa3ae;
  --link: #8fb4ff;
  --accent: #d62f2f; --accent-2: #b82525; --accent-ink: #fff6ef;
  --bg: #0b0d10; --surface: #12151a; --surface-2: #1a1e24; --surface-3: #262b33;
  --line: rgba(238, 241, 244, 0.09); --line-2: rgba(238, 241, 244, 0.18);
  --ink: #eef1f4; --ink-2: #9aa3ae; --muted: #7f8997;
  --pos: #3ccf7a; --pos-text: #3ccf7a; --neg: #d62f2f; --neg-text: #ef6a6a;
}

/* Header: the actions are quiet outlines. */
.header-actions {
  gap: 8px;
}
.header .claim-btn {
  border-color: rgba(246, 242, 232, 0.35);
  color: var(--shell-ink);
}
.header .btn.sm {
  background: transparent;
  border-color: rgba(246, 242, 232, 0.35);
  color: var(--shell-ink);
}
.theme-wrap { position: relative; display: inline-flex; }
.theme-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: var(--shell-ink); cursor: pointer;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), opacity 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.theme-btn:hover { opacity: 0.8; }
.theme-btn:active { transform: scale(0.98); }
.theme-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 120; display: grid; min-width: 180px; padding: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px;
}
.theme-menu::before {
  content: ''; position: absolute; top: -6.5px; right: 12px; width: 12px; height: 12px; background: var(--surface);
  border: 1px solid var(--line-2); border-right: 0; border-bottom: 0; rotate: 45deg;
}
.theme-menu b { font-size: 12.5px; color: var(--muted); padding: 4px 8px 8px; }
.theme-menu button {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; text-align: left; cursor: pointer;
}
.theme-menu button:hover { background: var(--surface-2); }
.theme-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-2); flex: none; }
.theme-check { margin-left: auto; }
@media (max-width: 640px) {
  .header .btn.sm { display: none; }
}

/* Highlights: one line of facts at the top. */
.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.hl {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}
.hl-k {
  color: var(--muted);
  font-size: 12px;
}
.hl .num {
  font-variant-numeric: tabular-nums;
}

/* Leaderboard: rank, player, games, buy-ins, best, worst, profit. Numbers only, no bars. (No ROI: older games kept
   only the result, so it could never be worked out for everyone.) */
.lb-card {
  border-top: 0;
  padding-top: 0;
}
.lb-row,
.lb-row.lb-head {
  grid-template-columns: 26px minmax(150px, 1.6fr) 64px 96px 88px 88px 110px;
}
.lb-cell,
.lb-net b {
  font-variant-numeric: tabular-nums;
}
.lb-bar {
  display: none;
}
@media (max-width: 980px) {
  .lb-row,
  .lb-row.lb-head {
    grid-template-columns: 26px minmax(140px, 1.6fr) 60px 90px 66px 110px;
  }
  .lb-row .x-best,
  .lb-row .x-worst {
    display: none;
  }
}
@media (max-width: 640px) {
  .lb-row,
  .lb-row.lb-head {
    grid-template-columns: 20px minmax(0, 1fr) auto;
  }
}

/* Running totals: one search, one dropdown. */
.chart-filter {
  display: flex;
  gap: 8px;
}
.chart-filter .input {
  height: 36px;
  width: auto;
  min-width: 0;
}
.chart-filter input {
  width: 180px;
}
@media (max-width: 640px) {
  .chart-filter {
    width: 100%;
    margin-left: 0;
  }
  .chart-filter input {
    flex: 1;
  }
}

/* Tighter: 8pt, no big gaps between sections. */
.page-head {
  margin-bottom: 16px;
}
.card + .card,
.kpis + .card,
.insights + .card,
.card + .insights,
.card + .grid,
.grid + .card,
.highlights + .card {
  margin-top: 24px;
}
.card {
  padding: 16px 0 8px;
}

/* ==========================================================================
   2.3 — phones (360 to 430 px): nothing ever wider than the screen.
   ========================================================================== */
.more-wrap { position: relative; display: none; }
/* Nothing wider than the screen, without making body a scroll box of its own (that trapped the scroll). */
html { overflow-x: clip; }
@media (max-width: 640px) {
  .header-actions { gap: 4px; flex: none; }
  .header-actions .claim-btn,
  .header-actions #adminBtn,
  .header-actions #addBtn,
  .header-actions .sync[data-state='synced'],
  .header-actions .sync[data-state='checking'] { display: none !important; }
  .theme-btn { width: 36px; height: 36px; }

  /* Bottom bar: four items, icon over a short word, the selected one only coloured. */
  .bottom-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
    gap: 0;
  }
  .bn-item[hidden] { display: none !important; }
  .bn-item {
    height: 52px; min-width: 0; gap: 2px; border-radius: 0;
    font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .bn-item svg { width: 20px; height: 20px; flex: none; }
  .bn-item[aria-selected='true'] { background: none; }

  /* Highlights: two by two, label over the fact, no pills. */
  .highlights {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 8px;
    border-top: 1px solid var(--line);
  }
  .hl {
    display: grid; gap: 2px; padding: 8px 0; border: 0; border-radius: 0; white-space: normal;
    border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0;
  }
  .hl:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
  .hl b, .hl .num { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .highlights + .card { margin-top: 8px; }

  /* Leaderboard: one line per player: rank, picture, name, games, profit. Tap for the rest. */
  .lb-row, .lb-row.lb-head {
    grid-template-columns: 18px minmax(0, 1fr) 36px auto;
    column-gap: 8px; padding: 8px 0; min-height: 44px;
  }
  .lb-row > .x { display: none; }
  .lb-row > .x-games { display: block; text-align: right; color: var(--muted); font-size: 13px; }
  .lb-meta { display: none; }
  .lb-player { gap: 8px; }
  .lb-player .av { width: 26px; height: 26px; font-size: 10px; }
  .lb-name { font-size: 14px; }
  .lb-net b { font-size: 14px; }

  /* Sessions: the date, the pot and the result; the tags wait for the session's own page. */
  .srow .tag { display: none; }
  .srow { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; }
  .av-stack { display: none; }
  .page-head { margin-bottom: 8px; }
}
@media (max-width: 640px) {
  .header-actions { gap: 2px; }
  .lb-row.lb-head { display: none; }
}
@media (max-width: 640px) {
}
@media (max-width: 380px) {
}
.header .theme-menu button { color: var(--ink); opacity: 1; }
.header .theme-menu b { color: var(--muted); }
@media (max-width: 640px) {
  .lb-card { margin-top: 0 !important; }
  [role='tabpanel'] { gap: 8px; }
}
/* Menus that open from the header keep the page's own colours (the header redefines --ink for itself). */
:root { --menu-ink: var(--ink); --menu-muted: var(--muted); --menu-surface: var(--surface); --menu-surface-2: var(--surface-2); --menu-line: var(--line-2); }
.header .theme-menu { background: var(--menu-surface); color: var(--menu-ink); border-color: var(--menu-line); }
.header .theme-menu::before { background: var(--menu-surface); border-color: var(--menu-line); }
.header .theme-menu button { color: var(--menu-ink); }
.header .theme-menu button:hover { background: var(--menu-surface-2); }
.header .theme-menu b { color: var(--menu-muted); }
@media (max-width: 640px) {
  .lb-card { padding-top: 0 !important; }
  .highlights { margin-bottom: 0; }
}
/* Tablets (641 to 980 px): games, buy-ins and profit; best and worst wait for a laptop. */
@media (min-width: 641px) and (max-width: 980px) {
  .lb-row,
  .lb-row.lb-head {
    grid-template-columns: 26px minmax(140px, 1fr) 60px 90px 110px;
  }
  .lb-row > .x:not(.x-best):not(.x-worst) {
    display: block;
  }
  .lb-row > .x-best,
  .lb-row > .x-worst {
    display: none;
  }
  .lb-meta {
    display: none;
  }
}
@media (min-width: 641px) and (max-width: 980px) {
  .lb-row.lb-head { display: grid; }
}

/* ==========================================================================
   2.4: the dashboard, dense.
   ========================================================================== */
.lb-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 4px; }

/* The leaderboard on a phone: rank, player, games and profit on one row, with the column names above. */
@media (max-width: 640px) {
  .lb-tools { margin-bottom: 0; }
  .top-seg { width: 100%; }
  .top-seg button { flex: 1; min-width: 0; }
  .lb-row, .lb-row.lb-head {
    grid-template-columns: 18px minmax(0, 1fr) 30px max-content;
    column-gap: 8px;
  }
  .lb-row.lb-head { display: grid; padding: 6px 0; min-height: 0; font-size: 11px; color: var(--muted); }
  .lb-row.lb-head > .x:not(.x-games) { display: none; }
  .lb-row > .x-games { display: block; text-align: right; font-size: 13px; color: var(--muted); }
  .lb-row > .x:not(.x-games) { display: none; }
}

/* Profile picture parity, on sign-in. */
.pic-banner {
  margin: 0 0 8px; padding: 10px 12px; border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 600;
}
.pic-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 4px; }
.pic-tile {
  display: grid; justify-items: center; gap: 8px; padding: 14px 8px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit;
}
.pic-tile img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; image-rendering: pixelated; }
.pic-tile .pic-empty { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; border: 1px dashed var(--line-2); font-size: 11px; color: var(--muted); text-align: center; }
.pic-tile .pic-label { font-weight: 600; font-size: 14px; }
.pic-tile[aria-pressed='true'] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pic-tile:disabled { opacity: 0.5; cursor: not-allowed; }

}

/* ==========================================================================
   2.5: the leaderboard lines up, one way to pick players, no stray lines.
   ========================================================================== */

/* No line on top of a page: a section's hairline is drawn only between sections. */
[role='tabpanel'] > .card:first-child {
  border-top: 0;
  padding-top: 0;
}

/* The leaderboard's numbers at the top: the same boxes as a player's own numbers. */
.lb-kpis {
  margin: 0 0 16px;
}

/* The filter: words as wide as themselves; the one in use bold with a 1px rule under it. */
.top-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2px;
  width: auto;
}
.top-seg button,
.top-seg button[aria-pressed] {
  display: inline-grid;
  align-items: center;
  flex: none;
  min-width: 44px;
  height: auto;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--ink-2);
  font: 550 14px/1 var(--font);
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  cursor: pointer;
}
.top-seg button {
  justify-items: start;
}
.top-seg button::after {
  content: attr(data-label);
  grid-area: 1 / 1;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 700;
}
.top-seg button:first-child {
  padding-left: 0;
}
.top-seg button[aria-pressed='true'] {
  color: var(--ink);
  font-weight: 700;
  text-decoration-line: underline;
}

/* Leaderboard columns: one fixed width per column, the same for the header and every row. A row never sizes a
   column to its own numbers, so the columns line up on every screen (test/leaderboard-alignment.test.ts). */
#leaderboard {
  --lb-cols: 26px minmax(0, 1fr) 64px 96px 88px 88px 112px;
}
#leaderboard .lb-row,
#leaderboard .lb-row.lb-head {
  grid-template-columns: var(--lb-cols);
  column-gap: 12px;
}
#leaderboard .lb-row > .lb-cell,
#leaderboard .lb-row > .lb-net {
  justify-self: stretch;
  min-width: 0;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#leaderboard .lb-head > .lb-net {
  display: block;
}
#leaderboard .lb-head > span {
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}
@media (max-width: 980px) {
  #leaderboard {
    --lb-cols: 26px minmax(0, 1fr) 60px 90px 112px;
  }
}
@media (max-width: 640px) {
  #leaderboard {
    --lb-cols: 18px minmax(0, 1fr) 50px 96px;
  }
  #leaderboard .lb-row,
  #leaderboard .lb-row.lb-head {
    column-gap: 8px;
  }
}

/* Running total: who's on the chart, as boxes. Picture, name and profit; tap to add or take off; the one in use has
   the accent border. The search above narrows the boxes. */
.pick {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.pick-find.input {
  width: 100%;
  max-width: 320px;
  min-height: 44px;
}
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}
.pick-box {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms cubic-bezier(0.16, 1, 0.3, 1), transform 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
.pick-box:hover {
  border-color: var(--ink-3, var(--muted));
}
.pick-box:active {
  transform: scale(0.98);
}
.pick-box .av {
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  font-size: 10px;
}
.pick-box .pb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
}
.pick-box .pb-net {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.pick-box[aria-pressed='true'] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pick-none {
  margin: 0;
}
@media (max-width: 640px) {
  .pick-find.input {
    max-width: none;
  }
  .pick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  .pick-box {
    transition: none;
  }
}

/* Phones: every control is at least 44 by 44 px to tap (test/usability.test.ts). */
@media (max-width: 760px) {
  .header .sync,
  .header .more-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .btn,
  .input,
  select.input,
  .seg button,
  .switch-btn {
    min-height: 44px;
  }
  button.link,
  .more-link,
  #rivalsMore,
  #historyMore,
  #h2hMore {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
    min-height: 44px;
  }
}

/* Phones: the save state, when there is one to tell (offline, saving, not saved), sits above the bottom bar in the
   bar's own colours, so the top bar never runs out of room at 360 px. */
@media (max-width: 640px) {
  .header .sync {
    position: fixed;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    z-index: 45;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--shell);
    color: var(--shell-ink);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  }
}
@media (max-width: 640px) {
  .header .sync .sync-label {
    display: inline;
  }
}
/* The #1 badge: gold, dark enough to read on the light ground. */
:root[data-theme='light'] .rank-badge.r1 {
  color: #905c02;
}

/* ------------------------------------------------------------------ 2.6
   First visit, before the real numbers are in: the page keeps its size and shows nothing that would switch. */
main.wrap[aria-busy='true'] [role='tabpanel'] {
  visibility: hidden;
}
.seg.seg-wrap {
  display: flex;
  flex-wrap: wrap;
}

/* Phones: Claim profile (or Sign in), New session and Edit are in the app menu, under the three apps, after a
   hairline. The bar keeps the mark, "Cachino | Tracker" and the theme, and fits 360 px. */
.cs-menu-acts {
  display: none;
}
@media (max-width: 640px) {
  .cs-menu-acts:not(:empty) {
    display: grid;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--cs-pop-line);
  }
  .cs-menu-acts button {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 8px 0 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cs-pop-ink);
    font: 600 15px/1.2 var(--font);
    text-align: left;
    cursor: pointer;
  }
  .cs-menu-acts button:hover,
  .cs-menu-acts button:focus-visible {
    background: color-mix(in srgb, var(--cs-pop-ink) 6%, transparent);
  }
}

/* One rule between two blocks, never two: a stat grid or the records sit right above a section that starts with its
   own hairline, so their closing line goes. */
.kpis:has(+ .card),
.insights:has(+ .grid),
.insights:has(+ .card) {
  border-bottom: 0;
}

/* ==========================================================================
   2.7: one inset with the bar, and dense. The page frame is the bar's: the mark and the content start on the same
   left edge (16px in on a phone, 32px on a laptop, 48px past 1440px). Between sections 32px at most (the card's
   8px under its last row, the panel's gap, 8px), between rows 12 to 16px, a title 12px above what it heads (test/spacing.test.ts).
   ========================================================================== */
.wrap {
  max-width: calc(var(--cs-frame) + 2 * var(--cs-gutter));
  padding-top: 16px;
  padding-left: var(--cs-gutter);
  padding-right: var(--cs-gutter);
}
@media (min-width: 860px) {
  .wrap {
    padding-bottom: 32px;
  }
}
.subnav {
  margin-bottom: 16px;
}
.page-head,
.lb-kpis {
  margin-bottom: 0;
}
.card + .card,
.kpis + .card,
.insights + .card,
.card + .insights,
.card + .grid,
.grid + .card,
.highlights + .card,
.grid + .insights,
.grid + .grid,
.kpis + .grid,
.kpis + .insights {
  margin-top: 8px;
}
.card-h {
  margin-bottom: 12px;
}

/* ==========================================================================
   2.8: the leaderboard folds. Top 10 (top 5 on a phone), a sliver of the next row fading out, and Show all under
   it. The height slides open and shut; the columns never move (test/leaderboard-collapse.test.ts).
   ========================================================================== */
.lb-body {
  overflow: hidden;
}
.lb-body.lb-moving {
  transition: height 360ms cubic-bezier(0.16, 1, 0.3, 1);
}
.lb-body[data-folded='true'] {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent);
}
.lb-body > .lb-row:first-child {
  border-top: 1px solid var(--line);
}
.lb-card .card-f {
  margin-top: 0;
}
@media (prefers-reduced-motion: reduce) {
  .lb-body.lb-moving {
    transition: none;
  }
}

/* Each tab's parts rise in one after another when it opens, as on cachino.online (shell.css .cs-rise). On a first
   visit they wait, still, until the real numbers are in. */
main.wrap[aria-busy='true'] .cs-rise > * {
  animation-play-state: paused;
}

/* Big screens: the page's content scales with the bar (shell.css --cs-zoom); dialogs and the full-screen timer live
   outside it and keep their own size. */
main.wrap {
  zoom: var(--cs-zoom);
}

/* The sign-in gate (2.15): the leaderboard is for Cachino Online players. Until the server says this device is logged
   in, the page is the log in form only: one narrow column, centred under the bar, like Cachino Online's own log in. */
body.gated main.wrap > :not(#gate),
body.gated .bottom-nav,
body.gated .header-actions {
  display: none !important;
}
.gate {
  width: 100%;
  max-width: 400px;
  margin: clamp(32px, 12vh, 120px) auto 64px;
}
.gate h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.gate-lede {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.5;
}
.gate .field input {
  min-height: 48px;
  font-size: 16px;
}
.gate-go {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}
.gate-new {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.gate-new a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Legal links (P0-4): the last thing in the page, small and quiet. */
.tr-legal {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
/* One even rhythm (the footer rule): three equal columns of 44px targets on a phone, one evenly spaced row wider. */
.tr-legal nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 12px;
  font-size: 12px;
}
@media (min-width: 600px) {
  .tr-legal nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
  }
}
.tr-legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink-3, var(--ink-2));
  text-decoration: none;
}
.tr-legal a:hover,
.tr-legal a:focus-visible {
  color: inherit;
  text-decoration: underline;
}

/* 6.9: on phones the fixed bottom bar covered the footer's last row, even at the end of the page. The page now ends
   with room for the bar, so every legal link can be seen and tapped. */
@media (max-width: 859px) {
  body:has(.bottom-nav) .tr-legal {
    margin-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}
