/* 180live: main stylesheet
   Dartboard palette: cream sisal + black + red + green + sparing gold.
   No orange/amber per feedback_palette_variety.md.
   Mobile-first. WCAG 2.1 AA. */

@layer reset, base, layout, components, utilities;

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Dartboard palette: cream sisal + black + red + green */
  --c-black:         #1a1a1a;   /* dartboard black segments */
  --c-cream:         #e8d9b5;   /* dartboard cream sisal */
  --c-cream-2:       #d8c9a5;   /* darker cream: alternating sections */
  --c-cream-3:       #f1e6c4;   /* lighter cream: elevated cards */
  --c-cream-4:       #faf3dd;   /* lightest cream: quiet surfaces */
  --c-red:           #b0171f;   /* dartboard double/treble red + inner bull */
  --c-red-deep:      #80101a;
  --c-green:         #0b6b3a;   /* dartboard double/treble green + outer bull */
  --c-green-deep:    #074a26;
  --c-gold:          #a07a14;   /* gold accent: 180 quickshot bg, decorative */
  --c-gold-text:     #e0b656;   /* lighter gold for body text on dark surfaces (passes AA on black) */
  --c-metal:         #c9c9c9;   /* dartboard number-ring silver: light borders */

  /* Semantic */
  --bg:              var(--c-cream);
  --bg-elev:         var(--c-cream-3);
  --bg-card:         var(--c-cream-3);
  --fg:              var(--c-black);
  --fg-muted:        #4a4a4a;
  --fg-dim:          #6a6a6a;
  --accent:          var(--c-red);
  --accent-2:        var(--c-green);
  --border:          var(--c-black);
  --focus:           var(--c-green);

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --fs-12: clamp(0.72rem, 0.7rem + 0.1vw, 0.78rem);
  --fs-14: clamp(0.82rem, 0.78rem + 0.2vw, 0.9rem);
  --fs-16: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --fs-18: clamp(1.05rem, 0.98rem + 0.35vw, 1.2rem);
  --fs-20: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
  --fs-24: clamp(1.3rem, 1.15rem + 0.7vw, 1.7rem);
  --fs-32: clamp(1.6rem, 1.3rem + 1.5vw, 2.4rem);
  --fs-48: clamp(2.2rem, 1.6rem + 3vw, 3.8rem);
  --fs-score: clamp(3rem, 2rem + 8vw, 6rem);

  /* Spacing (8pt scale) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.25rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-10: 2.5rem;
  --s-12: 3rem;
  --s-16: 4rem;

  /* Radii / shadows */
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(26, 26, 26, 0.12);
  --shadow-2: 0 4px 16px rgba(26, 26, 26, 0.15);

  /* Layout */
  --container: min(96rem, 100% - 2rem);
  --container-narrow: min(72rem, 100% - 2rem);

  /* Reserved heights for ad slots: prevents CLS when ads enable */
  --ad-h-banner: 50px;
  --ad-h-rect: 250px;
  --ad-h-leaderboard: 90px;
  --ad-h-sidebar: 600px;
}

/* ============================================================
   RESET
   ============================================================ */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; padding: 0; }
  html { -webkit-text-size-adjust: 100%; line-height: 1.5; }
  body { min-block-size: 100dvh; }
  img, picture, svg, video { display: block; max-inline-size: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  a { color: inherit; text-decoration-skip-ink: auto; }
  ul, ol { list-style: none; }
  h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.15; }
  p, li { text-wrap: pretty; }
  table { border-collapse: collapse; }
}

/* ============================================================
   BASE
   ============================================================ */
@layer base {
  html { font-family: var(--font-sans); font-size: 100%; color-scheme: light; }
  body {
    background: var(--bg);
    color: var(--fg);
    font-size: var(--fs-16);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
  }

  /* NOTE: the body.body--home .hero override lives in the components layer
     below (right after the base .hero rule). It can't live here in base
     because @layer order means components always wins over base regardless
     of specificity, and .hero in components uses the background shorthand
     which would clobber any image set here. */

  a { color: var(--fg); }
  a:hover { color: var(--accent); }

  /* Focus */
  :focus { outline: none; }
  :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
  }

  ::selection { background: var(--accent); color: var(--c-cream); }

  /* Skip link */
  .skip-link {
    position: absolute; inset-inline-start: var(--s-2); inset-block-start: -100px;
    background: var(--accent); color: var(--c-cream);
    padding: var(--s-2) var(--s-3);
    border-radius: var(--radius);
    z-index: 1000;
  }
  .skip-link:focus { inset-block-start: var(--s-2); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ============================================================
   LAYOUT
   ============================================================ */
@layer layout {
  .container { width: var(--container); margin-inline: auto; }
  .container-narrow { width: var(--container-narrow); margin-inline: auto; }

  /* Top bar: black cabinet frame */
  .topbar {
    position: sticky; inset-block-start: 0; z-index: 50;
    background: var(--c-black);
    color: var(--c-cream);
    border-block-end: 1px solid var(--c-black);
  }
  .topbar a { color: var(--c-cream); }
  .topbar a:hover { color: var(--c-cream); opacity: 0.85; }
  /* NOTE: button overrides for .topbar live in the components layer below;
     putting them here doesn't work because @layer order means components
     wins over layout regardless of selector specificity. */
  .topbar__inner {
    display: flex; align-items: center; justify-content: space-between;
    block-size: 56px; padding-inline: var(--s-4);
  }
  .brand {
    display: inline-flex; align-items: center; gap: var(--s-2);
    font-family: var(--font-mono); font-weight: 700; letter-spacing: -0.02em;
    font-size: var(--fs-18);
  }
  .brand__mark {
    display: inline-grid; place-items: center;
    inline-size: 28px; block-size: 28px;
    background: var(--accent); color: var(--c-cream);
    font-family: var(--font-mono); font-weight: 800;
    font-size: 11px; border-radius: 4px;
    letter-spacing: -0.02em;
  }

  /* Tab bar (mobile primary nav) */
  .tabbar {
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 49;
    background: var(--c-black);
    border-block-start: 1px solid var(--c-black);
    padding-block: 6px env(safe-area-inset-bottom, 6px);
  }
  .tabbar__list {
    display: grid; grid-template-columns: repeat(5, 1fr);
    max-inline-size: 32rem; margin-inline: auto;
  }
  .tabbar__link {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: 6px 4px;
    font-size: 11px; color: #a8a395;
    min-block-size: 44px;
    text-decoration: none; transition: color 0.15s;
  }
  .tabbar__link[aria-current="page"] { color: var(--c-red); }
  /* Fixed-size icon slot so the row's text baselines all line up
     regardless of whether the icon is a unicode glyph or an inline SVG. */
  .tabbar__icon {
    block-size: 22px;
    inline-size: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
  }
  svg.tabbar__icon { stroke: currentColor; fill: none; }

  main { padding-block-end: calc(72px + var(--s-6)); }

  /* Sections */
  .section { padding-block: var(--s-8); }
  .section--hero { padding-block: var(--s-10) var(--s-8); }
  .section__head { margin-block-end: var(--s-6); }
  .section__eyebrow {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--c-green); text-transform: uppercase; letter-spacing: 0.12em;
    margin-block-end: var(--s-2); font-weight: 700;
  }
  .section__title { font-size: var(--fs-32); font-weight: 800; letter-spacing: -0.02em; }
  .section__lede { color: var(--fg-muted); margin-block-start: var(--s-2); max-inline-size: 60ch; }

  /* Grid helpers */
  .grid { display: grid; gap: var(--s-4); }
  .grid--2 { grid-template-columns: 1fr; }
  .grid--3 { grid-template-columns: 1fr; }
  @media (min-width: 720px) {
    /* Two-column layout uses CSS multicol rather than grid so items
       flow DOWN the first column then top of the second. Row-major
       grid (the default) made time-sorted lists like "today's results"
       look randomly ordered because scanning each column individually
       skipped every other match. Multicol keeps each visible column
       individually sorted. */
    .grid--2 {
      display: block;
      column-count: 2;
      column-gap: var(--s-4);
    }
    /* Each item: keep its own display intact (e.g. .fixture is a grid),
       just stop it splitting across columns and give it bottom spacing
       (multicol can't use the parent's gap for inter-item spacing). */
    .grid--2 > * {
      break-inside: avoid;
      margin-block-end: var(--s-4);
    }
    .grid--2 > *:last-child { margin-block-end: 0; }
    .grid--3 { grid-template-columns: repeat(3, 1fr); }
  }

  /* Footer */
  footer.site-footer {
    background: var(--c-cream-2); border-block-start: 1px solid var(--c-metal);
    padding: var(--s-8) 0 calc(var(--s-8) + 72px);
    color: var(--fg-muted); font-size: var(--fs-14);
  }
  .site-footer__row { display: flex; flex-wrap: wrap; gap: var(--s-4); justify-content: space-between; }
  .site-footer a { color: var(--fg-muted); text-decoration: underline; text-decoration-color: var(--c-black); }
  .site-footer a:hover { color: var(--accent); text-decoration-color: var(--accent); }
}

