/* ==========================================================================
   Tennis Arcade Games — core stylesheet
   tennisarcade.xyz
   Layer order: tokens → reset → layout → components → utilities
   Breakpoint-specific rules live in responsive.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  /* Court-inspired palette. Deep green carries the brand; the ball-yellow
     accent is deliberately rationed to CTAs and focus rings only. */
  --court-900: #062C1D;
  --court-800: #08402A;
  --court-700: #0B5D3B;
  --court-600: #0E7A4D;
  --court-500: #149A62;
  --court-100: #E3F2EA;
  --court-050: #F1F9F5;

  --ball: #D8E64A;
  --ball-deep: #A8B62C;
  --clay: #C4643F;

  --ink: #14201A;
  --ink-soft: #4C5C54;
  --ink-faint: #75857C;

  --surface: #FFFFFF;
  --surface-alt: #F7FAF8;
  --surface-sunk: #EFF4F1;
  --line: #DDE6E1;
  --line-strong: #C3D1C9;

  --ok: #0E7A4D;
  --warn: #9A6212;
  --danger: #A62B22;

  /* Type scale — 1.2 minor third, fluid between 360px and 1200px */
  --fs-xs:   0.8125rem;
  --fs-sm:   0.9063rem;
  --fs-base: 1rem;
  --fs-md:   clamp(1.0625rem, 0.99rem + 0.32vw, 1.1875rem);
  --fs-lg:   clamp(1.25rem,  1.15rem + 0.45vw, 1.5rem);
  --fs-xl:   clamp(1.5rem,   1.32rem + 0.8vw,  2rem);
  --fs-2xl:  clamp(1.875rem, 1.55rem + 1.4vw,  2.75rem);
  --fs-3xl:  clamp(2.25rem,  1.75rem + 2.2vw,  3.5rem);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --lh-tight: 1.18;
  --lh-snug: 1.35;
  --lh-body: 1.68;

  /* Spacing — 4px base */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;  --s4: 1rem;
  --s5: 1.5rem;   --s6: 2rem;     --s7: 2.5rem;   --s8: 3rem;
  --s9: 4rem;     --s10: 5rem;    --s11: 6.5rem;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(6, 44, 29, 0.06),
               0 1px 3px rgba(6, 44, 29, 0.05);
  --shadow: 0 2px 4px rgba(6, 44, 29, 0.05),
            0 8px 20px -6px rgba(6, 44, 29, 0.12);
  --shadow-lg: 0 4px 8px rgba(6, 44, 29, 0.06),
               0 20px 44px -12px rgba(6, 44, 29, 0.20);

  --wrap: 1180px;
  --wrap-narrow: 760px;
  --header-h: 68px;

  --ease: cubic-bezier(0.32, 0.72, 0.28, 1);
}

/* Dark scheme. Roles are swapped consistently; no colour is defined only here. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --court-100: #10382A;
    --court-050: #0C2B20;
    --ink: #E7F0EA;
    --ink-soft: #A9BCB1;
    --ink-faint: #7D9287;
    --surface: #101A15;
    --surface-alt: #0B1410;
    --surface-sunk: #16231C;
    --line: #22332A;
    --line-strong: #2F4437;
    --court-700: #16A86B;
    --court-600: #17A067;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4), 0 20px 44px -12px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --court-100: #10382A;
  --court-050: #0C2B20;
  --ink: #E7F0EA;
  --ink-soft: #A9BCB1;
  --ink-faint: #7D9287;
  --surface: #101A15;
  --surface-alt: #0B1410;
  --surface-sunk: #16231C;
  --line: #22332A;
  --line-strong: #2F4437;
  --court-700: #16A86B;
  --court-600: #17A067;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.4), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4), 0 20px 44px -12px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s4));
  /* Guard against accidental horizontal overflow from in-flow content — a
     long unbroken string, a wide table. `clip` does not make html a scroll
     container, so sticky positioning keeps working. Note this does NOT
     contain fixed-position elements: those are laid out against the
     viewport, which is why the nav drawer is revealed with clip-path
     rather than being parked off-screen. */
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--surface-alt);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Long unbreakable tokens — email addresses, file paths, storage keys —
     would otherwise set a min-content width wider than a 320px screen. */
  overflow-wrap: break-word;
}

