/* Neon City Chess — in-game UI */

* { box-sizing: border-box; }
/* overscroll-behavior: a downward swipe on the board must not trigger
   pull-to-refresh (Android Chrome) and nuke a live game. */
html, body { margin: 0; padding: 0; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }

/* Visually-hidden but available to assistive tech (move announcements, etc.). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — single source of truth.
   The app has two visual languages that intentionally coexist:
     • EDITORIAL (paper-cream + brass) drives the HUD/shell.
     • NEON (cyan/magenta/mint/gold) drives the 3D scene only.
   The "editorial declutter" rules later in this file (≈L1590+) are component
   overrides, NOT token definitions — all tokens live here.
   ════════════════════════════════════════════════════════════════════════ */
:root {
  /* ───────── Color · grounds ───────── */
  --bg-0: #050813;
  --bg-1: #0a1124;
  --bg-2: #0e1730;
  --bg-3: #131e3d;
  --panel: rgba(18, 28, 58, 0.55);
  --panel-edge: rgba(255, 255, 255, 0.08);
  --panel-edge-2: rgba(255, 255, 255, 0.04);
  --panel-strong: rgba(20, 32, 64, 0.85);

  /* ───────── Color · editorial (HUD) ───────── */
  --paper: #efe5cf;          /* warm cream — primary type */
  --paper-soft: #d8cdb4;     /* secondary type */
  --paper-dim: rgba(239, 229, 207, 0.72);   /* AA on small labels */
  --paper-ghost: rgba(239, 229, 207, 0.5);  /* AA on the status kicker */
  --brass: #c9a85b;          /* sole HUD accent — hairlines, hover, key glyphs */
  --brass-soft: rgba(201, 168, 91, 0.42);
  --brass-faint: rgba(201, 168, 91, 0.16);
  --alert: #d98c6a;          /* single restrained warm alert — check / danger */
  --ink: #060912;
  --hairline: rgba(239, 229, 207, 0.14);
  --hairline-strong: rgba(239, 229, 207, 0.28);

  /* ───────── Color · neon text ramp (lifted to WCAG AA on dark) ───────── */
  --text-0: #f4f7ff;
  --text-1: #cad3ee;
  --text-2: #9aa4c8;
  --text-3: #7a849e;
  --text-dim: rgba(202, 211, 238, 0.7);

  /* ───────── Color · neon accents (3D scene only) ───────── */
  --accent-cyan: oklch(0.78 0.14 215);
  --accent-magenta: oklch(0.70 0.18 350);
  --accent-mint: oklch(0.82 0.13 165);
  --accent-gold: oklch(0.82 0.13 85);
  --accent-purple: oklch(0.65 0.17 295);

  /* ───────── Color · board + pieces (3D + glyph) ───────── */
  --board-light: oklch(0.85 0.02 240);
  --board-dark: oklch(0.32 0.06 250);
  --board-frame: rgba(255,255,255,0.06);
  --board-glow: var(--accent-cyan);
  --board-coord: rgba(255,255,255,0.55);
  --piece-light: #f4f8ff;
  --piece-light-stroke: rgba(15, 25, 50, 0.4);
  --piece-light-accent: var(--accent-cyan);
  --piece-dark: #131c34;
  --piece-dark-stroke: rgba(0,0,0,0.7);
  --piece-dark-accent: var(--accent-magenta);

  /* ───────── Typography ───────── */
  --font-sans: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  /* Type scale — named to the existing values (appearance-identical). A future
     visual pass can collapse the 13/14 and 11/12 near-duplicates. */
  --text-3xs: 9px;
  --text-2xs: 10px;
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 22px;
  --text-3xl: 26px;

  /* ───────── Spacing · 4px base ───────── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ───────── Radius · sharp, three steps ───────── */
  --radius-sm: 2px;
  --radius-md: 6px;
  --radius-pill: 999px;

  /* ───────── Elevation (tokenised repeats) ───────── */
  --shadow-pop: 0 10px 40px -10px rgba(0,0,0,0.7);  /* modals / lifted cards */
  --ring-brass: 0 0 0 1px var(--brass-soft);        /* hairline focus/active ring */

  /* ───────── Motion ───────── */
  --dur-fast: .18s;
  --dur-base: .3s;
  --dur-slow: .9s;
  --motion-ease-out: cubic-bezier(0.2, 0.8, 0.25, 1);
  --motion-ease-spring: cubic-bezier(0.22, 1.1, 0.32, 1);
}

body {
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-sans);
  min-height: 100dvh;
  overflow-x: hidden;
}

.app {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(80, 100, 200, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, rgba(255, 80, 180, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

/* Theme accent variable */
.app.theme-cyan { --theme-accent: var(--accent-cyan); }
.app.theme-magenta { --theme-accent: var(--accent-magenta); }
.app.theme-mint { --theme-accent: var(--accent-mint); }
.app.theme-gold { --theme-accent: var(--accent-gold); }
.app:not([class*="theme-"]) { --theme-accent: var(--accent-cyan); }

/* Board themes */
.board.theme-neon { --board-light: oklch(0.82 0.04 235); --board-dark: oklch(0.30 0.08 252); --board-glow: var(--accent-cyan); }
.board.theme-classic { --board-light: oklch(0.88 0.04 80); --board-dark: oklch(0.40 0.08 60); --board-glow: var(--accent-gold); }
.board.theme-contrast { --board-light: oklch(0.95 0.005 240); --board-dark: oklch(0.20 0.02 240); --board-glow: rgba(255,255,255,0.6); }

/* ─────────────────────────── Top bar ─────────────────────────── */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: 18px var(--space-8);
  border-bottom: 1px solid var(--panel-edge);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(8, 12, 28, 0.6), rgba(8, 12, 28, 0.0));
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 0.95;
  font-family: var(--font-display);
  /* Page-level <h1> for document outline/SR; neutralize the UA heading
     margin/size/weight so the masthead stays pixel-identical (the two lines
     set their own size below). */
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
.brand-line-1 {
  font-style: italic;
  font-size: var(--text-md);
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.brand-line-2 {
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}
@keyframes pulse-soft { 0%, 100% { opacity: 0.5; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1); } }
.topbar-right { display: flex; align-items: center; gap: var(--space-3); }
/* Single understated masthead entry to start a game. */
.masthead-action {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-dim);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  cursor: pointer;
  transition: color .2s, letter-spacing .3s;
}
.masthead-action:hover { color: var(--paper); letter-spacing: 0.24em; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--panel-edge);
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-md);
  color: var(--text-1);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.icon-btn:hover { color: var(--text-0); border-color: var(--brass-soft); }

/* ─────────────────────────── Stage ─────────────────────────── */
.stage {
  position: relative;
  z-index: 5;
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  gap: var(--space-6);
  padding: 28px var(--space-8) var(--space-8);
  align-items: start;
}
.density-cozy .stage { padding: var(--space-4) var(--space-6) var(--space-5); gap: var(--space-4); }
.density-airy .stage { padding: 40px 48px 48px; gap: var(--space-8); }
.rail { display: flex; flex-direction: column; gap: 14px; }

/* ─────────────────────────── Panels ─────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 18px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  position: relative;
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.panel-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--text-0);
  letter-spacing: 0.01em;
}
.panel-sub {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─────────────────────────── Opponent / You cards ─────────────────────────── */
.opponent-card, .you-card {
  padding: var(--space-4);
}
.opp-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
}
.opp-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.opp-style {
  font-size: var(--text-xs);
  color: var(--text-2);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.opp-rating {
  text-align: right;
  line-height: 1.05;
}
.opp-rating-num {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: var(--text-0);
  font-feature-settings: 'tnum';
}
.opp-rating-tier {
  font-size: var(--text-2xs);
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.opp-status {
  font-size: var(--text-sm);
  color: var(--text-2);
  margin-bottom: var(--space-3);
  height: 18px;
  display: flex;
  align-items: center;
}
.t-label { text-transform: uppercase; letter-spacing: 0.14em; font-size: var(--text-2xs); font-family: var(--font-mono); }
.t-label.idle { color: var(--text-3); }
.thinking-pulse {
  display: flex; align-items: center; gap: 6px;
  color: var(--theme-accent);
}
.thinking-pulse .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 8px var(--theme-accent);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.thinking-pulse .dot:nth-child(2) { animation-delay: .15s; }
.thinking-pulse .dot:nth-child(3) { animation-delay: .3s; }
@keyframes dot-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.captured-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
  min-height: 22px;
  padding: 6px var(--space-2);
  background: rgba(0,0,0,0.18);
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-edge-2);
}
.captured-piece { display: inline-flex; opacity: 0.85; }
.captured-empty {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  letter-spacing: 0.08em;
}
.material-delta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent-mint);
  font-weight: 600;
}

/* ─────────────────────────── Avatar ─────────────────────────── */
.avatar {
  position: relative;
  display: inline-block;
}
.avatar svg { display: block; border-radius: 50%; }
/* "Thinking" is signalled once — by the fc-thinking dots + the status-chip
   pulse. The avatar gets a static brass ring, not a third competing loop. */
.avatar.thinking::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 1px solid var(--brass-soft);
  border-radius: 50%;
  opacity: 0.7;
}

/* ─────────────────────────── Clock ─────────────────────────── */
/* The sidebar `.clock` layout was replaced by the immersive `.fc-clock`
   (Clocks.jsx / FloatingHUD); its rulesets are gone. Only this keyframe
   survives — it still drives the active `.fc-clock .sep` blink further down. */