/* ============================================================
   COMPONENTS
   ============================================================ */
@layer components {
  /* Buttons */
  .btn {
    display: inline-flex; align-items: center; gap: var(--s-2);
    padding: var(--s-3) var(--s-5);
    background: var(--c-black); color: var(--c-cream);
    border: 1px solid var(--c-black);
    border-radius: var(--radius); font-weight: 700;
    min-block-size: 44px;
    text-decoration: none;
    transition: transform 0.08s, background 0.15s;
  }
  .btn:hover { background: var(--c-cream-2); text-decoration: none; }
  .btn:active { transform: translateY(1px); }
  .btn--accent { background: var(--accent); color: var(--c-cream); border-color: var(--accent); }
  .btn--accent:hover { background: var(--c-red-deep); }
  .btn--ghost { background: transparent; color: var(--fg); border: 1px solid var(--c-metal); }
  .btn--ghost:hover { background: var(--c-cream-2); border-color: var(--c-black); }
  /* Buttons inside .topbar: black bg means default dark text would be
     invisible. Compact size here too so the topbar reads as light chrome,
     not as oversized chunky controls. */
  .topbar .btn, .topbar .btn--ghost {
    color: var(--c-cream);
    background: transparent;
    border-color: rgba(232, 217, 181, 0.4);
    padding: 6px 14px;
    min-block-size: 36px;
    font-size: var(--fs-14);
  }
  .topbar .btn--accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--c-cream);
  }
  .topbar .btn:hover, .topbar .btn--ghost:hover {
    background: rgba(232, 217, 181, 0.15);
    border-color: var(--c-cream);
    color: var(--c-cream);
  }
  .topbar .btn--accent:hover {
    background: var(--c-red-deep);
    border-color: var(--c-red-deep);
  }
  /* Ghost buttons on the home hero (dark image bg) need cream text + cream
     border to actually read, otherwise they're black-on-dark. */
  body.body--home .hero .btn--ghost {
    color: var(--c-cream);
    border-color: rgba(232, 217, 181, 0.55);
    background: rgba(10, 10, 10, 0.25);
  }
  body.body--home .hero .btn--ghost:hover {
    background: rgba(232, 217, 181, 0.18);
    border-color: var(--c-cream);
    color: var(--c-cream);
  }
  .btn--lg { padding: var(--s-4) var(--s-6); font-size: var(--fs-18); }
  .btn--block { width: 100%; justify-content: center; }

  /* Cards */
  .card {
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: var(--radius-lg);
    padding: var(--s-5);
  }
  .card--accent { border-color: var(--accent); border-width: 2px; }
  .card__title { font-size: var(--fs-20); font-weight: 700; margin-block-end: var(--s-2); }
  .card__meta {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.1em;
  }

  /* Hero (home) */
  .hero {
    padding-block: var(--s-10);
    background:
      radial-gradient(ellipse at 50% 0%, rgba(176, 23, 31, 0.10), transparent 60%),
      var(--bg);
    text-align: center;
  }
  .hero__title {
    font-size: var(--fs-48); font-weight: 900; letter-spacing: -0.03em;
    line-height: 1;
  }
  .hero__title em { font-style: normal; color: var(--accent); }
  .hero__lede { color: var(--fg-muted); margin-block-start: var(--s-4); font-size: var(--fs-18); max-inline-size: 50ch; margin-inline: auto; }
  .hero__cta-row { display: inline-flex; gap: var(--s-3); margin-block-start: var(--s-6); flex-wrap: wrap; justify-content: center; }

  /* Home page hero: dartboard photo on the right, headline + CTAs on the
     dark left half. Lives in the components layer so it actually beats
     the base .hero { background: ... } shorthand above. */
  body.body--home .hero {
    background:
      linear-gradient(90deg,
        rgba(10, 10, 10, 0.88) 0%,
        rgba(10, 10, 10, 0.78) 35%,
        rgba(10, 10, 10, 0.25) 65%,
        rgba(10, 10, 10, 0) 90%),
      url('/images/home-bg.jpg') right center / cover no-repeat,
      var(--c-black);
    min-block-size: clamp(380px, 55vh, 560px);
    display: flex;
    align-items: center;
    text-align: start;
    padding-block: var(--s-10);
  }
  body.body--home .hero .container-narrow {
    max-inline-size: min(34rem, 100% - 2rem);
    /* Pull the text in from the edge so the headline doesn't hug the
       viewport. Matches the 1rem implicit gutter in the max-inline-size
       formula above. */
    margin-inline-start: var(--s-4);
    margin-inline-end: auto;
  }
  body.body--home .hero__title { color: var(--c-cream); text-align: start; }
  body.body--home .hero__title em { color: var(--c-red); }
  body.body--home .hero__lede {
    color: rgba(232, 217, 181, 0.92);
    text-align: start;
    margin-inline: 0;
    max-inline-size: 38ch;
  }
  body.body--home .hero__cta-row { justify-content: flex-start; }

  /* Player thumbnail (used on fixture cards). 28px circle, soft border;
     placeholder is a neutral grey disc when no image_id is available. */
  .player-thumb {
    flex-shrink: 0;
    display: inline-block;
    inline-size: 28px; block-size: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
  }
  .player-thumb--placeholder {
    background: linear-gradient(135deg, var(--c-cream-2), var(--c-metal));
  }

  /* Fixture row: left accent stripe colour-codes the match status */
  .fixture {
    display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3); align-items: center;
    padding: var(--s-3); background: var(--bg-card); border: 1px solid var(--c-metal);
    border-inline-start: 4px solid var(--c-metal);
    border-radius: var(--radius); transition: border-color 0.15s;
    text-decoration: none; color: var(--fg);
  }
  .fixture:has(.fixture__time[data-status="live"])      { border-inline-start-color: var(--c-red); }
  .fixture:has(.fixture__time[data-status="scheduled"]) { border-inline-start-color: var(--c-green); }
  .fixture:has(.fixture__time[data-status="finished"])  { border-inline-start-color: var(--c-black); }
  .fixture:hover { border-color: var(--c-green); }
  .fixture__time {
    font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-14);
    color: var(--fg-muted); padding-inline-end: var(--s-3);
    border-inline-end: 1px solid var(--c-metal);
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    min-inline-size: 3.5rem;
  }
  .fixture__time-clock { font-weight: 700; }
  .fixture__time[data-status="live"]  .fixture__time-clock { color: var(--c-red); }
  .fixture__time[data-status="finished"] .fixture__time-clock { color: var(--fg-dim); }
  .fixture__tag {
    font-family: var(--font-mono); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--fg-dim);
  }
  .fixture__tag--live {
    color: var(--c-red);
    display: inline-flex; align-items: center; gap: 4px;
  }
  .fixture__tag--live::before {
    content: ""; display: inline-block; inline-size: 7px; block-size: 7px;
    border-radius: 50%; background: var(--c-red);
    animation: pulse 1.4s infinite;
  }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
  .fixture__players { display: flex; flex-direction: column; gap: 4px; }
  .fixture__player {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: var(--s-2);
    align-items: center;
  }
  .fixture__player-name { font-weight: 600; min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fixture__player-score { font-family: var(--font-mono); font-weight: 700; color: var(--fg-muted); }
  /* When a card carries odds, slot a 4th column into each player row
     between the name and the score for the odds pill. Same flat green
     pill style as .odds-card__cell--best on the odds page. */
  .fixture__players[data-has-odds="true"] .fixture__player {
    grid-template-columns: 28px 1fr auto auto;
  }
  .fixture__odds {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 2px 6px;
    background: var(--c-green); color: var(--c-cream);
    border: 1px solid var(--c-green); border-radius: 4px;
    font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-12);
    min-inline-size: 36px;
    letter-spacing: 0.02em;
  }
  .fixture__chevron { color: var(--fg-dim); font-family: var(--font-mono); }

  /* Fixtures page: section headers for Live / Upcoming / Finished groups */
  .fixtures-group__head {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--c-green); text-transform: uppercase; letter-spacing: 0.12em;
    font-weight: 700;
    display: flex; justify-content: space-between; align-items: baseline;
    margin-block: var(--s-6) var(--s-3);
    padding-block-end: var(--s-2);
    border-block-end: 1px solid var(--c-metal);
  }
  .fixtures-group__head:first-child { margin-block-start: 0; }
  .fixtures-group__count {
    color: var(--fg-dim); font-weight: 700;
  }

  /* Two-column layout: Upcoming left, Finished right (stacks on mobile).
     The Upcoming/Finished group headers keep their default top margin so
     they sit clear of the Live now grid above (instead of touching it). */
  .fixtures-cols {
    display: grid;
    gap: var(--s-6);
    grid-template-columns: 1fr;
    margin-block-start: var(--s-4);
  }
  @media (min-width: 720px) {
    .fixtures-cols { grid-template-columns: 1fr 1fr; align-items: start; }
  }

  /* Match detail page: bigger header + scoreboard than the fixture card */
  .match-header {
    margin-block-end: var(--s-6);
  }
  .match-header__title {
    font-size: var(--fs-32); font-weight: 800; letter-spacing: -0.02em;
    line-height: 1.1; margin-block-start: var(--s-2);
  }
  .match-header__meta {
    display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
    margin-block-start: var(--s-3);
  }
  .match-status {
    display: inline-flex; align-items: center; gap: var(--s-1);
    padding: 4px 12px; border-radius: 999px;
    font-family: var(--font-mono); font-size: var(--fs-12); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--c-cream-4); color: var(--fg);
    border: 1px solid var(--c-metal);
  }
  .match-status--live {
    background: var(--c-red); color: var(--c-cream); border-color: var(--c-red);
  }
  .match-status--live::before {
    content: ""; display: inline-block; inline-size: 7px; block-size: 7px;
    border-radius: 50%; background: var(--c-cream);
    animation: pulse 1.4s infinite;
  }
  .match-status--ft {
    background: var(--c-black); color: var(--c-cream); border-color: var(--c-black);
  }

  /* Match-detail player blocks: photos + big score, side-by-side with
     a "LEGS" divider down the middle. Stacks on narrow screens. */
  .match-players {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--s-3);
    margin-block-start: var(--s-4);
    padding: var(--s-5) var(--s-4);
    background: var(--bg-elev);
    border: 1px solid var(--c-black);
    border-radius: var(--radius-lg);
  }
  .match-player { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); }
  .match-player__thumb {
    inline-size: clamp(56px, 12vw, 96px);
    block-size: clamp(56px, 12vw, 96px);
    border-radius: 50%;
    object-fit: cover;
    background: var(--c-cream-4);
    border: 2px solid var(--c-black);
  }
  .match-player__thumb--placeholder {
    background: linear-gradient(135deg, var(--c-cream-2), var(--c-metal));
  }
  .match-player__name {
    font-weight: 700; font-size: var(--fs-16);
    line-height: 1.2;
  }
  .match-player__score {
    font-family: var(--font-mono);
    font-size: clamp(2.4rem, 1.6rem + 5vw, 4.2rem);
    font-weight: 800; line-height: 1;
  }
  .match-player__divider {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    align-self: center;
  }

  /* Head-to-head list on match detail */
  .h2h-list {
    display: flex; flex-direction: column; gap: 4px;
  }
  .h2h-row {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    gap: var(--s-2);
    align-items: center;
    padding: var(--s-2) var(--s-3);
    background: var(--bg-card);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    font-size: var(--fs-14);
  }
  .h2h-row__date { color: var(--fg-dim); font-size: var(--fs-12); }
  .h2h-row__player { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .h2h-row__player:last-child { text-align: end; }
  .h2h-row__player--win { font-weight: 700; color: var(--c-green-deep); }
  .h2h-row__score {
    font-family: var(--font-mono); font-weight: 700;
    padding-inline: var(--s-2);
    color: var(--fg);
  }

  /* Odds: used by match-detail page and the legacy table view. */
  .odds-row { display: grid; grid-template-columns: 1fr repeat(auto-fit, minmax(60px, 1fr)); gap: var(--s-2); align-items: center; }
  .odds-cell {
    display: inline-flex; align-items: center; justify-content: center;
    padding: var(--s-2);
    background: var(--c-cream-4); border: 1px solid var(--c-metal); border-radius: 4px;
    font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-14);
    text-decoration: none; color: var(--fg);
    min-block-size: 36px;
  }
  .odds-cell--best { background: var(--c-green); color: var(--c-cream); border-color: var(--c-green); }
  .odds-cell:hover { background: var(--c-cream-2); }
  .odds-cell--best:hover { background: var(--c-green-deep); }
  .odds-bookie { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim); text-transform: uppercase; }

  /* Odds page: 3-up grid of compact comparison cards.
     Mobile: 1 column. Tablet (≥600px): 2 columns. Desktop (≥960px): 3. */
  .odds-grid {
    display: grid;
    gap: var(--s-3);
    grid-template-columns: 1fr;
  }
  @media (min-width: 600px) { .odds-grid { grid-template-columns: 1fr 1fr; } }
  @media (min-width: 960px) { .odds-grid { grid-template-columns: repeat(3, 1fr); } }

  .odds-card {
    position: relative;
    display: block;
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: var(--radius-lg);
    padding: var(--s-3) var(--s-4);
    text-decoration: none; color: var(--fg);
    transition: border-color 0.15s;
  }
  .odds-card__live {
    position: absolute;
    inset-block-start: 8px;
    inset-inline-end: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-weight: 700; font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--c-red);
  }
  .odds-card__live::before {
    content: ""; display: inline-block;
    inline-size: 7px; block-size: 7px;
    border-radius: 50%; background: var(--c-red);
    animation: pulse 1.4s infinite;
  }
  .odds-card:hover { border-color: var(--c-green); text-decoration: none; }
  .odds-card--empty { opacity: 0.7; }
  .odds-card__meta {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.08em;
  }
  /* Player matchup row: thumb · name · vs · name · thumb */
  .odds-card__matchup {
    display: grid;
    grid-template-columns: 24px 1fr auto 1fr 24px;
    gap: var(--s-1);
    align-items: center;
    margin-block-start: var(--s-1);
  }
  .odds-card__thumb {
    inline-size: 24px; block-size: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
  }
  .odds-card__thumb--placeholder {
    background: linear-gradient(135deg, var(--c-cream-2), var(--c-metal));
    display: inline-block;
  }
  .odds-card__name {
    font-size: var(--fs-14); font-weight: 700;
    line-height: 1.15;
    min-inline-size: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .odds-card__name:nth-child(4) { text-align: end; }
  .odds-card__head {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
    margin-block-start: var(--s-2);
    font-family: var(--font-mono); font-size: 10px;
    color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.06em;
  }
  .odds-card__head > span:not(:first-child) { text-align: center; }
  .odds-card__rows {
    display: flex; flex-direction: column; gap: 2px;
    margin-block-start: 4px;
  }
  .odds-card__row {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
    align-items: center;
  }
  .odds-card__bookie {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--fg-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .odds-card__cell {
    text-align: center;
    padding: 4px 6px;
    background: var(--c-cream-4); border: 1px solid var(--c-metal); border-radius: 4px;
    font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-12);
    min-block-size: 28px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .odds-card__cell--best {
    background: var(--c-green); color: var(--c-cream); border-color: var(--c-green);
  }

  /* Responsible gambling banner */
  .rg-notice {
    background: var(--c-cream-2); border: 1px solid var(--c-metal);
    color: var(--fg-muted); font-size: var(--fs-12);
    padding: var(--s-2) var(--s-3); border-radius: var(--radius);
    display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap;
  }
  .rg-notice strong { color: var(--accent); font-family: var(--font-mono); }

  /* Ad slot placeholders: empty until AdSense is wired */
  .ad-slot {
    display: flex; align-items: center; justify-content: center;
    background: repeating-linear-gradient(45deg, var(--c-cream-2) 0 6px, var(--c-cream-3) 6px 12px);
    color: var(--fg-dim); font-family: var(--font-mono); font-size: var(--fs-12);
    border: 1px dashed var(--c-metal); border-radius: var(--radius);
    text-transform: uppercase; letter-spacing: 0.1em;
  }
  .ad-slot[data-ad-slot="mobile-banner"] { min-block-size: var(--ad-h-banner); }
  .ad-slot[data-ad-slot="rect"]          { min-block-size: var(--ad-h-rect); }
  .ad-slot[data-ad-slot="leaderboard"]   { min-block-size: var(--ad-h-leaderboard); display: none; }
  .ad-slot[data-ad-slot="sidebar"]       { min-block-size: var(--ad-h-sidebar); display: none; }
  @media (min-width: 768px) { .ad-slot[data-ad-slot="leaderboard"] { display: flex; } }
  @media (min-width: 1024px) { .ad-slot[data-ad-slot="sidebar"] { display: flex; } }

  /* Body when scoring: hide ads to keep the oche-mode UI clean (tabbar
     stays visible so users can jump to fixtures/odds mid-game). */
  body[data-scoring="true"] .ad-slot { display: none !important; }
  /* And tighten everything so the whole scoring UI fits without scrolling */
  body[data-scoring="true"] .section { padding-block: var(--s-2); }
  body[data-scoring="true"] .container-narrow { width: min(72rem, 100% - 0.5rem); }

  /* Value chips: small "Free / No signup / Works offline" badges
     under the scorer launcher hero, just above the game pickers. */
  .value-chips {
    display: flex; flex-wrap: wrap; gap: var(--s-2);
    margin-block-start: var(--s-3);
    padding: 0; list-style: none;
  }
  .value-chip {
    display: inline-flex; align-items: center; gap: 0.35em;
    padding: 0.3em 0.7em;
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: var(--fs-12);
    font-weight: 700;
    color: var(--fg);
    letter-spacing: 0.02em;
  }
  .value-chip span { color: var(--c-green); font-weight: 800; }

  /* SEO content block at the bottom of the scorer launcher. Quiet,
     readable, kept well below the game pickers + resume card so users
     never see it before the primary CTAs on phones. */
  .seo-block {
    margin-block-start: var(--s-12);
    padding-block: var(--s-6);
    border-block-start: 1px solid var(--c-metal);
    color: var(--fg-muted);
    font-size: var(--fs-14);
    line-height: 1.6;
  }
  .seo-block p { margin-block: var(--s-2) var(--s-3); }
  .seo-block__h {
    font-size: var(--fs-20);
    font-weight: 800;
    color: var(--fg);
    margin-block-end: var(--s-2);
  }
  .seo-faq { display: flex; flex-direction: column; gap: var(--s-3); }
  .seo-faq article {
    padding: var(--s-3);
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
  }
  .seo-faq h3 {
    font-size: var(--fs-16);
    font-weight: 700;
    color: var(--fg);
    margin-block-end: var(--s-1);
  }
  .seo-faq p { margin-block: 0; }

  /* Rules accordion (scorer launcher) */
  .rules {
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: var(--radius); padding: var(--s-3) var(--s-4);
  }
  .rules__summary {
    cursor: pointer; font-weight: 700; font-size: var(--fs-16);
    color: var(--fg); list-style: none;
  }
  .rules__summary::-webkit-details-marker { display: none; }
  .rules__summary::before {
    content: '+ '; font-family: var(--font-mono); color: var(--accent); font-weight: 800;
  }
  .rules[open] > .rules__summary::before { content: '\2212  '; }
  .rules__body { display: flex; flex-direction: column; gap: var(--s-2); }
  .rules__game {
    background: var(--c-cream-4); border: 1px solid var(--c-metal);
    border-radius: var(--radius); padding: var(--s-2) var(--s-3);
  }
  .rules__game > summary {
    cursor: pointer; font-size: var(--fs-14); color: var(--fg);
    padding-block: var(--s-1);
  }
  .rules__copy { padding-block-start: var(--s-2); color: var(--fg-muted); font-size: var(--fs-14); }
  .rules__copy p { margin-block: var(--s-1) var(--s-2); }
  .rules__copy ul { padding-inline-start: var(--s-5); list-style: disc; }
  .rules__copy li { margin-block: var(--s-1); }
  .rules__copy strong { color: var(--fg); }

  /* ============================================================
     SCORER UI
     ============================================================ */

  /* Launcher */
  .launcher__grid {
    display: grid; gap: var(--s-3);
    grid-template-columns: 1fr;
  }
  @media (min-width: 480px) { .launcher__grid { grid-template-columns: 1fr 1fr; } }
  .launcher__mode {
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: var(--radius-lg); padding: var(--s-5);
    cursor: pointer; transition: border-color 0.15s, transform 0.08s;
    text-align: start; color: var(--fg);
    position: relative; overflow: hidden;
  }
  .launcher__mode::before {
    /* dartboard-ring accent stripe at the top of every mode card */
    content: ""; position: absolute; inset-block-start: 0; inset-inline: 0;
    block-size: 4px; background: var(--c-black);
  }
  .launcher__mode:hover { border-color: var(--c-green); }
  /* Primary 501: red double-ring */
  .launcher__mode--primary {
    border-color: var(--c-black); border-width: 2px;
    background: linear-gradient(180deg, rgba(176, 23, 31, 0.08), var(--bg-card));
  }
  .launcher__mode--primary::before { background: var(--c-red); block-size: 6px; }
  .launcher__mode--primary .launcher__mode-title { color: var(--c-red); }
  /* Primary 301: green double-ring (split the marquee modes across red+green) */
  .launcher__mode--primary-green {
    border-color: var(--c-black); border-width: 2px;
    background: linear-gradient(180deg, rgba(11, 107, 58, 0.10), var(--bg-card));
  }
  .launcher__mode--primary-green::before { background: var(--c-green); block-size: 6px; }
  .launcher__mode--primary-green .launcher__mode-title { color: var(--c-green); }
  .launcher__mode--primary-green:hover { border-color: var(--c-green); }
  .launcher__mode-title { font-size: var(--fs-20); font-weight: 800; }
  .launcher__mode-desc { color: var(--fg-muted); margin-block-start: var(--s-1); font-size: var(--fs-14); }

  /* Active scoreboard: black header strip on cream body */
  .scoreboard {
    background: var(--bg-elev); border: 1px solid var(--c-black);
    border-radius: var(--radius-lg); padding: 0;
    overflow: hidden;
  }
  .scoreboard__head {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--c-black); color: var(--c-cream);
    padding: var(--s-2) var(--s-3);
    font-family: var(--font-mono); font-size: var(--fs-12);
    text-transform: uppercase; letter-spacing: 0.1em;
  }
  .scoreboard > #sb-players { padding: var(--s-2); }
  .player-row {
    display: grid; grid-template-columns: 1fr auto; gap: var(--s-2); align-items: center;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--radius);
    border: 1px solid transparent;
    margin-block: 2px;
  }
  .player-row[data-active="true"] {
    background: var(--c-black); color: var(--c-cream);
    border-color: var(--c-green); border-width: 2px;
  }
  .player-row[data-active="true"] .player-row__score { color: var(--c-cream); }
  .player-row[data-active="true"] .player-row__name { color: var(--c-cream); }
  .player-row[data-active="true"] .player-row__legs { color: #b8b3a3; }
  .player-row[data-active="true"] .player-row__visit { color: #d4cfb8; }
  .player-row[data-active="true"] .player-row__checkout { color: var(--c-gold-text); }
  .player-row__name { font-weight: 700; font-size: var(--fs-16); }
  .player-row__score {
    font-family: var(--font-mono);
    font-size: clamp(2.2rem, 1.4rem + 4vw, 4rem);
    font-weight: 800; color: var(--fg); line-height: 1;
  }
  body[data-scoring="true"] .player-row__name { font-size: var(--fs-14); }
  body[data-scoring="true"] .player-row__score { font-size: clamp(2rem, 1.2rem + 3.5vw, 3.2rem); }
  .player-row__legs {
    font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim);
  }
  .player-row__visit {
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--fg-muted); margin-block-start: 2px;
  }
  /* Only ever rendered on the active player (black row), so the gold-on-dark
     variant is what the user sees. */
  .player-row__checkout {
    font-family: var(--font-mono); font-size: var(--fs-14); color: var(--c-gold-text);
    margin-block-start: 2px;
  }

  /* Keypad */
  .keypad {
    display: grid; gap: var(--s-2);
    grid-template-columns: repeat(3, 1fr);
    margin-block-start: var(--s-3);
  }
  /* Segment grid for dart-by-dart: 5 cols, 5 rows. Last row carries
     Bull, B'eye, Miss, Undo, End. */
  .keypad--segments { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .keypad__btn {
    min-block-size: 56px;
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    font-family: var(--font-mono); font-size: var(--fs-20); font-weight: 700;
    color: var(--fg);
    transition: background 0.1s, transform 0.05s;
    -webkit-tap-highlight-color: transparent;
  }
  .keypad--segments .keypad__btn { min-block-size: 44px; font-size: var(--fs-16); padding: 0; }
  .keypad__btn:hover { background: var(--c-cream-2); }
  .keypad__btn:active { transform: scale(0.96); background: var(--c-cream-2); }
  .keypad__btn--accent { background: var(--accent); color: var(--c-cream); border-color: var(--accent); }
  .keypad__btn--accent:hover { background: var(--c-red-deep); }
  .keypad__btn--ghost { background: transparent; color: var(--fg-muted); border-style: dashed; }
  /* Bull (single bull = outer = green segment) */
  .keypad__btn--bull { background: var(--c-green); color: var(--c-cream); border-color: var(--c-green-deep); }
  .keypad__btn--bull:hover { background: var(--c-green-deep); }
  /* Bullseye (50 = inner = red segment) */
  .keypad__btn--bullseye { background: var(--c-red); color: var(--c-cream); border-color: var(--c-red-deep); }
  .keypad__btn--bullseye:hover { background: var(--c-red-deep); }
  .keypad__btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* Multiplier strip sits above the segment grid.
     Selectors are CHAINED (.scorer-toolbar.scorer-toolbar--multiplier) so
     modifier specificity beats the base .scorer-toolbar rule regardless of
     source order. */
  .scorer-toolbar.scorer-toolbar--multiplier {
    margin-block-start: var(--s-3);
    margin-block-end: var(--s-2);
    gap: 6px;
  }
  .scorer-toolbar--multiplier .toggle-chip--mul {
    flex: 1; min-block-size: 40px;
    text-align: center; justify-content: center;
    font-size: var(--fs-14);
  }

  /* Scorer options strip: three equal chips evenly filling the line */
  .scorer-toolbar.scorer-toolbar--options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-block-start: var(--s-2);
  }
  .scorer-toolbar--options .toggle-chip {
    font-size: var(--fs-12);
    padding: 6px 8px;
    min-block-size: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-align: center;
  }
  /* Actions row: undo + end-game side by side. Two equal columns matching the
     options row above. Parent controls size; the danger modifier only swaps
     colours so both chips look identical except for the red treatment. */
  .scorer-toolbar.scorer-toolbar--actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-block-start: 6px;
  }
  .scorer-toolbar--actions .toggle-chip {
    font-size: var(--fs-12);
    padding: 6px 18px;
    min-block-size: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-align: center;
  }
  .toggle-chip--danger {
    background: transparent;
    border-color: var(--c-red);
    color: var(--c-red);
  }
  .toggle-chip--danger:hover {
    background: var(--c-red);
    color: var(--c-cream);
    border-color: var(--c-red);
  }

  /* Quick-shot row */
  .quickshots {
    display: grid; gap: var(--s-2);
    grid-template-columns: repeat(4, 1fr);
    margin-block-start: var(--s-3);
  }
  .quickshot {
    min-block-size: 48px;
    background: var(--c-cream-4); border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-16);
    color: var(--fg);
  }
  .quickshot:hover { background: var(--c-cream-2); }
  /* Heat scale for the big-score shortcuts: cooler to hotter */
  .quickshot--100 { background: var(--c-green); color: var(--c-cream); border-color: var(--c-green); }
  .quickshot--140 { background: var(--c-red); color: var(--c-cream); border-color: var(--c-red); }
  .quickshot--180 { background: var(--c-gold); color: var(--c-cream); border-color: var(--c-gold); }
  .quickshot--100:hover { background: var(--c-green-deep); }
  .quickshot--140:hover { background: var(--c-red-deep); }

  /* Total entry (display of typed number) */
  .total-display {
    min-block-size: 56px;
    background: var(--c-cream-4); border: 1px solid var(--c-black);
    border-radius: var(--radius);
    font-family: var(--font-mono); font-size: var(--fs-32); font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    color: var(--fg);
    margin-block-end: var(--s-3);
  }
  .total-display[data-invalid="true"] { color: var(--c-red); border-color: var(--c-red); }

  /* Scorer toolbar */
  .scorer-toolbar {
    display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap;
    margin-block-start: var(--s-3);
  }
  .scorer-toolbar__group { display: inline-flex; gap: var(--s-1); }
  .toggle-chip {
    padding: var(--s-1) var(--s-3);
    background: var(--bg-card); border: 1px solid var(--c-metal);
    border-radius: 999px;
    font-family: var(--font-mono); font-size: var(--fs-12);
    color: var(--fg);
    cursor: pointer;
  }
  .toggle-chip[aria-pressed="true"] {
    background: var(--accent); color: var(--c-cream); border-color: var(--accent);
  }

  /* Toasts (for bust / 180 / leg-won announcements) */
  .toast-host {
    position: fixed; inset-block-start: 72px; inset-inline: 0;
    display: flex; justify-content: center; pointer-events: none;
    z-index: 60;
  }
  .toast {
    background: var(--c-black); border: 1px solid var(--c-black);
    color: var(--c-cream); padding: var(--s-3) var(--s-4);
    border-radius: var(--radius);
    font-weight: 700;
    box-shadow: var(--shadow-2);
    pointer-events: auto;
  }
  .toast--accent { background: var(--accent); color: var(--c-cream); border-color: var(--accent); }
  .toast--gold { background: var(--c-gold); color: var(--c-cream); border-color: var(--c-gold); }

  /* Install prompt chip */
  .install-chip {
    position: fixed; inset-block-end: 80px; inset-inline-end: var(--s-3);
    background: var(--c-black); color: var(--c-cream);
    padding: var(--s-2) var(--s-4);
    border-radius: 999px; font-weight: 700; font-size: var(--fs-14);
    box-shadow: var(--shadow-2);
    z-index: 48;
  }

  /* Stats panel */
  .stats-grid {
    display: grid; gap: var(--s-2);
    grid-template-columns: repeat(2, 1fr);
    margin-block-start: var(--s-4);
  }
  @media (min-width: 480px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
  .stat {
    background: var(--c-cream-4); border: 1px solid var(--c-metal);
    padding: var(--s-3); border-radius: var(--radius);
    text-align: center;
  }
  .stat__label { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.08em; }
  .stat__value { font-family: var(--font-mono); font-size: var(--fs-24); font-weight: 800; color: var(--fg); margin-block-start: var(--s-1); }

  /* Forms */
  .field { display: flex; flex-direction: column; gap: var(--s-1); }
  .field__label { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.08em; }
  .input, .select {
    padding: var(--s-3); background: var(--c-cream-4);
    border: 1px solid var(--c-black); border-radius: var(--radius);
    color: var(--fg); font-size: var(--fs-16);
    min-block-size: 44px;
  }
  .input:focus, .select:focus { border-color: var(--accent); outline: none; }
  .switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; }
}

