/* Existing diagnostics detail/review components. */
:root {
  /* Think64 primitives (think64 src/index.css @theme, design/brand-assets/tokens.json) */
  --t64-surface: #0e1321;
  --t64-surface-lowest: #090e1c;
  --t64-surface-low: #161b2a;
  --t64-surface-container: #1a1f2e;
  --t64-surface-high: #252a39;
  --t64-surface-highest: #303444;
  --t64-surface-bright: #343948;
  --t64-text: #dee2f6;
  --t64-text-muted: #c3c5d8;
  --t64-outline: #8d90a2;
  --t64-outline-variant: #434656;
  --t64-cobalt: #1d63ff;
  --t64-cobalt-hover: #0051e1;
  --t64-cobalt-active: #003cac;
  --t64-cobalt-soft: #b5c4ff;
  --t64-on-cobalt: #f6f5ff;
  --t64-cyan: #7bd0ff;
  --t64-rose: #ffb4ab;

  /* Existing names, re-pointed (do not rename) */
  --bg: var(--t64-surface);
  --surface: var(--t64-surface-low);
  --surface-2: var(--t64-surface-lowest);
  --text: var(--t64-text);
  --accent: var(--t64-cobalt);
  --accent-300: var(--t64-cobalt-soft);
  --accent-400: var(--t64-cobalt-soft);
  --accent-800: rgb(29 99 255 / 22%);
  --accent-900: var(--t64-surface-container);
  --n300: var(--t64-text);
  --n400: var(--t64-text-muted);
  --n500: var(--t64-outline);
  --n600: var(--t64-outline);
  --n800: var(--t64-outline-variant);
  --divider: rgb(67 70 86 / 50%);
  --divider-soft: rgb(67 70 86 / 40%);
  --divider-strong: rgb(67 70 86 / 70%);
  --border: var(--divider);
  --ok: var(--t64-cyan);
  --warn: #f0c36b;
  --bad: var(--t64-rose);
  --sq-light: var(--t64-outline-variant);
  --sq-dark: var(--t64-surface-high);
  --side-white: #dee2f6;
  --side-white-fill: rgb(222 226 246 / 28%);
  --side-black: #8d90a2;
  --side-black-fill: rgb(141 144 162 / 28%);
  --body: 14px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --font: Inter, ui-sans-serif, system-ui, sans-serif;
  --headline: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Semantic aliases */
  --surface-low: var(--t64-surface-low);
  --surface-container: var(--t64-surface-container);
  --surface-high: var(--t64-surface-high);
  --surface-highest: var(--t64-surface-highest);
  --text-muted: var(--t64-text-muted);
  --text-muted-85: rgb(195 197 216 / 85%);
  --text-muted-80: rgb(195 197 216 / 80%);
  --text-muted-70: rgb(195 197 216 / 70%);
  --text-muted-60: rgb(195 197 216 / 60%);
  --outline: var(--t64-outline);
  --outline-variant: var(--t64-outline-variant);
  --accent-hover: var(--t64-cobalt-hover);
  --accent-active: var(--t64-cobalt-active);
  --on-accent: var(--t64-on-cobalt);
  --accent-wash: rgb(29 99 255 / 16%);
  --ok-wash: rgb(123 208 255 / 14%);
  --warn-wash: rgb(240 195 107 / 14%);
  --bad-wash: rgb(255 180 171 / 14%);
  --secondary: var(--t64-cyan);

  /* Data palette (validated with the dataviz checks on #0e1321) */
  --series-1: #497ef7;
  --series-2: #00a3ab;
  --series-3: #b98a00;
  --series-4: #d14e95;
  --ok-mark: #00a3ab;
  --bad-mark: #d5584d;
  --warn-mark: #b98a00;
  --neutral-fill: #8d90a2;
  --chart-grid: var(--divider);
  --chart-axis: var(--t64-outline);
  --chart-line: var(--series-1);
  --chart-point: var(--t64-cobalt-soft);
  --track: rgb(67 70 86 / 60%);

  /* Motion (think64 src/index.css) */
  --duration-stagger: 40ms;
  --duration-micro: 80ms;
  --duration-quick: 150ms;
  --duration-fast: 250ms;
  --duration-medium: 350ms;
  --duration-slow: 400ms;
  --duration-very-slow: 500ms;
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: ease-in-out;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: var(--body) / 22px var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-color: var(--outline-variant) var(--bg);
}
html,
body {
  overflow-x: clip;
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--outline-variant);
  border: 2px solid var(--bg);
  border-radius: var(--radius-full);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