@keyframes blink { 50% { opacity: 0.1; } }

/* ─────────────────────────── Left actions ─────────────────────────── */
.left-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-1);
}
.action-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-base);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, background .18s, color .18s;
}
.action-btn:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color: var(--text-0);
}

/* ─────────────────────────── Board region ─────────────────────────── */
.board-region {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}
.board-frame {
  position: relative;
  width: min(72dvh, 100%);
  max-width: 720px;
  aspect-ratio: 1;
  display: flex;
}
.board {
  flex: 1;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  box-shadow:
    0 24px 60px -20px rgba(0,0,0,0.7),
    0 0 0 1px var(--panel-edge),
    0 0 0 6px rgba(255,255,255,0.015),
    0 0 60px -10px var(--board-glow);
}
/* Keyboard / screen-reader board overlay — a transparent ARIA grid that overlays
   the 3D board. It is pointer-events:none, so it never intercepts mouse/touch
   input or alters the locked 3D visuals; it exists purely for assistive tech +
   keyboard operation. */
.board-a11y-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  pointer-events: none;
  z-index: 4;
}
.board-a11y-grid .a11y-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
}
.board-a11y-grid .a11y-cell {
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  outline: none;
}
/* The 3D board is perspective-projected, so a flat grid-cell outline lands in
   the wrong place. Keep focus visible at the board boundary instead of drawing
   a misleading rectangle in the page corner. */
.board-a11y-grid .a11y-cell:focus-visible {
  outline: none;
}
.board-frame:focus-within {
  outline: 2px solid var(--theme-accent, #6cf);
  outline-offset: -2px;
}
/* ─────────────────────────── Immersive in-game layout ─────────────────────────── */
.app.immersive { overflow: hidden; height: 100dvh; }
.app.immersive .stage {
  display: block;
  padding: 0;
  position: fixed;
  inset: 0;
}
.app.immersive .rail { display: none; }
.app.immersive .board-region {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  display: block;
}
.app.immersive .board-frame {
  position: absolute;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  max-width: none;
  aspect-ratio: auto;
}
.app.immersive .board {
  border-radius: 0;
  box-shadow: none;
}
.app.immersive .board.board-3d {
  background: radial-gradient(ellipse at 50% 40%, #0d162e 0%, #04070f 70%);
}
.app.immersive .board-eval { display: none; }

.topbar-immersive {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(5, 8, 19, 0.85), rgba(5, 8, 19, 0));
  border-bottom: none;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 10px var(--space-5);
}

/* Floating cards — corners */
.float-card {
  position: fixed;
  z-index: 20;
  background: rgba(8, 12, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 14px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
  min-width: 260px;
}
.opponent-select {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.opponent-select:hover,
.opponent-select:focus-visible {
  border-color: rgba(247, 216, 119, 0.42);
  background: rgba(18, 24, 46, 0.68);
}
.opponent-select:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
}
.float-tl { top: 72px; left: 20px; }
.float-br { bottom: 10px; right: 20px; }

.fc-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.fc-meta { flex: 1; line-height: 1.15; min-width: 0; }
/* The bottom-right "you/White" card right-aligns its meta (mirror of the
   top-left card). Scoped to the card position so the markup stays class-driven. */
.float-br .fc-meta { text-align: right; }
.fc-name {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text-0);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-sub {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-clock {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
  color: var(--text-1);
  font-feature-settings: 'tnum';
  padding: 6px var(--space-3);
  border-radius: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex; gap: 1px;
  transition: border-color .2s, box-shadow .2s, color .2s;
}
.fc-clock.active {
  border-color: var(--theme-accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--theme-accent), 0 0 18px -6px var(--theme-accent);
}
/* Low time (<30s): magenta is the at-a-glance cue, but colour alone fails
   WCAG 1.4.1, so add an underline that survives greyscale (the aria-label also
   speaks ", low time"). */
.fc-clock.low { color: var(--accent-magenta); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.fc-clock .sep { opacity: 0.45; }
.fc-clock.active .sep { animation: blink 1s steps(2) infinite; }
.fc-captured {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-top: 10px;
  min-height: 18px;
  flex-wrap: wrap;
}
.fc-captured.reverse { margin-top: 0; margin-bottom: 10px; }
.fc-cp { display: inline-flex; opacity: 0.85; }
.fc-delta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-mint);
  font-weight: 600;
}
.fc-thinking {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  color: var(--brass);
  font-size: var(--text-xs);
}
.fc-thinking .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 6px var(--brass-soft);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.fc-thinking .dot:nth-child(2) { animation-delay: .15s; }
.fc-thinking .dot:nth-child(3) { animation-delay: .3s; }

/* Eval bar — vertical thin strip on right edge, just inside history toggle */
.float-eval {
  position: fixed;
  top: 50%; right: 70px;
  transform: translateY(-50%);
  z-index: 18;
  height: 460px;
  max-height: calc(100dvh - 240px);
  background: rgba(8, 12, 28, 0.45);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px var(--space-2);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.float-eval-bar {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.feb-track {
  width: 5px;
  flex: 1;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.feb-white {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #f4f8ff, #cad3ee);
  transition: height .4s cubic-bezier(.2,.8,.25,1);
}
.feb-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  letter-spacing: 0.04em;
}

/* Live status chip — top-center, compact, and outside the main playfield. */
.float-status {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100dvw - 360px));
  padding: var(--space-2) 14px;
  border: 1px solid var(--hairline, rgba(255,255,255,0.1));
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.74), rgba(8, 12, 26, 0.52));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 42px -24px rgba(0,0,0,0.85);
  color: var(--paper, var(--text-0));
  pointer-events: none;
  white-space: nowrap;
}
.float-status::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 14px var(--theme-accent);
  transition: background 0.2s var(--motion-ease-out), box-shadow 0.2s var(--motion-ease-out);
}
.status-kicker {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-dim, var(--text-3));
}
.status-label {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-base);
  letter-spacing: 0.02em;
}
/* Status dot — brass throughout, with one restrained warm alert for danger/
   check. Semantics live in the kicker text, not a scatter of neon hues. */
.status-good::before,
.status-ok::before,
.status-white::before,
.status-black::before,
.status-thinking::before { background: var(--brass); box-shadow: 0 0 10px var(--brass-soft); }
.status-bad::before,
.status-danger::before { background: var(--alert); box-shadow: 0 0 12px var(--alert); }
.status-thinking::before { animation: pulse-soft 1.4s ease-in-out infinite; }