/* Identifiers may break anywhere; they have no natural break opportunities. */
code, kbd, samp { overflow-wrap: anywhere; }
.toc a, .prose-links a, .widget a, .breadcrumbs { overflow-wrap: anywhere; }

/* Wide tables scroll inside their own container so the page never does. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--s5);
  border-radius: var(--radius);
}
.table-scroll > table { margin-bottom: 0; }
.table-scroll th, .table-scroll td { white-space: normal; min-width: 6rem; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--s3);
  line-height: var(--lh-tight);
  font-weight: 700;
  letter-spacing: -0.018em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p, ul, ol, dl, blockquote, figure, table { margin: 0 0 var(--s4); }
p { text-wrap: pretty; }

a {
  color: var(--court-700);
  text-decoration-color: color-mix(in srgb, var(--court-700) 35%, transparent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}
a:hover { color: var(--court-600); text-decoration-color: currentColor; }

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }

ul, ol { padding-left: 1.35em; }
li { margin-bottom: var(--s2); }
li:last-child { margin-bottom: 0; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }
code {
  background: var(--surface-sunk);
  padding: 0.12em 0.4em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
kbd {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 0.1em 0.45em;
  font-size: 0.85em;
  color: var(--ink);
  white-space: nowrap;
}

hr { border: 0; border-top: 1px solid var(--line); margin: var(--s7) 0; }

table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { text-align: left; padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 650; color: var(--ink); background: var(--surface-sunk); }

blockquote {
  border-left: 3px solid var(--court-600);
  padding: var(--s1) 0 var(--s1) var(--s4);
  color: var(--ink-soft);
  font-style: italic;
}

:focus-visible {
  outline: 3px solid var(--ball-deep);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection { background: color-mix(in srgb, var(--ball) 55%, transparent); color: var(--ink); }

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--s4); }
.wrap-narrow { max-width: var(--wrap-narrow); }

.section { padding-block: var(--s9); }
.section--tight { padding-block: var(--s7); }
.section--sunk { background: var(--surface-sunk); }
.section--surface { background: var(--surface); }

.section-head { margin-bottom: var(--s6); max-width: 62ch; }
.section-head p { color: var(--ink-soft); font-size: var(--fs-md); margin-bottom: 0; }
.section-head--split {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4); max-width: none;
}

/* Grid and flex children default to min-width:auto, which means they refuse
   to shrink below their content's minimum. One wide table or long token then
   widens the whole column. Overriding it is what keeps narrow screens honest. */
.grid > *, .article-layout > *, .footer-grid > *, .hero__inner > * { min-width: 0; }