input,
select {
  caret-color: var(--accent);
}
input::placeholder {
  color: var(--text-muted-70);
  opacity: 1;
}
option {
  background: var(--surface-high);
  color: var(--text);
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-300);
  outline-offset: 2px;
}
a {
  color: var(--accent-300);
}
.topbar-spacer {
  flex: 1;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
}
/* Page headings: Plus Jakarta Sans, tight tracking, more space above than below.
   Zero-specificity so component classes (chart titles, row titles) still win. */
:where(#content) :where(h1) {
  font: 700 32px/40px var(--headline);
  letter-spacing: -0.025em;
  color: var(--text);
}
:where(#content) :where(h2) {
  font: 600 20px/28px var(--headline);
  letter-spacing: -0.025em;
  color: var(--text);
}
:where(#content) :where(h3) {
  font: 600 16px/24px var(--headline);
  color: var(--text);
}
main {
  padding: 28px clamp(18px, 4vw, 48px) 64px;
  min-width: 0;
}
.page-head {
  display: flex;
  gap: 20px;
  align-items: start;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 4px 0 4px;
  font: 700 32px/40px var(--headline);
  letter-spacing: -0.025em;
  color: var(--text);
}
.page-head p {
  color: var(--text-muted-80);
  margin: 0;
}
.head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
/* Buttons: flat cobalt primary, ghost secondary, rose-text danger. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted-85);
  font: 600 14px/20px var(--font);
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color var(--duration-quick),
    color var(--duration-quick);
}
.btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}
.panel .btn:hover:not(:disabled) {
  background: var(--surface-high);
}
.btn.primary {
  padding: 0 16px;
  background: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover:not(:disabled),
.panel .btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--on-accent);
}
.btn.primary:active:not(:disabled) {
  background: var(--accent-active);
}

.filters,
.panel {
  background: var(--surface);
  border: 1px solid var(--divider-soft);
  border-radius: var(--radius);
}
.filters {
  padding: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.field {
  display: grid;
  gap: 4px;
  color: var(--text-muted-70);
  font: 600 11px/14px var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* Think64 underline inputs: no box, 2px rule that lights cobalt on focus. */
.field input,
.field select {
  min-width: 130px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--outline-variant);
  border-radius: 0;
  padding: 10px 0;
  color: var(--text);
  font: 400 16px/26px var(--font);
  letter-spacing: normal;
  text-transform: none;
  caret-color: var(--accent);
  color-scheme: dark;
  transition: border-color var(--duration-fast);
}
.field input:hover,
.field select:hover {
  border-bottom-color: rgb(29 99 255 / 70%);
}
.field input:focus,
.field select:focus {
  border-bottom-color: var(--accent);
  outline: none;
}
.grid {
  display: grid;
  gap: 14px;
}
.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.phases {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 16px 20px;
}
.review-panel {
  padding: 16px;
}

.muted {
  color: var(--n500);
}

/* Findings are a hairline list inside their panel, not nested cards. */
.finding {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}
.finding:last-child {
  border-bottom: 0;
}
.finding h3 {
  margin: 0 0 4px;
  font: 600 16px/24px var(--headline);
  color: var(--text);
}
.finding p {
  margin: 0;
  color: var(--text-muted-80);
  font-size: 14px;
  line-height: 22px;
}

/* Tables: transparent header, hairline rows, no zebra. */

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

