:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-soft: #cde2fb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --warning-text: #7a4f00;
  --serious: #ec835a;
  --critical: #d03b3b;
  --seq-250: #86b6ef;
  --seq-400: #3987e5;
  --seq-550: #1c5cab;
  /* Prep-sheet reading panel: soft cream (no stark white), dark softened text. */
  --prep-bg: #fbf6e9;
  --prep-text: #1b1b18;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262624;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #184f95;
    --warning-text: #f3c35a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --seq-250: #6da7ec;
    --seq-400: #3987e5;
    --seq-550: #86b6ef;
    /* Warm, low-glare dark surface with off-white (not stark) text. */
    --prep-bg: #232320;
    --prep-text: #ececdf;
  }
}
/* Forced dark (chosen in the top-right menu), regardless of the OS preference. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #262624; --text: #ffffff; --text-2: #c3c2b7;
  --muted: #898781; --grid: #2c2c2a; --border: rgba(255, 255, 255, 0.10); --accent: #3987e5;
  --accent-soft: #184f95; --warning-text: #f3c35a; --series-1: #3987e5; --series-2: #d95926; --seq-250: #6da7ec;
  --seq-400: #3987e5; --seq-550: #86b6ef; --prep-bg: #232320; --prep-text: #ececdf;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 6px 0; }
small, .muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 600; color: var(--text); font-size: 16px; }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: var(--text-2); padding: 4px 0; border-bottom: 2px solid transparent; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.topbar nav a:hover { text-decoration: none; color: var(--text); }
.topbar nav { flex-wrap: wrap; row-gap: 2px; }
.jobs { margin-left: auto; font-size: 13px; color: var(--text-2); display: flex; gap: 12px; align-items: center; }
.jobs .job { display: flex; align-items: center; gap: 6px; }
.jobs .bar { width: 90px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.jobs .bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; line-height: 18px; margin-left: 4px; }

/* Identity in the top bar, and the sign-in overlay. Members never see admin-only
   controls (marked .admin-only); the server also enforces this with a 403. */