.grid { display: grid; gap: var(--s5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.skip-link {
  position: absolute; left: var(--s4); top: -100px; z-index: 200;
  background: var(--court-700); color: #fff; padding: var(--s3) var(--s5);
  border-radius: 0 0 var(--radius) var(--radius); font-weight: 650;
  text-decoration: none; transition: top 0.18s var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

/* --------------------------------------------------------------------------
   4. Header & navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex; align-items: center; gap: var(--s4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex; align-items: center; gap: var(--s3);
  text-decoration: none; color: var(--ink); font-weight: 750;
  letter-spacing: -0.03em; flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand__mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-size: 1.0625rem; }
.brand__sub {
  font-size: 0.625rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--court-600);
}

.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: var(--s1); list-style: none; margin: 0; padding: 0; }
.nav__list li { margin: 0; }
.nav__link {
  display: block; padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 550; color: var(--ink-soft);
  text-decoration: none; white-space: nowrap;
}
.nav__link:hover { color: var(--ink); background: var(--surface-sunk); }
.nav__link[aria-current="page"] { color: var(--court-700); background: var(--court-050); font-weight: 650; }

.header-actions { display: flex; align-items: center; gap: var(--s2); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink-soft); cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { background: var(--surface-sunk); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 19px; height: 19px; }

.nav-toggle { display: none; }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: var(--s3) var(--s5); min-height: 44px;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 650;
  line-height: 1; letter-spacing: -0.006em;
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; text-align: center;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease),
              border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }

.btn--primary { background: var(--court-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--court-600); color: #fff; box-shadow: var(--shadow); }

.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--surface-sunk); color: var(--ink); border-color: var(--court-600); }

.btn--ghost { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--surface-sunk); color: var(--ink); }

.btn--accent { background: var(--ball); color: var(--court-900); }
.btn--accent:hover { background: var(--ball-deep); color: var(--court-900); }

.btn--lg { padding: var(--s4) var(--s6); font-size: var(--fs-base); min-height: 52px; }
.btn--sm { padding: var(--s2) var(--s3); min-height: 36px; font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 420px at 88% -12%, color-mix(in srgb, var(--court-500) 26%, transparent), transparent 70%),
    linear-gradient(168deg, var(--court-900), var(--court-700) 72%);
  color: #fff;
  padding-block: var(--s10) var(--s9);
}
.hero::after {
  /* Faint court-line motif. Decorative only. */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 20%, transparent 78%);
}
.hero__inner { position: relative; z-index: 1; display: grid; gap: var(--s7); align-items: center; }
.hero h1 { color: #fff; font-size: var(--fs-3xl); margin-bottom: var(--s4); }
.hero__lede {
  font-size: var(--fs-md); color: rgba(255,255,255,0.87);
  max-width: 54ch; margin-bottom: var(--s6);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--s3); }
.hero .btn--secondary {
  background: rgba(255,255,255,0.1); color: #fff;
  border-color: rgba(255,255,255,0.28);
}
.hero .btn--secondary:hover { background: rgba(255,255,255,0.18); color: #fff; border-color: rgba(255,255,255,0.5); }

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ball);
  margin-bottom: var(--s4);
}
.hero__stats {
  display: flex; flex-wrap: wrap; gap: var(--s6);
  margin-top: var(--s7); padding-top: var(--s5);
  border-top: 1px solid rgba(255,255,255,0.16);
}
.hero__stat b { display: block; font-size: var(--fs-lg); color: #fff; line-height: 1.2; }
.hero__stat span { font-size: var(--fs-xs); color: rgba(255,255,255,0.7); }

.hero__visual { display: grid; place-items: center; }
.hero__visual svg { width: 100%; max-width: 420px; filter: drop-shadow(0 18px 40px rgba(0,0,0,0.3)); }

/* Compact page hero for interior pages */
.page-hero {
  background: linear-gradient(170deg, var(--court-800), var(--court-700));
  color: #fff; padding-block: var(--s8) var(--s7);
}
.page-hero h1 { color: #fff; margin-bottom: var(--s3); }
.page-hero__lede { color: rgba(255,255,255,0.85); font-size: var(--fs-md); max-width: 62ch; margin: 0; }
.page-hero .breadcrumbs, .page-hero .breadcrumbs a { color: rgba(255,255,255,0.72); }
.page-hero .breadcrumbs a:hover { color: #fff; }
.page-hero .breadcrumbs [aria-current] { color: #fff; }

/* --------------------------------------------------------------------------
   7. Cards
   -------------------------------------------------------------------------- */
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card__media { position: relative; aspect-ratio: 16 / 9; background: var(--court-050); overflow: hidden; }
.card__media img, .card__media svg { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: var(--s5); display: flex; flex-direction: column; flex: 1; gap: var(--s3); }
.card__title { font-size: var(--fs-md); margin: 0; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--court-700); }
.card__title a::after { content: ""; position: absolute; inset: 0; } /* whole-card hit area */
.card { position: relative; }
.card__desc { color: var(--ink-soft); font-size: var(--fs-sm); margin: 0; flex: 1; }
.card__foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); margin-top: auto; padding-top: var(--s2);
  font-size: var(--fs-xs); color: var(--ink-faint);
}
/* Real controls must sit above the card's full-area overlay link. Badges are
   not interactive, so they stay under it and keep the whole card clickable. */
.card__foot .btn, .card__foot a { position: relative; z-index: 1; }

.badge {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.22em 0.6em; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.5;
  background: var(--court-050); color: var(--court-700);
  border: 1px solid color-mix(in srgb, var(--court-600) 22%, transparent);
  white-space: nowrap;
}
.badge--diff-easy   { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.badge--diff-medium { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge--diff-hard   { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.badge--soon {
  background: var(--surface-sunk); color: var(--ink-faint);
  border-color: var(--line-strong);
}
.badge--live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.card__tags { display: flex; flex-wrap: wrap; gap: var(--s1); }
.tag {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 0.15em 0.5em; border-radius: var(--radius-sm);
  background: var(--surface-sunk); color: var(--ink-faint);
  text-transform: capitalize;
}

/* Article card variant */
.card--article .card__meta {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  font-size: var(--fs-xs); color: var(--ink-faint);
}
.card--wide { flex-direction: row; }
.card--wide .card__media { aspect-ratio: 1 / 1; width: 132px; flex-shrink: 0; }

/* Category tile */
.cat-tile {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  padding: var(--s5); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.cat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--court-600); color: var(--ink); }
.cat-tile__icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  background: var(--court-050); color: var(--court-700);
  display: grid; place-items: center; margin-bottom: var(--s2);
}
.cat-tile__icon svg { width: 22px; height: 22px; }
.cat-tile h3 { margin: 0; font-size: var(--fs-md); }
.cat-tile p { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.cat-tile__count { font-size: var(--fs-xs); color: var(--ink-faint); margin-top: var(--s2); }

/* --------------------------------------------------------------------------
   8. Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumbs { font-size: var(--fs-xs); color: var(--ink-faint); margin-bottom: var(--s4); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { margin: 0; display: flex; align-items: center; gap: var(--s2); }
.breadcrumbs li + li::before { content: "/"; color: var(--ink-faint); opacity: 0.6; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { color: var(--court-700); text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   9. Game shell (canvas + HUD)
   -------------------------------------------------------------------------- */
.game-shell {
  background: var(--court-900);
  border: 1px solid var(--court-800);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.game-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--court-800);
  /* Stop a swipe on the canvas scrolling the page on touch devices. */
  touch-action: none;
}
.game-stage canvas { width: 100%; height: 100%; display: block; }

.game-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center; text-align: center;
  padding: var(--s5);
  background: color-mix(in srgb, var(--court-900) 84%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: #fff;
}
.game-overlay[hidden] { display: none; }
.game-overlay__inner { max-width: 44ch; }
.game-overlay h2, .game-overlay h3 { color: #fff; margin-bottom: var(--s3); }
.game-overlay p { color: rgba(255,255,255,0.82); font-size: var(--fs-sm); margin-bottom: var(--s5); }
.game-overlay .btn--secondary { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.3); }
.game-overlay .btn--secondary:hover { background: rgba(255,255,255,0.2); color: #fff; }

.game-hud {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--court-800);
  border-top: 1px solid rgba(255,255,255,0.09);
  color: #fff; flex-wrap: wrap;
}
.hud-stat { display: flex; flex-direction: column; line-height: 1.2; min-width: 58px; }
.hud-stat__label {
  font-size: 0.625rem; font-weight: 650; letter-spacing: 0.09em;
  text-transform: uppercase; color: rgba(255,255,255,0.55);
}
.hud-stat__value { font-size: var(--fs-md); font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-actions { display: flex; gap: var(--s2); margin-left: auto; flex-wrap: wrap; }
.hud-actions .btn {
  background: rgba(255,255,255,0.1); color: #fff;
  border-color: rgba(255,255,255,0.2); min-height: 38px; padding: var(--s2) var(--s4);
}
.hud-actions .btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
.hud-actions .btn[aria-pressed="true"] { background: var(--ball); color: var(--court-900); border-color: var(--ball); }

/* On-screen touch controls, shown by responsive.css on coarse pointers */
.touch-pad { display: none; padding: var(--s3) var(--s4) var(--s4); background: var(--court-800); gap: var(--s3); }
.touch-pad__btn {
  flex: 1; min-height: 62px; border-radius: var(--radius);
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: var(--fs-base); font-weight: 650;
  display: grid; place-items: center; cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.touch-pad__btn:active { background: var(--ball); color: var(--court-900); }
.touch-pad--dpad { display: none; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }

.game-note {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4); margin-top: var(--s5);
  background: var(--court-050); border: 1px solid color-mix(in srgb, var(--court-600) 20%, transparent);
  border-radius: var(--radius); font-size: var(--fs-sm); color: var(--ink-soft);
}
.game-note svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--court-700); margin-top: 2px; }
.game-note strong { color: var(--ink); }

/* Scaffolded (not yet playable) game notice */
.build-notice {
  padding: var(--s7) var(--s5); text-align: center;
  background: var(--surface); border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.build-notice svg { width: 44px; height: 44px; color: var(--court-600); margin: 0 auto var(--s4); }
.build-notice h2 { font-size: var(--fs-lg); }
.build-notice p { color: var(--ink-soft); max-width: 56ch; margin-inline: auto; }

.spec-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--s5); }
.spec-list div { display: flex; gap: var(--s4); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); background: var(--surface); }
.spec-list div:last-child { border-bottom: 0; }
.spec-list dt { font-weight: 650; min-width: 108px; flex-shrink: 0; color: var(--ink-soft); font-size: var(--fs-sm); }
.spec-list dd { margin: 0; font-size: var(--fs-sm); }