.board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(360px, 100%);
  aspect-ratio: 1;
  margin: 15px 0;
  border: 1px solid var(--divider);
}
.sq {
  display: grid;
  place-items: center;
  font-size: clamp(18px, 4vw, 32px);
}
.sq img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.sq.light {
  background: var(--sq-light);
}
.sq.dark {
  background: var(--sq-dark);
}
.review-board {
  max-width: 480px;
}

.timeline {
  display: flex;
  gap: 2px;
  overflow: auto;
  padding: 10px 0;
}
/* Move strips: ghost SAN buttons; the current move gets a cobalt wash and,
   outside the review list, the 2px cobalt bar over the track. */
.timeline:not(.review-moves) {
  background: linear-gradient(var(--track), var(--track)) left bottom / 100%
    2px no-repeat;
}
.timeline button {
  position: relative;
  border: 0;
  min-width: 34px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted-85);
  font: 500 14px/20px var(--font);
  font-variant-numeric: tabular-nums;
  transition:
    background-color var(--duration-quick),
    color var(--duration-quick);
}
.timeline button:hover {
  background: var(--surface-container);
  color: var(--text);
}
.timeline button[aria-current="true"] {
  background: var(--accent-800);
  color: var(--text);
}
.timeline:not(.review-moves) button {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.timeline:not(.review-moves) button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--duration-fast) var(--ease-smooth-out);
}
.timeline:not(.review-moves) button[aria-current="true"]::after {
  transform: scaleX(1);
}
.empty,
.notice {
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted-80);
  font: 400 14px/22px var(--font);
}
.notice .btn,
.empty .btn {
  margin-left: 8px;
}
.selection-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0;
  text-align: left;
}
.rd-page[aria-busy="true"] > :not(header):not(.selection-status) {
  opacity: .55;
}
.rd-loading-placeholder {
  min-height: 160px;
}
.selection-status .btn {
  margin-left: 0;
}
.error,
.notice.error {
  color: var(--bad);
}

@media (max-width: 959px) {
  .rail {
    min-height: auto;
    padding: 8px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--divider);
    overflow: auto;
  }
  .nav {
    display: flex;
    margin: 6px 0 0;
    overflow: auto;
  }
  .nav a {
    white-space: nowrap;
  }
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  main {
    padding: 20px 14px 48px;
  }
  .topbar {
    padding: 0 14px;
  }
  .page-head {
    display: block;
  }
  .head-actions {
    margin-top: 14px;
  }
  .phases {
    grid-template-columns: 1fr;
  }
  .metrics {
    gap: 8px;
  }
  .panel {
    padding: 16px;
  }
  .review-panel {
    padding: 13px;
  }
  .filters .field {
    flex: 1 1 130px;
  }
  .filters .field input,
  .filters .field select {
    min-width: 0;
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

.nav a {
  text-decoration: none;
}

/* Stitch overview, games, and shared shell. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
svg {
  flex-shrink: 0;
}
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 256px;
  padding: 0 16px;
  background: var(--surface-2);
  border: 0;
  border-right: 1px solid var(--divider-soft);
  overflow-y: auto;
}
/* Lockup: mark and wordmark as one unit, the mark's left edge on the nav icon
   column (rail 16px + item 12px) and centred on the wordmark's cap band. */
.brand-lockup {
  height: 64px;
  display: flex;
  align-items: center;
  padding-left: 12px;
}
/* Lockup: mark 22 / type 26, gap 0.25x the type (Think64 tokens.json). */
.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font: 700 26px/32px var(--headline);
  letter-spacing: -0.025em;
  text-decoration: none;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.brand-glyph {
  width: 22px;
  height: 22px;
  flex: none;
  display: block;
  /* Cap band of Jakarta 700 at 26px sits ~0.8px below the line-box centre. */
  transform: translateY(1px);
}
.brand-64 {
  color: var(--accent);
}

.nav {
  display: grid;
  gap: 4px;
  margin: 0;
  overflow: visible;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: var(--radius);
  font: 500 14px/20px var(--font);
  color: var(--text-muted-85);
  white-space: nowrap;
  transition:
    background-color var(--duration-quick),
    color var(--duration-quick);
}
.nav a[aria-current="page"] {
  font-weight: 600;
}
.nav-icon {
  display: flex;
  transition: color var(--duration-quick);
}
.nav a[aria-current="page"] .nav-icon {
  color: var(--accent-300);
}
.nav-icon svg {
  width: 20px;
  height: 20px;
}
.nav-count {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--surface-container);
  font: 600 11px/16px var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.shell {
  margin-left: 256px;
  min-height: 100vh;
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  gap: 20px;
  background: var(--bg);
  border: 0;
  z-index: 25;
}
.sync-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--n400);
  font-size: 11px;
  font-weight: 500;
}
.sync-status svg {
  width: 16px;
  height: 16px;
  color: var(--ok);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted-85);
  text-decoration: none;
  transition:
    background-color var(--duration-quick),
    color var(--duration-quick);
}
.icon-button:hover {
  background: var(--surface);
  color: var(--text);
}
.icon-button svg {
  width: 20px;
  height: 20px;
}
.menu-toggle {
  display: none;
}
main {
  max-width: none;
  padding: 0 20px 40px;
}
main:has(> :not(.rd-page)) {
  padding-top: 24px;
}
main:has(> .rd-page) {
  padding-top: 0;
}
.rd-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;
}
.rd-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.rd-page svg {
  width: 20px;
  height: 20px;
}