/* ============================================================
   PLAY PAGE (/play)
   ============================================================
   Lives in @layer components so any base/layout rules it overrides
   resolve correctly (see CLAUDE.md @layer ordering gotcha).
*/
@layer components {

  /* Mode tiles inherit .launcher__mode styling from the scorer. */
  .play-launcher__mode { /* hook for future customisation */ }

  /* Config form */
  .play-config__group, .play-settings__group {
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    padding: var(--s-4);
    margin-block-end: var(--s-4);
    background: var(--c-cream-4);
  }
  .play-config__group legend, .play-settings__group legend {
    font-family: var(--font-mono);
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
    padding-inline: var(--s-2);
  }
  .play-config__row, .play-settings__row {
    display: flex; flex-wrap: wrap; gap: var(--s-4);
    align-items: center;
    margin-block-start: var(--s-2);
  }
  .play-config__row label, .play-settings__row label {
    display: inline-flex; align-items: center; gap: var(--s-2);
    min-block-size: 44px;
    font-size: var(--fs-16);
  }
  .play-config__row input[type="text"] {
    padding: var(--s-2) var(--s-3);
    background: var(--c-cream-3);
    border: 1px solid var(--c-black);
    border-radius: var(--radius);
    min-block-size: 44px;
    min-inline-size: 9rem;
  }
  .play-settings__select select, .play-settings__select input[type="range"] {
    background: var(--c-cream-3);
    border: 1px solid var(--c-black);
    border-radius: var(--radius);
    padding: var(--s-1) var(--s-2);
    min-block-size: 36px;
  }
  .play-settings__select select { max-inline-size: 18rem; }

  /* Active view header */
  .play-active__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--s-3); margin-block-end: var(--s-3);
  }
  .play-active__settings {
    font-size: var(--fs-20);
    padding: var(--s-2) var(--s-3);
  }
  .play-active__head-actions {
    display: flex;
    gap: var(--s-2);
    align-items: flex-start;
  }
  .play-active__read {
    padding: var(--s-2) var(--s-3);
    font-size: var(--fs-14);
    font-family: var(--font-mono);
  }

  /* Scoreboard */
  .play-scoreboard {
    flex: 1;
    display: grid; gap: var(--s-2);
  }
  .play-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--c-cream-3);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
  }
  .play-row[data-active="true"] {
    background: var(--c-black);
    color: var(--c-cream);
    border-color: var(--c-black);
  }
  .play-row__name { font-weight: 700; font-size: var(--fs-18); }
  .play-row__legs { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim); }
  .play-row[data-active="true"] .play-row__legs { color: var(--c-cream-2); }
  .play-row__score { font-size: var(--fs-32); font-weight: 800; }

  /* Practice cells */
  .play-practice {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-2);
  }
  @media (min-width: 480px) {
    .play-practice { grid-template-columns: repeat(4, 1fr); }
  }
  .play-practice__cell {
    background: var(--c-cream-3);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    padding: var(--s-3);
    text-align: center;
    display: flex; flex-direction: column; gap: var(--s-1);
  }
  .play-practice__label { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.08em; }
  .play-practice__value { font-size: var(--fs-24); font-weight: 800; }

  /* Stage label (live instruction during a throw) */
  .play-stage {
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--fs-14);
    color: var(--fg-muted);
    padding: var(--s-2);
    min-block-size: 1.5rem;
  }

  /* Board + flanking chalkboards row. Chalkboards either side of the board
     show each player's name, remaining score and legs so the player never
     has to scroll to see scores during a game. */
  .play-board-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: stretch;
    gap: var(--s-2);
    margin-block: var(--s-3);
  }
  .play-chalk {
    background: #14110d;
    border: 1px solid #2c241a;
    border-radius: var(--radius);
    box-shadow: inset 0 0 12px rgba(0,0,0,0.5);
    color: var(--c-cream-4);
    inline-size: clamp(64px, 18vw, 110px);
    display: flex;
    align-items: stretch;
    padding: var(--s-2);
  }
  .play-chalk[aria-hidden="true"] { display: none; }
  .play-chalk__inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-1);
    text-align: center;
    border: 1px dashed rgba(232, 217, 181, 0.25);
    border-radius: 4px;
    padding: var(--s-2) var(--s-1);
  }
  .play-chalk__inner[data-active="true"] {
    border-color: var(--c-gold-text);
    box-shadow: 0 0 0 1px var(--c-gold-text) inset;
  }
  .play-chalk__name {
    font-size: var(--fs-12);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-cream-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .play-chalk__inner[data-active="true"] .play-chalk__name { color: var(--c-gold-text); }
  .play-chalk__score {
    font-size: clamp(1.5rem, 6vw, 2.25rem);
    font-weight: 800;
    line-height: 1;
    color: var(--c-cream);
    margin-block-start: var(--s-1);
  }
  .play-chalk__inner[data-active="true"] .play-chalk__score { color: var(--c-gold-text); }
  /* Checkout suggestion (active human only, score <=170). Each dart on its
     own line so it fits inside the narrow chalkboard column. */
  .play-chalk__checkout {
    font-size: var(--fs-12);
    line-height: 1.15;
    color: var(--c-gold-text);
    letter-spacing: 0.04em;
    padding: var(--s-1) 0;
    border-block-start: 1px dashed rgba(232, 217, 181, 0.2);
    border-block-end: 1px dashed rgba(232, 217, 181, 0.2);
    inline-size: 100%;
  }
  .play-chalk__legs {
    font-size: var(--fs-12);
    color: var(--c-cream-2);
    opacity: 0.85;
  }
  .play-chalk__legs-label { display: none; }
  @media (min-width: 480px) {
    .play-chalk__legs-label { display: inline; }
  }

  /* Visual board */
  .play-board {
    margin-block: 0;
    display: flex;
    justify-content: center;
    min-inline-size: 0;
    position: relative; /* positioning context for the play-online win banner */
  }
  /* "Leg to X" / "X wins" banner overlaid on the /play-online dartboard. */
  .board-banner {
    position: absolute;
    inset-block-start: 50%;
    inset-inline: var(--s-4);
    transform: translateY(-50%) scale(0.92);
    z-index: 2;
    text-align: center;
    padding: var(--s-3) var(--s-4);
    background: var(--c-black);
    color: var(--c-cream);
    border: 2px solid var(--c-gold-text);
    border-radius: var(--radius-md, 8px);
    font-weight: 800;
    font-size: var(--fs-24, 1.5rem);
    line-height: 1.15;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .board-banner.is-shown { opacity: 1; transform: translateY(-50%) scale(1); }
  @media (prefers-reduced-motion: reduce) {
    .board-banner { transition: none; }
  }
  .play-board__svg {
    inline-size: 100%;
    max-inline-size: 380px;
    block-size: auto;
    overflow: visible;
  }
  .play-board__wedge {
    transition: fill 0.1s linear;
  }
  .play-board__wedge--a { fill: var(--c-cream-3); }
  .play-board__wedge--b { fill: var(--c-cream-2); }
  .play-board__wedge.is-active { fill: var(--c-gold-text); }
  /* Per-wedge double + triple ring fills. Parity 'a' (black-single wedges) =
     RED, parity 'b' (cream-single wedges) = GREEN, matching a real board. */
  .play-board__zone { stroke: none; pointer-events: none; }
  .play-board__zone--a { fill: var(--c-red); }
  .play-board__zone--b { fill: var(--c-green); }
  .play-board__ring {
    fill: none;
    stroke: var(--c-black);
    stroke-width: 0.8;
    transition: fill 0.1s linear, stroke 0.1s linear;
  }
  .play-board__ring[data-ring="BULL_INNER"] { fill: var(--c-red); stroke: var(--c-black); }
  .play-board__ring[data-ring="BULL_OUTER"] { fill: var(--c-green); stroke: var(--c-black); }
  /* Active ring highlight uses gold so it stays visible whether the underlying
     zone is red, green or cream. */
  .play-board__ring.is-active {
    fill: var(--c-gold-text);
    fill-opacity: 0.85;
    stroke: var(--c-gold);
    stroke-width: 1.5;
  }
  .play-board__ring[data-ring="BULL_INNER"].is-active { fill: var(--c-gold-text); fill-opacity: 1; }
  .play-board__ring[data-ring="BULL_OUTER"].is-active { fill: var(--c-gold-text); fill-opacity: 1; }
  /* Outer numbered ring is filled solid black like a real dartboard surround,
     with metallic numbers on top. */
  .play-board__ring[data-ring="MISS"] { fill: var(--c-black); stroke: none; }
  .play-board__ring[data-ring="MISS"].is-active { fill: var(--c-gold-text); fill-opacity: 0.65; stroke: var(--c-gold); stroke-width: 1; }
  .play-board__num {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    fill: var(--c-metal);
    pointer-events: none;
  }
  .play-board__dart {
    fill: var(--c-black);
    stroke: var(--c-cream-4);
    stroke-width: 1.5;
  }
  .play-board__dart--miss { fill: var(--fg-dim); }

  /* Visit history strip */
  .play-history {
    display: flex;
    gap: var(--s-2);
    justify-content: center;
    flex-wrap: wrap;
    margin-block: var(--s-3);
    min-block-size: 2rem;
  }
  .play-history__dart {
    font-family: var(--font-mono);
    font-weight: 700;
    background: var(--c-cream-3);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    padding: var(--s-1) var(--s-3);
    min-inline-size: 3rem;
    text-align: center;
  }
  .play-history__total {
    align-self: center;
    font-weight: 800;
    color: var(--accent);
    padding-inline: var(--s-2);
  }
  .play-history__placeholder {
    color: var(--fg-dim);
    font-style: italic;
  }

  /* THROW button */
  .play-throw {
    display: flex;
    justify-content: center;
    margin-block: var(--s-5);
  }
  .play-throw-btn {
    background: var(--c-red);
    color: var(--c-cream-4);
    border: 3px solid var(--c-black);
    border-radius: 50%;
    min-inline-size: 140px;
    min-block-size: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-2);
    transition: transform 0.08s ease, background 0.15s;
  }
  .play-throw-btn:hover, .play-throw-btn:focus-visible {
    background: var(--c-red-deep);
    outline: 3px solid var(--c-green);
    outline-offset: 3px;
  }
  .play-throw-btn:active { transform: scale(0.97); }
  .play-throw-btn__label {
    font-size: var(--fs-24);
    font-weight: 800;
    letter-spacing: 0.05em;
  }
  .play-throw-btn__sub {
    font-size: var(--fs-12);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-block-start: var(--s-1);
    opacity: 0.8;
  }

  /* Settings panel (modal). The HTML `hidden` attribute applies display:none,
     but a `display: flex` rule on the same element overrides it. The explicit
     [hidden] guard below makes hiding win. */
  .play-settings-panel[hidden] { display: none !important; }
  .play-settings-panel {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.55);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-4);
    overflow-y: auto;
  }
  .play-settings-panel__inner {
    background: var(--c-cream-3);
    border: 2px solid var(--c-black);
    border-radius: var(--radius-lg);
    padding: var(--s-5);
    inline-size: min(32rem, 100%);
    max-block-size: calc(100dvh - 2 * var(--s-4));
    overflow-y: auto;
    position: relative;
  }
  .play-settings-panel__title {
    margin-block-end: var(--s-4);
    font-size: var(--fs-20);
  }
  .play-settings-panel__close {
    position: absolute;
    top: var(--s-2);
    inset-inline-end: var(--s-2);
    font-size: var(--fs-24);
    line-height: 1;
    padding: var(--s-1) var(--s-2);
    min-block-size: 44px;
    min-inline-size: 44px;
  }

  /* Post-game summary */
  .play-postgame {
    padding: var(--s-5);
  }
  .play-postgame__title {
    font-size: var(--fs-24);
    margin-block-end: var(--s-4);
  }
  .play-postgame__stats {
    display: grid; gap: var(--s-2);
    margin-block-end: var(--s-5);
  }
  .play-postgame__line {
    display: flex; justify-content: space-between; gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
  }
  .play-postgame__label { color: var(--fg-muted); }
  .play-postgame__value { font-weight: 700; }
  .play-postgame__actions {
    display: flex; flex-wrap: wrap; gap: var(--s-2);
  }

  /* Audio-only display preset: hides the visual board entirely. Stage label
     and history strip stay so deaf/HoH players still get a text mirror. */
  body[data-audio-only="true"] .play-board {
    display: none;
  }
  body[data-audio-only="true"] .play-stage {
    font-size: var(--fs-20);
    color: var(--fg);
  }

  /* Reduced motion: no transitions on board highlights, no scale on throw button. */
  @media (prefers-reduced-motion: reduce) {
    .play-board__wedge, .play-board__ring { transition: none; }
    .play-throw-btn:active { transform: none; }
  }

  /* Crosshair throw style overlay (vertical + horizontal aim lines). */
  .play-board__cx-line {
    stroke: var(--c-red);
    stroke-width: 1.5;
    pointer-events: none;
    opacity: 0.95;
  }
  .play-board__cx-line--locked {
    stroke: var(--c-black);
    stroke-dasharray: 4 3;
    opacity: 0.8;
  }
  .play-board__cx-point {
    fill: var(--c-red);
    stroke: var(--c-cream-4);
    stroke-width: 1.5;
    pointer-events: none;
  }

  /* In-game audio cheatsheet (collapsed details under the THROW button). */
  .play-cheatsheet {
    background: var(--c-cream-4);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius);
    padding: var(--s-3) var(--s-4);
  }
  .play-cheatsheet summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--fs-14);
    color: var(--fg-muted);
  }
  .play-cheatsheet[open] summary { margin-block-end: var(--s-2); color: var(--fg); }
  .play-cheatsheet__body p { font-size: var(--fs-14); }

  /* Pitch -> result reference rows in the rules accordion. */
  .play-pitch-list {
    list-style: none;
    padding: 0;
    margin: var(--s-3) 0;
    display: grid;
    gap: var(--s-1);
  }
  .play-pitch-list li {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: var(--s-3);
    padding: var(--s-2) var(--s-3);
    background: var(--c-cream-4);
    border-radius: var(--radius);
    border: 1px solid var(--c-metal);
  }
  .play-pitch-list__pitch {
    font-family: var(--font-mono);
    font-size: var(--fs-14);
    color: var(--fg-muted);
  }
  .play-pitch-list__lands {
    font-weight: 700;
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */
@layer utilities {
  .text-mono { font-family: var(--font-mono); }
  .text-muted { color: var(--fg-muted); }
  .text-dim { color: var(--fg-dim); }
  .text-center { text-align: center; }
  .mt-2 { margin-block-start: var(--s-2); }
  .mt-3 { margin-block-start: var(--s-3); }
  .mt-4 { margin-block-start: var(--s-4); }
  .mt-6 { margin-block-start: var(--s-6); }
  .mt-8 { margin-block-start: var(--s-8); }
  .mb-4 { margin-block-end: var(--s-4); }
  .hidden { display: none !important; }
  .sr-only {
    position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
}


/* ============================================================
   /play-online — multiplayer darts.
   Uses the site's standard chrome (topbar, section, container-narrow,
   card, btn, tabbar) plus the small set of bespoke pieces below that
   the rest of the site doesn't have: scoreboard, action prompt,
   throw area, room PIN display, and a couple of layout helpers.
   ============================================================ */
@layer components {
  /* 4-digit room PIN: tracking-wide JetBrains Mono so each digit is
     unambiguous at a glance and the brand mono face matches headings. */
  .room-code {
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.15em;
    color: var(--c-red);
  }

  /* Lists and rows that are common across the lobby and pre-match views. */
  .form-row { display: flex; flex-direction: column; gap: var(--s-2); margin-block: var(--s-3); }
  .form-row legend { font-weight: 700; margin-block-end: var(--s-2); }
  .radio-row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
  .radio-row label { font-weight: 400; }

  .btn-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
  .btn-row > .btn { flex: 1 1 auto; min-inline-size: 8rem; }

  .player-list { list-style: none; padding: 0; margin: 0; }
  .player-list li {
    padding: var(--s-2) var(--s-3);
    border-block-end: 1px solid var(--c-metal);
  }
  .player-list li:last-child { border-block-end: none; }

  /* Match-view scoreboard: side-by-side cards, big remaining numbers,
     accent border on whoever is up. Mirrors the scorer's visual weight
     (big mono digits) without copying its full chalkboard chrome. */
  .play-online__scoreboard {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3);
  }
  .play-online__scoreboard .scoreboard__row {
    background: var(--bg-card);
    border: 1px solid var(--c-metal);
    border-radius: var(--radius-md, 8px);
    padding: var(--s-3);
    text-align: center;
  }
  .play-online__scoreboard .scoreboard__row--active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 23, 31, 0.15);
  }
  .scoreboard__name { display: block; font-weight: 700; margin-block-end: var(--s-2); }
  .scoreboard__remaining {
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: var(--fs-32, 2rem);
    line-height: 1.1;
    color: var(--c-red);
  }
  .scoreboard__legs { display: block; font-size: var(--fs-14, 0.875rem); color: var(--fg-muted); margin-block-start: var(--s-1); }
  /* Checkout route shown under a player on a finish (<=170). Green to read as
     "on a shot"; mono so the dart codes line up. */
  .scoreboard__checkout {
    display: block;
    margin-block-start: var(--s-1);
    font-family: "JetBrains Mono", monospace;
    font-size: var(--fs-12, 0.75rem);
    font-weight: 700;
    color: var(--c-green);
    letter-spacing: 0.02em;
  }

  /* Action prompt: focusable on turn change so VoiceOver / NVDA / JAWS
     jump straight to it. Accent edge picks up the dartboard red. */
  .action-prompt {
    background: var(--c-cream-4);
    border-inline-start: 3px solid var(--accent);
    padding: var(--s-3) var(--s-4);
    border-radius: var(--radius-sm, 4px);
    min-block-size: 3rem;
    font-weight: 500;
  }
  .action-prompt:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }

  /* Throw area: a quiet inset block. Stage label sits below the button
     and updates live as the throw machine advances. */
  .throw-area {
    background: var(--c-cream-4);
    border-radius: var(--radius-sm, 4px);
    padding: var(--s-3);
    text-align: center;
  }
  .throw-stage { color: var(--fg-muted); font-style: italic; min-block-size: 1.4em; }

  /* The action card hosts the throw button. On mobile we cap the dartboard
     below it so the button + board fit on screen without scrolling past
     a huge dartboard to reach the button. */
  .play-online__action .throw-btn { min-block-size: 56px; font-size: 1.1rem; }
  @media (max-width: 640px) {
    .play-online .play-board__svg,
    .play-board .play-board__svg { max-inline-size: 320px; }
  }
}