/* Actions bar — bottom center */
.float-actions {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  background: rgba(8, 12, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: var(--space-1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
}
.float-actions .board-actions {
  width: auto;
  max-width: none;
  margin: 0;
}
.float-actions .action-pill {
  border: none;
  background: transparent;
  padding: var(--space-2) var(--space-3);
}
.float-actions .action-pill:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
}
.float-actions .actions-spacer {
  flex: 0;
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  margin: 0 6px;
}

/* Draw-offer toast — sits just above the bottom action bar.
   Appears for 2.5s when AI declines a draw, or until game-over modal lands. */
.draw-toast {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  padding: var(--space-2) 18px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(8, 12, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.8);
  animation: draw-toast-in 0.28s ease-out;
}
.draw-toast.draw-accepted { color: var(--accent-mint, #8de5c1); border-color: rgba(141, 229, 193, 0.35); }
.draw-toast.draw-declined { color: var(--accent-magenta, #f48ec1); border-color: rgba(244, 142, 193, 0.35); }
@keyframes draw-toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* History toggle and panel — right edge */
.history-toggle {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  background: rgba(8, 12, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px 0 0 10px;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-right: none;
  transition: color .18s, background .18s;
}
.history-toggle.open { color: var(--theme-accent); }
.history-toggle:hover { color: var(--text-0); }
.float-history {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 21;
  width: 280px;
  max-height: 500px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(8, 12, 28, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  -webkit-backdrop-filter: blur(22px);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-pop);
  animation: slide-in-r .25s cubic-bezier(.2,.8,.25,1);
}
@keyframes slide-in-r {
  from { opacity: 0; transform: translate(20px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}
.float-history .panel {
  background: transparent;
  border: none;
  padding: 0;
}
.float-history .panel::before { display: none; }

/* Coach panel — bottom left */
.float-coach {
  position: fixed;
  bottom: 10px;
  left: 20px;
  z-index: 19;
  max-width: 300px;
  background: rgba(8, 12, 28, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-pop);
}
.fcoach-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.fcoach-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--accent-mint);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.fcoach-close {
  background: transparent;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  display: grid; place-items: center;
}
.fcoach-close:hover { color: var(--text-0); }
.fcoach-line {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-1);
  text-wrap: pretty;
}
.coach-toggle-btn {
  position: fixed;
  bottom: 10px;
  left: 20px;
  z-index: 19;
  display: flex; align-items: center; gap: 6px;
  padding: var(--space-2) var(--space-3);
  background: rgba(8, 12, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.coach-toggle-btn:hover { color: var(--accent-mint); }

/* In immersive mode, mute the topbar a bit */
.topbar-immersive .nav-btn { font-size: var(--text-base); padding: 6px var(--space-3); }
.topbar-immersive .brand-tag { display: none; }
.topbar-immersive .profile-pill { padding: 3px 10px 3px 3px; }
.topbar-immersive .profile-meta { display: none; }
.topbar-immersive { padding: var(--space-3) var(--space-6); }
.board-3d-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.board-3d-shell {
  position: absolute;
  inset: 0;
}
.board-3d-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.board-boot-state {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(5, 22, 38, 0.24), rgba(1, 4, 12, 0.06) 46%, transparent 76%);
}
.board-boot-card {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: min(280px, calc(100% - 48px));
  padding: 11px 14px;
  border: 1px solid rgba(92, 235, 255, 0.26);
  border-radius: 5px;
  background: rgba(1, 8, 22, 0.7);
  color: var(--paper);
  box-shadow: 0 18px 48px rgba(0, 2, 12, 0.36), inset 0 1px 0 rgba(219, 253, 255, 0.06);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}
.board-boot-card strong,
.board-boot-card span:not(.board-boot-orbit) {
  display: block;
}
.board-boot-card strong {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  color: var(--brass);
  text-transform: uppercase;
}
.board-boot-card span:not(.board-boot-orbit) {
  margin-top: 3px;
  color: var(--paper-ghost);
  font-size: 11px;
}
.board-boot-orbit {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(50, 233, 255, 0.28);
  border-top-color: var(--brass);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(50, 233, 255, 0.18);
  animation: board-boot-spin 1s linear infinite;
}
.board-boot-state.is-error .board-boot-card { border-color: rgba(255, 75, 193, 0.42); }
.board-boot-state.is-error .board-boot-card strong { color: #ff9cdd; }
.board-boot-state.is-error .board-boot-orbit { border-top-color: var(--alert); animation: none; }
@keyframes board-boot-spin { to { transform: rotate(1turn); } }

/* eval bar attached to board */
.board-eval {
  position: absolute;
  left: -22px;
  top: 0; bottom: 0;
  width: 14px;
  display: flex;
}

.eval-bar-wrap {
  position: relative;
  width: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.eval-bar {
  position: relative;
  width: 6px;
  flex: 1;
  background: #0e1424;
  border: 1px solid var(--panel-edge);
  border-radius: 3px;
  overflow: hidden;
}
.eval-white {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #f4f8ff 0%, #cad3ee 100%);
  transition: height .4s cubic-bezier(.2,.8,.25,1);
}
.eval-midline {
  position: absolute;
  left: -3px; right: -3px; top: 50%;
  height: 1px;
  /* Neutral hairline — the "equal" line must read the same regardless of the
     board theme accent (was --theme-accent, which tinted it per theme). */
  background: var(--text-3);
  opacity: 0.6;
}
.eval-num {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-2);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.08em;
}

/* ─────────────────────────── Board actions ─────────────────────────── */
.board-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 720px;
}
.action-pill {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.action-pill:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: var(--text-0);
}
.action-pill:disabled { opacity: 0.4; cursor: not-allowed; }
.action-pill.danger { color: var(--accent-magenta); }
.action-pill.danger:hover:not(:disabled) { border-color: var(--accent-magenta); }
/* Touch press feedback — GPU-cheap transform, auto-neutralized by the
   reduced-motion duration override. No layout impact. */
.action-pill:active:not(:disabled),
.opp-tile:active,
.promo-btn:active { transform: scale(0.97); transition: transform .12s var(--motion-ease-out); }
.ap-icon { display: inline-flex; opacity: 0.85; }
.kbd {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  color: var(--text-3);
  margin-left: var(--space-1);
}
.actions-spacer { flex: 1; }

/* ─────────────────────────── Move history ─────────────────────────── */
/* Hold the ply-count box steady so the toggle doesn't reflow across digit thresholds. */
.history-count { min-width: 2ch; text-align: center; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: var(--space-1);
}
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.history-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--text-base);
}
.history-empty {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  text-align: center;
  padding: var(--space-5) 0;
  letter-spacing: 0.06em;
}
.hn { color: var(--text-3); font-size: var(--text-xs); }
.mc {
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-base);
  text-align: left;
  padding: 5px var(--space-2);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  font-feature-settings: 'tnum';
}
.mc:hover { background: rgba(255,255,255,0.04); color: var(--text-0); }
.mc.current { background: rgba(255,255,255,0.06); color: var(--text-0); }
.mc.empty { color: var(--text-3); }
.mc-marker {
  margin-left: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
}
.mc.tag-inaccuracy .mc-marker { color: var(--accent-gold); }
.mc.tag-mistake .mc-marker { color: #f5a623; }
.mc.tag-blunder .mc-marker { color: var(--accent-magenta); }
.mc.tag-brilliant .mc-marker { color: var(--accent-cyan); }
.mc.tag-good .mc-marker { color: var(--accent-mint); }

/* ─────────────────────────── Coach panel ─────────────────────────── */
.coach { padding: var(--space-4) 18px; }
.coach-toggle { color: var(--accent-mint); }
.coach-line {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-1);
  text-wrap: pretty;
}
.coach-line.muted { color: var(--text-2); font-style: italic; }
.link {
  color: var(--theme-accent);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.link:hover { color: var(--text-0); }

/* ─────────────────────────── Promotion overlay ─────────────────────────── */
.promo-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 19, 0.75);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
  opacity: 1;
}
.promo-card {
  background: var(--panel-strong);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: var(--space-6) 28px;
  text-align: center;
}
.promo-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  margin-bottom: var(--space-4);
  color: var(--text-1);
}
.promo-row { display: flex; gap: 10px; margin-bottom: var(--space-3); }
.promo-btn {
  width: 96px; height: 96px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
  position: relative;
  transition: border-color .18s, background .18s;
}
.promo-btn:hover { border-color: var(--theme-accent); background: rgba(255,255,255,0.08); }
.promo-key {
  position: absolute;
  bottom: 6px; right: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
}
.promo-hint {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─────────────────────────── Modals ─────────────────────────── */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(5, 8, 19, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: grid; place-items: center;
  z-index: 80;
  padding: 40px;
  opacity: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: scrim-in 0.28s var(--motion-ease-out) forwards;
}
.modal {
  background: linear-gradient(180deg, rgba(18, 28, 58, 0.95), rgba(10, 17, 36, 0.95));
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  max-width: 100%;
  width: 100%;
  max-height: calc(100dvh - 80px);
  overflow-y: auto;
  overscroll-behavior: contain;
  position: relative;
  box-shadow:
    0 40px 80px -20px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  animation: modal-in 0.34s var(--motion-ease-spring) 0.04s forwards;
}
@keyframes scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-sm { width: 440px; }
.modal-md { width: 560px; }
.modal-lg { width: 880px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-6) 28px var(--space-4);
  border-bottom: 1px solid var(--panel-edge);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.01em;
  margin: 0;
  font-weight: 400;
}
.modal-sub {
  margin: var(--space-1) 0 0;
  font-size: var(--text-base);
  color: var(--text-2);
}
.modal-close {
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
}
.modal-close:hover { color: var(--text-0); border-color: rgba(255,255,255,0.18); }
.modal-body { padding: var(--space-6) 28px 28px; }
.modal-actions {
  display: flex; gap: 10px;
  justify-content: flex-end;
  margin-top: var(--space-6);
}

.modal.accent-gold { border-top: 2px solid var(--accent-gold); }
.modal.accent-mint { border-top: 2px solid var(--accent-mint); }
.modal.accent-magenta { border-top: 2px solid var(--accent-magenta); }
.modal.accent-cyan { border-top: 2px solid var(--accent-cyan); }

/* ─────────────────────────── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 10px 18px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-base);
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s, transform .12s cubic-bezier(.2,.7,.3,1), box-shadow .18s;
}
.btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text-0); background: rgba(255,255,255,0.05); }
/* Tactile press — matches the app's established scale(0.97) press (action pills,
   tiles, promo). */
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; }
.btn.primary {
  background: var(--brass);
  color: var(--ink);
  border-color: var(--brass);
  font-weight: 600;
  box-shadow: 0 4px 16px -4px var(--brass-soft);
}
/* Primary CTA lifts on hover (then dips on press, below) for a confident feel. */
.btn.primary:hover { background: color-mix(in oklab, var(--brass), white 14%); color: var(--ink); transform: translateY(-1px); box-shadow: 0 8px 22px -6px var(--brass-soft); }
.btn.primary:active { transform: scale(0.97); }
.btn.primary.accent-cyan { background: var(--accent-cyan); border-color: var(--accent-cyan); box-shadow: 0 4px 16px -4px var(--accent-cyan);}
.btn.primary.accent-mint { background: var(--accent-mint); border-color: var(--accent-mint); box-shadow: 0 4px 16px -4px var(--accent-mint);}
.btn.primary.accent-magenta { background: var(--accent-magenta); border-color: var(--accent-magenta); color: #fff; box-shadow: 0 4px 16px -4px var(--accent-magenta);}
.btn.primary.accent-magenta:hover { color: #fff; }
.btn.primary.accent-gold { background: var(--accent-gold); border-color: var(--accent-gold); box-shadow: 0 4px 16px -4px var(--accent-gold);}
.btn.full { width: 100%; justify-content: center; margin-top: var(--space-3); }

/* ─────────────────────────── Opponent picker ─────────────────────────── */
.opp-picker-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-6);
}
.opp-list { display: flex; flex-direction: column; gap: var(--space-2); }
.opp-tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  color: var(--text-1);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, background .18s, transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .18s;
}
.opp-tile:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); background: rgba(255,255,255,0.045); }
/* Press wins over the hover-lift (later in source) and matches the 0.97 convention. */
.opp-tile:active { transform: scale(0.97); }
.opp-tile.active { border-color: var(--theme-accent); background: rgba(255,255,255,0.05); }
.opp-tile.active.accent-cyan { border-color: var(--accent-cyan); box-shadow: 0 0 0 1px var(--accent-cyan); }
.opp-tile.active.accent-mint { border-color: var(--accent-mint); box-shadow: 0 0 0 1px var(--accent-mint); }
.opp-tile.active.accent-magenta { border-color: var(--accent-magenta); box-shadow: 0 0 0 1px var(--accent-magenta); }
.opp-tile.active.accent-gold { border-color: var(--accent-gold); box-shadow: 0 0 0 1px var(--accent-gold); }
.opp-tile-name { font-family: var(--font-display); font-size: var(--text-xl); line-height: 1.1; }
.opp-tile-tag { font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }
.opp-tile-rating-num { font-family: var(--font-mono); font-size: 16px; text-align: right; }
.opp-tile-rating-tier { font-family: var(--font-mono); font-size: var(--text-3xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; text-align: right; }

.opp-detail {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.opp-detail.accent-cyan { box-shadow: 0 0 60px -30px var(--accent-cyan), inset 0 0 80px -40px var(--accent-cyan); }
.opp-detail.accent-mint { box-shadow: 0 0 60px -30px var(--accent-mint), inset 0 0 80px -40px var(--accent-mint); }
.opp-detail.accent-magenta { box-shadow: 0 0 60px -30px var(--accent-magenta), inset 0 0 80px -40px var(--accent-magenta); }
.opp-detail.accent-gold { box-shadow: 0 0 60px -30px var(--accent-gold), inset 0 0 80px -40px var(--accent-gold); }
.opp-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); }
.opp-detail-name { font-family: var(--font-display); font-size: 38px; margin: 0; letter-spacing: -0.01em; font-weight: 400; }
.opp-detail-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  margin: var(--space-1) 0 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.opp-detail-blurb { font-size: var(--text-md); line-height: 1.55; color: var(--text-1); margin: 0; max-width: 56ch; text-wrap: pretty; }
.opp-detail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }
.col-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
}
.bullet-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.bullet-list li {
  font-size: var(--text-base);
  color: var(--text-1);
  padding-left: var(--space-4);
  position: relative;
}
.bullet-list.good li::before {
  content: '';
  position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px;
  background: var(--accent-mint);
  border-radius: 50%;
}
.bullet-list.bad li::before {
  content: '';
  position: absolute; left: 0; top: 10px;
  width: 8px; height: 1px;
  background: var(--accent-magenta);
}
.opp-detail-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: auto; }