/* Segmented filters: labels over a 2px track; the active label turns ink and
   one 2px cobalt bar (.rd-slider, positioned by redesign.js attachSlider)
   slides beneath it. Shared by timeframe, pills, chart series, pagination and
   the openings segments. */

/* Tiles: card tone + 40% hairline, no shadow. */

/* Overview tiles share the .rd-stat-tile measurements: flex column, 8px rhythm,
   148px floor, label 11/14 eyebrow, 32/40 figure, 12/16 foot. */

/* One inline 16px icon for every time class (the .rd-stat-tile-label icon);
   identity lives in the label. */

/* Deltas and badges: tone text on a 14% tone wash, tabular numerals. */

.is-positive {
  color: var(--ok);
}
.is-negative {
  color: var(--bad);
}
.is-muted {
  color: var(--text-muted-70);
}

/* Bars: 4px full-radius track, segments split by 2px gaps. */

/* Shared headline tile: every page's headline metrics use this one component
   (Opening, Middlegame, Endgame, Tactics, Time control) so font, colour and size
   match the overview tiles above. */

/* Fixed-height head (two 14px label lines fit in 36px) so every figure in a row
   starts on the same line whatever the label length; badges live in the value row. */

/* Figure plus its badge: badge right-aligned on the figure's baseline; when a word
   figure fills the line the badge wraps under it, left-aligned. */

/* Three tiles stay one row while each can hold a two-line word figure. */

/* Two-up below 1280, like the overview tiles: four-up tiles narrower than ~230px
   cannot hold a 32px word figure ("Middlegame") on one line. */

/* Phones: the Think64 hairline rows the overview tiles use. */
@media (max-width: 760px) {
  
  
  
  
  
  /* Rows: the figure keeps the right edge; a badge sits just before it. */
  
  
  
  
}

/* Four-up only from 1280; two-up between the phone rows and 1280. */

