:root {
  --bg: #312e2b;
  --panel: #262421;
  --text: #e8e6e3;
  --muted: #a09d9a;
  --light-sq: #ecdab9;
  --dark-sq: #ae8a68;
  --accent: #7fa650;
  --accent-dark: #5d7a3a;
  --highlight: rgba(255, 213, 79, 0.55);
  --check: rgba(224, 82, 82, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* The persistent main landmark wrapping the switchable views —
   layout-neutral: it stretches within .app exactly as the views did. */
.app > main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0.25rem 0.75rem;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.brand { font-size: 1.4rem; font-weight: 700; }

.app-version {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.status {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
  flex: 1;
}

/* Stack before the board column gets narrower than the board wants to be —
   tablets in portrait were overlapping at the old 760px breakpoint. */
@media (max-width: 950px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---- Board ---- */
.board-wrap { display: flex; justify-content: center; }

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(92vw, 640px, calc(100vh - 180px));
  width: min(92vw, 640px, calc(100dvh - 180px));
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
  container-type: inline-size;
}

.board.flipped { transform: rotate(180deg); }
.board.flipped .square { transform: rotate(180deg); }

/* ARIA rows are grouping-only: their cells stay direct CSS-grid items. */
.board-row { display: contents; }

.square:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 1;
}

.square {
  position: relative;
  border: none;
  padding: 0;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
}

.square.light { background: var(--light-sq); }
.square.dark { background: var(--dark-sq); }

.square .piece {
  font-size: min(9vw, 3.2rem);
  /* Size glyphs relative to the board itself so a height-limited board
     (phone landscape) never overflows its squares. 1cqw = 1% board width. */
  font-size: 9.5cqw;
  line-height: 1;
  pointer-events: none;
}

/* Render both colors from the filled glyph set so pieces look solid,
   then color them — the outline set is hard to read on small screens. */
.square.white-piece .piece {
  color: #f9f9f9;
  text-shadow: 0 0 2px #333, 0 1px 2px rgba(0,0,0,0.6);
}
.square.black-piece .piece {
  color: #2b2b2b;
  text-shadow: 0 0 2px rgba(255,255,255,0.35);
}

.square.selected { background: var(--highlight); }
.square.last-move::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--highlight);
  opacity: 0.5;
  pointer-events: none;
}
.square.check {
  background: radial-gradient(circle, var(--check) 40%, transparent 75%);
}

.square.hint::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.square.hint-capture::after {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 4px solid rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.coord {
  position: absolute;
  font-size: 0.6rem;
  font-weight: 700;
  opacity: 0.7;
  pointer-events: none;
}
.coord.rank { top: 2px; left: 3px; }
.coord.file { bottom: 1px; right: 3px; }
.square.light .coord { color: var(--dark-sq); }
.square.dark .coord { color: var(--light-sq); }

/* ---- Panel ---- */
.panel {
  background: var(--panel);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 300px;
}

.controls { display: flex; flex-direction: column; gap: 0.6rem; }

.control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.control select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid #4a4642;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.9rem;
}

.buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
  background: #3d3936;
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: #4a4642; }
/* --accent-dark, not --accent: white-on-#7fa650 is ~2.81:1 (below WCAG AA);
   white-on-#5d7a3a clears 4.5:1 for these 0.9rem labels. Hover goes darker
   still for feedback. */