/* ─────────────────────────── Variants & TC ─────────────────────────── */
.form-group { margin-bottom: var(--space-5); }
.form-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 10px;
}
.variant-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}
.variant-tile {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  padding: 18px var(--space-4);
  cursor: pointer;
  text-align: left;
  color: var(--text-1);
  transition: border-color .18s, background .18s, transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .18s;
  font-family: inherit;
}
.variant-tile:hover { border-color: var(--brass-soft); transform: translateY(-2px); }
.variant-tile:active { transform: scale(0.97); }
.variant-tile.active { border-color: var(--brass); background: rgba(201,168,91,0.06); box-shadow: var(--ring-brass); }
.variant-tile svg { margin-bottom: 10px; }
.variant-name { font-size: var(--text-md); color: var(--text-0); }
.variant-sub { font-size: var(--text-xs); color: var(--text-2); margin-top: 2px; line-height: 1.3; }
.variant-soon-note {
  margin: 10px 0 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--text-2);
  max-width: 46ch;
}

/* Local 2-player optional names */
.form-label-opt { color: var(--text-2); text-transform: none; letter-spacing: 0; }
.player-name-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.player-name-input {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  padding: var(--space-3) 14px;
  color: var(--text-0);
  font-family: inherit;
  font-size: var(--text-md);
  transition: border-color .18s, background .18s;
}
.player-name-input::placeholder { color: var(--text-3); }
.player-name-input:hover { border-color: var(--brass-soft); }
.player-name-input:focus-visible {
  outline: none;
  border-color: var(--brass);
  box-shadow: var(--ring-brass);
}

.tc-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.tc-tile {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 14px var(--space-3);
  cursor: pointer;
  color: var(--text-1);
  font-family: inherit;
  text-align: left;
  transition: border-color .18s, background .18s, transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .18s;
}
.tc-tile:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); }
.tc-tile:active { transform: scale(0.97); }
.tc-tile.active { border-color: var(--brass); background: rgba(201,168,91,0.06); box-shadow: var(--ring-brass); }
.tc-time {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
  color: var(--text-0);
}
.tc-plus { font-size: var(--text-md); color: var(--text-2); margin-left: 2px; }
.tc-name { font-size: var(--text-base); margin-top: 2px; }
.tc-blurb { font-size: var(--text-xs); color: var(--text-3); }

/* ─────────────────────────── Settings ─────────────────────────── */
.settings-grid {
  display: flex;
  flex-direction: column;
}
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-6);
  padding: 14px 0;
  border-bottom: 1px solid var(--panel-edge-2);
}
.setting-row:last-child { border-bottom: 0; }
.setting-label { font-size: var(--text-md); color: var(--text-0); }
.setting-hint { font-size: var(--text-sm); color: var(--text-2); margin-top: 2px; }
.seg {
  display: inline-flex;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 3px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-family: inherit;
  font-size: var(--text-sm);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.seg-btn.active { background: var(--brass); color: var(--ink); font-weight: 500; }

.toggle {
  width: 38px; height: 22px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-pill);
  position: relative;
  cursor: pointer;
  transition: background .2s;
}
.toggle.on { background: var(--theme-accent); }
.toggle-knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s cubic-bezier(.2,.8,.25,1);
}
.toggle.on .toggle-knob { transform: translateX(16px); }

/* ─────────────────────────── Stat blocks + mini-board (shared: game-over, share) ─────────────────────────── */
.stat-block { line-height: 1.1; }
.stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.stat-value { font-size: var(--text-lg); color: var(--text-0); font-family: var(--font-display); letter-spacing: -0.01em; }
.stat-value.mono { font-family: var(--font-mono); font-size: 16px; }
.mini-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 240px;
  height: 240px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.mb-sq { display: grid; place-items: center; position: relative; }
.mb-sq.light { background: var(--board-light); }
.mb-sq.dark { background: var(--board-dark); }
.mb-sq.highlight { box-shadow: inset 0 0 0 2px var(--brass); }

/* ─────────────────────────── Share ─────────────────────────── */
.share-card { margin-bottom: var(--space-5); }
.og-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-5);
  padding: var(--space-5);
  background: linear-gradient(135deg, rgba(10, 17, 36, 0.95), rgba(18, 28, 58, 0.95));
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.og-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 90% 10%, var(--accent-magenta), transparent 50%),
    radial-gradient(circle at 10% 90%, var(--accent-cyan), transparent 50%);
  opacity: 0.08;
}
.og-board { position: relative; z-index: 1; }
.og-board .mini-board { width: 200px; height: 200px; }
.og-meta { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--space-1); }
.og-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-md);
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.og-sub {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: var(--space-2);
}
.accent-text { color: var(--accent-gold); }
.og-line { font-size: var(--text-base); color: var(--text-1); }
.og-link {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.share-row { display: flex; gap: 10px; }
.share-input {
  flex: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-1);
  display: flex; align-items: center;
}
.share-row-mini { display: flex; gap: 6px; margin-top: var(--space-3); flex-wrap: wrap; }
.chip {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--panel-edge);
  color: var(--text-1);
  border-radius: var(--radius-pill);
  padding: 6px var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.chip:hover { border-color: rgba(255,255,255,0.18); }
.chip-rec {
  color: var(--accent-magenta);
  border-color: rgba(245, 132, 207, 0.55);
  background: rgba(245, 132, 207, 0.10);
}

.share-import {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--panel-edge);
}
.share-import-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}
.share-import-area {
  width: 100%;
  min-height: 70px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-2) 10px;
  resize: vertical;
  box-sizing: border-box;
}
.share-import-area:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}
.share-import-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.share-import-status {
  font-size: var(--text-sm);
  color: var(--accent-mint);
  font-family: var(--font-mono);
}

/* ─────────────────────────── Game over ─────────────────────────── */
.gameover-grid { display: flex; flex-direction: column; gap: var(--space-6); }
.go-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--panel-edge);
}
.go-tags { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tag {
  padding: var(--space-1) 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.02);
}
.tag.good { color: var(--accent-mint); }
.tag.ok { color: var(--accent-cyan); }
.tag.bad { color: var(--accent-gold); }

/* Tweaks panel font override */
.twk-panel, .twk-panel * { font-family: var(--font-sans) !important; }

/* ═══════════════════════════════════════════════════════════════════
   EDITORIAL LUXURY LAYER
   ──────────────────────────────────────────────────────────────────
   Override pass that pushes the HUD from "chess app" toward "art-magazine
   spread": Fraunces variable-serif body, instrument-precision clocks,
   brass hairlines instead of glow rings, paper-grain atmosphere,
   staggered editorial reveals on first paint.
   The 3D scene is unchanged — this layer is shell only.
   ═══════════════════════════════════════════════════════════════════ */

/* Editorial tokens (fonts, paper/brass palette, hairlines, radius) are now
   defined in the unified :root at the top of this file. */