/* --------------------------------------------------------------------------
   10. Article
   -------------------------------------------------------------------------- */
.article-layout { display: grid; gap: var(--s8); align-items: start; }
.article-body { max-width: 72ch; font-size: var(--fs-md); }
.article-body > * + h2 { margin-top: var(--s8); }
.article-body > * + h3 { margin-top: var(--s6); }
.article-body h2 {
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.article-body ul, .article-body ol { margin-bottom: var(--s5); }
.article-body li { line-height: var(--lh-body); }
.article-body figure { margin: var(--s6) 0; }
.article-body figcaption {
  font-size: var(--fs-xs); color: var(--ink-faint);
  margin-top: var(--s2); text-align: center;
}

.article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4);
  padding: var(--s4) 0; margin-bottom: var(--s5);
  border-block: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--ink-soft);
}
.article-meta__author { display: flex; align-items: center; gap: var(--s3); }
.article-meta__author img { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); }
.article-meta__author a { font-weight: 650; text-decoration: none; }
.article-meta time { white-space: nowrap; }
.article-meta__dates { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); }

.reading-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--ball); z-index: 150;
  transition: width 0.1s linear;
}

.toc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: var(--s5); margin-bottom: var(--s6);
}
.toc h2 {
  font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); margin-bottom: var(--s3); border: 0; padding: 0;
}
.toc ol { counter-reset: toc; list-style: none; padding: 0; margin: 0; }
.toc li { counter-increment: toc; margin-bottom: var(--s2); font-size: var(--fs-sm); }
.toc li::before { content: counter(toc) ". "; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.toc a { text-decoration: none; color: var(--ink-soft); }
.toc a:hover, .toc a.is-active { color: var(--court-700); text-decoration: underline; }
.toc ol ol { margin: var(--s2) 0 0 var(--s4); }

.callout {
  border-radius: var(--radius); padding: var(--s5);
  margin: var(--s6) 0; border: 1px solid var(--line);
  background: var(--surface);
}
.callout__label {
  display: block; font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: var(--s2);
}
.callout > :last-child { margin-bottom: 0; }
.callout--insight { background: var(--court-050); border-color: color-mix(in srgb, var(--court-600) 24%, transparent); }
.callout--insight .callout__label { color: var(--court-700); }
.callout--takeaways { background: var(--surface-sunk); border-color: var(--line-strong); }
.callout--takeaways .callout__label { color: var(--ink-soft); }
.callout--note { background: color-mix(in srgb, var(--clay) 8%, var(--surface)); border-color: color-mix(in srgb, var(--clay) 28%, transparent); }
.callout--note .callout__label { color: var(--clay); }

.faq { margin-top: var(--s7); }
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin-bottom: var(--s3);
}
.faq summary {
  padding: var(--s4) var(--s5); cursor: pointer; font-weight: 650;
  list-style: none; display: flex; justify-content: space-between;
  align-items: center; gap: var(--s4); font-size: var(--fs-base);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0;
  border-right: 2px solid var(--ink-faint); border-bottom: 2px solid var(--ink-faint);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq summary:hover { background: var(--surface-sunk); }
.faq__answer { padding: 0 var(--s5) var(--s4); color: var(--ink-soft); font-size: var(--fs-sm); }
.faq__answer > :last-child { margin-bottom: 0; }

.author-box {
  display: flex; gap: var(--s5); padding: var(--s5);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); margin-top: var(--s8);
}
.author-box img { width: 84px; height: 84px; border-radius: 50%; flex-shrink: 0; border: 1px solid var(--line); }
.author-box h3 { font-size: var(--fs-md); margin-bottom: var(--s1); }
.author-box__role { font-size: var(--fs-xs); color: var(--court-700); font-weight: 650; margin-bottom: var(--s3); }
.author-box p { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: var(--s3); }

