  :root {
    /* Base — dark slate-navy: a restrained blue cast (roughly half the chroma of
       the original navy) so it reads cool/blue without swamping the gold accent.
       The bg->surface gap is widened so cards sit distinctly above the page. */
    --bg: #090c14;
    --bg-soft: #0e1420;
    --surface: #161f31;
    --surface-alt: #1e2941;
    --surface-elevated: #27334c;
    --text: #eef2f8;
    --text-soft: #99a6b8;
    --text-muted: #6b7787;
    /* Hairline borders — a low-opacity white reads cleaner on a dark surface
       than a saturated blue line. */
    --border: rgba(255, 255, 255, 0.12);
    --border-soft: rgba(255, 255, 255, 0.07);
    /* Brand accent — gold is the signature (coins). One saturated colour, used
       for primary actions, active states and highlights. Blue is demoted to a
       support / info role. */
    --brand: #f0c850;
    --brand-hover: #e6ba36;
    --brand-ink: #201700;                 /* dark text that sits on gold */
    --brand-soft: rgba(240, 200, 80, 0.12);
    --brand-border: rgba(240, 200, 80, 0.34);
    --primary: #4a9fe8;
    --primary-hover: #2f8ad6;
    --primary-soft: rgba(74, 159, 232, 0.12);
    --secondary: #232b39;                 /* neutral secondary button (was blue) */
    --secondary-hover: #2d3646;
    --accent: #8ec2ee;
    --warning: #f59e0b;
    --success-bg: #123020;
    --error-bg: #3a1720;
    --ring: rgba(240, 200, 80, 0.30);     /* gold focus ring, to match the brand */
    --gold: #f0c850;
    --silver: #b7c3d1;
    --bronze: #cd8a4e;
    --green: #35c98d;
    --green-dim: rgba(52, 211, 153, 0.12);
    --up: #3ddc84;                        /* leaderboard rank-move up */
    --down: #ff5b5b;                      /* leaderboard rank-move down */
    --warm-surface: rgba(20, 25, 34, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22), 0 1px 1px rgba(0, 0, 0, 0.16);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.34), 0 2px 6px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.40), 0 4px 12px rgba(0, 0, 0, 0.24);
    /* Radius scale — collapses the old 2–16px sprawl (10 distinct values) to a
       5-step ramp. The remap of literal values to these tokens is mechanical. */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-pill: 999px;
    /* Spacing scale (4-based). New layout should use these; existing paddings
       are migrated opportunistically. */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
  }
  * { box-sizing: border-box; }
  html, body { min-height: 100%; }
  body {
    font-family: "Plus Jakarta Sans", sans-serif;
    margin: 0;
    background:
      radial-gradient(1100px 600px at -10% -25%, rgba(240, 200, 80, 0.05), transparent 60%),
      radial-gradient(1000px 560px at 118% -28%, rgba(120, 150, 200, 0.035), transparent 58%),
      linear-gradient(180deg, #080b14 0%, #0a0e1a 45%, var(--bg) 100%);
    color: var(--text);
    letter-spacing: 0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  nav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    column-gap: 12px;
    background: rgba(10, 14, 22, 0.9);
    backdrop-filter: blur(8px) saturate(130%);
    -webkit-backdrop-filter: blur(8px) saturate(130%);
    color: var(--text);
    padding: 4px 20px;
    border-bottom: 1px solid var(--border);
  }
  nav a { color: var(--text); text-decoration: none; font-weight: 700; }
  .nav-scroller {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
    column-gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    /* overflow-y:hidden clips at the padding box, so this vertical padding gives
       the notification badge (top:-6px) headroom to overhang without being
       cropped. The matching reduction in nav's own padding keeps height stable. */
    padding-block: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav-scroller::-webkit-scrollbar { display: none; }
  .nav-scroller > * { flex: 0 0 auto; }
  .nav-menu { margin-left: auto; margin-right: auto; }
  .nav-scroll-cue { display: none; }
  .container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px 22px;
    margin-bottom: 14px;
    /* Soft drop shadow + a 1px top "catch-light" so the panel reads as lit from
       above with a defined top edge (crisper than shadow alone on dark). */
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: fade-up 260ms ease-out both;
    min-width: 0;
  }
  .grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
  .btn {
    background: var(--brand);
    color: var(--brand-ink);
    border: 0;
    border-radius: var(--r-sm);
    padding: 9px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.005em;
    transition: background 140ms ease, transform 120ms ease, box-shadow 140ms ease;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 1px 2px rgba(0, 0, 0, 0.34);
  }
  .btn:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 6px 14px rgba(240, 200, 80, 0.20); }
  .btn:active { transform: translateY(0); }
  .btn.secondary {
    background: var(--secondary);
    color: var(--text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  }
  .btn.secondary:hover { background: var(--secondary-hover); }
  .btn.is-current {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.35);
    cursor: default;
    box-shadow: none;
  }
  .btn.is-current:hover { background: var(--green-dim); transform: none; box-shadow: none; }
  .btn.danger {
    background: #c0392b;
    color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 1px 2px rgba(2, 8, 20, 0.32);
  }
  .btn.danger:hover { background: #a92e22; }
  .btn.danger:disabled { background: #6a352f; cursor: not-allowed; opacity: 0.7; }
  .danger-zone { border-color: rgba(192, 57, 43, 0.55); }
  .danger-zone h3 { color: #e0796f; }
  .leagues-table th:last-child,
  .leagues-table td:last-child {
    text-align: right;
    width: 1%;
    white-space: nowrap;
  }
  .leagues-table th:nth-child(1),
  .leagues-table td:nth-child(1),
  .leagues-table th:nth-child(2),
  .leagues-table td:nth-child(2) {
    white-space: nowrap;
  }
  .leagues-table td .inline-form { display: inline-block; margin-left: 6px; }
  .leagues-table td .inline-form:first-child { margin-left: 0; }

  /* ---- FPL-style league cards/rows ---- */
  .muted-copy { color: var(--text-soft); margin: 0; }
  .league-forms { margin-bottom: 14px; }
  .league-forms .card { margin-bottom: 0; }

  .league-list-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 2px 14px 8px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .league-list-head .lh-rank { flex: 0 0 58px; text-align: center; }
  .league-list-head .lh-name { flex: 1 1 auto; min-width: 0; }
  .league-list-head .lh-move { flex: 0 0 56px; text-align: center; }
  .league-list-head .lh-action { flex: 0 0 120px; }
  .league-empty-hint { margin-top: 12px; }

  .league-list { display: flex; flex-direction: column; gap: 10px; }
  .league-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    background: var(--bg-soft);
    transition: border-color 140ms ease, background 140ms ease;
  }
  .league-row:hover { border-color: rgba(58, 163, 245, 0.28); }
  .league-row.is-current { border-color: rgba(52, 211, 153, 0.40); }
  .league-row-global {
    background:
      radial-gradient(420px 120px at 0% 0%, rgba(58, 163, 245, 0.10), transparent 70%),
      var(--bg-soft);
    border-color: rgba(58, 163, 245, 0.22);
  }
  .league-row-main {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
  }
  .league-row.is-current .league-row-main { cursor: default; }

  .league-rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    background: var(--surface-alt);
    border: 1px solid var(--border-soft);
  }
  .league-rank-value { font-size: 1.15rem; font-weight: 800; line-height: 1.1; color: var(--accent); }
  .league-rank-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

  .league-info { min-width: 0; flex: 1 1 auto; }
  .league-name { font-weight: 700; font-size: 1.02rem; overflow-wrap: break-word; }
  .league-meta { font-size: 0.82rem; color: var(--text-soft); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .league-meta-sep { color: var(--text-muted); }
  .invite-inline { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); }
  .invite-inline code { color: var(--text-soft); }
  .meta-mobile-only { display: none; }  /* inline rank-move shown only on the mobile layout */

  .league-tag {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    padding: 1px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--primary-soft);
    border: 1px solid rgba(58, 163, 245, 0.30);
    border-radius: var(--r-pill);
  }

  .league-move {
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .league-move .rank-move { margin-left: 0; }
  .league-move .rank-move-none { color: var(--text-muted); font-weight: 700; }

  .league-action { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 120px; }
  .btn.icon-only { padding: 8px; line-height: 0; }

  @media (max-width: 560px) {
    /* Top-align so the badge and action button anchor to the league name's
       first line instead of floating in the middle of a wrapped name. */
    .league-row { gap: 10px; padding: 12px; align-items: flex-start; }
    .league-row-main { gap: 10px; align-items: flex-start; }
    .league-rank { min-width: 44px; padding: 4px 6px; }
    .league-rank-value { font-size: 1.02rem; }
    .league-list-head { display: none; }
    .league-action { flex-basis: auto; gap: 6px; }
    .league-action .btn { padding: 7px 11px; font-size: 0.82rem; }
    .league-action .btn.icon-only { padding: 7px; }
    .league-name { font-size: 0.96rem; }
    /* Drop the standalone Move column and the invite code; the rank-move arrow
       folds inline into the meta line instead, freeing width for the name. */
    .league-move { display: none; }
    .league-meta .invite-inline { display: none; }
    .meta-mobile-only { display: inline; }
    .league-meta .rank-move { margin-left: 0; }
  }
  .copy-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
  }
  .copy-btn:hover {
    color: var(--text);
    background: var(--primary-soft);
    border-color: rgba(58, 163, 245, 0.30);
  }
  .copy-btn .icon-check { display: none; }
  .copy-btn.copy-btn-success {
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.35);
    background: var(--green-dim);
  }
  .copy-btn.copy-btn-success .icon-copy { display: none; }
  .copy-btn.copy-btn-success .icon-check { display: inline-block; }
  .messages { list-style: none; padding: 0; }
  .messages li {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--primary);
    background: var(--bg-soft);
    font-size: 0.94rem;
  }
  .messages li.success { background: var(--success-bg); }
  .messages li.error { background: var(--error-bg); }
  table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    overflow: hidden;
  }
  .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-scroll table { min-width: 100%; }
  .scroll-hint { position: relative; }
  .scroll-hint .scroll-hint-cue { display: none; }
  /* Hide the right-edge fade + cue once scrolled to the end (or when there's no
     overflow) so the last column stays fully visible. Toggled by csInitScrollHints. */
  .scroll-hint::after { transition: opacity 180ms ease; }
  .scroll-hint.is-scroll-end::after { opacity: 0; }
  .scroll-hint.is-scroll-end .scroll-hint-cue { display: none; }
  @media (max-width: 760px) {
    .scroll-hint::after {
      content: "";
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      width: 44px;
      pointer-events: none;
      background: linear-gradient(to right, rgba(23, 52, 89, 0) 0%, var(--surface-alt) 80%);
      border-top-right-radius: 10px;
      border-bottom-right-radius: 10px;
    }
    .scroll-hint .scroll-hint-cue {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      top: 0;
      right: 4px;
      bottom: 0;
      width: 22px;
      pointer-events: none;
      color: var(--accent);
      font-size: 1.6rem;
      font-weight: 800;
      line-height: 1;
      animation: scroll-hint-bounce 1.4s ease-in-out infinite;
    }
  }
  @keyframes scroll-hint-bounce {
    0%, 100% { transform: translateX(0); opacity: 0.85; }
    50%      { transform: translateX(-6px); opacity: 1; }
  }
  th, td {
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
  }
  tbody tr:last-child td { border-bottom: 0; }
  th {
    background: rgba(58, 163, 245, 0.06);
    color: var(--text-muted);
    font-family: "Plus Jakarta Sans", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.74rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
  }
  tr:hover td { background: rgba(58, 163, 245, 0.05); }
  .numeric-cell, .status-cell { white-space: nowrap; }
  /* Tabular figures so columns line up digit-for-digit across the data tables
     and stat readouts (was only set on a few tables before). */
  .numeric-cell, .round-history-table td, .stat-value { font-variant-numeric: tabular-nums; }

  /* Sortable column headers (leaderboard). The <button> inherits the <th>'s
     uppercase/letter-spaced look so it reads as a header, not a control. */
  .th-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
  }
  .th-sort:hover,
  .th-sort:focus-visible,
  .th-sort.is-sorted { color: var(--text); }
  .sort-arrow { font-size: 0.6rem; line-height: 1; }

  /* ---- Results grid (per-player x per-match heatmap) ---- */
  .matrix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 14px 0 12px;
    font-size: 0.8rem;
    color: var(--text-soft);
  }
  .matrix-legend-item { display: inline-flex; align-items: center; gap: 6px; }
  .matrix-swatch {
    width: 14px;
    height: 14px;
    border-radius: var(--r-xs);
    display: inline-block;
    flex: 0 0 auto;
  }
  .results-matrix { border-collapse: separate; border-spacing: 0; }
  .results-matrix th,
  .results-matrix td {
    padding: 7px 8px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-soft);
  }
  .results-matrix .matrix-col { min-width: 42px; vertical-align: bottom; }
  /* Divider between rounds: the first column of each round group carries a
     gold left border (the active-tab colour) so adjacent rounds read as
     distinct blocks. */
  .results-matrix th.matrix-round-start,
  .results-matrix td.matrix-round-start { border-left: 2px solid #d4a017; }
  .matrix-fixture { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
  .matrix-fixture .team-flag { width: 18px; height: auto; }
  .matrix-score {
    display: block;
    margin-top: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: none;
    letter-spacing: 0;
  }
  .results-matrix .matrix-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.15;
  }
  .matrix-pick { display: block; }
  /* Coin staked: the value inside a matte ring so it reads as a coin without a
     busy icon. The ring inherits the cell's state colour, dimmed, so it blends
     with the cell background and stays secondary to the score. */
  .matrix-coin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    margin-top: 3px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.65;
  }
  /* Player name pinned while the (potentially very wide) grid scrolls sideways. */
  .results-matrix .matrix-player-col {
    position: sticky;
    left: 0;
    z-index: 2;
    text-align: left;
    min-width: 130px;
    background: var(--surface);
  }
  .results-matrix thead .matrix-player-col { z-index: 3; background: var(--surface-alt); }
  /* Corner cell: the two axis labels as separate stacked boxes (Match over
     Player), split by a divider. Opaque base keeps the sticky cell hiding the
     columns scrolling behind it. */
  .results-matrix thead th.matrix-corner {
    position: relative;
    padding: 0;
    background: var(--surface-alt);
  }
  .matrix-corner-inner { position: absolute; inset: 0; display: flex; flex-direction: column; }
  .matrix-corner-inner > span {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 4px 10px;
    line-height: 1;
  }
  .matrix-corner-match { justify-content: flex-end; border-bottom: 1px solid var(--border); }
  .matrix-corner-player { justify-content: flex-start; }
  .results-matrix tr.rank-you .matrix-player-col {
    background: var(--surface-alt);
    box-shadow: inset 2px 0 0 var(--primary);
  }
  /* Cell fills. Scoped to td so they beat the generic tr:hover/rank-you td rules. */
  .results-matrix td.matrix-exact   { background: rgba(37, 221, 146, 0.40); color: #6bf0b6; }
  .results-matrix td.matrix-outcome { background: rgba(69, 129, 245, 0.32); color: #9cc0fc; }
  .results-matrix td.matrix-wrong   { background: rgba(248, 113, 113, 0.18); color: #f7a6a6; }
  .results-matrix td.matrix-pending { background: rgba(255, 255, 255, 0.03); color: var(--text-muted); }
  .results-matrix td.matrix-none    { color: var(--text-muted); }
  /* Legend swatches reuse the same fills (a touch more opaque so they read). */
  .matrix-swatch.matrix-exact   { background: rgba(37, 221, 146, 0.72); }
  .matrix-swatch.matrix-outcome { background: rgba(69, 129, 245, 0.62); }
  .matrix-swatch.matrix-wrong   { background: rgba(248, 113, 113, 0.45); }

  /* Medal / highlight rows */
  .rank-gold td { background: rgba(240, 200, 80, 0.08); }
  .rank-silver td { background: rgba(176, 196, 216, 0.06); }
  .rank-bronze td { background: rgba(205, 127, 50, 0.06); }
  .rank-medal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 800;
  }
  .rank-medal::before {
    font-size: 1rem;
    line-height: 1;
  }
  .rank-gold .rank-medal { color: var(--gold); }
  .rank-gold .rank-medal::before { content: "\1F947"; }
  .rank-silver .rank-medal { color: var(--silver); }
  .rank-silver .rank-medal::before { content: "\1F948"; }
  .rank-bronze .rank-medal { color: var(--bronze); }
  .rank-bronze .rank-medal::before { content: "\1F949"; }
  /* Rank movement arrow inline with the rank number (leaderboard + round history).
     Shows the change in the most recent completed round; absent when no change. */
  .rank-cell { white-space: nowrap; }
  .rank-move {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    font-size: 0.72rem;
    font-weight: 800;
    vertical-align: middle;
  }
  .rank-move-up { color: var(--up); }
  .rank-move-down { color: var(--down); }
  tr.rank-you td {
    background: var(--brand-soft);
    font-weight: 600;
  }
  tr.rank-you td:first-child {
    box-shadow: inset 2px 0 0 var(--brand);
  }

  /* Numeric hierarchy: Points is the hero of each row (bigger + heavier); the
     secondary metrics (Accuracy / Accuracy-Results / Coin IQ = columns 4-6) are
     demoted to a muted, smaller treatment so the eye lands on rank + points
     first. Columns 7-8 (Badges / Award) aren't .numeric-cell, so nth-child(n+4)
     targets exactly the three secondary stats. */
  .leaderboard-row td.numeric-cell strong { font-size: 1.06rem; font-weight: 800; color: var(--text); }
  .leaderboard-row td.numeric-cell:nth-child(n+4) { color: var(--text-soft); font-size: 0.9rem; }

  /* Breathing room between the "Leaderboard - <league>" heading and the
     view-switch tabs below it. */
  #leaderboard .page-header { margin-bottom: 16px; }

  /* Leaderboard header controls: the view switch (Leaderboard / Round History /
     Scorecard) plus the round filter (filter only shows on the leaderboard view). */
  .leaderboard-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  .leaderboard-controls .round-filter { margin-bottom: 0; }
  .view-switch {
    display: inline-flex;
    flex-wrap: nowrap;          /* keep the three tabs on one line */
    max-width: 100%;
    gap: 6px;
    padding: 5px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    /* When the strip is full-width (mobile), spread the tabs with equal space
       between them and the edges instead of bunching them on the left. A no-op on
       desktop, where the inline-flex strip is only as wide as its tabs. */
    justify-content: space-evenly;
  }
  .view-seg {
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;        /* never break a label across lines */
    color: var(--text-soft);
    text-decoration: none;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
  }
  .view-seg:hover {
    color: var(--text);
    border-color: rgba(240, 180, 40, 0.35);
    background: rgba(240, 180, 40, 0.10);
  }
  .view-seg-active,
  .view-seg-active:hover {
    color: #2a1c00;
    background: var(--brand);
    border-color: #c8961a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }
  /* Brief dim while a view swaps in via fetch (no full-page reload). */
  #leaderboard-panel.is-swapping {
    opacity: 0.55;
    transition: opacity 120ms ease;
    pointer-events: none;
  }
  /* After a view swap the script focuses the panel heading for screen-reader
     continuity. It's not keyboard-focusable (tabindex=-1), so hide the focus ring. */
  #leaderboard-panel h3:focus { outline: none; }

  /* ---- Emotes ---- */
  /* Nav bell + unread badge */
  .emote-nav { position: relative; display: inline-flex; align-items: center; }
  .emote-bell {
    position: relative;
    background: var(--secondary);
    color: var(--text);
    border: 0;
    border-radius: var(--r-sm);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    transition: background 140ms ease;
  }
  .emote-bell:hover { background: var(--secondary-hover); }
  .emote-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-sm);
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
  }
  /* Lives on <body> and is positioned by JS (fixed), so the nav's overflow +
     backdrop-filter can't clip it. */
  .emote-dropdown {
    position: fixed;
    top: 64px;
    right: 12px;
    width: 320px;
    max-width: 86vw;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    z-index: 90;
  }
  .emote-dropdown-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 10px 12px;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
  }
  /* Title grows so the action buttons group to the right; truncates on tiny screens. */
  .emote-dropdown-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .emote-dropdown-back {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: var(--text);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
  }
  /* Gold "Send message" CTA in the header: opens the compose (player) view. */
  .emote-compose-btn {
    flex: 0 0 auto;
    background: var(--gold);
    color: #1a1205;
    border: 0;
    border-radius: var(--r-sm);
    padding: 4px 10px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: none;
    cursor: pointer;
    white-space: nowrap;
  }
  .emote-compose-btn:hover { filter: brightness(1.06); }
  .emote-clear-all {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
  }
  .emote-clear-all:hover { color: var(--text); text-decoration: underline; }
  /* Compose view: clickable player rows (ordered by leaderboard rank). */
  .emote-player {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: var(--r-sm);
    padding: 9px 10px;
    cursor: pointer;
    color: var(--text);
    font: inherit;
  }
  .emote-player:hover { background: var(--primary-soft); }
  .emote-player-rank { flex: 0 0 auto; min-width: 28px; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; }
  .emote-player-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .emote-player-go { flex: 0 0 auto; color: var(--text-muted); font-size: 1.15rem; line-height: 1; }

  /* Leaderboard actions: round filter + the titles-vote CTA, kept on one line.
     flex-shrink:0 + the parent's flex-wrap means the pair drops below the view
     tabs together on narrow widths rather than stacking on top of each other. */
  .leaderboard-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; flex-shrink: 0; }
  .leaderboard-actions .round-filter { margin-bottom: 0; flex: 0 0 auto; }
  /* Keep the League Awards button text close to the view-switch tabs, a touch smaller. */
  .vote-cta { white-space: nowrap; flex: 0 0 auto; font-size: 0.8rem; }
  /* Keep the "View League Awards" button on a single line in the Leagues & Cups card. */
  .award-card-btn { white-space: nowrap; }
  /* Gold "Time to vote!" prompt under the League Awards heading. */
  .vote-now-eyebrow { color: var(--gold); font-weight: 700; margin: 4px 0 2px; }

  /* League Awards section (on the Leagues & Cups page). */
  /* Plain, low-key helper line (no callout box) — just tells you which league's
     ballot you're on. Spaced off the ballot below it. */
  .voting-scope-note {
    margin-top: 14px;
    margin-bottom: 22px;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
  }
  .voting-scope-note strong { color: var(--text-soft); }
  .voting-closed-note {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    border-left: 4px solid var(--text-muted);
    background: var(--bg-soft);
    color: var(--text-soft);
    font-size: 0.9rem;
    font-weight: 600;
  }
  /* The page lays the title cards out in a responsive grid; the same .vote-card
     pieces are reused (one card per title). */
  .vote-list-page {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
  }
  .vote-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
  }
  .vote-card-emoji { font-size: 1.6rem; line-height: 1.1; flex: 0 0 auto; }
  .vote-card-body { min-width: 0; flex: 1 1 auto; }
  /* Tiny discreet "AWARD" eyebrow above each title, so it's clear the title is the award. */
  .vote-card-eyebrow { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 3px; }
  .vote-card-title { font-weight: 700; font-size: 1rem; color: var(--text); }
  .vote-card-desc { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
  .vote-card-leader { font-size: 0.84rem; font-weight: 700; color: var(--gold); margin-top: 8px; }
  .vote-card-leader-empty { color: var(--text-soft); font-weight: 600; }
  /* Live standings (name · bar · count) under each title. */
  .vote-standings { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
  .vote-standing { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-soft); }
  .vote-standing.is-leader { color: var(--text); font-weight: 700; }
  .vote-standing-name { flex: 0 0 38%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vote-standing-bar { flex: 1 1 auto; height: 7px; border-radius: var(--r-pill); background: var(--bg-soft); overflow: hidden; }
  .vote-standing-bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--primary); }
  .vote-standing.is-leader .vote-standing-bar > span { background: var(--gold); }
  /* Vote tally as a hoverable circle/pill; its tooltip reveals who cast the votes. */
  .vote-count-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: border-color 140ms ease, color 140ms ease;
  }
  .vote-standing.is-leader .vote-count-chip { border-color: var(--gold); color: var(--text); }
  .vote-count-chip:hover,
  .vote-count-chip:focus-visible { border-color: var(--primary); color: var(--text); }
  .vote-form { margin-top: 10px; }
  .vote-form-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
  }
  .vote-select {
    width: 100%;
    background-color: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    padding: 8px 32px 8px 8px;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;   /* drop the native (dark) dropdown arrow */
    -moz-appearance: none;
    /* White chevron so it's clearly visible on the dark field (matches the Stats
       filter / metric-chart selects). Longhands, not the background shorthand, so the
       arrow isn't reset and survives :focus. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }
  .vote-select:focus { outline: none; border-color: var(--primary); }
  /* Award chips on the leaderboard: each held title shows as a gold "emoji + name"
     pill. Multiple co-held awards stack vertically. Reuses .badge-chip for the
     tooltip wiring; the gold tint sets these peer-voted titles apart from the
     data-earned badges. */
  .award-list {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .badge-chip.title-chip {
    gap: 5px;
    padding: 2px 8px;
    border: 1px solid rgba(240, 200, 80, 0.45);
    border-radius: var(--r-pill);
    background: rgba(240, 200, 80, 0.08);
    white-space: nowrap;
  }
  .title-chip-emoji { font-size: 1.05rem; }
  .title-chip-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
  }
  /* Marks a co-held award without naming the other holders. */
  .title-chip-shared {
    font-weight: 500;
    color: var(--text-soft);
  }
  .emote-dropdown-list { padding: 6px; }
  .emote-empty { padding: 16px 14px; color: var(--text-soft); font-size: 0.9rem; text-align: center; }
  .emote-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    border-left: 3px solid transparent;  /* reserved so read/unread stay aligned */
  }
  .emote-item-emoji { font-size: 1.25rem; line-height: 1; flex: 0 0 auto; }
  .emote-item-body { min-width: 0; flex: 1 1 auto; }
  /* Read items stay fully legible — "seen", not disabled. */
  .emote-item-text { font-weight: 600; font-size: 0.92rem; color: var(--text); }
  .emote-item-meta { color: var(--text-muted); font-size: 0.78rem; margin-top: 1px; }
  /* Unread gets the emphasis instead: accent border, tint, bolder label, a dot. */
  .emote-item.is-unread {
    background: var(--primary-soft);
    border-left-color: var(--primary);
  }
  .emote-item.is-unread .emote-item-text { font-weight: 700; }
  .emote-item.is-unread .emote-item-text::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--primary);
    vertical-align: middle;
  }
  .emote-item-reply {
    flex: 0 0 auto;
    background: var(--secondary);
    color: var(--text);
    border: 0;
    border-radius: var(--r-sm);
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
  }
  .emote-item-reply:hover { background: var(--secondary-hover); }
  /* Once you've replied to an emote, the action becomes a muted "Replied" tag. */
  .emote-item-reply.is-replied,
  .emote-item-reply.is-replied:hover {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-soft);
    cursor: default;
  }
  /* ---- Notifications (🔔 bell) ---- */
  /* Mirrors the emote bell/dropdown; kept as its own class set so the emote
     feature stays untouched. */
  .notif-nav { position: relative; display: inline-flex; align-items: center; }
  .notif-bell {
    position: relative;
    background: var(--secondary);
    color: var(--text);
    border: 0;
    border-radius: var(--r-sm);
    padding: 7px 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    transition: background 140ms ease;
  }
  .notif-bell:hover { background: var(--secondary-hover); }
  .notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-sm);
    background: #c0392b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
  }
  /* Lives on <body>, positioned by JS (fixed), so nav overflow can't clip it. */
  .notif-dropdown {
    position: fixed;
    top: 64px;
    right: 12px;
    width: 340px;
    max-width: 90vw;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    z-index: 90;
  }
  .notif-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
  }
  .notif-clear-all {
    background: transparent;
    border: 0;
    color: var(--text-soft);
    font: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
  }
  .notif-clear-all:hover { color: var(--text); text-decoration: underline; }
  .notif-dropdown-list { padding: 6px; }
  .notif-empty { padding: 16px 14px; color: var(--text-soft); font-size: 0.9rem; text-align: center; }
  .notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    border-left: 3px solid transparent;  /* reserved so read/unread stay aligned */
  }
  .notif-item-emoji { font-size: 1.25rem; line-height: 1.2; flex: 0 0 auto; }
  .notif-item-body { min-width: 0; flex: 1 1 auto; }
  .notif-item-text { font-weight: 600; font-size: 0.9rem; color: var(--text); line-height: 1.35; }
  .notif-item-link { color: var(--accent); font-weight: 700; text-decoration: underline; }
  .notif-item-link:hover { color: var(--text); }
  .notif-item-meta { color: var(--text-muted); font-size: 0.76rem; margin-top: 3px; }
  /* Unread emphasis: accent border, tint, bolder text, a dot after the body. */
  .notif-item.is-unread {
    background: var(--primary-soft);
    border-left-color: var(--primary);
  }
  .notif-item.is-unread .notif-item-text { font-weight: 700; }
  .notif-item.is-unread .notif-item-text::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--primary);
    vertical-align: middle;
  }
  .notif-item-del {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--r-sm);
  }
  .notif-item-del:hover { color: #e0796f; background: rgba(192, 57, 43, 0.12); }

  /* Leaderboard player cell layout. Keep this a normal table cell — NOT display:flex.
     A flex/grid <td> is wrapped in an anonymous table-cell that stretches to the row
     height, while the styled .player-cell only covers its own content. On tall rows
     (a player holding several stacked award chips) the medal/you row tint then stopped
     at the name and the untinted surface below showed as a "dark band". A plain cell
     stretches to the full row height, so the tint fills it and the band is gone; the
     link centres via the default vertical-align: middle. */
  .player-cell { vertical-align: middle; }
  .player-cell .player-link { min-width: 0; }

  /* Shared emote picker (dropdown reply + predictions-page send) */
  .emote-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(3, 8, 18, 0.6);
    backdrop-filter: blur(2px);
  }
  /* The class rule above would otherwise beat the [hidden] attribute and show
     the empty modal on load — keep it hidden until JS opens it. */
  .emote-picker-backdrop[hidden] { display: none; }
  .emote-picker {
    width: 420px;
    max-width: 100%;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
  .emote-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-soft);
  }
  .emote-picker-close {
    background: transparent;
    border: 0;
    color: var(--text-soft);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }
  .emote-picker-close:hover { color: var(--text); }
  /* The received message being replied to. Deliberately styled UNLIKE the
     clickable .emote-option boxes below it (tinted, captioned, thicker accent
     bar, no hover) so it clearly reads as a quotation, not another option. */
  .emote-picker-quote {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin: 14px 16px 0;
    padding: 10px 12px;
    background: var(--primary-soft);
    border-left: 4px solid var(--primary);
    border-radius: 0 10px 10px 0;
    font-size: 0.88rem;
  }
  .emote-picker-quote[hidden] { display: none; }
  .emote-picker-quote-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .emote-picker-quote-msg { display: flex; align-items: center; gap: 10px; }
  .emote-picker-quote-emoji { font-size: 1.25rem; line-height: 1; flex: 0 0 auto; }
  .emote-picker-quote-text { min-width: 0; color: var(--text); font-weight: 600; }
  .emote-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 14px 16px;
  }
  .emote-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, transform 100ms ease;
  }
  .emote-option:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
  .emote-option:disabled { opacity: 0.5; cursor: default; transform: none; }
  .emote-option-emoji { font-size: 1.25rem; line-height: 1; }
  .emote-option-label { min-width: 0; }
  .emote-picker-flash { min-height: 18px; padding: 0 16px 14px; font-size: 0.86rem; }
  .emote-picker-flash.is-ok { color: var(--green); }
  .emote-picker-flash.is-err { color: #e0796f; }
  @media (max-width: 560px) {
    .emote-picker-grid { grid-template-columns: 1fr; }
  }

  /* Round filter (leaderboard header + the per-user predictions page). Lives in
     base.css so it's styled on the dashboard, which doesn't load predictions.css. */
  .round-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
  }
  .round-filter label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
  }
  .round-filter select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: auto;
    cursor: pointer;
    padding: 8px 30px 8px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f88a8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
  }
  .round-filter select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
  }
  .round-filter select option {
    color: var(--text);
    background: #0d1117;
  }

  /* Your personal Round History table (FPL-style): compact rows so many rounds
     stack and compare at a glance. */
  .round-history-table th,
  .round-history-table td { padding: 7px 12px; }
  .round-history-table th { white-space: nowrap; }  /* never stack a header (e.g. "Coin") letter-by-letter */
  .round-history-table .rh-round { font-weight: 700; white-space: nowrap; }
  .round-history-table .rank-move { margin-left: 4px; font-size: 0.72rem; }
  .player-team {
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
    /* Wrap at spaces only — never mid-word (table cells default to
       overflow-wrap:anywhere, which chopped names like "Studenten"). */
    overflow-wrap: normal;
  }
  .player-manager {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.25;
    margin-top: 2px;
    overflow-wrap: normal;
  }
  /* Badges + Awards columns: keep the header and the chip row on one line so each
     column gets real width (no vertical "BA DG ES"). Awards = the live League
     Awards poll's current holders, mirroring the badge-chip layout. */
  .badge-col, .award-col { white-space: nowrap; }
  a.player-link {
    display: block;
    text-decoration: none;
    color: inherit;
  }
  a.player-link:hover .player-team {
    color: var(--primary);
    text-decoration: underline;
  }
  tr.leaderboard-row { cursor: pointer; }
  tr.leaderboard-row:hover td {
    background: rgba(58, 163, 245, 0.06);
  }

  .badge {
    background: rgba(125, 211, 252, 0.12);
    border: 1px solid rgba(125, 211, 252, 0.35);
    border-radius: var(--r-pill);
    padding: 3px 9px;
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
  }
  .nav-left { justify-self: start; display: flex; align-items: center; }
  .nav-brand { display: inline-flex; align-items: center; line-height: 0; }
  .nav-brand img {
    height: 80px;
    width: auto;
    display: block;
    object-fit: contain;
  }
  .nav-menu { display: flex; align-items: center; gap: 4px; justify-self: center; flex-wrap: nowrap; }
  .nav-menu a {
    padding: 7px 12px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.92rem;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
  }
  .nav-menu a:hover {
    color: var(--text);
    background: rgba(58, 163, 245, 0.08);
  }
  .nav-menu a.brand {
    color: var(--text);
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-right: 6px;
  }
  .nav-menu a.is-active {
    color: var(--text);
    background: var(--brand-soft);
    border-color: var(--brand-border);
  }
  .nav-bells, .nav-account { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
  .nav-account > a {
    padding: 7px 12px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 0.92rem;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
  }
  .nav-account > a:hover {
    color: var(--text);
    background: var(--brand-soft);
  }
  .nav-account > a.is-active {
    color: var(--text);
    background: var(--brand-soft);
    border-color: var(--brand-border);
  }
  .nav-divider {
    width: 1px;
    height: 22px;
    background: var(--border-soft);
    margin: 0 4px;
  }
  .league-switcher { display: flex; align-items: center; }
  .league-switcher select {
    width: auto;
    min-width: 170px;
    padding: 7px 30px 7px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: var(--bg-soft);
    border-color: var(--border-soft);
  }
  .league-switcher select:hover { border-color: var(--border); }
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .nav-user {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }
  .inline-form { margin: 0; }
  input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    background: var(--bg-soft);
    color: var(--text);
    font-size: 0.94rem;
    font-family: inherit;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  }
  input:hover, select:hover, textarea:hover {
    border-color: var(--border);
  }
  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
    background: var(--surface);
  }
  input::placeholder, textarea::placeholder { color: var(--text-muted); }
  label { display: block; color: var(--text-soft); margin-bottom: 6px; font-size: 0.88rem; font-weight: 500; }
  .form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
  }
  .form-row .form-field { flex: 0 1 280px; min-width: 0; }
  .form-row .form-field input { width: 100%; }
  .form-row .btn { flex: 0 0 auto; }
  h1, h2, h3, h4 {
    margin-top: 0;
    font-family: "Plus Jakarta Sans", sans-serif;
    letter-spacing: -0.01em;
    color: var(--text);
    font-weight: 700;
  }
  h1 { font-size: 1.65rem; line-height: 1.2; }
  h2 { font-size: 1.3rem; line-height: 1.25; }
  h3 { font-size: 1.05rem; line-height: 1.3; }
  p, li { color: var(--text-soft); overflow-wrap: anywhere; line-height: 1.55; }
  strong { color: var(--text); font-weight: 600; }
  code { background: var(--bg-soft); padding: 2px 6px; border-radius: var(--r-xs); font-size: 0.88em; border: 1px solid var(--border-soft); }
  .page-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }
  .page-header-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
  }
  .page-header h1,
  .page-header h2,
  .page-header h3,
  .page-header p {
    margin: 0;
  }
  .page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
  }
  .page-header-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    min-width: 0;
  }
  .page-header-meta p { margin: 0; }
  .page-meta-badge {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(46, 168, 255, 0.22);
    background: rgba(46, 168, 255, 0.08);
    color: var(--text-soft);
  }
  .badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .login-card {
    max-width: 460px;
    margin: 40px auto;
  }
  .field-spacer { margin-top: 12px; }
  .btn-block {
    width: 100%;
    margin-top: 16px;
  }
  .auth-page-intro {
    max-width: 720px;
    margin: 40px auto 0;
    text-align: center;
    color: var(--text-muted);
    line-height: 1.5;
  }
  .auth-page-intro + .auth-grid {
    margin-top: 20px;
  }
  .auth-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    max-width: 960px;
    margin: 40px auto;
  }
  .auth-card {
    margin-bottom: 0;
  }
  .auth-card-intro {
    margin: 0 0 18px;
  }
  .errorlist {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    color: #ffd5dc;
    font-size: 0.92rem;
  }
  .errorlist li {
    margin: 0;
  }
  .helptext {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.83rem;
  }
  .helptext ul {
    margin: 6px 0 0 18px;
    padding: 0;
  }
  .privacy-notice {
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    background: rgba(8, 17, 30, 0.40);
  }
  .privacy-notice h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    margin: 0 0 10px;
    font-weight: 600;
  }
  .privacy-notice p {
    font-size: 0.83rem;
    line-height: 1.5;
    margin: 0 0 8px;
  }
  .privacy-notice p:last-child {
    margin-bottom: 0;
  }

  /* Stat cards */
  .stat-card {
    text-align: center;
    padding: 20px 14px;
  }
  .stat-card h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    margin: 0 0 8px;
    font-weight: 600;
  }
  .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .stat-value.accent { color: var(--accent); }
  .stat-value.gold { color: var(--gold); }

  /* Analytics tab: compact 3-up summary above the per-coin table. Stays 3 across
     even on phones (values are short), unlike the auto-fit .grid. */
  .analytics-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }
  .analytics-summary .stat-card { padding: 14px 10px; margin-bottom: 0; }
  .analytics-summary .stat-value { font-size: 1.7rem; }
  .analytics-goals { margin-top: 4px; }
  .analytics-summary .stat-sub {
    font-size: 0.72rem;
    color: var(--text-soft);
    margin-top: 4px;
  }
  /* Stats summary metrics: four equal cards kept on a single line, with a tighter
     gap and padding than the default 3-up so they fit across a phone too. */
  .analytics-summary.cols-4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  /* min-width:0 lets each card shrink to its 1fr track (grid items default to
     min-width:auto). The header font is sized small enough that the longest single
     word ("ACCURACY") fits on one line — so headers wrap only at spaces, never
     mid-word — and the value below it stays comfortably inside the narrow card. */
  /* Flex column with the value pinned to the bottom: the cards are equal height (grid
     stretch), so a two-line header ("Accuracy – Results") no longer pushes its value
     lower than the one-line cards — every value sits on the same baseline. */
  .analytics-summary.cols-4 .stat-card {
    padding: 14px 4px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .analytics-summary.cols-4 .stat-card h3 { font-size: 0.6rem; letter-spacing: 0; }
  .analytics-summary.cols-4 .stat-value { font-size: 1.35rem; }
  /* Player picker, sat just under the metric cards on the Stats tab. */
  .stats-user-filter { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
  .stats-user-filter select,
  .metric-chart-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 260px;
    appearance: none;
    -webkit-appearance: none;   /* drop the native (dark) iOS dropdown arrow */
    -moz-appearance: none;
    cursor: pointer;
    padding: 10px 32px 10px 12px;
    /* White chevron so it's clearly visible on the dark field. Longhands (not the
       background shorthand) so the arrow survives :focus, which swaps the bg colour. */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
  }
  .analytics-subhead {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 20px 0 8px;
  }
  /* Metric-over-rounds trend chart, sat just below the Stats metric cards. The
     selected metric is plotted as a hand-rolled inline SVG line (no chart lib). */
  .metric-chart { margin: 4px 0 18px; }
  .metric-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .metric-chart-title { margin: 0; }
  .metric-chart-select { flex: 0 0 auto; max-width: 200px; }
  .metric-chart-svg {
    display: block;
    width: 100%;
    /* Full width with a fixed height (no aspect-ratio): the JS fits the viewBox to the
       rendered pixel size, so the line spans the whole card width without ballooning
       in height, letterboxing, or stretching the axis text. */
    height: 290px;
    margin-top: 6px;
  }
  @media (max-width: 560px) {
    .metric-chart-svg { height: 200px; }
  }
  /* Strokes stay crisp/constant as the viewBox scales up to the card width. */
  .metric-chart .mc-grid { stroke: var(--border-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
  .metric-chart .mc-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
  }
  /* League-average baseline: a solid gold line (slightly thinner than your accent line). */
  .metric-chart .mc-line-league {
    stroke: var(--gold);
    stroke-width: 2;
    opacity: 0.9;
  }
  .metric-chart .mc-axis { fill: var(--text-muted); font-size: 12px; }
  .metric-chart .mc-axis-y { text-anchor: end; }
  .metric-chart .mc-axis-x { text-anchor: middle; }
  .metric-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
  }
  .mc-legend-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
  .mc-swatch { flex: 0 0 auto; width: 16px; height: 3px; border-radius: var(--r-xs); }
  .mc-swatch-you { background: var(--accent); }
  .mc-swatch-league { background: var(--gold); }
  /* Calibration bar in the per-coin Hit-rate column: the bar length shows whether
     bigger coins actually hit more (rows are sorted high coin first). */
  .calib {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
  }
  .calib-track {
    width: 64px;
    height: 5px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
  }
  .calib-bar {
    display: block;
    height: 100%;
    border-radius: var(--r-pill);
    background: var(--accent);
  }

  /* Empty states */
  .empty-state {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-soft);
  }
  .empty-state-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
    opacity: 0.7;
  }
  .empty-state p {
    margin: 4px 0;
    font-size: 0.95rem;
  }

  /* Badge card */
  .badge-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
  }
  .badge-card-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 42px;
    text-align: center;
  }
  .badge-card-body h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
  }
  .badge-card-body p {
    margin: 0;
    font-size: 0.88rem;
  }
  .badge-card.badge-earned {
    border-color: rgba(125, 211, 252, 0.32);
    background: linear-gradient(150deg, rgba(125, 211, 252, 0.06), var(--surface));
  }
  .badge-card.badge-locked {
    opacity: 0.5;
  }

  /* Leaderboard badge chips with hover/tap tooltip */
  .badge-list {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 4px;
  }
  .badge-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 1;
    font-size: inherit;
    color: inherit;
  }
  .badge-chip-icon {
    font-size: 1.05rem;
  }
  /* Small "i" info button (e.g. next to the Coin IQ header) — reuses the
     shared badge tooltip for its explanation. */
  .info-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text-soft);
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-weight: 700;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    text-transform: none;
  }
  .info-chip:hover,
  .info-chip:focus-visible {
    color: var(--text);
    border-color: var(--primary);
  }
  .badge-tooltip {
    /* Positioned with position:fixed by JS so it escapes the leaderboard's
       overflow-x:auto scroll container (which would otherwise clip it).
       Explicit width avoids shrink-wrapping into a one-char-per-line column. */
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    box-sizing: border-box;
    width: 220px;
    max-width: calc(100vw - 16px);
    padding: 8px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    text-align: left;
    white-space: normal;
    overflow-wrap: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease;
  }
  .badge-tooltip strong {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 2px;
  }
  .badge-tooltip span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-soft);
    font-weight: 400;
  }
  .badge-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--arrow-x, 50%);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--surface-elevated);
  }
  .badge-tooltip.below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--surface-elevated);
  }
  .badge-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
  }

  /* Your badges inline list */
  .your-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .your-badge-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-pill);
    background: rgba(125, 211, 252, 0.1);
    border: 1px solid rgba(125, 211, 252, 0.3);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
  }
  .your-badge-item .badge-emoji {
    font-size: 1.1rem;
  }

  @keyframes fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @media (max-width: 960px) {
    nav {
      position: sticky;
      /* Two rows on mobile. Top row: logo left (the top-level brand), then 🔔/💬
         bells and the account/logout button on the right (always visible for
         engagement). Bottom row: the scrollable menu, spanning the full width. */
      display: grid;
      grid-template-columns: 1fr auto auto;
      grid-template-areas:
        "logo bells account"
        "menu menu  menu";
      align-items: center;
      column-gap: 12px;
      row-gap: 8px;
    }
    /* The logo lives OUTSIDE .nav-scroller (a direct flex child of <nav>), so it
       sits on the real nav glass and matches it exactly under any scroll. Only
       the menu/right items scroll, clipped to the scroller's box — they can never
       slide under the logo, so no masking fill is needed here. */
    .nav-scroller {
      grid-area: menu;
      display: flex;
      min-width: 0;
      flex-wrap: nowrap;
      align-items: center;
      column-gap: 8px;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      -ms-overflow-style: none;
      padding-block: 8px;
    }
    .nav-scroller::-webkit-scrollbar { display: none; }
    .nav-left {
      flex: 0 0 auto;
      grid-area: logo;
      justify-self: start;
    }
    .nav-brand img { height: 60px; }
    .nav-menu { display: contents; }
    /* Bells and the account/logout button both sit on the top row (right). */
    .nav-bells {
      grid-area: bells;
      justify-self: end;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .nav-account {
      grid-area: account;
      justify-self: end;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .nav-menu a, .nav-account > a, .nav-account .inline-form, .nav-divider {
      flex: 0 0 auto;
      white-space: nowrap;
    }
    /* Scroll hint for the menu: the old full-height cue is dropped (it would
       overlap the bells row), replaced by a little bouncing arrow scoped to the
       bottom (menu) row — same style as the table scroll hints. Authed only, since
       anonymous users have no scrolling menu. The menu now spans the full width,
       so the cue pins to the far-right edge of that row to overlay the scrolling
       menu (no Logout button shares the row anymore). JS in base.html toggles
       .nav-scroll-end on <nav> to hide the cue once the menu is scrolled to its
       far-right end (or doesn't overflow at all). */
    nav::after { content: none; }
    .nav-scroll-cue { display: none; }
    .nav-authed .nav-scroll-cue {
      display: flex;
      align-items: center;
      justify-content: center;
      grid-column: 1 / -1;
      grid-row: 2;
      justify-self: end;
      align-self: center;
      width: 26px;
      pointer-events: none;
      color: var(--accent);
      font-size: 1.6rem;
      font-weight: 800;
      line-height: 1;
      z-index: 4;
      animation: scroll-hint-bounce 1.4s ease-in-out infinite;
    }
    .nav-authed.nav-scroll-end .nav-scroll-cue { display: none; }
  }
  @media (max-width: 760px) {
    nav { padding: 10px 14px; }
    .container {
      margin: 16px auto;
      padding: 0 12px;
    }
    .card {
      padding: 14px;
      margin-bottom: 12px;
    }
    .nav-menu a {
      text-align: center;
    }
    .nav-menu a.brand {
      margin-right: 0;
    }
    .page-header {
      gap: 8px;
    }
    .page-header-meta { gap: 8px; }
    .page-meta-badge { width: 100%; justify-content: center; }
    th, td { padding: 9px 8px; }
    th { font-size: 0.76rem; letter-spacing: 0.04em; }
    /* Keep badges out from under the right-edge scroll fade so they read clearly
       and are easy to tap when scrolled to the end of the table. */
    td.badge-col { padding-right: 40px; }
    .table-scroll table {
      min-width: 440px;
    }
    .table-scroll.table-wide table {
      min-width: 560px;
    }
    .login-card {
      margin: 20px auto;
    }
    .stat-value { font-size: 1.6rem; }
  }
  @media (max-width: 560px) {
    .page-meta-badge { justify-content: flex-start; }
    .table-scroll table {
      min-width: 380px;
    }
    .table-scroll.table-wide table {
      min-width: 500px;
    }
    /* Keep the three Status tabs on a single line on phones: shrink them to fit,
       and let the strip scroll horizontally (no wrap) if a screen is very narrow. */
    .leaderboard-controls .view-switch {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .leaderboard-controls .view-switch::-webkit-scrollbar { display: none; }
    .view-switch { gap: 4px; }
    .view-seg { padding: 7px 10px; font-size: 0.78rem; }
    /* Let the actions row span full width so the League Awards button can sit at
       the right edge (round filter stays left), matched to the tab font size. */
    .leaderboard-actions { width: 100%; }
    .vote-cta { margin-left: auto; font-size: 0.72rem; }
  }

  /* Used coins */
  .used-coins-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .used-coins-round {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .used-coins-label {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 80px;
  }
  .used-coins-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .used-coin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: var(--r-lg);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    box-shadow: 0 1px 2px rgba(2, 8, 20, 0.32);
  }

  .predictions-table tr.prediction-hit td { background: rgba(52, 211, 153, 0.08); }
  .predictions-table tr.prediction-miss td { background: rgba(244, 63, 94, 0.06); }

  /* Prediction nudge banner (temporary stand-in for push notifications) */
  .predict-nudge {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-left: 4px solid var(--warning);
    border-radius: var(--r-md);
    padding: 10px 16px;
    margin-bottom: 16px;
    color: var(--text);
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
  }
  .predict-nudge-icon { font-size: 1.15rem; line-height: 1; }
  .predict-nudge-text { flex: 1 1 240px; }
  .predict-nudge-text strong { color: var(--warning); font-weight: 800; }
  .predict-nudge-cta {
    color: var(--warning);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
  }
  .predict-nudge-cta:hover { text-decoration: underline; }
  /* Celebratory variant (you lead a metric / earned a badge) — green instead of
     the amber reminder, with a dismiss button pushed to the far right. */
  .predict-nudge-congrats {
    background: linear-gradient(90deg, rgba(52, 211, 153, 0.18), rgba(52, 211, 153, 0.07));
    border: 1px solid rgba(52, 211, 153, 0.45);
    border-left: 4px solid var(--green);
  }
  /* Informational variant (e.g. the knockout-deadline heads-up) - blue. */
  .predict-nudge-info {
    background: linear-gradient(90deg, rgba(58, 163, 245, 0.16), rgba(58, 163, 245, 0.06));
    border: 1px solid rgba(58, 163, 245, 0.45);
    border-left: 4px solid var(--primary);
  }
  .predict-nudge-dismiss {
    margin-left: auto;
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
  }
  .predict-nudge-dismiss:hover { color: var(--text); }
  /* "leaderboard" word inside the congrats banner, linked to the table below. */
  .predict-nudge-link {
    color: var(--green);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
  }
  .predict-nudge-link:hover { text-decoration: none; }

  /* Countdown ticker */
  .countdown-card { text-align: center; }
  .countdown-label {
    font-family: "Plus Jakarta Sans", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: var(--text-soft);
    margin-bottom: 10px;
  }
  .countdown-clock {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
  }
  .countdown-segment {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-md);
    padding: 10px 14px;
    min-width: 68px;
    justify-content: center;
  }
  .countdown-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
  }
  .countdown-unit {
    font-size: 0.85rem;
    color: var(--text-soft);
    font-weight: 700;
  }
  .countdown-meta {
    margin-top: 12px;
    color: var(--text-soft);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .countdown-meta .team-flag { vertical-align: middle; }
  .countdown-meta-sep { opacity: 0.6; }
  .countdown-card.countdown-soon .countdown-value { color: var(--warning); }
  .countdown-card.countdown-expired .countdown-value { color: var(--text-soft); }
  @media (max-width: 560px) {
    .countdown-clock { gap: 8px; }
    .countdown-segment { min-width: 56px; padding: 6px 8px; }
    .countdown-value { font-size: 1.5rem; }
  }

  /* Mobile layout for predictions page */
  @media (max-width: 600px) {
    .predictions-stats {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
    }
    .predictions-stats-sep {
      display: none;
    }
    .predictions-table {
      min-width: 0 !important;
    }
    .predictions-table thead {
      display: none;
    }
    .predictions-table tbody tr {
      display: block;
      border: 1px solid var(--border);
      border-radius: var(--r-sm);
      margin-bottom: 12px;
      padding: 4px 0;
    }
    .predictions-table tbody tr td {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 14px;
      text-align: right;
      border: none;
    }
    .predictions-table tbody tr td::before {
      content: attr(data-label);
      font-weight: 600;
      text-transform: uppercase;
      font-size: 0.78rem;
      letter-spacing: 0.04em;
      color: var(--text-secondary);
      text-align: left;
      margin-right: 12px;
    }
    .predictions-table tbody tr td[colspan] {
      display: block;
      text-align: center;
    }
    .predictions-table tbody tr td[colspan]::before {
      display: none;
    }
  }

  .site-footer {
    margin: 48px auto 24px;
    padding: 16px;
    max-width: 1100px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
  }
  .site-footer a {
    color: var(--text-soft);
    text-decoration: none;
  }
  .site-footer a:hover { color: var(--text); text-decoration: underline; }
  .site-footer .footer-sep { margin: 0 8px; opacity: 0.5; }
  .site-footer .footer-copied {
    margin-left: 8px;
    color: var(--green);
    font-weight: 600;
  }

  .legal-page { text-align: left; max-width: 720px; margin-inline: auto; }
  .legal-page p { color: var(--text-soft); line-height: 1.65; margin: 0 0 16px; }
  .legal-page a { color: var(--accent); }

  /* ---- Head-to-Head Cup bracket ---- */
  .cup-champion-banner {
    margin: 0 0 14px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-weight: 800;
    text-align: center;
    color: var(--gold);
    background: linear-gradient(180deg, rgba(240, 200, 80, 0.14), rgba(240, 200, 80, 0.05));
    border: 1px solid rgba(240, 200, 80, 0.40);
  }
  .cup-legend { margin: 0 0 14px; font-size: 0.84rem; line-height: 1.65; }

  /* Cup status line on the Leagues & Cups list */
  .cup-status--done { color: var(--gold); font-weight: 600; }
  .cup-status--live { color: var(--accent); }

  .cup-bracket-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cup-bracket {
    --cup-gap: 44px;
    --cup-line: rgba(125, 211, 252, 0.55);
    display: flex;
    gap: var(--cup-gap);
    min-width: min-content;
    padding: 2px 0 10px;
  }
  .cup-col {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 190px;
  }
  .cup-col-head {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-bottom: 10px;
    /* Tall enough for a two-line sub ("Points from … predictions"), so a column
       whose sub fits on one line (e.g. the Final) keeps the same head height —
       the connector lines assume every column's ties start at the same y. */
    min-height: 56px;
  }
  .cup-col-stage { font-weight: 800; font-size: 0.92rem; }
  .cup-col-sub {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }
  .cup-col-ties {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
  }
  /* Each tie sits in an equal-height flex slot; a later-round slot is twice as
     tall as its two feeders, so a merged tie centres exactly on the boundary
     between them — which is what lets the connector lines line up. */
  .cup-match {
    position: relative;
    flex: 1 1 0;
    min-height: 72px;
    display: flex;
    align-items: center;
  }
  .cup-tie {
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    background: var(--bg-soft);
    overflow: hidden;
  }

  /* ---- Light-blue bracket connectors ---- */
  /* Horizontal feed into every tie after the first column. */
  .cup-col:not(:first-child) .cup-match::before {
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    width: calc(var(--cup-gap) / 2);
    border-top: 2px solid var(--cup-line);
  }
  /* Elbow out of each tie before the last column: a horizontal stub at the tie's
     centre plus a vertical that meets its sibling's, forming the bracket join. */
  .cup-col:not(:last-child) .cup-match::after {
    content: "";
    position: absolute;
    left: 100%;
    width: calc(var(--cup-gap) / 2);
    border-right: 2px solid var(--cup-line);
  }
  .cup-col:not(:last-child) .cup-match:nth-child(odd)::after {
    top: 50%;
    bottom: 0;
    border-top: 2px solid var(--cup-line);
    border-top-right-radius: 8px;
  }
  .cup-col:not(:last-child) .cup-match:nth-child(even)::after {
    top: 0;
    bottom: 50%;
    border-bottom: 2px solid var(--cup-line);
    border-bottom-right-radius: 8px;
  }

  .cup-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    min-width: 0;
    color: var(--text-soft);
    transition: background 120ms ease;
  }
  .cup-slot + .cup-slot { border-top: 1px solid var(--border-soft); }
  .cup-seed {
    flex: 0 0 auto;
    min-width: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
  }
  .cup-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cup-pts {
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
  }
  /* Winner: bright, accented, with a light-blue advance bar. */
  .cup-slot-winner {
    background: rgba(58, 163, 245, 0.24);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .cup-slot-winner .cup-name { font-weight: 800; color: #fff; }
  .cup-slot-winner .cup-pts,
  .cup-slot-winner .cup-seed { color: var(--accent); }
  /* Loser of a decided tie: clearly knocked back. */
  .cup-slot-loser { opacity: 0.5; }
  .cup-slot-loser .cup-name,
  .cup-slot-loser .cup-pts,
  .cup-slot-loser .cup-seed { color: var(--text-muted); font-weight: 600; }
  .cup-slot-empty .cup-name { color: var(--text-muted); font-style: italic; }
  .cup-tie--pending { opacity: 0.9; }
  /* A bye tie holds a single advancing player (no opponent slot). Centre that
     lone slot — and drop its empty points cell — so it reads as intentional
     rather than a half-empty matchup. */
  .cup-tie--bye .cup-slot { justify-content: center; }
  .cup-tie--bye .cup-name { flex: 0 1 auto; text-align: center; }
  .cup-tie--bye .cup-pts { display: none; }

  @media (max-width: 560px) {
    /* Keep the full desktop bracket on mobile — side-by-side columns with the
       light-blue connector lines — and let it scroll horizontally. The base
       .scroll-hint arrow cue (shown at <=760px) signals "swipe right for the
       rest of the structure" and fades out once you reach the end. Spacing is
       tightened so more of the bracket is visible per screen; connectors stay
       aligned because they derive their stub length from --cup-gap. */
    .cup-bracket { --cup-gap: 30px; }
    .cup-col { width: 160px; }
  }