body {
  font-family: var(--font-sans);
  font-feature-settings: 'ss01' on, 'ss02' on, 'liga' on, 'dlig' on;
  font-variation-settings: 'opsz' 14, 'SOFT' 50;
  letter-spacing: 0.005em;
  color: var(--paper);
}

/* Paper grain — faint SVG noise applied as a fixed overlay. Adds tactile
   atmosphere without competing with the 3D scene. */
.app::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.9  0 0 0 0 0.81  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}

/* Deeper, more cinematic background — heavy on cool navy w/ a subtle warm
   pool at the top so the eye reads the masthead area as the focal start. */
.app {
  background:
    radial-gradient(900px 600px at 50% -8%, rgba(201, 168, 91, 0.08), transparent 60%),
    radial-gradient(1400px 900px at 20% 100%, rgba(60, 80, 160, 0.08), transparent 60%),
    linear-gradient(180deg, #050813 0%, #0a1226 100%);
}

/* A single architectural horizon gives the full-bleed board a gallery-like
   room to sit in. It is intentionally a line, not another glow or orb, so the
   negative space stays quiet while the board gains a little visual anchoring. */
.app.immersive::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
  background: linear-gradient(
    180deg,
    transparent 0 25.5%,
    rgba(201, 168, 91, 0.08) 25.62%,
    transparent 25.78% 100%
  );
  -webkit-mask-image: linear-gradient(180deg, #000 0 72%, transparent 96%);
  mask-image: linear-gradient(180deg, #000 0 72%, transparent 96%);
}

/* ─── Masthead (top bar) ──────────────────────────────────────────── */

.topbar, .topbar-immersive {
  background: linear-gradient(180deg, rgba(5, 8, 19, 0.7), rgba(5, 8, 19, 0));
  border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: var(--space-4) var(--space-8);
  animation: edl-fade-down 0.9s 0.05s both cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* Respect the notch/status bar: top inset (portrait) + side insets (landscape). */
.topbar-immersive {
  padding:
    max(10px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    10px
    max(20px, env(safe-area-inset-left));
}

.brand { gap: 18px; }
.brand-mark {
  width: 38px; height: 38px;
  border: 1px solid var(--brass-soft);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(201, 168, 91, 0.10), rgba(201, 168, 91, 0));
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset;
}
.brand-text { font-family: var(--font-display); }
.brand-line-1 {
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--paper-soft);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}
.brand-line-2 {
  font-size: 23px;
  letter-spacing: 0.005em;
  color: var(--paper);
  font-weight: 400;
}
.brand-tag { display: none; }  /* drop the v2.0 chip — too "app-like" */

/* Nav: tracked small-caps Fraunces, italic on active. */
.topnav { gap: 2px; }
.nav-btn {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-dim);
  padding: var(--space-2) 14px;
  border-radius: 0;
  transition: color 0.25s, letter-spacing 0.35s;
}
.nav-btn:hover {
  color: var(--paper);
  background: transparent;
  letter-spacing: 0.26em;
}
.nav-btn.active { color: var(--paper); font-style: italic; letter-spacing: 0.18em; }
.nav-btn.active::after {
  left: 50%; right: auto;
  width: 18px;
  bottom: 4px;
  transform: translateX(-50%);
  background: var(--brass);
  box-shadow: none;
  height: 1px;
}
.nav-pulse { background: var(--brass); box-shadow: 0 0 8px var(--brass-soft); }

/* Profile pill — quieter, brass-tinted. */
.profile-pill {
  border-color: var(--hairline);
  background: rgba(239, 229, 207, 0.025);
}
.profile-pill:hover { border-color: var(--brass-soft); }
.profile-name { color: var(--paper); font-family: var(--font-display); font-style: italic; font-size: var(--text-md); }
.profile-rating { color: var(--paper-dim); font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.1em; }

/* ─── Opponent card ───────────────────────────────────────────────── */

.float-card {
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.78), rgba(8, 12, 26, 0.62));
  border: 1px solid var(--hairline);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(201,168,91,0.06) inset;
  padding: var(--space-3) var(--space-4);
  animation: edl-slide-left 0.9s 0.15s both cubic-bezier(0.2, 0.7, 0.2, 1);
}
.float-card .fc-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--paper);
  letter-spacing: 0;
}
.float-card .fc-sub {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  color: var(--paper-dim);
  text-transform: uppercase;
}
.float-card .avatar { border: 1px solid var(--brass-soft); }

/* ─── Clocks — precision-instrument brass-tinted ──────────────────── */

.clock, .fc-clock {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 21px;
  letter-spacing: 0.04em;
  color: var(--paper);
  background: rgba(5, 8, 19, 0.6);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-2) 14px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4) inset;
}
.clock.active, .fc-clock.active {
  border-color: var(--brass);
  color: var(--paper);
  box-shadow: 0 0 0 1px var(--brass-faint) inset, 0 0 24px rgba(201, 168, 91, 0.18);
}

/* ─── Coach panel — field-journal feel ────────────────────────────── */

.float-coach {
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.82), rgba(8, 12, 26, 0.68));
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--brass);
  border-radius: var(--radius-sm);
  padding: 10px 14px var(--space-3);
  box-shadow: 0 18px 50px rgba(0,0,0,0.4);
  max-width: 300px;
  animation: edl-fade-up 0.9s 0.5s both cubic-bezier(0.2, 0.7, 0.2, 1);
}
.fcoach-label {
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--brass);
  opacity: 0.9;
}
.fcoach-line {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  color: var(--paper);
  letter-spacing: 0.005em;
}
.fcoach-close { color: var(--paper-dim); }
.fcoach-close:hover { color: var(--brass); }

/* ─── Action bar (Undo / Hint / Flip / Offer draw / Concede) ──────── */

.float-actions {
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.72), rgba(8, 12, 26, 0.55));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: edl-float-actions-in 0.9s 0.4s both cubic-bezier(0.2, 0.7, 0.2, 1);
}
.float-actions .board-actions {
  background: transparent;
  border: 0;
  animation: none;
}
.action-pill {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-soft);
  background: transparent;
  border: none;
  padding: var(--space-3) 14px;
  border-radius: 0;
  transition: color 0.2s, letter-spacing 0.3s;
}
.action-pill:hover:not(:disabled) {
  color: var(--paper);
  background: transparent;
  border: none;
  letter-spacing: 0.2em;
}
.action-pill .kbd, .action-pill kbd {
  font-family: var(--font-mono);
  font-size: var(--text-3xs);
  color: var(--paper-ghost);
  margin-left: 6px;
  padding: 2px var(--space-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}
.action-pill.danger { color: var(--brass); }
.action-pill.danger:hover:not(:disabled) { color: var(--paper); border: none; }

/* ─── Eval bar — vertical brass column ───────────────────────────── */

.eval-bar {
  border: 1px solid var(--hairline);
  background: rgba(5, 8, 19, 0.6);
  border-radius: 1px;
  width: 8px;
  animation: edl-fade-up 0.9s 0.3s both cubic-bezier(0.2, 0.7, 0.2, 1);
}
.eval-white,
.feb-white {
  background: linear-gradient(180deg, var(--paper) 0%, var(--brass) 100%);
  border-radius: 0;
}
.eval-num,
.feb-num {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  color: var(--paper-dim);
  letter-spacing: 0.08em;
}

/* ─── Reveal animations ──────────────────────────────────────────── */

@keyframes edl-fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes edl-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes edl-float-actions-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes edl-slide-left {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── 3D scene container ─────────────────────────────────────────── */

.board.board-3d { animation: edl-fade-up 1.2s 0s both cubic-bezier(0.2, 0.7, 0.2, 1); }

/* Cinematic vignette — radial dark overlay around the canvas so the eye
   reads the board center as the focal point. Sits over the canvas but under
   the HUD (z-index 1 vs HUD ~10). pointer-events:none so clicks pass through. */
.board-3d-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.board-3d-container::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse at center,
    transparent 34%,
    rgba(5, 8, 19, 0.12) 64%,
    rgba(5, 8, 19, 0.42) 100%
  );
}

/* ─── Modal / overlay aesthetic alignment ────────────────────────── */

.modal {
  background: linear-gradient(180deg, rgba(8, 12, 26, 0.96), rgba(5, 8, 19, 0.94));
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}
.modal h1, .modal h2, .modal h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--paper);
  letter-spacing: 0;
}

/* ─── Misc cleanups for the editorial layer ──────────────────────── */

/* Replace the harsh white text-0 default everywhere we missed */
.app, .app * { caret-color: var(--brass); }
.coach-toggle-btn { border-color: var(--hairline); color: var(--paper-dim); }
.coach-toggle-btn:hover { color: var(--brass); border-color: var(--brass-soft); }

/* ─── Responsive — tablet (≤ 900px) + phone (≤ 540px) ────────────────────
   The desktop layout is built around a 1440-wide stage with floating cards
   in the four corners. At smaller widths these collide with each other and
   with the board; below collapses them progressively. The Three.js canvas
   resizes itself via ResizeObserver so the scene fills whatever space is
   left after the chrome shrinks. */