@media (max-width: 760px) {
  .rail {
    transform: translateX(-100%);
    padding-top: 52px;
    background: var(--surface-2);
    transition: transform var(--duration-quick) var(--ease-smooth-out);
  }
  .nav-open .rail {
    transform: translateX(0);
    transition-duration: var(--duration-fast);
  }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgb(9 14 28 / 60%);
    pointer-events: none;
    animation: backdrop-in var(--duration-fast) var(--ease-smooth-out);
  }
  .brand-lockup {
    height: 60px;
  }
  .nav a {
    min-height: 42px;
  }
  .shell {
    margin-left: 0;
  }
  .menu-toggle {
    display: grid;
    position: relative;
    z-index: 60;
  }
  .topbar {
    z-index: 40;
    padding: 0 14px;
    gap: 12px;
  }
  main {
    padding: 0 14px 32px;
  }
  .rd-page {
    gap: 16px;
  }
  
  
  
  
  /* Phone tiles collapse into Think64 hairline rows: label left, figure right. */
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
}
@media (max-width: 440px) {
  
  
  
  
  .sync-status {
    font-size: 11px;
  }
  
}

.sync-status:has(.error) svg {
  color: var(--bad);
}

/* Review refinements: quieter chrome, clear matchups, and stable refreshes. */
.rail .nav {
  margin-top: 38px;
}

.review-panel {
  max-width: 1040px;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(220px, var(--review-board-size, 480px)) minmax(
      0,
      1fr
    );
  gap: 20px;
  align-items: start;
  overflow: hidden;
}

.review-player {
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-color {
  width: 12px;
  height: 12px;
  border: 1px solid var(--outline);
  border-radius: var(--radius-full);
}
.review-color.white {
  background: var(--text);
  border-color: var(--outline);
}
.review-color.black {
  background: var(--surface-2);
  border-color: var(--outline);
}
.review-board {
  grid-column: 1;
  grid-row: 2;
  width: var(--review-board-size, 100%);
  height: var(--review-board-size, auto);
}
.review-controls {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.review-moves {
  grid-column: 2;
  grid-row: 2 / 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 0;
  gap: 4px;
}
.review-moves {
  align-content: start;
}
.review-moves button {
  text-align: left;
  padding: 10px;
  border-radius: var(--radius-sm);
}
.review-moves button:first-child {
  grid-column: 1 / -1;
}
@media (max-width: 760px) {
  
  
  .review-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .review-controls,
  .review-moves {
    width: 100%;
  }
  .review-moves {
    height: auto;
    min-height: 64px;
    max-height: none;
    flex: 1;
  }
  .review-player {
    font-size: 12px;
  }
}

/* Refined Stats navigation and compact account management. */
.stats-nav-row {
  display: flex;
  align-items: center;
}
.stats-nav-row > a {
  flex: 1;
}
/* One chevron grammar: 16px SVG, 1.5px round stroke, cobalt soft; it turns
   180deg when its control is expanded. */
.chevron {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--accent-300);
  transition: transform var(--duration-fast) var(--ease-smooth-out);
}
.chevron svg,
.icon-button .chevron svg {
  width: 16px;
  height: 16px;
  /* 1.5px at 16px on the 24-unit icon grid. */
  stroke-width: 2.25;
}
[aria-expanded="true"] > .chevron {
  transform: rotate(180deg);
}
.stats-nav-row > button {
  flex: none;
  width: 28px;
  height: 28px;
  margin-right: 6px;
}
.stats-pages:not([hidden]) {
  display: grid;
  gap: 2px;
  padding-left: 32px;
}
.stats-pages a {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted-80);
}
.stats-pages a[aria-current="page"] {
  color: var(--text);
}