.whoami { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.whoami .who { font-weight: 600; color: var(--text); }
.whoami .avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; flex: none; }
.whoami-wrap { position: relative; }
#whoami-btn { display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; color: var(--text); padding: 2px; font: inherit; font-size: 13px; }
#whoami-btn:hover { border: none; color: var(--text); }
#whoami-menu { position: absolute; right: 0; top: 34px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-width: 190px; box-shadow: 0 8px 24px rgba(0, 0, 0, .28); z-index: 20; display: flex; flex-direction: column; gap: 6px; }
#whoami-menu.hidden { display: none; }
#whoami-menu .menu-head { font-weight: 600; display: flex; align-items: center; gap: 6px; }
#whoami-menu .menu-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
#whoami-menu .menu-row { display: flex; gap: 6px; }
#whoami-menu #logout-btn { align-self: flex-start; margin-top: 4px; }
.login-overlay { position: fixed; inset: 0; background: rgba(10, 10, 14, .92); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.login-box { display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; background: var(--surface); border: 1px solid var(--border); padding: 28px 32px; border-radius: 12px; min-width: 300px; max-width: 340px; }
.login-box .btn { width: 100%; text-align: center; }
.login-magic { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.login-err { color: var(--critical); margin: 0; font-size: 13px; }
.login-msg { color: var(--text-2); min-height: 1em; margin: 0; font-size: 13px; }
body:not(.is-admin) .admin-only { display: none !important; }
/* Visitors: no own home/games/settings. The Report tab stays (it shows the demo
   player's report and repertoire as a sample), plus Scouting, Drills, Puzzles. */
body.is-visitor [data-nav="home"], body.is-visitor [data-nav="games"], body.is-visitor [data-nav="settings"] { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: 20px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

button, .btn {
  font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { font-size: 12px; padding: 3px 8px; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=number], input[type=search], select, textarea {
  font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%;
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; min-height: 120px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 3px; }
label.field small { display: block; margin-top: 2px; }
label.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { color: var(--text-2); font-weight: 500; font-size: 13px; }
.nowrap { white-space: nowrap; }
.log-table { font-size: 13px; }
.log-table td { vertical-align: top; }
.prep-card-md h3 { margin: 12px 0 4px; }
.prep-card-md p { margin: 4px 0; }
.prep-card-md ul, .prep-card-md ol { margin: 4px 0 8px; padding-left: 20px; }
.prep-card-md li { margin: 2px 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip.white { background: #fff; color: #222; border-color: #bbb; }
.chip.black { background: #222; color: #fff; border-color: #222; }
.chip.blunder { color: var(--critical); border-color: var(--critical); }
.chip.mistake { color: var(--serious); border-color: var(--serious); }
.chip.inaccuracy { color: var(--warning-text); border-color: var(--warning); }
.chip.cat { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.chip.status-imported { color: var(--muted); }
.chip.status-analysing { color: var(--accent); border-color: var(--accent); }
.chip.status-explained { color: var(--good); border-color: var(--good); }
.chip.warn { color: var(--warning-text); border-color: var(--warning); }
/* Evidence ids on a prep sheet: small and quiet. A chip that links to a game is
   an <a> and keeps the accent colour; a hover-only fact is a <span> and stays
   muted, so the clickable ones stand out. */
.chip.ev { font-size: 11px; padding: 0 6px; margin-left: 2px; font-family: ui-monospace, Menlo, monospace; color: var(--text-2); border-color: var(--border); background: var(--surface); text-decoration: none; }
a.chip.ev { color: var(--accent); border-color: var(--accent-soft); }
a.chip.ev:hover { background: var(--accent-soft); }

/* Print the preparation sheet alone: the chrome, the subject list, and every
   other dossier section drop out, the sheet fills the page. */
@media print {
  .no-print { display: none !important; }
  body.print-sheet .topbar, body.print-sheet #subject-list, body.print-sheet #subject-search, body.print-sheet #prep-request,
  body.print-sheet #dossier > :not(.print-target), body.print-sheet .toast { display: none !important; }
  body.print-sheet .acc.print-target { border: none; }
  body.print-sheet .acc.print-target > summary::before { display: none; }
  body.print-sheet .prep-sheet { max-width: none; background: none; color: #000; padding: 0; }
  body.print-sheet .chip.ev { color: #000; border-color: #999; }
}

/* Opening clash: an indented, alternating move tree. */
.clash-tree { list-style: none; margin: 3px 0; padding-left: 16px; border-left: 1px solid var(--border); }
.clash-tree li { margin: 3px 0; line-height: 1.5; }
.clash-move { font-variant-numeric: tabular-nums; cursor: pointer; border-radius: 4px; padding: 0 3px; }
.clash-move:hover { background: var(--surface-2); }
.clash-move.sel { background: var(--accent-soft); }
.clash-move.student { font-weight: 600; }
.clash-move.opponent { color: var(--text-2); }
.clash-move.engine { color: var(--accent); }
.clash-engine { margin: 2px 0 2px 16px; }
.clash-engine .clash-tree { border-left-style: dashed; margin-top: 1px; }
/* Lichess-style variation view: main line as a two-column table, alternatives
   inlined as full-width bands. */
.clash-num { color: var(--text-2); font-variant-numeric: tabular-nums; }
.clash-lichess { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.clash-lichess td { padding: 2px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.clash-lichess td.clash-num { width: 2.5em; text-align: right; padding-right: 6px; }
.clash-var-row td { background: var(--surface-2); font-size: 13px; line-height: 1.7; }
.clash-var .clash-move { margin: 0 1px; }
.clash-fmt { display: inline-flex; }
.clash-fmt button { border-radius: 0; }
.clash-fmt button:first-child { border-radius: 6px 0 0 6px; }
.clash-fmt button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
/* Keep the board (and the moves-played list under it) in view while the
   variation tree scrolls; drop the pinning when the grid collapses on mobile. */
.clash-board-col { align-self: start; }
@media (min-width: 801px) { .clash-board-col { position: sticky; top: 64px; } }
.clash-line { margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.9; font-size: 14px; max-width: 520px; }
.clash-line .clash-num { color: var(--muted); margin-left: 6px; }
.clash-line .clash-ply { cursor: pointer; padding: 0 3px; border-radius: 4px; }
.clash-line .clash-ply:hover { background: var(--surface-2); }
.clash-line .clash-ply.sel { background: var(--accent-soft); }
.clash-line .clash-lichess { margin-left: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Collapsible section (native <details>): a header bar with a rotating triangle,
   so long pages (Scouting) show just the headers and expand on demand. */
.acc { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; background: var(--surface); }
.acc > summary { cursor: pointer; padding: 12px 16px; list-style: none; display: flex; align-items: baseline; gap: 8px; user-select: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: '\25B8'; color: var(--muted); font-size: 12px; align-self: center; transition: transform .15s; }
.acc[open] > summary::before { transform: rotate(90deg); }
.acc > summary:hover { color: var(--text); }
.acc > summary .acc-title { font-weight: 600; font-size: 16px; }
.acc-body { padding: 0 16px 16px; }
/* Report + Repertoire share one page: the accordion summary is the title, so
   drop each sub-view's own heading inside these bodies. */
.rr .acc-body > h1 { display: none; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 20; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.error { background: var(--critical); color: #fff; }

/* Game view */
.game-layout { display: grid; grid-template-columns: minmax(320px, 520px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .game-layout { grid-template-columns: 1fr; } }
.board-wrap { width: 100%; aspect-ratio: 1 / 1; max-width: 520px; }
.board-wrap .cg-wrap { width: 100%; height: 100%; }
.board-controls { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.board-controls .spacer { flex: 1; }
.eval-bar-text { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 60px; text-align: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 12px; color: var(--text-2); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.moves { display: grid; grid-template-columns: 44px 1fr 1fr; font-variant-numeric: tabular-nums; font-size: 14px; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.moves .num { color: var(--muted); padding: 3px 8px; background: var(--surface-2); }
.moves .mv { padding: 3px 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.moves .mv:hover { background: var(--surface-2); }
.moves .mv.current { background: var(--accent-soft); }
.moves .mv .ev { color: var(--muted); font-size: 12px; }
.moves .mv.blunder { color: var(--critical); font-weight: 600; }
.moves .mv.mistake { color: var(--serious); font-weight: 600; }
.moves .mv.inaccuracy { color: var(--warning-text); }

.moment { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; cursor: pointer; background: var(--surface); }
.moment:hover { border-color: var(--muted); }
.moment.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.moment .title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.moment .sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }

.guess { border: 1px solid var(--accent); border-radius: 8px; padding: 12px 14px; background: var(--surface); }
.guess .result { margin: 8px 0; font-weight: 600; }
.guess .result.good { color: var(--good); }
.guess .result.bad { color: var(--critical); }
.lines { list-style: none; padding: 0; margin: 8px 0; font-size: 14px; }
.lines li { padding: 4px 6px; border-radius: 4px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.lines li:hover { background: var(--surface-2); }
.lines li .ev { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 56px; }
.lines li.played { border-left: 3px solid var(--critical); }
.explanation { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--grid); }
.explanation .kq { margin-top: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-style: italic; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.tile .v { font-size: 26px; font-weight: 600; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--text-2); margin-top: 4px; }

/* charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; transform: translate(-50%, -120%); display: none; z-index: 3; }
.chart text { fill: var(--text-2); font-size: 12px; font-family: system-ui, sans-serif; }
.chart .axis { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1; }
.chart .bar { fill: var(--seq-400); }
.chart .bar.dim { fill: var(--seq-250); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.flagged { fill: var(--critical); }
.chart .area { fill: var(--seq-250); opacity: .55; }
.chart .cursor { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .tbar.white { fill: var(--muted); opacity: .8; }
.chart .tbar.black { fill: var(--text-2); opacity: .8; }
.chart .hit { fill: transparent; cursor: pointer; }

.import-area { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
@media (max-width: 700px) { .import-area { grid-template-columns: 1fr; } }
.drill-layout { display: grid; grid-template-columns: minmax(320px, 480px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .drill-layout { grid-template-columns: 1fr; } }
/* A phone held sideways (a tournament hall, playing offline) is wide enough
 * for board and panel side by side; stacking them would push the guess/grade
 * buttons below the fold after every move. Narrower columns than the desktop
 * layout, and only when height confirms landscape (a portrait tablet at this
 * width should still stack). */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .game-layout, .drill-layout { grid-template-columns: minmax(200px, 42vw) 1fr; gap: 12px; }
  .board-wrap { max-width: 100%; }
}
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.empty { color: var(--muted); padding: 30px; text-align: center; }
.promo-overlay { position: fixed; inset: 0; background: rgba(10, 10, 14, .45); display: flex; align-items: center; justify-content: center; z-index: 30; }
.promo { display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.promo button { font-size: 38px; line-height: 1; padding: 6px 14px; }
.dialog { display: flex; flex-direction: column; gap: 10px; min-width: 300px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
pre.prompt { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: 6px; max-height: 260px; overflow: auto; }

/* Phones. The board is already full width (game/drill layouts collapse to one
   column at 900px); this makes the header, wide tables, and forms usable too. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 16px; padding: 8px 12px; }
  .topbar nav { gap: 14px; width: 100%; }
  .brand { font-size: 15px; }
  main { padding: 12px; }
  h1 { font-size: 20px; }
  h2 { font-size: 16px; }
  /* Wide tables (the games list especially) scroll sideways in their card
     instead of overflowing the viewport or crushing columns. */
  .card { overflow-x: auto; }
  table { min-width: max-content; }
  /* 16px inputs so iOS Safari does not zoom in on focus. */
  input[type=text], input[type=number], input[type=search], select, textarea { font-size: 16px; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
  .tile .v { font-size: 22px; }
  .board-controls { flex-wrap: wrap; }
  .toast { left: 12px; right: 12px; transform: none; text-align: center; }
}

/* Prep-sheet reading panel. The sheet is read at the board (often on a phone),
   so it is tuned for legibility: an open sans-serif stack, wide line spacing,
   a short line length, block headings, and a real list for the cues. Follows
   the dyslexia-friendly guidance (clean font, 1.5+ line height, left aligned,
   soft low-glare background, dark-on-light text, bold not italics). */
.prep-sheet {
  background: var(--prep-bg);
  color: var(--prep-text);
  border-radius: 8px;
  padding: 4px 20px 14px;
  margin: 10px 0 12px;
  max-width: 62ch;             /* keeps lines to roughly 60-70 characters */
  font-family: Lexend, "Atkinson Hyperlegible", Verdana, Arial, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: .01em;
  word-spacing: .04em;
  text-align: left;            /* never justified: no uneven word gaps */
}
.prep-sheet h3 {
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  text-transform: none;        /* no all-caps blocks */
  letter-spacing: 0;
  margin: 20px 0 6px;
}
.prep-sheet > :first-child { margin-top: 0; }
.prep-sheet p { margin: 6px 0; }
.prep-sheet ul, .prep-sheet ol { margin: 6px 0; padding-left: 24px; }
.prep-sheet li { margin: 6px 0; }
/* Headline reads like a pull-quote: the one thing to know, set off from the rest. */
.prep-sheet .prep-headline {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 4px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
/* Compact, low-clutter tables inside the reading panel: soft row rules, roomy
   cells, left aligned, and free to wrap (never forced to scroll on a phone). */
.prep-sheet .prep-table { min-width: 0; font-size: inherit; margin: 6px 0 4px; }
.prep-sheet .prep-table th,
.prep-sheet .prep-table td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.prep-sheet .prep-table thead th { font-weight: 700; }
.prep-sheet .prep-table tbody th { font-weight: 700; white-space: nowrap; width: 1%; }

/* Keyboard users need to see where they are: an accent ring on whatever has
   focus from the keyboard, none from a mouse click. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* The typed-move box under a board (Board with input: true). */
.san-input { margin-top: 6px; }
.san-input input { width: 100%; max-width: 280px; font-family: ui-monospace, Menlo, monospace; }
.san-input input.bad { border-color: var(--critical); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.keymap { margin: 10px 0 0; color: var(--muted); }
.keymap .kbd { margin-right: 2px; }

/* Utility classes for the spacing and sizes that used to be inline styles. */
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; } .input-sm { padding: 6px 10px; font-size: 14px; }

/* The Players list as a sortable table. */
.players-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.players-table th[data-sort].sorted::after { content: " ▾"; color: var(--muted); }
.players-table th[data-sort].sorted.asc::after { content: " ▴"; }
.players-table tr.current td { background: var(--accent-soft); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--grid); }
.dot.green { background: rgb(70, 196, 106); } .dot.yellow { background: rgb(224, 180, 0); }

/* Clash tree: the moves of the line currently on the board. */
.clash-move.onboard { background: var(--accent-soft); border-radius: 3px; box-shadow: 0 0 0 2px var(--accent-soft); }
/* A link styled as a small button (row actions in tables). */
a.button-like { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 12px; line-height: 18px; }
a.button-like:hover { background: var(--accent-soft); }

/* Preview mode: an admin looking at the site as a visitor. Deliberately loud
   and fixed to the top, because it is easy to forget it is on and then wonder
   where the admin pages went. */
.preview-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--warning); color: var(--warning-text);
  font-size: 14px; line-height: 1.4; text-align: center;
}
.preview-banner strong { text-transform: lowercase; }
.preview-banner button { background: rgba(0, 0, 0, 0.14); color: var(--warning-text); border-color: rgba(0, 0, 0, 0.28); }
.preview-banner button:hover { background: rgba(0, 0, 0, 0.24); }