@media (max-width: 900px) {
  /* Top bar: compact the brand, drop the version tag, shrink avatars. */
  .topbar { padding: var(--space-2) var(--space-3); }
  .brand-tag { display: none; }
  .brand-text { font-size: var(--text-md); line-height: 1.05; }
  .topnav { gap: var(--space-1); }
  .nav-btn { padding: 6px var(--space-2); font-size: var(--text-xs); letter-spacing: 0.08em; }
  .profile-meta { display: none; }
  .profile-pill { padding: var(--space-1); }

  /* Float cards: stay docked but lose decorative padding + captures row. */
  .float-card { padding: var(--space-2) 10px; min-width: 0; }
  .float-card .fc-sub { font-size: var(--text-2xs); }
  .float-tl, .float-br { max-width: 240px; }
  /* Tablet anchors — equalize the symmetric edges so opponent + you cards
     sit at matching distances from the viewport edge. */
  .float-card.float-tl { top: 64px; left: 14px; }
  /* Lift the bottom-right card above the centered action bar (≈62px tall). */
  .float-card.float-br { bottom: 84px; right: 14px; }

  /* Captured-piece glyphs visually collide at narrow widths — add a hair
     of breathing room. */
  .fc-cp { margin-right: 2px; }
  /* Thinking pulse + label must stay on one line in a compact card. */
  .fc-thinking { min-width: 0; flex-wrap: nowrap; white-space: nowrap; }

  /* Eval bar: keep on tablet but clear of the move-history toggle. */
  .float-eval { right: 60px; }
  /* Move-history rows need a tappable target on tablet/phone (desktop stays dense). */
  .mc { min-height: 36px; display: flex; align-items: center; padding-top: 8px; padding-bottom: 8px; }
  .history-list { gap: 4px; }
  .float-status {
    top: 64px;
    max-width: min(420px, calc(100dvw - 300px));
    padding: 7px 10px;
  }

  /* Action bar: drop the keyboard shortcut chips. */
  .float-actions .kbd { display: none; }
  .float-actions .action-pill { padding: 6px 10px; }

  /* History panel: narrower so it doesn't cover the board. */
  .float-history { width: 260px; }
}

@media (max-width: 1320px) and (min-width: 541px) {
  .float-actions .action-pill .ap-text,
  .float-actions .action-pill .kbd,
  .float-actions .actions-spacer {
    display: none;
  }
  /* Pixel-perfect-centered icon-only pills at the laptop breakpoint.
     grid+place-items beats line-height tricks for vertically aligning the
     SVG icon, and min-* enforces the 44×44 touch target. */
  .float-actions .action-pill {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2) 10px;
  }
  .float-coach {
    max-width: 280px;
  }
  .float-card.float-br {
    min-width: 286px;
    padding: 10px var(--space-3);
  }
}

@media (max-width: 540px) {
  /* Brand collapses to the mark only. Top nav becomes a single row of tight
     labels; everything else hides. */
  .topbar,
  .topbar-immersive {
    gap: var(--space-2);
    /* keep the notch/Dynamic-Island clearance the base/landscape blocks have */
    padding: max(var(--space-2), env(safe-area-inset-top)) var(--space-2) var(--space-2);
  }
  .brand-text { display: none; }
  .brand { gap: 0; min-width: 36px; }
  /* Nav scrolls horizontally so a long label like "ACHIEVEMENTS" doesn't
     clip at the right edge of a narrow phone. -webkit-overflow-scrolling
     keeps momentum on iOS Safari. */
  .topnav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    scrollbar-width: none;
    justify-self: stretch;
    max-width: 100%;
    min-width: 0;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    padding: var(--space-1) 6px;
    font-size: var(--text-2xs);
    letter-spacing: 0.06em;
  }
  .nav-btn .nav-pulse { display: none; }
  .topbar-right { gap: 6px; min-width: 0; }
  .topbar-right .icon-btn:nth-child(2) { display: none; } /* drop theme button on phone */
  .profile-pill { padding: 2px; }

  /* Hide eval bar — board is the priority on a narrow screen. */
  .float-eval { display: none; }
  .float-status {
    top: 124px;
    max-width: calc(100dvw - 24px);
    padding: 6px 9px;
    gap: 7px;
  }
  .status-kicker { font-size: var(--text-3xs); letter-spacing: 0.12em; }
  .status-label { font-size: var(--text-xs); }

  /* Opponent / you cards become small chips along top + bottom edges. */
  .float-card.float-tl,
  .float-card.float-br {
    top: 64px; left: 8px; right: 8px; bottom: auto;
    max-width: none; transform: none;
    padding: 6px 10px;
    display: flex; flex-direction: row; align-items: center;
    gap: var(--space-2); font-size: var(--text-xs);
  }
  .float-card.float-br {
    top: auto; bottom: 70px; left: auto; right: 8px;
    flex-direction: row-reverse;
    width: auto;
    padding: var(--space-1) var(--space-2);
  }
  .float-card .fc-sub { display: none; }
  .float-card .fc-thinking { display: none; }
  .float-card .fc-captured { display: none; }
  .float-card.float-br .fc-meta,
  .float-card.float-br .avatar { display: none; }
  .float-card.float-br .fc-row { gap: 0; }
  .float-card.float-br .fc-clock { font-size: var(--text-lg); padding: 6px 10px; }

  /* Action bar: icon-only pills, sticks to bottom. width:auto so the glass
     hugs its content — the fixed 260px cap made the 6th pill (Concede) spill
     past the container on every phone. */
  .float-actions {
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 50%;
    width: auto;
    max-width: calc(100dvw - 120px);
    padding: var(--space-1);
  }
  /* In AI mode you always play White and the camera auto-frames — Flip is
     dead weight on a phone; hiding it gets the bar to 5 pills that fit.
     Hotseat (is-local) keeps Flip: pass-and-play genuinely needs it. */
  .float-actions.is-ai .action-pill[aria-label="Flip board"] { display: none; }
  /* Untimed games render the bottom-right card as an empty glass speck once
     the meta/avatar/captures are phone-hidden — drop the husk entirely. */
  .float-card.float-br.is-untimed { display: none; }
  .float-actions .board-actions { justify-content: center; gap: 2px; }
  .float-actions .action-pill .ap-text,
  .float-actions .action-pill .kbd { display: none; }
  .float-actions .actions-spacer { display: none; }
  /* grid+place-items keeps the SVG glyph pixel-centered inside the 44×44
     touch target — relying on text line-height tricks misses by a pixel. */
  .float-actions .action-pill {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 6px;
  }

  /* History toggle: detach the count badge so it stays tappable. */
  .history-toggle {
    right: 8px;
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    transform: none;
    width: 44px;
    min-height: 44px;
    padding: 6px;
    border-radius: var(--radius-sm);
  }
  .float-history { right: 0; left: 0; width: auto; top: 64px; bottom: 130px; }

  /* Coach panel: stretch full width but compact. */
  .float-coach { left: 8px; right: 8px; bottom: 148px; max-width: none; padding: var(--space-2) 10px; }
  .fcoach-line { font-size: var(--text-sm); line-height: 1.35; }
  .coach-toggle-btn {
    left: 8px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 0;
    gap: 0;
    border-radius: var(--radius-sm);
  }
  .coach-toggle-text { display: none; }

  /* Board frame fills the viewport between the top chip and the bottom chip. */
  .stage { padding: 0; }
  .board-region { padding: var(--space-1); }
  .board-frame { padding: 0; }

  /* Modal padding tighter. Keep the panel inside the scrim's content box;
     the fixed desktop width otherwise wins against the mobile grid. */
  .modal-scrim { padding: var(--space-2); }
  .modal {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
  }
  .modal-body { padding: var(--space-3); }
  .modal-head { padding: var(--space-4) var(--space-3) var(--space-3); }
  .modal-title { font-size: 24px; }
  .tc-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-actions { flex-wrap: wrap; justify-content: flex-start; }
  .modal-actions .variant-soon-note { flex: 1 0 100%; }

  /* Tweaks panel: collapsed by default would be nicer, but at minimum keep
     it off-screen-friendly so it doesn't cover gameplay. */
  .tweaks-panel { display: none; }
}

/* ─── Phase 3 — Orientation-aware HUD: short landscape (iPhone landscape) ────
   Targets: 844×390, 667×375, etc. — any landscape viewport under 480px tall.
   Strategy: the board fills the full height; chrome compacts to thin corner
   chips so nothing overlaps the playing surface. ─────────────────────────── */