.review-board-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  align-items: flex-start;
}
.review-board-column .review-board {
  margin: 0;
}
.review-board-column .review-controls {
  width: 100%;
}
.review-panel > .review-moves {
  grid-column: 2;
  grid-row: auto;
  max-height: none;
}
.review-page {
  --review-board-size: 480px;
  display: flex;
  flex-direction: column;
  height: var(--review-viewport-height, calc(100dvh - 88px));
  min-height: 0;
  overflow: hidden;
}
.review-page > .page-head {
  flex: 0 0 auto;
  margin-bottom: 14px;
}
main:has(> .review-page) {
  height: calc(100dvh - 64px);
  padding-bottom: 16px;
  overflow: hidden;
}
@media (max-height: 500px) and (min-width: 761px) {
  body:has(.review-page) .topbar {
    display: none;
  }
  main:has(> .review-page) {
    height: 100dvh;
    padding-top: 10px;
    padding-bottom: 8px;
  }
  .review-page > .page-head {
    align-items: center;
    margin-bottom: 6px;
  }
  .review-page > .page-head h1 {
    margin: 0 0 2px;
    font-size: 20px;
    line-height: 26px;
  }
  .review-page > .page-head p {
    font-size: 12px;
  }
  .review-panel {
    gap: 12px;
    padding: 8px;
  }
  .review-board-column {
    gap: 4px;
  }
  .review-player {
    gap: 5px;
    font-size: 11px;
    line-height: 1.2;
  }
  .review-color {
    width: 9px;
    height: 9px;
  }
  .review-controls {
    gap: 4px;
  }
  .review-controls .btn {
    min-height: 32px;
    padding: 4px 10px;
  }
  .review-moves button {
    padding: 6px 8px;
  }
}
@media (max-width: 760px) {
  
  .stats-pages a {
    min-height: 40px;
  }
  .review-board-column {
    width: 100%;
    gap: 6px;
  }
  .review-panel > .review-moves {
    max-height: none;
  }
  .review-page > .page-head {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
  }
  .review-page > .page-head h1 {
    font-size: 20px;
    line-height: 24px;
  }
  .review-page > .page-head p {
    font-size: 12px;
  }
  .review-page > .page-head .head-actions {
    margin: 0 0 0 auto;
  }
  .review-page > .page-head .btn {
    white-space: nowrap;
  }
  .review-board-column .review-board {
    width: var(--review-board-size);
    height: var(--review-board-size);
    align-self: center;
  }
  main:has(> .review-page) {
    height: calc(100dvh - 64px);
    padding-bottom: 8px;
  }
}

/* Account selection belongs to the navigation and stays visible across pages. */
.sidebar-account {
  position: relative;
  margin: 22px 12px 0;
}
/* The native select stays as the accessible source of truth, visually hidden;
   the trigger and listbox below draw it in Think64's underline grammar. */
.sidebar-account .account-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid var(--outline-variant);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 500 14px/20px var(--font);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-fast);
}
.account-trigger-logo,
.account-option-logo {
  display: inline-flex;
  flex: none;
  width: 18px;
  height: 18px;
  margin-right: 10px;
  color: var(--text);
}
.account-trigger-logo:empty,
.account-option-logo:empty {
  display: none;
}
.account-trigger-logo svg,
.account-option-logo svg {
  width: 18px;
  height: 18px;
}
.account-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-trigger:hover:not(:disabled) {
  border-bottom-color: rgb(29 99 255 / 70%);
}
.account-trigger:focus-visible,
.account-trigger[aria-expanded="true"] {
  border-bottom-color: var(--accent);
  outline: none;
}
.account-trigger:disabled {
  opacity: 1;
  cursor: default;
  color: var(--text-muted-70);
}
.account-trigger:disabled .chevron {
  color: var(--text-muted-60);
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
/* Fixed and outside the rail (see index.html), so the rail's scroll box never
   clips it; app.js sets top/left and min-width (trigger) / max-width (320px) on open. */
.account-menu {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  width: max-content;
  max-width: 320px;
  max-height: 288px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--divider-strong);
  border-radius: var(--radius);
  background: var(--surface-high);
  outline: none;
  animation: menu-in var(--duration-quick) var(--ease-smooth-out);
}
.account-menu[hidden] {
  display: none;
}
.account-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted-85);
  font: 400 14px/20px var(--font);
  cursor: pointer;
  transition:
    background-color var(--duration-quick),
    color var(--duration-quick);
}
.account-option:hover,
.account-option.is-active {
  background: var(--surface-container);
  color: var(--text);
}
.account-option.is-selected {
  color: var(--text);
  font-weight: 600;
}
.account-option-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent-300);
}
.account-option-check svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.25;
}
.account-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu:focus-visible .account-option.is-active {
  outline: 1px solid var(--accent-300);
  outline-offset: -1px;
}
.sidebar-account + .nav {
  margin-top: 20px;
}

