/* Chess Coach — dark theme, orange accent (docs/research/frontend.md §7). */
:root {
  color-scheme: dark;
  --bg: #14151a;
  --surface: #1d1f26;
  --surface-2: #262932;
  --border: #33363f;
  --text: #e6e6e6;
  --text-muted: #9aa0aa;
  --accent: #ff8a1f;
  --accent-hover: #ffa24d;
  --accent-fg: #1a1205;
  --accent-soft: rgba(255, 138, 31, .14);
  --good: #3fb950;
  --bad: #e5534b;
  --warn: #f2c94c;
  --info: #4a90e2;
  --sev-inaccuracy: #f2c94c;
  --sev-mistake: #ff8a1f;
  --sev-blunder: #e5534b;
  --radius: 8px;
  --gap: 16px;
  --maxw: 1280px;
  --board-size: min(72vh, 560px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.45rem; margin: 0 0 .5rem; }
h2 { font-size: 1.12rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: .8rem 0 .3rem; color: var(--text-muted); font-weight: 600; }
code, kbd, .mono { font-family: var(--mono); }
kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 .3em; font-size: .78em; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.small { font-size: .86rem; }
.tiny, .tiny-help { font-size: .75rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.error { color: var(--bad); }
.warning { color: var(--warn); }
.ok { color: var(--good); }
.ok-box { border: 1px solid var(--good); border-radius: var(--radius); padding: .6rem 1rem; margin: .8rem 0; background: rgba(63, 185, 80, .08); }
.row { display: flex; gap: .6rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.plain { list-style: none; padding: 0; margin: .3rem 0; }
.plain li { margin: .2rem 0; }

/* shell */
.topbar { display: flex; align-items: center; gap: 1.2rem; padding: .6rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.logo { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; gap: .3rem; flex: 1; }
.nav a { color: var(--text-muted); padding: .3rem .7rem; border-radius: 6px; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
.switcher { position: relative; }
.switcher summary { cursor: pointer; list-style: none; padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 6px; }
.switcher summary::-webkit-details-marker { display: none; }
.switcher-menu { position: absolute; top: 2.2rem; left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem; min-width: 220px; display: flex; flex-direction: column; z-index: 30; }
.switcher-menu a { padding: .3rem .5rem; border-radius: 4px; color: var(--text); }
.switcher-menu a.current { background: var(--accent-soft); }
.logout { margin-left: auto; }
.readonly-note { margin-left: auto; }
.page { max-width: var(--maxw); margin: 0 auto; padding: 24px; }
.footer { max-width: var(--maxw); margin: 0 auto; padding: 1rem 24px 2rem; font-size: .8rem; }
.footer a { color: var(--text-muted); }

/* cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: var(--gap); }
.card.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--gap); }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--gap); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.cards .card { margin-bottom: 0; }
.cards-theme { font-size: .95rem; font-weight: 600; color: var(--text-muted); margin: var(--gap) 0 .5rem; }
@media (max-width: 1100px) { .grid-2, .grid-main { grid-template-columns: 1fr; } }

/* forms */
.form { display: flex; flex-direction: column; gap: .7rem; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
label.check, label.chip, label.toggle, .radio-row label { flex-direction: row; align-items: center; gap: .4rem; }
.radio-row { display: flex; gap: 1rem; }
input, select, textarea { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .55rem; font: inherit; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; margin: 0 0 .8rem; }
legend { color: var(--text-muted); padding: 0 .3rem; }
.btn { display: inline-flex; align-items: center; gap: .35rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .42rem .85rem; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.small { padding: .25rem .6rem; font-size: .86rem; }
.btn.tiny { padding: .1rem .45rem; font-size: .78rem; }
.btn.good { border-color: var(--good); }
.btn:disabled { opacity: .45; cursor: default; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; font: inherit; }
button.link:hover { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .6rem; font-size: .85rem; }
.chip.small { font-size: .78rem; padding: 0 .5rem; }
.chip.accent { border-color: var(--accent); background: var(--accent-soft); }
.chip.note { border-color: var(--info); }
.chip.muted { color: var(--text-muted); border-style: dashed; }
.chip.bad { border-color: var(--bad); color: var(--bad); }
.chip-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: .2rem .7rem; cursor: pointer; font: inherit; font-size: .86rem; }
.chip-btn:hover:not(:disabled) { border-color: var(--accent); }
.chip-btn:disabled { opacity: .4; cursor: default; }
.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.badge.exp { color: var(--info); border-color: var(--info); }
.pill { display: inline-block; font-size: .82rem; padding: .15rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.pill.running { border-color: var(--accent); color: var(--accent); }
.status.done { color: var(--good); }
.status.failed { color: var(--bad); }
.status.running, .status.queued { color: var(--accent); }
.status.cancelled { color: var(--text-muted); }
.sev { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 4px; font-weight: 600; color: #111; }
.sev.inaccuracy { background: var(--sev-inaccuracy); }
.sev.mistake { background: var(--sev-mistake); }
.sev.blunder { background: var(--sev-blunder); color: #fff; }
.sev.note { background: transparent; color: var(--info); border: 1px solid var(--info); font-weight: 500; }
.label-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--text-muted); vertical-align: middle; }
.label-dot.correct { background: var(--good); }
.label-dot.not_a_mistake { background: var(--bad); }
.label-dot.wrong_kind, .label-dot.wrong_motif { background: var(--warn); }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--text-muted); font-weight: 600; background: var(--surface-2); padding: .4rem .5rem; position: relative; }
.table td { padding: .35rem .5rem; border-top: 1px solid var(--border); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td { padding: .25rem .4rem; }
.table.dots td { border-top: 0; padding: .25rem .3rem; }
.table.dots tr.total td { border-top: 1px solid var(--border); font-weight: 600; padding-top: .45rem; }
.table tr.sub td { padding-left: 1.5rem; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table tr.dup td { opacity: .7; }
.table tr.group-start td { border-top: 2px solid var(--border); }
.sortable th { cursor: pointer; user-select: none; }
.sortable th.sorted::after { content: " ▼"; color: var(--accent); font-size: .7em; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg-btn { background: var(--surface-2); color: var(--text-muted); border: 0; padding: .2rem .6rem; cursor: pointer; font: inherit; font-size: .82rem; }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); }
.cell-bar { display: inline-block; width: 70px; height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.cell-bar span { display: block; height: 100%; background: var(--good); }

/* dashboard */
.student-list { list-style: none; padding: 0; margin: 0; }
.student-list li { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--border); }
.student-list li:first-child { border-top: 0; }
.student-name { font-weight: 600; font-size: 1.05rem; }

/* jobs */
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: .5rem 0; }
.progress .bar { height: 100%; background: var(--accent); transition: width .4s; }

/* profile */
.context-line { font-size: 1.02rem; margin: 0 0 .3rem; }
.badges { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0 0 .7rem; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: var(--gap); }
.filter-bar input, .filter-bar select { padding: .2rem .4rem; font-size: .86rem; }
.headline-list { list-style: none; padding: 0; margin: 0; }
/* sentence + meta wrap in the left column; the lesson button keeps a fixed right column */
.headline-list li { padding: .45rem 0; border-top: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .6rem; align-items: baseline; }
.headline-list li .headline-text { min-width: 0; }
.headline-list li .headline-text .muted { margin-left: .3rem; }
.headline-list li:first-child { border-top: 0; }
.headline-list .sentence { font-size: 1.04rem; color: var(--text); }
.headline-list .sentence:hover { color: var(--accent); }
.headline-list .btn { flex-shrink: 0; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.trend.bad { color: var(--bad); }
.trend.good { color: var(--good); }
.top { padding-left: 1.2rem; margin: .2rem 0 .6rem; }
.top li { margin: .3rem 0; }
.share { margin-top: .8rem; }
.edit { margin-top: .8rem; }
.tutor-title { color: var(--text-muted); font-size: .86rem; }
.tutor-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.tutor-value .unit { font-size: .95rem; color: var(--text-muted); margin-left: .25rem; font-weight: 400; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; gap: .4rem; align-items: center; font-size: .78rem; margin-top: .25rem; }
.bar-label { color: var(--text-muted); }
.bar-track { height: 7px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); }
.bar-fill.avg { background: var(--info); }
.bar-fill.prev { background: var(--text-muted); }
.bar-fill.last { background: var(--accent-hover); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; margin: .5rem 0; }
.tile { background: var(--surface-2); border-radius: var(--radius); padding: .6rem .8rem; }
.tile-label { color: var(--text-muted); font-size: .82rem; }
.tile-value { font-size: 1.5rem; font-weight: 700; }
.chart-box { position: relative; height: 320px; }
.chart-box.eval { height: 240px; }
.trend-toggles { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.trend-toggles button { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; cursor: pointer; }
.trend-toggles button.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

/* mistakes */
.mistakes-layout { display: grid; grid-template-columns: 250px 1fr; gap: var(--gap); align-items: start; }
.filters { position: sticky; top: 70px; }
.filters form { display: flex; flex-direction: column; gap: .5rem; }
.filters select { width: 100%; }
.pager { display: flex; gap: .5rem; margin-top: .7rem; }
.piece-color { color: var(--text-muted); }
/* static export (export-site): no server-side filters, single column */
.mistakes-layout.export { grid-template-columns: 1fr; }
.export-student { color: var(--text-muted); }
.export-nav { gap: 1rem; flex-wrap: wrap; }
@media (max-width: 900px) { .mistakes-layout { grid-template-columns: 1fr; } .filters { position: static; } }

/* position */
.position-layout { display: grid; grid-template-columns: auto 1fr; gap: calc(var(--gap) * 1.5); align-items: start; }
.board { width: var(--board-size); height: var(--board-size); }
.board-controls { margin-top: .6rem; display: flex; flex-direction: column; gap: .35rem; width: var(--board-size); }
.cg-wrap coords { font-size: 11px; }
.cg-wrap .cg-shapes { opacity: .8; }
.pos-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pos-head h1 { margin: 0; }
.evals { font-size: 1.05rem; }
.explanation { font-size: 1.02rem; line-height: 1.55; }
.label-panel .verdicts { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.label-panel .btn.verdict { padding: .45rem .8rem; }
.label-panel .chips { margin: .4rem 0 .6rem; padding: .5rem; background: var(--surface-2); border-radius: var(--radius); }
.label-panel .chips[hidden] { display: none; }
.note-field textarea { width: 100%; resize: vertical; }
.claim { font-size: 1.02rem; }
@media (max-width: 900px) { .position-layout { grid-template-columns: 1fr; } }

/* game */
.flags { list-style: none; padding: 0; margin: 0; }
.flag { border-top: 1px solid var(--border); padding: .6rem 0; }
.flag:first-child { border-top: 0; }
.flag-label { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .3rem; }

/* lesson */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: var(--gap); }
.lesson-item { display: grid; grid-template-columns: 240px 1fr; gap: 1rem; margin-bottom: 0; }
.lesson-item.pinned { border-color: var(--accent); }
.mini-board { width: 240px; height: 240px; }
.lesson-title { font-size: 1.02rem; margin-bottom: .3rem; }
.excluded-item { display: flex; gap: .8rem; align-items: center; padding: .3rem 0; border-top: 1px solid var(--border); grid-template-columns: none; }
form.inline { display: inline; }
@media (max-width: 640px) { .lesson-grid { grid-template-columns: 1fr; } .lesson-item { grid-template-columns: 1fr; } }

/* settings */
.setting { display: grid; grid-template-columns: minmax(240px, 2fr) 160px 1fr; gap: .3rem 1rem; align-items: center; padding: .3rem 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; }
.setting label { flex-direction: row; }
.setting code { grid-column: 1 / -1; margin-top: -.3rem; }
.setting.overridden label { color: var(--accent); }
.setting .control input[type=number], .setting .control select { width: 150px; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--accent); color: var(--text); padding: .55rem 1.1rem; border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .4); z-index: 50; }

/* print view of lessons: 2 diagrams per row, diagram + best line only */
body.print .topbar, body.print .footer, body.print .no-print { display: none !important; }
body.print { background: #fff; color: #000; }
body.print .card { background: #fff; border-color: #ccc; color: #000; }
body.print .lesson-grid { grid-template-columns: 1fr 1fr; }
body.print .lesson-item { grid-template-columns: 1fr; break-inside: avoid; }
body.print .lesson-item .explanation { display: none; }
body.print .mini-board { width: 300px; height: 300px; }
body.print a { color: #000; }
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { background: #fff; border-color: #ccc; color: #000; }
  .lesson-grid { grid-template-columns: 1fr 1fr; }
  .lesson-item { grid-template-columns: 1fr; break-inside: avoid; }
  .cg-wrap, .cg-wrap * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* phones: 16px gutters, board fits the screen (last, so it overrides the base rules) */
@media (max-width: 600px) { .page { padding: 16px; } .board-col { overflow-x: clip; } :root { --board-size: min(calc(100vw - 32px), 560px); } .topbar { padding: .6rem 16px; gap: .8rem; flex-wrap: wrap; } }

/* game viewer (move by move) */
.board-wrap { display: flex; gap: 6px; align-items: stretch; }
.evalbar { position: relative; flex: 0 0 18px; height: var(--board-size); background: #2b2b2b; border-radius: 3px; overflow: hidden; }
.evalbar-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #f0f0f0; transition: height .2s; }
.evalbar.flipped .evalbar-fill { bottom: auto; top: 0; }
.evalbar-text { position: absolute; left: 0; right: 0; bottom: 2px; font-size: 9px; text-align: center; color: #555; writing-mode: vertical-rl; transform: rotate(180deg); }

/* game page: one-screen game review (board | sidebar: coach bubble, label panel, moves, eval graph, controls) */
.study { --strip: 26px; --board-size: clamp(280px, min(calc(100vh - 170px), calc(100vw - 520px)), 820px);
  display: grid; grid-template-columns: auto minmax(320px, 460px); gap: 14px; align-items: start; justify-content: center; }
.study-board { display: flex; flex-direction: column; }
.player-strip { height: var(--strip); display: flex; align-items: center; gap: .45rem; padding-left: 24px; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-strip .dot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--text-muted); flex: none; }
.player-strip .dot.white { background: #f0f0f0; }
.player-strip .dot.black { background: #222; }
.player-strip .name.student { font-weight: 700; }
.study-side { height: calc(var(--board-size) + 2 * var(--strip)); display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.side-head { padding: .45rem .8rem; border-bottom: 1px solid var(--border); }
.side-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .7rem .5rem; flex: none; max-height: 45%; overflow-y: auto; }
.coach-avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 1.6rem; color: var(--accent); }
.coach-bubble { position: relative; flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .5rem .7rem .55rem; }
.coach-bubble::before { content: ""; position: absolute; left: -7px; top: 14px; width: 12px; height: 12px; background: var(--surface-2);
  border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.coach-head { display: flex; align-items: center; gap: .45rem; }
.coach-head strong { flex: 1; min-width: 0; font-size: .98rem; }
.eval-chip { flex: none; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .05rem .4rem; font-size: .82rem; }
.eval-chip:empty { display: none; }
.coach-body { font-size: .92rem; line-height: 1.45; }
.coach-body p { margin: .4rem 0 0; }
.coach-tags { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-top: .4rem; }
.coach-tags .chip { font-size: .78rem; }
.ai-text { border-left: 2px solid var(--accent); padding-left: .55rem; }
.badge-ic { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em; padding: 0 .2em; border-radius: 999px; color: #fff;
  font: 700 .72rem/1 var(--font); flex: none; }
.coach-head .badge-ic { font-size: .82rem; }
.var .tok { padding: .05rem .2rem; border-radius: 3px; cursor: pointer; color: var(--good); }
.var .tok:hover { background: var(--surface); }
.var .tok.cur { background: var(--accent-soft); outline: 1px solid var(--accent); color: var(--text); }
.coach-actions { display: flex; gap: .4rem; padding: 0 .7rem .6rem; flex: none; }
.act { flex: 1; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .4rem; font: inherit; font-weight: 600; cursor: pointer; }
.act:hover { border-color: var(--accent); }
.act.primary { background: #5d9b3a; border-color: #5d9b3a; color: #fff; }
.act.primary:hover { background: #6cae47; }
.act:disabled { opacity: .45; cursor: default; }
.label-slot { flex: none; margin: 0 .7rem .6rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.label-slot > summary { cursor: pointer; padding: .35rem .6rem; font-size: .86rem; font-weight: 600; }
.label-slot-body { max-height: 40vh; overflow-y: auto; }
.label-slot-body .label-panel { margin: 0; border: 0; border-radius: 0; background: none; padding: .2rem .6rem .6rem; }
#explore-toggle { display: none !important; }
.mlist { flex: 1; min-height: 3rem; overflow-y: auto; display: grid; grid-template-columns: 2.6em 1fr 1fr; align-content: start;
  border-top: 1px solid var(--border); font-size: .95rem; }
.mlist .no { color: var(--text-muted); background: var(--surface-2); text-align: right; padding: .22rem .45rem; font-size: .85rem; }
.mlist .mv { display: flex; align-items: center; gap: .3rem; padding: .22rem .55rem; cursor: pointer; white-space: nowrap; font-family: var(--mono); }
.mlist .mv:hover { background: var(--surface-2); }
.mlist .mv.empty, .mlist .mv.result { color: var(--text-muted); cursor: default; }
.mlist .mv.cur { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.mlist .mv.player { font-weight: 600; }
.mlist .mv.k-inaccuracy { color: var(--sev-inaccuracy); }
.mlist .mv.k-mistake { color: var(--sev-mistake); }
.mlist .mv.k-blunder { color: var(--sev-blunder); }
.mlist .mv.k-great { color: #7fb0d6; }
.chart-box.eval.mini { height: 64px; flex: none; border-top: 1px solid var(--border); cursor: pointer; }
.side-controls { flex: none; border-top: 1px solid var(--border); background: var(--surface-2); }
.nav-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.ctl { background: none; border: 0; color: var(--text); font-size: 1.2rem; padding: .4rem 0; cursor: pointer; }
.ctl:hover { background: var(--surface); color: var(--accent); }
.tool-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem; padding: .15rem .4rem .3rem; border-top: 1px solid var(--border); font-size: .85rem; }
.tool-group { display: inline-flex; align-items: center; gap: .1rem; }
.tool { background: none; border: 1px solid transparent; color: var(--text); padding: .2rem .5rem; border-radius: 5px; cursor: pointer; font: inherit; }
.tool:hover { border-color: var(--border); background: var(--surface); }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
body.exploring .mlist { opacity: .45; pointer-events: none; }
.study-help { text-align: center; margin: .6rem 0 0; }
.study-more { margin-top: 1rem; }
.study-more > summary { cursor: pointer; font-weight: 600; }
.study-more h3 { margin: 1rem 0 .5rem; }
@media (max-width: 900px) {
  .study { --board-size: min(calc(100vw - 72px), 600px); grid-template-columns: 1fr; justify-items: center; }
  .study-side { height: auto; width: 100%; max-width: calc(var(--board-size) + 24px); }
  .coach { max-height: none; }
  .mlist { max-height: 40vh; }
  .side-controls { position: sticky; bottom: 0; }
  .study-help { display: none; }
}
@media (max-width: 600px) { .study { --board-size: calc(100vw - 48px); } .player-strip { padding-left: 16px; } }
.mv.inaccuracy .g, .glyph.inaccuracy { color: var(--sev-inaccuracy); }
.mv.mistake .g, .glyph.mistake { color: var(--sev-mistake); }
.mv.blunder .g, .glyph.blunder { color: var(--sev-blunder); }
@media (max-width: 600px) { .evalbar { flex-basis: 10px; } .evalbar-text { display: none; } }

/* analysis form: browser-only note, game picker */
.browser-note { border-left: 3px solid var(--accent); padding: .4rem .7rem; background: var(--surface-2); border-radius: 4px; }
.pick summary { cursor: pointer; }
.pick-list { list-style: none; padding: 0; margin: .4rem 0 0; max-height: 22rem; overflow-y: auto; display: grid; gap: .15rem; }
.pick-list li { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.tabnum { font-variant-numeric: tabular-nums; }
/* browser worker bar (analysis.engine = "browser") */
.bw-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; gap: .8rem; align-items: center; justify-content: center; flex-wrap: wrap; padding: .45rem 1rem calc(.45rem + env(safe-area-inset-bottom, 0px)); background: var(--surface-2); border-top: 1px solid var(--accent); font-size: .88rem; }
.bw-bar b { color: var(--accent); }
body.has-bw-bar { padding-bottom: 2.6rem; }