@media (orientation: landscape) and (max-height: 480px) {
  /* Topbar: strip down to 44px — just the mark + brand name + one action */
  .topbar-immersive {
    padding:
      max(6px, env(safe-area-inset-top))
      max(14px, env(safe-area-inset-right))
      6px
      max(14px, env(safe-area-inset-left));
  }
  .topbar-immersive .brand-line-2 { font-size: var(--text-md); }
  .topbar-immersive .brand-line-1 { display: none; }
  .topbar-immersive .nav-btn { padding: var(--space-1) var(--space-2); font-size: var(--text-2xs); }
  .topbar-immersive .profile-meta { display: none; }

  /* Opponent chip — top-left micro strip, no avatar, no captured, no thinking */
  .float-card.float-tl {
    top: 44px;
    left: max(8px, env(safe-area-inset-left));
    padding: var(--space-1) 10px;
    min-width: 0;
    border-radius: 8px;
    flex-direction: row;
    align-items: center;
    gap: var(--space-2);
  }
  .float-card.float-tl .avatar    { width: 28px; height: 28px; font-size: var(--text-xs); }
  .float-card.float-tl .fc-name   { font-size: var(--text-sm); }
  .float-card.float-tl .fc-sub    { display: none; }
  .float-card.float-tl .fc-captured { display: none; }
  .float-card.float-tl .fc-thinking { display: none; }
  .float-card.float-tl .fc-clock  { font-size: var(--text-base); padding: 2px 6px; }

  /* You chip — bottom-right, clock only */
  .float-card.float-br {
    bottom: max(6px, env(safe-area-inset-bottom));
    right: max(8px, env(safe-area-inset-right));
    padding: var(--space-1) 10px;
    min-width: 0;
    border-radius: 8px;
  }
  .float-card.float-br .fc-meta   { display: none; }
  .float-card.float-br .avatar    { display: none; }
  .float-card.float-br .fc-captured { display: none; }
  .float-card.float-br .fc-clock  { font-size: var(--text-base); padding: 2px 6px; }

  /* Status chip: just below topbar, compact */
  .float-status {
    top: 44px;
    padding: var(--space-1) 10px;
    gap: 6px;
  }
  .status-kicker { font-size: var(--text-3xs); letter-spacing: 0.10em; }
  .status-label  { font-size: var(--text-2xs); }

  /* Eval bar: hidden — board is the full height, no room for a sidebar strip */
  .float-eval { display: none; }

  /* Action bar: icon-only pills, slim, centered just above safe-area bottom */
  .float-actions {
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 50%;
    width: auto;
    padding: 3px var(--space-1);
    border-radius: 10px;
  }
  .float-actions .board-actions { gap: 2px; }
  .float-actions .action-pill .ap-text,
  .float-actions .action-pill .kbd { display: none; }
  .float-actions .actions-spacer  { display: none; }
  .float-actions .action-pill {
    display: grid;
    place-items: center;
    min-width: 36px;
    min-height: 36px;
    padding: var(--space-1);
  }

  /* History toggle: small, bottom-left so it clears the action bar */
  .history-toggle {
    right: auto;
    left: max(8px, env(safe-area-inset-left));
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    transform: none;
    width: 36px;
    min-height: 36px;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
  }
  /* Expand the history panel upward from the bottom-left */
  .float-history {
    left: 0;
    right: 0;
    top: 44px;
    bottom: 60px;
    width: auto;
  }

  /* Coach: hidden — no vertical room on a 390px screen */
  .float-coach       { display: none; }
  .coach-toggle-btn  { display: none; }

  /* Modal stays centered but shorter */
  .modal { max-height: calc(100dvh - 16px); }

  /* Board: absolute edge-to-edge vertical */
  .stage { padding: 0; }
  .board-region { padding: 0; }
  .board-frame  { padding: 0; }
}

/* ─── Phase 3 — Portrait refinement (≤ 540px width) ─────────────────────────
   Already handled by the max-width: 540px block above; this block tightens
   the portrait card positioning so they sit in the top/bottom slack below
   and above the width-filled board. No board/chrome overlap. ─────────────── */