.review-player {
  width: min(100%, var(--review-board-size));
  min-width: 0;
}
.review-player strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-color {
  flex-shrink: 0;
}
.review-clock {
  flex-shrink: 0;
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--surface-container);
  color: var(--text);
  font: 600 13px/1.2 var(--headline);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 760px) {
  .review-player {
    align-self: center;
  }
}
@media (max-height: 500px) and (min-width: 761px) {
  .review-clock {
    padding: 2px 5px;
    font-size: 11px;
  }
}

/* Stats › Opening (openings.js): repertoire table + opening-tree explorer. */
/* Shared Stats filter toolbar: no box, just labelled segmented tracks. */

/* Same header grammar as every Stats page: H1 left, filters right, top-aligned;
   stacks under 760px (openings.css). */

/* Status badges (left-book deviation), not filters: tone text on tone wash. */

/* Openings search and select: underline inputs, cobalt on focus. */

@media (max-width: 767px) {
  
  
  
  
  
  
  
  
  
  
  
  /* Repertoire rows become stacked cards: name, ECO · line, then metrics. */
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
}

/* Compact opening workspace: one focused view with bounded repertoire pages. */

/* The same table surface used by Games. */

/* Balance metric columns while leaving room for opening names. */
@media (min-width: 701px) {
  
  
  
  
  
  
  
  
  
  
  
  /* Align the table's outer columns with the card header's 20px inset. */
  
  
  
}

/* Games table on phones: rows stack like the Opening repertoire (match up as the
   row title, then labelled time control / result / moves / date pairs). */

/* Profile Overview header: the shared Stats page header (Headline XL H1 left,
   filters right and top-aligned, stacking under 760px). */

.engine-progress {
  min-height: 20px;
  padding: 4px 20px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 760px) {
  .engine-progress { padding-inline: 14px; }
}

/* ---------------------------------------------------------------------------
   Stats pages, shared (redesign.js): page header, hairline result rows with the
   W/D/L rate cell, the status banner, and the loading skeleton. Every Stats
   page and the Profile Overview use these, so they load and read the same way.
   ------------------------------------------------------------------------- */

/* Retained results dim only when a replacement takes longer than a blink. */
.rd-page[aria-busy="true"] > :not(header):not(.selection-status) {
  transition: opacity var(--duration-quick) var(--ease-smooth-out) 120ms;
}

/* Word figures (an opening or position type) wrap rather than shrink. */

@media (max-width: 760px) {
  /* Phone rows: a word figure takes its own line under the label and badge. */
  
  
  
}

/* Status banner (preparing data, unavailable sections, Games type scope). */
.rd-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 16px;
  border: 1px solid var(--divider-soft);
  border-radius: var(--radius);
  font: 400 13px/20px var(--font);
  color: var(--text-muted-80);
}
.rd-status > span:not(.rd-status-chip) {
  flex: 1 1 280px;
}
.rd-status .btn {
  margin: 0;
}
.rd-status-chip {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-high);
  color: var(--text);
  font: 500 12px/16px var(--font);
  white-space: nowrap;
}

/* Hairline result rows: one card, an eyebrow header row, one row per item. */

/* Win % then the W/D/L bar. */

/* Row actions: a 32px round target holding the one chevron. */

/* Variations: a tonal block under their opening, no hairlines inside it. */

/* Stage shares: a 4px cobalt track. */

/* Narrow cards (phones, tablets beside the rail): name and action on one line,
   figures beneath, each with its label. */

/* Loading skeleton: the page's real header, tiles and a card, at rest. */

@keyframes rd-skeleton-pulse {
  from { opacity: .45; }
  to { opacity: 1; }
}

.nav a.is-section {
  color: var(--text);
  font-weight: 600;
}
.nav a.is-section .nav-icon {
  color: var(--accent-300);
}