.share { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s6); }
.share__label { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); margin-right: var(--s2); }
.share a, .share button {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  text-decoration: none; transition: all 0.15s var(--ease);
}
.share a:hover, .share button:hover { border-color: var(--court-600); color: var(--court-700); background: var(--court-050); }
.share svg { width: 17px; height: 17px; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: calc(var(--header-h) + var(--s4)); }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5); }
.widget h2, .widget h3 {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); margin-bottom: var(--s4); border: 0; padding: 0;
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { margin-bottom: var(--s3); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.widget li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.widget a { font-size: var(--fs-sm); font-weight: 550; text-decoration: none; color: var(--ink); }
.widget a:hover { color: var(--court-700); }
.widget__meta { display: block; font-size: var(--fs-xs); color: var(--ink-faint); margin-top: 2px; }

/* --------------------------------------------------------------------------
   11. Filters, search, forms
   -------------------------------------------------------------------------- */
.filters {
  display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s5); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: var(--s6);
}
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.filter-row__label {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-faint); min-width: 74px;
}
.chip {
  padding: var(--s2) var(--s4); min-height: 38px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-soft);
  font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; transition: all 0.15s var(--ease);
}
.chip:hover { border-color: var(--court-600); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--court-700); border-color: var(--court-700); color: #fff; }