@media (orientation: portrait) and (max-width: 540px) {
  /* Opponent card: anchored to top slack; stat chip sits below topbar.
     Bottom of card must leave room for the board. Give it a max-height so
     it can't expand into the board on very short portrait sizes. */
  .float-card.float-tl {
    top: calc(60px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    max-height: 56px;
    overflow: hidden;
    border-radius: 10px;
  }
  /* You card: anchored to bottom slack, above the action bar */
  .float-card.float-br {
    left: auto;
    right: 8px;
    bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px));
    max-height: 44px;
    overflow: hidden;
    border-radius: 10px;
  }
  /* Action bar: sits at the very bottom in the safe-area gap */
  .float-actions {
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* Global toasts for lightweight UX feedback (variant fallback, lesson load). */
.global-toast {
  position: fixed;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(8, 12, 28, 0.88);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  font-size: var(--text-base);
  line-height: 1.2;
  color: var(--text-0);
  box-shadow: 0 10px 30px -14px rgba(0,0,0,0.8);
  animation: toast-in 0.22s ease-out;
}
.global-toast.toast-good { color: var(--accent-mint); border-color: rgba(141, 229, 193, 0.36); }
.global-toast.toast-warn { color: var(--accent-gold); border-color: rgba(247, 216, 119, 0.36); }
.global-toast.toast-info { color: var(--text-1); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══════════════════════════════════════════════════════════════════
   ACCESSIBILITY FLOOR — focus visibility, reduced motion, touch targets.
   Appended last so it authoritatively wins the cascade.
   ═══════════════════════════════════════════════════════════════════ */

/* Visible keyboard focus on every interactive control (brass ring, offset
   so it reads on dark grounds). Mouse users never see it (:focus-visible). */
.masthead-action:focus-visible,
.icon-btn:focus-visible,
.action-pill:focus-visible,
.promo-btn:focus-visible,
.opp-tile:focus-visible,
.variant-tile:focus-visible,
.tc-tile:focus-visible,
.mc:focus-visible,
.modal-close:focus-visible,
.toggle:focus-visible,
.seg-btn:focus-visible,
.btn:focus-visible,
.history-toggle:focus-visible,
.coach-toggle-btn:focus-visible,
.fcoach-close:focus-visible,
.opponent-select:focus-visible,
.share-chip:focus-visible,
.copy-btn:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Larger touch targets for the small icon affordances. */
.modal-close { width: 40px; height: 40px; }
.fcoach-close {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  padding: 0;
}

/* Respect prefers-reduced-motion — kill the looping/decorative animations
   (thinking dots, status pulse, nav pulse) and neutralise staggered reveals. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .fc-thinking .dot,
  .status-thinking::before,
  .fc-clock.active .sep,
  .nav-pulse { animation: none; }
}

/* ─── Touch pointers (iPad / iPhone) ─────────────────────────────────────
   Raise interactive controls to the ~44px touch floor. Gated on coarse
   pointers so desktop mouse layouts (pointer: fine) are untouched, and only
   ever enlarges — never shrinks a control another surface already sized. */
@media (pointer: coarse) {
  .float-actions .action-pill { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
  .seg-btn { min-height: 40px; display: inline-flex; align-items: center; }
  /* The toggle's 38×22 box is coupled to the knob geometry — grow only the hit
     area via a transparent overlay so the knob math stays intact. */
  .toggle { position: relative; }
  .toggle::before { content: ''; position: absolute; inset: -11px; }
}

/* ═══════════════════════════════════════════════════════════════════
   CYBER GLASS SYSTEM — observatory world, crystal pieces, play-first HUD.
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --bg-0: #01030a;
  --bg-1: #030817;
  --bg-2: #07152a;
  --panel: rgba(2, 8, 20, 0.7);
  --panel-strong: rgba(2, 7, 18, 0.94);
  --paper: #ecfdff;
  --paper-soft: #c7f3f7;
  --paper-dim: rgba(199, 243, 247, 0.72);
  --paper-ghost: rgba(199, 243, 247, 0.48);
  --brass: #32e9ff;
  --brass-soft: rgba(50, 233, 255, 0.44);
  --brass-faint: rgba(50, 233, 255, 0.13);
  --alert: #ff4bc1;
  --hairline: rgba(105, 231, 255, 0.2);
  --hairline-strong: rgba(105, 231, 255, 0.42);
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "JetBrains Mono", ui-monospace, monospace;
}

.app,
.app * { letter-spacing: 0; }
.app { background: var(--bg-0); }
.app::after { opacity: 0.012; mix-blend-mode: screen; }
.app.immersive::before { display: none; }

.app.immersive .board-region {
  isolation: isolate;
  overflow: hidden;
  background: var(--bg-0);
}
.app.immersive .board-region::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("/assets/backgrounds/cyber-glass-atrium.webp");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.96;
  filter: saturate(1.08) contrast(1.08) brightness(0.96);
  transform: translateY(-40px) scale(1.1);
  pointer-events: none;
}
.app.immersive .board-region::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  box-shadow: inset 0 0 84px 14px rgba(0, 2, 10, 0.16);
  pointer-events: none;
}
.app.immersive .board-frame { z-index: 1; }
.app.immersive .board.board-3d,
.board-3d-container { background: transparent; }
.board-3d-container::after {
  background: none;
  box-shadow: inset 0 0 96px 8px rgba(0, 3, 13, 0.12);
}

.topbar,
.topbar-immersive {
  min-height: 62px;
  background: rgba(1, 5, 14, 0.68);
  border-bottom: 1px solid rgba(72, 224, 255, 0.16);
  -webkit-backdrop-filter: blur(22px) saturate(120%);
  backdrop-filter: blur(22px) saturate(120%);
  box-shadow: 0 18px 46px rgba(0, 2, 10, 0.24);
}
.brand { gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(65, 228, 255, 0.48);
  border-radius: 4px;
  background: rgba(25, 160, 190, 0.06);
  box-shadow: inset 0 0 22px rgba(40, 231, 255, 0.1), 0 0 24px rgba(40, 231, 255, 0.08);
}
.brand-text {
  font-family: var(--font-display);
  font-style: normal;
  line-height: 0.95;
}
.brand-line-1 {
  font-family: var(--font-display);
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  color: var(--brass);
}
.brand-line-2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
}
.masthead-action,
.nav-btn {
  font-family: var(--font-display);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  color: var(--paper-dim);
}
.masthead-action {
  padding: 10px 12px;
  border-left: 1px solid rgba(50, 233, 255, 0.18);
}
.masthead-action:hover,
.nav-btn:hover { color: var(--brass); }
.icon-btn {
  border: 1px solid rgba(50, 233, 255, 0.16);
  border-radius: 5px;
  background: rgba(1, 8, 21, 0.72);
  color: var(--paper-dim);
}
.icon-btn:hover {
  border-color: rgba(50, 233, 255, 0.54);
  color: var(--brass);
  box-shadow: inset 0 0 18px rgba(50, 233, 255, 0.07), 0 0 20px rgba(50, 233, 255, 0.1);
}

.float-card,
.float-status,
.float-actions,
.float-history,
.float-coach,
.coach-toggle-btn,
.history-toggle {
  background: rgba(2, 8, 21, 0.72);
  border-color: rgba(64, 226, 255, 0.2);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
  box-shadow: 0 20px 58px rgba(0, 2, 12, 0.48), inset 0 1px 0 rgba(213, 251, 255, 0.035);
}
.float-card {
  min-width: 292px;
  padding: 11px 12px;
  border-radius: 5px;
  overflow: hidden;
}
.float-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--alert);
  box-shadow: 0 0 18px rgba(255, 75, 193, 0.72);
}
.float-card[data-side="black"]::before { left: 0; }
.float-card[data-side="white"]::before {
  right: 0;
  left: auto;
  background: var(--brass);
  box-shadow: 0 0 18px rgba(50, 233, 255, 0.72);
}
.float-tl { top: 78px; left: 18px; }
.float-br { bottom: 18px; right: 18px; }
.float-card .fc-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-style: normal;
  font-weight: 700;
  color: var(--paper);
}
.float-card .fc-sub,
.status-kicker,
.fcoach-label {
  font-family: var(--font-display);
  color: var(--brass);
}
.float-card[data-side="black"] .fc-sub { color: #ff8bd7; }
.float-card .avatar {
  border-color: rgba(50, 233, 255, 0.38);
  box-shadow: 0 0 18px rgba(50, 233, 255, 0.09);
}
.float-card[data-side="black"] .avatar {
  border-color: rgba(255, 75, 193, 0.42);
  box-shadow: 0 0 18px rgba(255, 75, 193, 0.1);
}
.clock,
.fc-clock {
  color: var(--paper);
  background: rgba(0, 4, 14, 0.82);
  border-color: rgba(80, 229, 255, 0.18);
  border-radius: 4px;
  font-weight: 650;
}
.clock.active,
.fc-clock.active {
  border-color: var(--brass);
  color: #efffff;
  box-shadow: 0 0 24px rgba(50, 233, 255, 0.2), inset 0 0 18px rgba(50, 233, 255, 0.04);
}
.float-card[data-side="black"] .fc-clock.active {
  border-color: var(--alert);
  box-shadow: 0 0 24px rgba(255, 75, 193, 0.19), inset 0 0 18px rgba(255, 75, 193, 0.04);
}

.float-status {
  top: 78px;
  gap: 9px;
  padding: 7px 9px 7px 12px;
  border-radius: 4px;
}
.status-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
}
.status-ply {
  padding: 4px 7px;
  border-left: 1px solid rgba(105, 231, 255, 0.2);
  color: var(--paper-ghost);
  font-family: var(--font-display);
  font-size: 10px;
}
.status-good::before,
.status-ok::before,
.status-white::before,
.status-black::before,
.status-thinking::before {
  background: var(--brass);
  box-shadow: 0 0 14px rgba(50, 233, 255, 0.78);
}
.status-bad::before,
.status-danger::before {
  background: var(--alert);
  box-shadow: 0 0 16px rgba(255, 75, 193, 0.82);
}

.float-actions {
  bottom: 18px;
  border-radius: 6px;
  padding: 4px;
}
.action-pill {
  min-height: 40px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  color: var(--paper-dim);
  padding: 9px 11px;
}
.action-pill:hover:not(:disabled) {
  color: var(--brass);
  background: rgba(50, 233, 255, 0.07);
}
.action-pill:focus-visible { outline-color: var(--brass); }
.action-pill.danger { color: #ff9cdd; }
.action-pill.danger:hover:not(:disabled) {
  color: #ffd0ec;
  background: rgba(255, 75, 193, 0.09);
}
.action-pill .kbd,
.action-pill kbd { display: none; }

.float-coach {
  bottom: 18px;
  left: 18px;
  max-width: 370px;
  padding: 12px 14px;
  border-left: 2px solid var(--brass);
  border-radius: 4px;
}
.fcoach-head { margin-bottom: 7px; }
.fcoach-line {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-style: normal;
  line-height: 1.42;
  color: var(--paper-soft);
}
.fcoach-next {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(50, 233, 255, 0.14);
  color: var(--paper-dim);
  font-size: 12px;
  line-height: 1.38;
}
.fcoach-next span {
  color: var(--brass);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.coach-toggle-btn {
  bottom: 18px;
  left: 18px;
  border-radius: 4px;
}
.coach-toggle-btn:hover,
.fcoach-close:hover { color: var(--brass); }

.float-eval {
  right: 66px;
  background: rgba(2, 8, 21, 0.64);
  border-color: rgba(50, 233, 255, 0.18);
  border-radius: 4px;
}
.feb-white,
.eval-white { background: #dffcff; }
.history-toggle { border-radius: 4px 0 0 4px; }

.modal {
  background: rgba(2, 7, 18, 0.96);
  border-color: rgba(50, 233, 255, 0.26);
  border-radius: 6px;
  box-shadow: 0 30px 96px rgba(0, 1, 9, 0.78), 0 0 54px rgba(50, 233, 255, 0.07);
}
.modal h1,
.modal h2,
.modal h3 {
  font-family: var(--font-display);
  font-style: normal;
}
.modal .btn { border-radius: 4px; }
.gameover-grid .modal-actions { border-top: 1px solid rgba(50, 233, 255, 0.14); padding-top: 16px; }

@media (max-width: 900px) {
  .app.immersive .board-region::before {
    opacity: 0.92;
    filter: saturate(0.96) contrast(1.02) brightness(0.92);
  }
  .float-card { min-width: 0; }
  .float-card.float-tl { width: 278px; max-width: 278px; }
  .float-status { top: 68px; }
}

@media (max-width: 540px) {
  .app.immersive .board-region::before {
    background-position: 32% center;
    opacity: 0.68;
  }
  .app.immersive .board-region::after { box-shadow: inset 0 0 90px 18px rgba(0, 2, 10, 0.7); }
  .topbar,
  .topbar-immersive { min-height: 56px; }
  .brand-line-1,
  .topbar-immersive .brand-line-1 { display: block; }
  .topbar-immersive .brand-line-2 { font-size: 14px; }
  .masthead-action { padding: 9px 8px; border-left: 0; }
  .float-status { top: 116px; }
  .status-ply { display: none; }
  .float-actions { bottom: max(12px, env(safe-area-inset-bottom)); }
  .float-actions .action-pill { padding: 8px; }
  .float-card.float-tl { top: 60px; }
  .float-card.float-br { bottom: 66px; }
  .float-coach { bottom: 142px; }
  .fcoach-next { grid-template-columns: 36px 1fr; }
}

@media (max-width: 360px) {
  .float-actions .action-pill[aria-label="Offer draw"] { display: none; }
}

/* ─── V3.12 — Glass Atrium hero pass ──────────────────────────────── */
@media (min-width: 901px) {
  .topbar,
  .topbar-immersive {
    min-height: 68px;
    padding-left: 24px;
    padding-right: 24px;
    background: rgba(1, 6, 17, 0.52);
    border-bottom-color: rgba(110, 239, 255, 0.12);
    box-shadow: 0 16px 48px rgba(0, 2, 10, 0.3);
  }
  .brand-mark {
    width: 42px;
    height: 42px;
    border-color: rgba(91, 236, 255, 0.6);
    box-shadow: inset 0 0 24px rgba(40, 231, 255, 0.14), 0 0 30px rgba(40, 231, 255, 0.12);
  }
  .brand-line-1 { font-size: 9px; }
  .brand-line-2 { font-size: 19px; }
  .masthead-action {
    border: 1px solid rgba(76, 229, 255, 0.24);
    border-radius: 4px;
    background: rgba(6, 29, 50, 0.34);
    color: var(--paper);
  }
  .masthead-action:hover {
    border-color: rgba(106, 242, 255, 0.66);
    background: rgba(16, 72, 94, 0.38);
    box-shadow: 0 0 24px rgba(40, 231, 255, 0.12);
  }
  .float-card {
    min-width: 268px;
    padding: 10px 12px;
    background: rgba(2, 10, 26, 0.58);
    border-color: rgba(110, 239, 255, 0.16);
    box-shadow: 0 16px 54px rgba(0, 2, 12, 0.42), inset 0 1px 0 rgba(214, 252, 255, 0.06);
  }
  .float-tl { top: 88px; left: 24px; }
  .float-br { bottom: 24px; right: 24px; }
  .float-status {
    top: 90px;
    background: rgba(2, 12, 28, 0.58);
    border-color: rgba(110, 239, 255, 0.14);
  }
  .float-actions {
    bottom: 24px;
    padding: 5px;
    background: rgba(2, 10, 25, 0.6);
    border-color: rgba(110, 239, 255, 0.16);
  }
  .float-actions .board-actions { gap: 2px; }
  .float-actions .action-pill {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
  }
  .float-actions .action-pill .ap-text,
  .float-actions .actions-spacer { display: none; }
  .coach-toggle-btn { bottom: 24px; left: 24px; }
  .history-toggle { right: 0; }
}