.btn.primary { background: var(--accent-dark); color: #fff; }
.btn.primary:hover { background: #4a6330; }

.game-ending-controls .btn {
  flex: 1;
  min-height: 44px;
}
.game-ending-controls .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.game-ending-controls .btn:disabled:hover { background: #3d3936; }

.captured {
  min-height: 1.4rem;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--muted);
}

/* ---- Chess clocks ---- */
.clocks { display: flex; gap: 0.5rem; }
.clocks[hidden] { display: none; }

.clock {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid #4a4642;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-variant-numeric: tabular-nums;
}
.clock span { font-size: 0.8rem; color: var(--muted); }
.clock b { font-size: 1.05rem; }
.clock.active { border-color: var(--accent); }
.clock.active span { color: var(--accent); }
.clock.low b { color: #e05252; }

.moves {
  flex: 1;
  position: relative; /* ply offsetTop is measured against the list itself */
  overflow-y: auto;
  max-height: 300px;
  list-style: none;
  counter-reset: move;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  border-top: 1px solid #3d3936;
  border-bottom: 1px solid #3d3936;
  padding: 0.4rem 0;
}

.moves li {
  counter-increment: move;
  display: grid;
  grid-template-columns: 2.2rem 1fr 1fr;
  align-items: center;
  padding: 0.1rem 0.4rem;
}
.moves li::before {
  content: counter(move) '.';
  color: var(--muted);
}
.moves li:nth-child(odd) { background: rgba(255, 255, 255, 0.03); }

/* Move-list plies are buttons: click one to review that position. */
.moves .ply {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
  cursor: pointer;
}
.moves .ply:hover { background: rgba(255, 255, 255, 0.1); }
.moves .ply.current { background: rgba(127, 166, 80, 0.45); font-weight: 700; }

.replay-nav .btn {
  flex: 1;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  line-height: 1;
}
.replay-nav .btn:disabled { opacity: 0.35; cursor: default; }
.replay-nav .btn:disabled:hover { background: #3d3936; }

.replay-clock-snapshot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.replay-clock-snapshot[hidden] { display: none; }
.replay-clock-snapshot > :first-child { flex-basis: 100%; }
.replay-clock-snapshot b { color: var(--text); }

.offline-note {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ---- Dialogs ---- */
dialog {
  /* Explicit centering: some mobile browsers place open dialogs near the
     top of the visual viewport, colliding with the browser chrome. */
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: calc(100vw - 2rem);
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  border: 1px solid #4a4642;
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 1.2rem;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }

.promotion-choices { display: flex; gap: 0.5rem; }

.promo-btn {
  font-size: 2.4rem;
  line-height: 1;
  background: var(--bg);
  color: var(--text);
  border: 2px solid #4a4642;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.promo-btn:hover { border-color: var(--accent); }
.promo-btn.white { color: #f9f9f9; text-shadow: 0 0 2px #333; }
.promo-btn.black { color: #2b2b2b; background: #cfc9c2; }

.gameover h2 { margin-bottom: 0.4rem; }
.gameover p { color: var(--muted); margin-bottom: 1rem; }
.gameover-actions { justify-content: center; }

.setup { width: min(92vw, 380px); text-align: left; }
.setup h2 { margin-bottom: 0.8rem; text-align: center; }
.setup-actions { justify-content: center; margin-top: 1rem; }
.setup-actions .btn { min-height: 44px; flex: 1; }

/* Long settings and messages scroll independently of their actions. Keeping
   the whole dialog scrollable hides Start/Cancel below the fold on phones.
   Only open dialogs become flex containers: closed dialogs must stay hidden. */
dialog.dialog-panel {
  inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  padding: 0;
  overflow: hidden;
  max-width: calc(100vw - 2rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  max-height: calc(100vh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
.dialog-panel[open] { display: flex; flex-direction: column; }
.dialog-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 1.2rem;
  scroll-padding-block: 0.5rem;
}
.dialog-panel > .buttons {
  flex: none;
  margin-top: 0;
  padding: 0.8rem 1.2rem 1.2rem;
  border-top: 1px solid #4a4642;
  background: var(--panel);
}
.dialog-panel > .buttons .btn { min-height: 44px; }
/* Native file inputs have a wide intrinsic size. They must shrink inside the
   import form instead of clipping a narrow dialog's scrollable body. */
.dialog-content input[type="file"] { min-width: 0; width: 100%; }
/* iOS zooms text fields below 16px on focus, reducing the usable viewport. */
.dialog-content .coach-form input[type="text"],
.dialog-content .coach-form textarea,
.dialog-content .coach-form select { font-size: max(1rem, 16px); }

/* Radio groups styled as tap-friendly pills (44px targets). The inputs
   stay in the tree (hidden, not display:none) so keyboard focus and
   arrow-key group navigation keep working. */
.choice { border: none; margin: 0 0 0.85rem; padding: 0; }
.choice legend { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }
.choice-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.choice label { flex: 1 1 auto; display: block; position: relative; }
.choice.stack .choice-options { flex-direction: column; }
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  /* The focus target occupies its whole pill so keyboard navigation scrolls
     the full label into view. The label still owns pointer/touch activation. */
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  background: var(--bg);
  border: 1px solid #4a4642;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.choice span:hover { border-color: #6a655f; }
.choice input:checked + span {
  /* --accent-dark (not --accent): white-on-#7fa650 is ~2.81:1, below WCAG AA;
     white-on-#5d7a3a clears 4.5:1 for these normal-sized pill labels (side
     picker, New Game options). */
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.choice input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.setup-summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

/* The hidden attribute must always win — author display rules (flex/grid
   panels) otherwise override the UA's [hidden] { display: none }. */
[hidden] { display: none !important; }

/* ---- App section tabs (Play / Review) ---- */
.tabs {
  display: flex;
  gap: 0.4rem;
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}

.update-note {
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0.65rem 0.8rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.tab {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid #4a4642;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { color: var(--text); border-color: #6a655f; }
/* White text sits on --accent-dark (4.8:1, WCAG 1.4.3) — never on
   --accent itself (2.8:1); see #35 for the app-wide contrast pass. */
.tab[aria-current="page"] {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

/* Live timed-game banner: visible in coach views while Play's clocks run. */
.live-note {
  width: 100%;
  min-height: 44px;
  margin-bottom: 0.75rem;
  background: var(--accent-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

/* ---- Coach views ---- */
.coach {
  background: var(--panel);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.coach-note { font-size: 0.85rem; color: var(--muted); }

.game-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 60vh;
  overflow-y: auto;
}

.game-item {
  width: 100%;
  text-align: left;
  background: var(--bg);
  color: var(--text);
  border: 1px solid #4a4642;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.game-item:hover { border-color: var(--accent); }

.coach-board-row {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(240px, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 760px) {
  .coach-board-row { grid-template-columns: 1fr; }
}

.coach-board-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}
#reviewFlow .coach-board-wrap {
  grid-column: 1;
  grid-row: 1;
}
#reviewFlow .coach-side {
  grid-column: 2;
  grid-row: 1 / span 2;
}
#reviewFlow .review-history {
  grid-column: 1;
  grid-row: 2;
}
@media (max-width: 760px) {
  #reviewFlow .coach-board-wrap,
  #reviewFlow .coach-side,
  #reviewFlow .review-history {
    grid-column: 1;
    grid-row: auto;
  }
}

.board.small {
  width: min(88vw, 380px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
/* Inspection-only boards (Review): squares are focusable for keyboard/AT
   users but activating them does nothing — don't advertise a click. */
.board.inspect .square { cursor: default; }

.review-nav .btn { flex: 1; min-height: 44px; }
.review-nav .btn:disabled { opacity: 0.35; cursor: default; }
.review-actions .btn { min-height: 44px; }

.review-history {
  min-width: 0;
  margin-top: 0.15rem;
  padding: 0.7rem;
  background: var(--bg);
  border: 1px solid #4a4642;
  border-radius: 8px;
}
.review-history h3 { font-size: 1rem; }
.review-history .coach-note {
  margin: 0.35rem 0 0.55rem;
  line-height: 1.4;
}
.review-moves {
  list-style: none;
  max-height: 18rem;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #4a4642;
  border-radius: 6px;
  background: var(--panel);
}
.review-moves li {
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.3rem;
  align-items: stretch;
}
.review-move-number {
  padding: 0.75rem 0.2rem;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.review-ply {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0.45rem 0.5rem;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.review-ply:hover { border-color: var(--accent); }
.review-ply:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}
.review-ply.current {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
}
.review-ply.empty { cursor: default; }
.review-san {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.review-eval {
  margin-left: auto;
  color: var(--text);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.review-eval.estimate { color: var(--muted); }
.review-nag {
  padding: 0.08rem 0.3rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.review-nag.source { color: #d7b4f3; }
.review-nag.chessy { color: #b7d883; }
@media (max-width: 420px) {
  .review-history { padding: 0.55rem; }
  .review-moves {
    max-height: 11rem;
    margin-inline: -0.2rem;
    padding-inline: 0.15rem;
  }
  .review-moves li {
    grid-template-columns: 2.45rem minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.15rem;
  }
  .review-move-number { padding-inline: 0; }
  .review-ply { padding-inline: 0.35rem; }
}
@media (max-width: 360px) {
  .review-moves li {
    grid-template-columns: 2.45rem minmax(0, 1fr);
  }
  .review-move-number { grid-row: span 2; }
}

.coach-side { display: flex; flex-direction: column; gap: 0.75rem; min-width: 0; }

.scan-panel .coach-note { line-height: 1.4; }
.scan-side {
  border: 0;
  min-width: 0;
}
.scan-side legend {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.scan-side-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.scan-side-options label {
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  flex-direction: row;
  align-items: center;
  border: 1px solid #4a4642;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.scan-side-options input { min-width: 1rem; min-height: 1rem; }
.scan-actions .btn { min-height: 44px; }
.scan-panel .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.scan-meter {
  width: 100%;
  accent-color: var(--accent);
}
.scan-moments {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.45rem;
}
.scan-moment {
  min-height: 44px;
  width: 100%;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.coach-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg);
  border: 1px solid #4a4642;
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 0.9rem;
}
.coach-form h3 { font-size: 1rem; }
.coach-form label { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); }
.coach-form .input-error { color: var(--danger, #d9534f); }

/* Chessy's candidate lines (Review v2): SAN + player-POV eval + a short PV,
   best-first. The played move's line is marked so the player can see where
   their choice ranked without any move being labelled an error. */
/* Ranks are rendered as explicit "#n" text (a played line appended from below
   the shown MultiPV keeps its true rank), so the list itself is unnumbered. */
.verify-lines { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }
.verify-lines li { color: var(--text); }
.verify-lines li.played { font-weight: 700; }
.verify-lines .eval { font-variant-numeric: tabular-nums; color: var(--muted); }
.verify-lines .pv { color: var(--muted); }
.verify-lines .tag { color: var(--muted); font-size: 0.8rem; }
/* The partial qualifier lives in #verifyMeta's TEXT (accessible); this only
   emphasises it visually. */
#verifyMeta.partial { color: var(--danger, #d9534f); }
.verify-activity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.verify-progress {
  display: grid;
  flex: 1 1 12rem;
  gap: 0.2rem;
  min-width: 0;
}
.verify-progress progress {
  width: 100%;
  accent-color: var(--accent);
}
.verify-activity #verifyElapsed {
  font-variant-numeric: tabular-nums;
}
.verify-activity .btn {
  min-height: 44px;
}

.stats {
  display: grid;
  /* minmax(0, max-content), NOT max-content: the label column must be
     allowed to shrink below its one-line width on narrow phones so long
     labels wrap instead of forcing horizontal page overflow. */
  grid-template-columns: minmax(0, max-content) 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.9rem;
}
.stats dt { color: var(--muted); }
.stats dd { font-weight: 700; font-variant-numeric: tabular-nums; }

.coach-subhead { font-size: 0.95rem; margin-top: 0.25rem; }

.coach-form input[type="text"],
.coach-form textarea,
.coach-form select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #4a4642;
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
  min-height: 40px;
}
/* PGN paste box (Phase 4b1): monospace so tag pairs and movetext line up. */
.coach-form textarea {
  resize: vertical;
  min-height: 8em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.import-file { font-size: 0.85rem; }
.review-tools { margin-bottom: 0.6rem; }
/* A lighter red than --danger (a button/border colour): on the dark dialog
   background (--bg #312e2b) #d9534f is only ~2.9:1, below WCAG AA. #f28b82
   clears 4.5:1 for this status text. */
#importStatus[data-kind="error"],
#dataStatus[data-kind="error"] { color: #f28b82; }
#importStatus[data-kind="info"],
#dataStatus[data-kind="info"] { color: var(--text); }
/* Destructive controls (Replace archive, Delete all) read as a warning. */
.btn.danger { border-color: var(--danger, #d9534f); color: #f28b82; }
/* Darker red on hover so white text clears WCAG AA: white on #d9534f is only
   ~3.96:1, white on #a12f2f is ~5.9:1. */
.btn.danger:hover { background: #a12f2f; color: #fff; }