.field { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.field label { font-size: var(--fs-sm); font-weight: 650; }
.field__hint { font-size: var(--fs-xs); color: var(--ink-faint); }
input[type="text"], input[type="email"], input[type="search"], select, textarea {
  width: 100%; padding: var(--s3) var(--s4); min-height: 46px;
  font-family: inherit; font-size: var(--fs-base); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
textarea { min-height: 150px; resize: vertical; line-height: var(--lh-snug); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--court-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--court-600) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2375857C' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right var(--s4) center; background-size: 10px; padding-right: var(--s7); }

.search-form { display: flex; gap: var(--s3); }
.search-form input { flex: 1; }
.search-status { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: var(--s5); }
.empty-state { text-align: center; padding: var(--s9) var(--s5); color: var(--ink-soft); }
.empty-state svg { width: 52px; height: 52px; color: var(--line-strong); margin: 0 auto var(--s4); }
.empty-state h2 { font-size: var(--fs-lg); }

.result { display: block; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; margin-bottom: var(--s3); transition: all 0.15s var(--ease); }
.result:hover { border-color: var(--court-600); box-shadow: var(--shadow-sm); }
.result__type { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--court-700); }
.result__title { font-size: var(--fs-base); font-weight: 650; color: var(--ink); margin: var(--s1) 0; }
.result__desc { font-size: var(--fs-sm); color: var(--ink-soft); margin: 0; }
mark { background: color-mix(in srgb, var(--ball) 60%, transparent); color: inherit; padding: 0 0.1em; border-radius: 2px; }

.newsletter {
  background: linear-gradient(150deg, var(--court-800), var(--court-700));
  color: #fff; border-radius: var(--radius-lg); padding: var(--s8) var(--s6);
  text-align: center;
}
.newsletter h2 { color: #fff; }
.newsletter p { color: rgba(255,255,255,0.82); max-width: 52ch; margin-inline: auto; }
.newsletter form { display: flex; gap: var(--s3); max-width: 460px; margin: var(--s5) auto var(--s3); }
.newsletter input { flex: 1; border-color: transparent; }
.newsletter small { display: block; color: rgba(255,255,255,0.62); font-size: var(--fs-xs); }

.form-note {
  padding: var(--s4); border-radius: var(--radius);
  background: var(--surface-sunk); border: 1px solid var(--line-strong);
  font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: var(--s5);
}
.form-note strong { color: var(--ink); }

/* --------------------------------------------------------------------------
   12. Ad slots — reserved layout space only. No ad code ships by default.
   -------------------------------------------------------------------------- */
.ad-slot {
  width: 100%; margin-inline: auto;
  /* Reserving height prevents layout shift if ads are enabled later. */
  background: repeating-linear-gradient(135deg, var(--surface-sunk), var(--surface-sunk) 10px, var(--surface-alt) 10px, var(--surface-alt) 20px);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); overflow: hidden;
}
.ad-slot::before { content: "Advertisement space"; }
.ad-slot-top { max-width: 970px; min-height: 92px; margin-block: var(--s5); }
.ad-slot-content { max-width: 728px; min-height: 92px; margin-block: var(--s7); }
.ad-slot-sidebar { min-height: 250px; }
.ad-slot-bottom { max-width: 970px; min-height: 92px; margin-block: var(--s7) var(--s5); }
/* Ads are never permitted inside the playfield. */
.game-stage .ad-slot { display: none !important; }

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--court-900); color: rgba(255,255,255,0.72); padding-block: var(--s9) var(--s5); margin-top: var(--s10); }
.site-footer a { color: rgba(255,255,255,0.72); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; gap: var(--s7); grid-template-columns: 1.6fr repeat(3, 1fr); margin-bottom: var(--s7); }
.footer-brand .brand { color: #fff; margin-bottom: var(--s4); }
.footer-brand .brand__name { color: #fff; }
.footer-brand p { font-size: var(--fs-sm); max-width: 38ch; }
.footer-col h2 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.09em; color: #fff; margin-bottom: var(--s4); }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: var(--s3); font-size: var(--fs-sm); }
.social-row { display: flex; gap: var(--s3); margin-top: var(--s4); }
.social-row a {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.18); border-radius: var(--radius-sm);
}
.social-row a:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }
.social-row svg { width: 17px; height: 17px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12); padding-top: var(--s5);
  display: flex; flex-wrap: wrap; gap: var(--s4); justify-content: space-between;
  font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   14. Cookie consent
   -------------------------------------------------------------------------- */
.cookie-bar {
  position: fixed; left: var(--s4); right: var(--s4); bottom: var(--s4); z-index: 180;
  max-width: 660px; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--s5); display: flex; gap: var(--s4); align-items: flex-start;
}
.cookie-bar[hidden] { display: none; }
.cookie-bar p { font-size: var(--fs-sm); color: var(--ink-soft); margin: 0 0 var(--s4); }
.cookie-bar h2 { font-size: var(--fs-base); margin-bottom: var(--s2); }
.cookie-bar__actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* --------------------------------------------------------------------------
   15. Utilities
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: var(--fs-sm); }
.stack > * + * { margin-top: var(--s4); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-6 { margin-top: var(--s6); } .mb-6 { margin-bottom: var(--s6); }
[hidden] { display: none !important; }

.prose-links { list-style: none; padding: 0; display: grid; gap: var(--s2); }
.prose-links a { font-weight: 600; }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s5); }

.roadmap-table { font-size: var(--fs-sm); }
.roadmap-table td:first-child { font-weight: 600; color: var(--ink); }
.roadmap-table .muted { font-size: var(--fs-xs); }
