:root {
  color-scheme: dark;
  --bg: #262421;
  --surface: #312e2b;
  --surface-raised: #3d3a37;
  --surface-hover: #484440;
  --surface-inset: #211f1c;
  --edge: rgba(255,255,255,.06);
  --edge-strong: rgba(255,255,255,.13);
  --text: #ededeb;
  --muted: #b8b5b0;
  --faint: #8f8c87;
  --accent: #81b64c;
  --accent-hover: #92c35b;
  --accent-edge: #53933f;
  --accent-soft: rgba(129,182,76,.14);
  --board-light: #ebecd0;
  --board-dark: #739552;
  --board-light-move: #f5f682;
  --board-dark-move: #bbcc44;
  --brilliant: #1bada6;
  --great: #5c8bb0;
  --best: #96bc4b;
  --good-move: #89936f;
  --inaccuracy: #e2b83b;
  --mistake: #e6912c;
  --blunder: #ca3431;
  --good: #81b64c;
  --bad: #ca3431;
  --warn: #e6912c;
  --hard-shadow: 0 2px 0 rgba(0,0,0,.18);
  --board-shadow: 0 3px 10px rgba(0,0,0,.28);
  --t-fast: 120ms;
  --t-base: 200ms;
  --t-slow: 320ms;
  --t-sheet: 420ms;
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ease-ios: cubic-bezier(.32,.72,0,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 9px;
  --radius-chip: 999px;
  --header-h: 56px;
  --ease: var(--t-base) var(--ease-out);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.42;
  font-variant-numeric: tabular-nums;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
* { -webkit-tap-highlight-color: transparent; }
button, .btn, .sq, .mobile-tab, .tab-link { user-select: none; -webkit-user-select: none; }
button, summary, select, label.file-label { cursor: pointer; }
button:disabled, .btn:disabled { cursor: not-allowed; opacity: .42; transform: none !important; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 {
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.14;
}
h1 { font-size: clamp(22px, 5.4vw, 30px); }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
small, .muted { color: var(--muted); }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button, .btn, [role="button"], input, textarea, select { touch-action: manipulation; }
.move-strip, .live-move-ticker, .filter-row { touch-action: pan-x; }
.review-rail, .coach-card-scroll, .move-table-scroll, .chat-messages, .native-sheet-body, .mobile-drawer-body { touch-action: pan-y; }
html.immersive, body.immersive {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.immersive .app-shell, body.immersive .view {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,.22);
  background: var(--surface);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 3px 6px 3px 3px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.brand:hover { background: rgba(255,255,255,.04); }
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 7px;
  background: url("/static/icons/icon.svg") center/cover;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.account-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 48px;
  min-height: 38px;
  max-width: 140px;
  padding: 7px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.account-chip:hover { background: var(--surface-hover); }
.account-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--good); }
.status-dot.guest { background: var(--muted); }
.desktop-tabs { display: none; }

.view {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 14px 12px calc(88px + env(safe-area-inset-bottom));
}
.mobile-tabs {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(58px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0,0,0,.25);
  background: var(--surface);
}
.mobile-tab, .tab-link {
  border: 0;
  color: var(--muted);
  background: transparent;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.mobile-tab {
  min-height: 46px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: var(--radius-md);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.mobile-tab svg { width: 22px; height: 22px; fill: currentColor; transform-origin: 50% 55%; }
.mobile-tab:hover { color: var(--text); background: rgba(255,255,255,.035); }
.mobile-tab.active { color: var(--accent); background: transparent; }
.mobile-tab.active svg { animation: tabPop var(--t-base) var(--ease-spring); }
@keyframes tabPop {
  0% { transform: scale(1); }
  45% { transform: scale(.9); }
  100% { transform: scale(1); }
}

.hero {
  margin: 0 0 12px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--edge);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}
.hero p, .section-lede {
  max-width: 680px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
}
.section-head h2 { font-size: 18px; }
.section-head p { color: var(--muted); font-size: 12px; }

.card {
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--hard-shadow);
}
.card-inner { padding: 12px; }
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-title h2, .panel-title h3 { margin: 0; }
.divider { height: 1px; margin: 12px 0; background: var(--edge); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 800;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: transform 90ms var(--ease-out), box-shadow 90ms var(--ease-out), background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.btn-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 -4px 0 var(--accent-edge), 0 1px 0 rgba(0,0,0,.2);
  text-shadow: 0 1px 0 rgba(0,0,0,.14);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 var(--accent-edge), 0 1px 0 rgba(0,0,0,.16);
}
.btn-secondary, .btn-sheet-secondary {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28), 0 1px 0 rgba(0,0,0,.14);
}
.btn-secondary:hover, .btn-sheet-secondary:hover { background: var(--surface-hover); }
.btn-secondary:active, .btn-sheet-secondary:active {
  transform: translateY(2px);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.28);
}
.btn-ghost {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.045); }
.btn-danger {
  color: #fff;
  background: var(--bad);
  box-shadow: inset 0 -3px 0 #8f2927, 0 1px 0 rgba(0,0,0,.16);
}
.btn-danger:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 #8f2927; }
.btn-small { min-height: 38px; padding: 7px 11px; border-radius: 6px; font-size: 13px; }
.btn-block { width: 100%; }
.btn .spinner { width: 15px; height: 15px; }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(237,237,235,.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-grid { display: grid; gap: 10px; }
.field { display: grid; gap: 5px; }
.field span, .field label, .field-label-text {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.input, textarea.input, select.input {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--edge-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface-inset);
  color: var(--text);
  font-size: 16px;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
textarea.input { min-height: 124px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(129,182,76,.18); background: #242220; }
.input::placeholder { color: rgba(184,181,176,.52); }
.input-row { display: flex; gap: 7px; align-items: center; }
.input-row .input { flex: 1; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.form-note { color: var(--muted); font-size: 12px; }
.form-error, .inline-error { color: #ef817d; font-size: 12px; font-weight: 750; }
.form-success { color: var(--accent); font-size: 12px; font-weight: 750; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}
.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.segmented button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.segmented button.active {
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent-edge);
}

.bot-grid { display: grid; gap: 8px; margin-top: 10px; }
.bot-card {
  position: relative;
  width: 100%;
  min-height: 82px;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--hard-shadow);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.bot-card:hover { background: #363331; border-color: var(--edge-strong); }
.bot-card.active {
  border-color: var(--accent);
  background: #363331;
  box-shadow: inset 0 0 0 1px var(--accent), var(--hard-shadow);
}
.bot-card.active .bot-avatar { animation: avatarPop var(--t-slow) var(--ease-spring); }
@keyframes avatarPop {
  0% { transform: scale(1); }
  48% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.bot-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-raised);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.2);
}
.bot-avatar svg { width: 42px; height: 42px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.24)); }
.bot-copy { min-width: 0; display: grid; }
.bot-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bot-name { font-size: 14px; font-weight: 850; letter-spacing: -.01em; }
.elo-pill, .accuracy-badge, .source-pill, .result-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: var(--radius-chip);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}
.elo-pill { color: var(--accent); background: var(--accent-soft); }
.bot-tagline { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.3; }
.bot-personality { margin-top: 3px; color: rgba(237,237,235,.72); font-size: 11px; font-style: italic; line-height: 1.25; }
.bot-chevron { color: var(--accent); font-size: 24px; font-weight: 700; line-height: 1; }
.play-setup-footer {
  position: relative;
  z-index: 2;
  margin: 12px 0 6px;
  padding: 8px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--hard-shadow);
}

.game-layout, .review-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.board-column { min-width: 0; }
.board-panel { display: grid; gap: 7px; }
.player-strip {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 2px;
}
.player-id { display: flex; align-items: center; min-width: 0; gap: 8px; }
.player-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--surface-raised);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.24);
  font-size: 12px;
  font-weight: 900;
}
.bot-strip .player-avatar { background: var(--accent); box-shadow: inset 0 -3px 0 var(--accent-edge); }
.player-copy { min-width: 0; display: grid; }
.player-name {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-sub, .elo-chip { color: var(--muted); font-size: 11px; }
.thinking-dots {
  height: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 1px 0;
  opacity: 0;
}
.thinking-dots.active { animation: thinkingReveal 1ms linear 150ms forwards; }
.thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .25;
  animation: botDotPulse 900ms ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 150ms; }
.thinking-dots span:nth-child(3) { animation-delay: 300ms; }
@keyframes thinkingReveal { to { opacity: 1; } }
@keyframes botDotPulse {
  0%, 100% { opacity: .25; }
  50% { opacity: 1; }
}
.captured-tray { display: flex; align-items: center; justify-content: flex-end; min-width: 44px; max-width: 46%; min-height: 24px; }
.captured-tray .tray-piece {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-left: -6px;
}
.captured-tray .tray-piece:first-child { margin-left: 0; }
.captured-tray .tray-piece svg { width: 18px; height: 18px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.captured-tray .newly-captured { animation: capturedEnter var(--t-base) var(--ease-out); }
.material-plus { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
@keyframes capturedEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.board-wrap {
  position: relative;
  width: min(100%, calc(100vw - 24px), 480px);
  margin: 0 auto;
  transition: filter var(--t-slow) var(--ease-out);
}
.board-wrap.game-ended {
  filter: brightness(.55);
  transition-delay: 600ms;
  animation: boardDim var(--t-slow) var(--ease-out) 600ms both;
}
@keyframes boardDim {
  from { filter: brightness(1); }
  to { filter: brightness(.55); }
}
.chessboard {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: var(--board-shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.chessboard.pieces-enter .piece-svg { animation: pieceEnter 240ms var(--ease-out) both; }
@keyframes pieceEnter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.sq {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: filter var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.sq.light { background: var(--board-light); }
.sq.dark { background: var(--board-dark); }
.sq.interactive { cursor: pointer; }
.sq.interactive:active .piece-svg { transform: scale(.96); }
.sq.light.last-move { background: var(--board-light-move); }
.sq.dark.last-move { background: var(--board-dark-move); }
.sq.light.selected { background: var(--board-light-move); }
.sq.dark.selected { background: var(--board-dark-move); }
.sq.selected { box-shadow: inset 0 0 0 3px rgba(255,255,255,.42); }
.sq.check::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(202,52,49,.48);
  opacity: .88;
  animation: checkPulse var(--t-slow) var(--ease-out) 1 both;
}
@keyframes checkPulse {
  0% { opacity: .55; }
  55% { opacity: .95; }
  100% { opacity: .88; }
}
.sq.check.mate .piece-svg {
  transform-origin: 50% 86%;
  animation: kingTopple var(--t-slow) var(--ease-spring) both;
}
@keyframes kingTopple { to { transform: rotate(12deg); } }
.sq.winner-king {
  box-shadow: inset 0 0 0 3px var(--accent);
  animation: winnerRing 600ms var(--ease-out) 2;
}
@keyframes winnerRing {
  0%, 100% { box-shadow: inset 0 0 0 3px var(--accent); }
  50% { box-shadow: inset 0 0 0 3px rgba(129,182,76,.28); }
}
.sq.correct-target { animation: correctSquareFlash 400ms var(--ease-out); }
@keyframes correctSquareFlash {
  0% { box-shadow: inset 0 0 0 999px rgba(129,182,76,0); }
  35% { box-shadow: inset 0 0 0 999px rgba(129,182,76,.45); }
  100% { box-shadow: inset 0 0 0 999px rgba(129,182,76,0); }
}
.piece-svg {
  position: relative;
  z-index: 2;
  width: 88%;
  height: 88%;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.25));
  transition: transform var(--t-fast) var(--ease-out), filter var(--t-fast) var(--ease-out);
}
.legal-dot {
  position: absolute;
  z-index: 3;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0,0,0,.24);
  pointer-events: none;
  animation: legalFade var(--t-fast) var(--ease-out);
}
.legal-capture {
  position: absolute;
  z-index: 3;
  inset: 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.24);
  pointer-events: none;
  animation: legalFade var(--t-fast) var(--ease-out);
}
@keyframes legalFade { from { opacity: 0; } to { opacity: 1; } }
.coord {
  position: absolute;
  z-index: 4;
  font-size: 10px;
  font-weight: 700;
  opacity: .82;
  pointer-events: none;
}
.coord.rank { top: 3px; left: 4px; }
.coord.file { right: 4px; bottom: 2px; }
.sq.light .coord { color: var(--board-dark); }
.sq.dark .coord { color: var(--board-light); }
.sq.drag-target { box-shadow: inset 0 0 0 3px rgba(255,255,255,.6); }
.drag-ghost {
  position: fixed;
  z-index: 100;
  width: var(--ghost-size, 52px);
  height: var(--ghost-size, 52px);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.45));
}
.drag-ghost svg { width: 100%; height: 100%; }
.move-anim-piece, .captured-anim-piece {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
}
.move-anim-piece svg, .captured-anim-piece svg { width: 88%; height: 88%; display: block; }
.promotion-popover {
  position: absolute;
  z-index: 20;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--edge-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  box-shadow: 0 8px 20px rgba(0,0,0,.36);
  transform-origin: 50% 0;
  animation: promotionOpen var(--t-base) var(--ease-ios) both;
}
.promotion-popover button {
  width: var(--promo-size, 54px);
  height: var(--promo-size, 54px);
  min-height: var(--promo-size, 54px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.promotion-popover button:hover { background: rgba(129,182,76,.16); }
.promotion-popover button + button { border-top: 1px solid var(--edge); }
.promotion-popover svg { width: 88%; height: 88%; }
@keyframes promotionOpen {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}
.board-caption { margin-top: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.board-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 7px;
}
.toggle-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.toggle-chip:hover { color: var(--text); background: var(--surface-raised); }
.toggle-chip.active { color: var(--accent); border-color: rgba(129,182,76,.44); background: var(--accent-soft); }

.game-side-panel { display: grid; gap: 10px; }
.move-list {
  max-height: 238px;
  overflow: auto;
  padding: 2px 0;
  scrollbar-width: thin;
}
.move-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  gap: 5px;
  min-height: 29px;
  align-items: center;
  border-bottom: 1px solid var(--edge);
  font-size: 13px;
}
.move-row:last-child { border-bottom: 0; }
.move-number { color: var(--faint); font-size: 11px; font-weight: 800; }
.move-san { padding: 3px 5px; border-radius: 4px; font-weight: 750; }
.move-san.latest { color: var(--accent); background: var(--accent-soft); }
.status-card { display: grid; gap: 7px; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }
.status-line strong { color: var(--text); font-size: 13px; }
.bot-quote {
  margin-top: 5px;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--accent-soft);
  color: rgba(237,237,235,.9);
  font-size: 13px;
  font-style: italic;
}

.sheet-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20,18,16,.68);
  animation: sheetBackdropIn var(--t-fast) var(--ease-out) 700ms both;
}
.end-sheet {
  position: relative;
  width: min(100%, 500px);
  max-height: calc(88vh - env(safe-area-inset-bottom));
  overflow: hidden auto;
  border: 1px solid var(--edge-strong);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 28px rgba(0,0,0,.38);
  transform: translateY(100%);
  animation: sheetRise var(--t-sheet) var(--ease-ios) 700ms both;
}
.end-sheet.settled { animation: none; transform: translateY(0); }
.sheet-grab {
  position: relative;
  z-index: 2;
  height: 34px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  cursor: grab;
  touch-action: none;
}
.sheet-grab span { width: 36px; height: 5px; border-radius: 999px; background: rgba(184,181,176,.42); }
.end-sheet-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}
.end-result-word {
  margin-top: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.05;
}
.end-result-word.win { color: var(--good); }
.end-result-word.draw { color: var(--text); }
.end-result-word.loss { color: #ef817d; }
.end-reason { margin-top: -6px; color: var(--muted); font-size: 12px; }
.end-rating-row {
  width: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 12px;
  margin-top: 2px;
}
.end-rating-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
}
.end-rating-number {
  color: var(--text);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.end-delta-chip {
  min-width: 42px;
  margin-bottom: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-chip);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}
.end-delta-chip.good { color: #fff; background: var(--good); }
.end-delta-chip.bad { color: #fff; background: var(--bad); }
.end-delta-chip.pop { animation: deltaPop var(--t-slow) var(--ease-spring); }
@keyframes deltaPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.end-actions, .end-analysis { width: 100%; display: grid; gap: 8px; margin-top: 4px; }
.end-review {
  color: #171309;
  background: #e6b450;
  box-shadow: inset 0 -4px 0 #ad7d1f, 0 1px 0 rgba(0,0,0,.2), 0 0 24px rgba(230,180,80,.24);
  text-shadow: none;
}
.end-review:hover { background: #f0c368; }
.end-review:active { box-shadow: inset 0 -2px 0 #ad7d1f, 0 1px 0 rgba(0,0,0,.16), 0 0 16px rgba(230,180,80,.18); }
.end-secondary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-sheet-secondary { min-height: 44px; border-radius: var(--radius-md); }
.end-particles {
  position: absolute;
  z-index: 0;
  inset: 0 0 auto;
  height: 170px;
  overflow: hidden;
  pointer-events: none;
}
.end-particles span {
  position: absolute;
  top: 28px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--pcolor);
  opacity: 0;
  animation: particleFall 1400ms var(--ease-out) var(--delay) both;
}
@keyframes particleFall {
  0% { opacity: 0; transform: translateY(0) scale(.8); }
  8% { opacity: 1; }
  100% { opacity: 0; transform: translateY(120px) scale(1); }
}
@keyframes sheetBackdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetRise { from { transform: translateY(100%); } to { transform: translateY(0); } }

.analysis-wait-card {
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.analysis-bar {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.analysis-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: analysisSlide 1100ms linear infinite;
}
@keyframes analysisSlide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}
.analysis-copy { min-height: 18px; color: var(--muted); font-size: 12px; transition: opacity var(--t-base) var(--ease-out); }
.analysis-copy.copy-fade { opacity: 0; }

.games-list { display: grid; gap: 8px; }
.game-card {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  box-shadow: var(--hard-shadow);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
button.game-card:hover, .game-card:hover { background: #363331; border-color: var(--edge-strong); }
.game-main { min-width: 0; }
.game-title-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.game-opponent { overflow: hidden; font-size: 14px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.game-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.game-end { display: flex; align-items: center; gap: 7px; }
.result-chip.win { color: #fff; background: var(--good); }
.result-chip.loss { color: #fff; background: var(--bad); }
.result-chip.draw, .result-chip.active { color: var(--text); background: var(--surface-raised); }
.result-chip.review { color: #fff; background: var(--accent); }
.accuracy-badge.high { color: var(--best); background: rgba(150,188,75,.13); }
.accuracy-badge.mid { color: var(--inaccuracy); background: rgba(226,184,59,.13); }
.accuracy-badge.low { color: #ef817d; background: rgba(202,52,49,.14); }
.source-pill { color: var(--muted); background: var(--surface-raised); }
.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 26px 14px;
  border: 1px dashed rgba(184,181,176,.28);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text); font-size: 15px; }
.games-empty .mini-board { width: 120px; opacity: .35; pointer-events: none; }
.games-empty .mini-board .chessboard { width: 120px; box-shadow: none; }
.text-link {
  min-height: 40px;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.import-grid { display: grid; gap: 8px; }
.import-card {
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--hard-shadow);
}
.import-card h3 { margin-bottom: 2px; }
.import-card p { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.import-skeletons { display: grid; gap: 8px; margin-top: 10px; }
.import-skeleton-row {
  height: 58px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  animation: skeletonPulse 1200ms ease-in-out infinite;
}
@keyframes skeletonPulse {
  0%, 100% { opacity: .58; }
  50% { opacity: 1; }
}
.import-error { margin-top: 6px; font-size: 12px; font-weight: 700; }

.review-layout.setup-layout { align-items: start; }
.sample-row { display: grid; gap: 7px; }
.loading-view { min-height: 40vh; display: grid; place-items: center; color: var(--muted); gap: 10px; }
.loading-view .spinner { width: 26px; height: 26px; color: var(--accent); }
.clean-review { text-align: center; }
.clean-review strong { color: var(--text); font-size: 16px; font-weight: 750; }
.clean-check { width: 46px; height: 46px; }
.clean-check path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 44;
  stroke-dashoffset: 44;
  animation: cleanCheckDraw 500ms var(--ease-out) forwards;
}
@keyframes cleanCheckDraw { to { stroke-dashoffset: 0; } }

.review-desk {
  width: min(100%, 560px);
  margin: auto;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.review-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--edge);
}
.review-summary small, .review-voice small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.review-summary h1 {
  margin: 3px 0 0;
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  text-wrap: balance;
}
.review-summary em { font: normal 12px system-ui; color: var(--muted); }
.accuracy-score { text-align: right; flex: none; }
.accuracy-score strong {
  display: block;
  color: var(--best);
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.accuracy-score small { color: var(--muted); font-size: 10px; letter-spacing: 0; }
.accuracy-score .other-accuracy { display: block; font-weight: 500; }
.grade-counts, .move-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}
.grade-counts {
  flex-wrap: nowrap;
  gap: 4px 8px;
  align-items: center;
}
.grade-counts span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.move-grade {
  display: inline-grid;
  place-items: center;
  width: 16px;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  color: #fff;
  background: var(--best);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 1px rgba(0,0,0,.28);
}
.grade-brilliant { background: var(--brilliant); }
.grade-great { background: var(--great); }
.grade-best, .grade-excellent { background: var(--best); }
.grade-good { background: var(--good-move); }
.grade-inaccuracy { color: #262421; background: var(--inaccuracy); }
.grade-mistake { background: var(--mistake); }
.grade-blunder { background: var(--blunder); }
.review-voice {
  position: relative;
  padding: 9px 11px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--hard-shadow);
}
.review-voice::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--surface-raised);
  border-right: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  transform: rotate(45deg);
}
.review-voice p {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.36;
}
.review-position { display: flex; gap: 7px; align-items: stretch; }
.review-board { position: relative; flex: 1; min-width: 0; }
.review-meter {
  width: 7px;
  overflow: hidden;
  position: relative;
  border-radius: 4px;
  background: #191715;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.review-meter i { position: absolute; bottom: 0; width: 100%; background: #ededeb; }
.review-arrows { pointer-events: none; position: absolute; inset: 0; width: 100%; height: 100%; }
.sq .move-grade { position: absolute; z-index: 5; top: 2px; right: 2px; }
.review-chart {
  overflow: hidden;
  padding: 5px 7px 2px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.review-chart svg { height: 46px; touch-action: none; cursor: crosshair; }
.eval-sparkline { width: 100%; display: block; overflow: visible; }
.eval-zero { stroke: rgba(237,237,235,.18); stroke-width: 1; stroke-dasharray: 3 4; }
.eval-area { fill: rgba(237,237,235,.06); }
.eval-line {
  fill: none;
  stroke: #dcdee0;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.eval-key-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; pointer-events: none; }
.eval-key-hit { fill: transparent; stroke: none; cursor: pointer; pointer-events: all; }
.eval-scrub-line { stroke: var(--accent); stroke-width: 1.5; opacity: .8; }
.eval-current-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.move-strip {
  position: relative;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.move-strip button {
  position: relative;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.move-strip button:hover { background: rgba(255,255,255,.05); }
.move-strip button[aria-current="true"] {
  color: var(--accent);
  background: var(--surface-raised);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.key-move:before {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.pair-number { flex: 0 0 auto; color: var(--faint); font-size: 11px; }
.review-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.review-actions button {
  flex: auto;
  min-height: 40px;
  height: 40px;
  padding: 0 9px;
  font-size: 12px;
}
.review-actions #practice, .review-actions #answer {
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent-edge);
}
.review-actions #practice:active, .review-actions #answer:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 var(--accent-edge); }
.review-desk details {
  padding: 8px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.review-desk details summary { min-height: 30px; color: var(--text); font-weight: 750; }
.review-desk details p { margin: 6px 0; }
.review-desk details .btn { margin: 6px 0; }

.profile-hero { display: grid; gap: 10px; }
.rating-card { position: relative; overflow: hidden; padding: 14px; }
.rating-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.rating-number {
  margin-top: 3px;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sparkline { width: 100%; height: 82px; margin-top: 9px; overflow: visible; }
.sparkline .grid-line { stroke: rgba(237,237,235,.1); stroke-width: 1; }
.sparkline .spark-area { fill: rgba(129,182,76,.1); }
.sparkline .spark-path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.sparkline.empty-history { height: 64px; }
.empty-rating-line { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 5; }
.chart-caption { margin-top: 4px; color: var(--muted); font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-card {
  padding: 11px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--hard-shadow);
}
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 750; }
.auth-grid { display: grid; gap: 10px; }
.user-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.user-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent-edge);
  font-size: 17px;
  font-weight: 900;
}
.user-name { overflow: hidden; font-size: 15px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
  background: rgba(20,18,16,.68);
  animation: fadeIn 150ms ease;
}
.modal-card {
  width: min(100%, 480px);
  max-height: min(82vh, 640px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--edge-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0,0,0,.42);
  animation: riseIn 180ms ease;
}
.modal-kicker { color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.modal-card h2 { margin-top: 6px; }
.modal-card p { margin-top: 7px; color: var(--muted); }
.modal-actions { display: grid; gap: 8px; margin-top: 14px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }

.toast {
  position: fixed;
  z-index: 100;
  right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  left: 12px;
  max-width: 500px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left: 3px solid var(--bad); }
.toast.info { border-left: 3px solid var(--accent); }
.noscript { padding: 30px; text-align: center; color: #ef817d; }

.turning-point-card, .coach-card, .walkthrough-insight, .eval-strip {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.turning-eyebrow, .walkthrough-insight h3, .coach-card h3 {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.turning-copy p, .walkthrough-insight p, .coach-card p { color: var(--text); font-size: 14px; }
.turning-sparkline { width: 100%; height: 64px; display: block; overflow: visible; }
.turning-area { fill: rgba(237,237,235,.08); }
.turning-line, .turning-ghost { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.turning-line { stroke: var(--text); stroke-width: 2; }
.turning-ghost { stroke: var(--good); stroke-width: 2; stroke-dasharray: 4 5; opacity: .7; }
.turning-dot { fill: var(--accent); }
.turning-ripple { fill: none; stroke: var(--accent); stroke-width: 2; }
.turning-fixed { color: var(--good); font-size: 12px; font-weight: 800; }
.move-class-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.move-class-chip { padding: 3px 7px; border-radius: var(--radius-chip); font-size: 11px; font-weight: 850; }
.move-class-chip.best { color: #fff; background: var(--best); }
.move-class-chip.inaccuracy { color: #262421; background: var(--inaccuracy); }
.move-class-chip.mistake { color: #fff; background: var(--mistake); }
.move-class-chip.blunder { color: #fff; background: var(--blunder); }
.feedback-box {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}
.feedback-box .hint { color: var(--accent); }
.evidence-details { border-top: 1px solid var(--edge); padding-top: 8px; }
.evidence-details summary { min-height: 38px; color: var(--accent); font-weight: 800; }
.evidence-details dl { display: grid; gap: 8px; margin: 7px 0 0; }
.evidence-details dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.evidence-details dd { margin: 2px 0 0; color: var(--text); }
.review-tabs-note { padding: 9px 10px; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.eval-readout { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.eval-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.eval-value.positive { color: var(--good); }
.eval-value.negative { color: #ef817d; }
.eval-value.even { color: var(--text); }
.eval-caption { color: var(--muted); font-size: 11px; font-weight: 750; }
.walk-controls {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 10px auto 0;
}
.walk-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28);
  color: var(--text);
  font-weight: 800;
}
.walk-button:hover { background: var(--surface-hover); }
.chevron { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.walk-position { min-width: 54px; color: var(--muted); font-size: 12px; text-align: center; }
.walk-position strong { color: var(--text); font-size: 16px; }
.opponent-pill, .key-moment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: var(--radius-chip);
  font-size: 11px;
  font-weight: 800;
}
.opponent-pill { color: var(--muted); background: var(--surface-raised); }
.key-moment-badge { color: #fff; background: var(--accent); }

@media (min-width: 560px) {
  .view { padding-right: 18px; padding-left: 18px; }
  .bot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bot-card.grandmaster { grid-column: 1 / -1; }
  .import-grid, .auth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-backdrop { place-items: center; }
  .modal-actions { grid-template-columns: 1fr 1fr; }
  .modal-actions .btn-primary { grid-column: 1 / -1; }
}

@media (min-width: 840px) {
  .app-header { padding-right: max(20px, calc((100vw - 1100px)/2)); padding-left: max(20px, calc((100vw - 1100px)/2)); }
  .desktop-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--edge);
    border-radius: var(--radius-md);
    background: var(--surface-inset);
  }
  .tab-link {
    min-height: 34px;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 800;
  }
  .tab-link:hover { color: var(--text); background: rgba(255,255,255,.05); }
  .tab-link.active {
    color: #fff;
    background: var(--accent);
    box-shadow: inset 0 -3px 0 var(--accent-edge);
  }
  .mobile-tabs { display: none; }
  .view { padding: 22px 24px 56px; }
  .hero { margin-bottom: 16px; }
  .game-layout, .review-layout { grid-template-columns: minmax(0, 1.06fr) minmax(300px, .74fr); gap: 22px; }
  .review-layout.setup-layout { grid-template-columns: minmax(0, .95fr) minmax(340px, .85fr); }
  .bot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bot-card.grandmaster { grid-column: auto; }
  .profile-hero { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: start; }
  .toast { right: 20px; left: auto; bottom: 20px; margin: 0; }
  .walkthrough-panel { position: sticky; top: 74px; }
}

@media (min-width: 1120px) {
  .bot-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bot-card { grid-template-columns: 1fr; align-content: start; min-height: 178px; }
  .bot-chevron { position: absolute; right: 10px; top: 10px; }
}

@media (max-width: 600px) {
  .view:has(.review-desk) { padding-top: 8px; }
  .review-desk { gap: 6px; }
  .review-board { max-width: min(100%, 46svh); }
  .review-position { justify-content: center; }
  .review-summary small { line-height: 1.1; }
}

@media (max-width: 390px) {
  .view { padding-right: 10px; padding-left: 10px; }
  .board-wrap { width: min(100%, calc(100vw - 20px), 480px); }
  .account-chip { max-width: 108px; padding-right: 8px; padding-left: 8px; }
  .player-strip { padding-right: 0; padding-left: 0; }
  .board-actions .btn { flex: 1 1 auto; }
  .walk-controls { gap: 7px; }
  .walk-button { min-height: 42px; font-size: 12px; }
  .walk-position { min-width: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
  }
  .legal-dot, .legal-capture { animation-duration: var(--t-fast) !important; }
  .analysis-copy, .toast { transition: opacity var(--t-fast) ease !important; }
  .end-particles, .turning-ripple { display: none !important; }
  .end-sheet, .end-sheet.settled { animation: none !important; transform: translateY(0) !important; }
  .sheet-backdrop { animation-duration: var(--t-fast) !important; }
  .thinking-dots span { animation: none !important; opacity: 1; }
}

:root {
  --bg: #262421;
  --surface: #312e2b;
  --surface-raised: #3a3631;
  --surface-hover: #44403a;
  --surface-inset: #211f1c;
  --accent: #81b64c;
  --text: #f1efea;
  --muted: #a6a199;
  --edge: #3a3631;
  --edge-strong: #4a453f;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;
  --radius-sheet: 20px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.34;
  font-variant-numeric: tabular-nums;
}
h1 { font-size: 28px; font-weight: 800; line-height: 34px; letter-spacing: -.028em; }
h2 { font-size: 20px; line-height: 25px; }
h3 { font-size: 17px; line-height: 22px; }
button, input, textarea, select { font-variant-numeric: tabular-nums; }
.view {
  width: min(100%, 640px);
  padding: calc(8px + env(safe-area-inset-top)) 16px calc(78px + env(safe-area-inset-bottom));
}
.mobile-tabs {
  height: calc(49px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 3px 10px calc(3px + env(safe-area-inset-bottom));
  border-top: 1px solid #3a3631;
  background: rgba(38,36,33,.94);
}
.mobile-tab { min-height: 44px; font-size: 10px; }
.mobile-tab svg { width: 21px; height: 21px; }
body.immersive .mobile-tabs { display: none; }
body.immersive .view {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.native-title-block, .native-title-row {
  margin: 2px 0 14px;
}
.native-title-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.native-title-row h1, .native-title-block h1 { margin: 0; }
.app-brand { display: flex; align-items: center; gap: 8px; }
.app-brand img { border-radius: 7px; }

.native-sheet-backdrop {
  position: fixed;
  z-index: 88;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20,18,16,.68);
  animation: sheetBackdropIn var(--t-fast) var(--ease-out) both;
}
.native-sheet {
  width: min(100%, 500px);
  max-height: calc(88vh - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--edge-strong);
  border-bottom: 0;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--surface);
  box-shadow: 0 -8px 28px rgba(0,0,0,.38);
  animation: sheetRise 320ms var(--ease-ios) both;
}
.native-sheet-grab { flex: 0 0 28px; height: 28px; padding-top: 7px; }
.native-sheet-header {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 6px;
}
.native-sheet-header h2 { font-size: 17px; line-height: 22px; font-weight: 800; }
.sheet-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
}
.native-sheet-body {
  display: grid;
  gap: 13px;
  overflow-y: auto;
  padding: 2px 16px calc(16px + env(safe-area-inset-bottom));
}
.bot-config-sheet { height: auto; min-height: 0; }
.bot-config-sheet .native-sheet-header { justify-content: flex-end; min-height: 28px; padding-bottom: 0; }
.bot-config-sheet .native-sheet-header h2 { display: none; }
.bot-config-sheet .native-sheet-body { gap: 14px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.bot-sheet-hero { display: flex; align-items: center; gap: 12px; }
.bot-badge {
  border-radius: 12px;
  font-size: 25px;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.bot-badge.large { width: 58px; height: 58px; flex-basis: 58px; font-size: 34px; }
.bot-sheet-title { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bot-sheet-title h3 { font-size: 20px; line-height: 25px; }
.bot-sheet-bio { color: var(--muted); font-size: 14px; line-height: 1.35; }
.sheet-field { gap: 7px; }
.sheet-copy { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.sheet-play-cta { min-height: 50px; font-size: 16px; }
.import-segmented { grid-template-columns: repeat(2, 1fr); }
.sheet-list { display: grid; overflow: hidden; border-radius: 12px; background: var(--surface-inset); }
.sheet-list-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--edge);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}
.sheet-list-row:last-child { border-bottom: 0; }
.sheet-list-row strong { color: var(--muted); font-size: 13px; font-weight: 750; }
.sheet-list-row:active { background: rgba(255,255,255,.045); }
.sheet-danger-zone { display: grid; gap: 10px; padding-top: 2px; }
.confirm-resign { display: grid; gap: 9px; padding: 10px; border: 1px solid rgba(202,52,49,.44); border-radius: 12px; background: rgba(202,52,49,.1); }
.confirm-resign p { color: var(--text); font-size: 13px; }
.confirm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.continuation-copy { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.continuation-copy strong { color: var(--text); }

.play-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.play-header { margin: 2px 0 0; }
.play-rating-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid var(--edge-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.ladder-progress-card {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.ladder-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.ladder-progress-top strong { color: var(--text); font-size: 13px; font-weight: 800; }
.ladder-progress-top span { color: var(--muted); font-weight: 700; }
.ladder-progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-inset);
}
.ladder-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.section-kicker {
  margin: 2px 0 -4px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.bot-grid, .bot-grid.bot-ladder { grid-template-columns: 1fr; gap: 10px; margin-top: 0; }
.bot-card.bot-row {
  min-height: 82px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface);
}
.bot-card.bot-row.active {
  border-color: rgba(129,182,76,.48);
  box-shadow: var(--hard-shadow);
}
.bot-card.bot-row .bot-avatar { width: 48px; height: 48px; }
.bot-card.bot-row .bot-name-row { flex-wrap: nowrap; min-width: 0; }
.bot-card.bot-row .bot-name { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.bot-card.bot-row .bot-tagline {
  overflow: hidden;
  margin-top: 3px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-card.bot-row .bot-chevron { color: var(--muted); font-size: 22px; }
.beaten-chip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.play-quick-footer {
  margin-top: 4px;
  padding-top: 0;
}
.play-quick-cta { min-height: 48px; font-size: 15px; }
.elo-pill, .accuracy-badge, .source-pill, .result-chip {
  min-height: 21px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.immersive-nav {
  flex: 0 0 auto;
  min-height: calc(44px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(66px, auto) minmax(0, 1fr) minmax(44px, auto);
  align-items: center;
  gap: 6px;
  padding: env(safe-area-inset-top) 6px 0;
  border-bottom: 1px solid var(--edge);
  background: var(--bg);
}
.nav-back {
  min-width: 64px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 750;
  text-align: left;
}
.nav-icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  justify-self: end;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}
.nav-icon-btn:active { background: rgba(255,255,255,.06); color: var(--text); }
.immersive-nav-title {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-spacer { width: 44px; height: 44px; }
.live-game-screen {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.live-bot-banner {
  height: 86px;
  flex: 0 0 86px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 4px;
  padding: 10px 12px;
}
.live-bot-portrait {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge-strong);
  border-radius: 12px;
  background: var(--surface);
  font-size: 26px;
  line-height: 1;
}
.live-bot-bubble {
  flex: 1;
  min-width: 0;
  height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.live-bot-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-bot-quote {
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.live-board-stack { flex: 0 0 auto; min-height: 0; display: flex; flex-direction: column; margin: 8px 0; }
.live-game-screen .player-strip {
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  gap: 8px;
}
.live-game-screen .player-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.live-game-screen .player-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 7px;
  font-size: 14px;
  transition: box-shadow var(--t-fast) var(--ease-out);
}
.live-game-screen .player-strip.is-turn .player-avatar {
  box-shadow: 0 0 0 2px var(--accent), inset 0 -2px 0 rgba(0,0,0,.22);
}
.live-game-screen .player-name { font-size: 14px; font-weight: 800; line-height: 1.1; }
.live-game-screen .player-elo {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.turn-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(129,182,76,.22);
}
.live-game-screen .thinking-dots { height: 10px; margin: 0 0 0 2px; }
.live-game-screen .captured-tray { min-width: 0; max-width: 44%; min-height: 20px; }
.live-game-screen .captured-tray .tray-piece,
.live-game-screen .captured-tray .tray-piece svg { width: 16px; height: 16px; }
.review-board-shell {
  width: min(100vw, 52vh);
  max-width: 100vw;
  margin: 0 auto;
}
.immersive-board {
  width: clamp(240px, min(100vw, calc(100dvh - 390px - env(safe-area-inset-top) - env(safe-area-inset-bottom))), 52vh);
  max-width: 100vw;
  margin: 0 auto;
}
.immersive-board .chessboard, .review-board .chessboard {
  border-radius: 0;
  box-shadow: none;
}
.live-move-panel {
  flex: 1 1 auto;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  border-top: 1px solid var(--edge);
  background: var(--surface-inset);
}
.live-match-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.live-match-strip div {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 16px 6px;
}
.live-match-strip div + div { border-left: 1px solid var(--edge); }
.live-match-strip strong { color: var(--text); font-size: 14px; font-weight: 800; }
.live-match-strip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.live-move-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
}
.live-move-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}
.live-opening-name {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-move-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.live-move-ticker {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding: 0 10px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  scrollbar-width: none;
  white-space: nowrap;
}
.live-move-ticker::-webkit-scrollbar, .move-strip::-webkit-scrollbar, .filter-row::-webkit-scrollbar { display: none; }
.ticker-num {
  flex: 0 0 auto;
  margin-left: 4px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 750;
}
.ticker-num:first-child { margin-left: 0; }
.ticker-move {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
}
.ticker-move.latest { color: #fff; background: var(--accent); }
.game-action-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
  background: var(--surface);
}
.action-bar-btn {
  min-height: 46px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  padding: 4px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}
.action-bar-btn svg { width: 20px; height: 20px; fill: currentColor; }
.action-bar-btn:hover, .action-bar-btn:active { color: var(--text); background: rgba(255,255,255,.06); }

.games-screen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.games-screen .native-title-row { margin: 2px 0 0; }
.add-import-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--accent);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.24);
  font-size: 29px;
  font-weight: 500;
  line-height: 1;
}
.resume-review {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(129,182,76,.35);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
}
.resume-review span:first-child { min-width: 0; display: grid; gap: 1px; }
.resume-review strong { color: var(--accent); font-size: 13px; }
.resume-review small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.filter-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0;
  padding-bottom: 0;
  scrollbar-width: none;
}
.filter-chip {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.filter-chip.active {
  border-color: rgba(129,182,76,.55);
  background: var(--accent-soft);
  color: var(--accent);
}
.library-status { color: var(--faint); font-size: 11px; }
.library-status:empty { display: none; }
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -4px 2px 0;
  padding: 0 2px 7px;
  border-bottom: 1px solid var(--edge);
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
}
.sync-dot {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .75;
}
.sync-status.error { color: var(--muted); }
.sync-status.error .sync-dot { background: var(--bad); }
.games-list { gap: 7px; }
.game-card.game-row {
  min-height: 62px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border-radius: 12px;
  box-shadow: none;
}
.games-import-banner {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border: 1px dashed var(--edge-strong);
  border-radius: 12px;
  background: rgba(49,46,43,.55);
  color: var(--text);
  text-align: left;
}
.games-import-banner span:first-child { min-width: 0; display: grid; gap: 2px; }
.games-import-banner strong { font-size: 13px; font-weight: 800; color: var(--text); }
.games-import-banner small { font-size: 11px; color: var(--muted); }
.games-import-banner:active { background: var(--surface); }
.result-edge {
  width: 20px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.result-edge.win { background: var(--good); }
.result-edge.loss { background: var(--bad); }
.result-edge.draw { color: var(--text); background: #6d6861; }
.result-edge.active { color: var(--muted); background: var(--surface-raised); }
.game-row-top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.game-row-top .game-opponent { font-size: 14px; }
.opponent-elo { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.game-row .game-meta {
  overflow: hidden;
  margin-top: 3px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-row-end { display: flex; align-items: center; gap: 5px; }
.row-chevron { color: var(--faint); font-size: 22px; line-height: 1; }
.analyze-pill { color: var(--muted); background: var(--surface-raised); }
.game-row[aria-label^="Analyze"] { cursor: pointer; }

.review-screen {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
}
.review-nav { grid-template-columns: minmax(70px, auto) minmax(0, 1fr) auto; }
.review-title { font-size: 14px; }
.review-nav-trailing { display: flex; align-items: center; gap: 2px; }
.review-accuracy-pill {
  min-width: 48px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(150,188,75,.14);
  color: var(--best);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-overflow {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}
.coach-strip {
  height: 76px;
  flex: 0 0 76px;
  margin: 8px 12px;
  padding: 9px 12px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}
.coach-strip::before { display: none; }
.coach-strip.tappable { cursor: pointer; }
.coach-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.coach-line-hint {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}
.coach-strip p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.review-position { flex: 0 0 auto; display: block; }
.review-board-shell { position: relative; }
.review-board { position: relative; width: 100%; }
.review-board .coord.rank { left: 10px; }
.review-meter {
  position: absolute;
  z-index: 7;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  overflow: hidden;
  border-radius: 0;
  background: #191715;
  box-shadow: none;
}
.review-arrows { z-index: 5; }
.review-promotion-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px 12px 0;
}
.review-deck {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--edge);
  background: var(--surface-inset);
}
.review-eval-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.review-eval-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.review-eval-chip.positive { color: var(--best); border-color: rgba(150,188,75,.35); }
.review-eval-chip.negative { color: #ef817d; border-color: rgba(202,52,49,.35); }
.review-best-copy {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.review-chart {
  flex: 1 1 auto;
  min-height: 56px;
  max-height: 82px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
}
.review-chart svg { width: 100%; height: 100%; min-height: 46px; }
.review-screen .move-strip {
  flex: 0 0 auto;
  height: 42px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
}
.review-screen .move-strip button { min-height: 34px; font-size: 12px; }
.review-grade-row {
  flex: 0 0 auto;
  gap: 10px;
  padding: 0 2px;
}
.review-grade-row .grade-stat { font-size: 11px; gap: 4px; }
.review-action-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
  background: var(--surface);
}
.review-stepper {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.28);
  color: var(--text);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}
.review-stepper:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(0,0,0,.28); }
.review-primary-slot { min-width: 0; display: grid; }
.review-primary-pill {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset 0 -4px 0 #5d8734, 0 1px 0 rgba(0,0,0,.2);
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  justify-self: center;
}
.review-primary-pill:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 #5d8734; }
.practice-prompt {
  min-height: 48px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profile-screen { display: flex; flex-direction: column; gap: 12px; }
.profile-compact-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-avatar { width: 44px; height: 44px; flex-basis: 44px; border-radius: 12px; }
.profile-compact-header h1 { font-size: 28px; line-height: 32px; }
.profile-compact-header p { color: var(--muted); font-size: 13px; }
.claim-account {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(129,182,76,.34);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
}
.claim-account strong { color: var(--accent); font-size: 13px; }
.claim-account span { color: var(--muted); font-size: 12px; }
.hero-rating-card { border-radius: 12px; padding: 14px; }
.rating-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.rating-range {
  width: 132px;
  grid-template-columns: repeat(3, 1fr);
  padding: 2px;
}
.rating-range button { min-height: 28px; font-size: 10px; }
.hero-rating-card .rating-number { font-size: 40px; }
.hero-rating-card .sparkline { height: 68px; margin-top: 6px; }
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.kpi-strip div { display: grid; justify-items: center; gap: 2px; padding: 11px 4px; }
.kpi-strip div + div { border-left: 1px solid var(--edge); }
.kpi-strip strong { font-size: 17px; font-weight: 850; font-variant-numeric: tabular-nums; }
.kpi-strip span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.best-win-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 13px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.best-win-row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.profile-error { margin: 0; }
.inset-group { display: grid; gap: 6px; }
.inset-group > h2 {
  margin: 2px 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  line-height: 16px;
  text-transform: uppercase;
}
.inset-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.inset-list .inset-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--edge);
  border-radius: 0;
}
.inset-list .inset-row:last-child { border-bottom: 0; }
.inset-row, .inset-card {
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.inset-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}
.inset-row strong { color: var(--muted); font-size: 13px; }
.inset-card { padding: 12px; }
.native-auth-grid { grid-template-columns: 1fr; gap: 8px; }
.native-auth-grid .panel-title { margin-bottom: 6px; }
.native-auth-grid .btn { width: 100%; }
.auth-error { margin: 0; }

@media (min-width: 840px) {
  .mobile-tabs { display: grid; }
  .view { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  body.immersive .view { padding-bottom: 0; }
}

@media (max-width: 390px) {
  .view { padding-right: 14px; padding-left: 14px; }
  body.immersive .view { padding-right: 0; padding-left: 0; }
  .review-title { font-size: 13px; }
  .review-accuracy-pill { min-width: 44px; font-size: 10px; }
}
.review-screen .review-board { max-width: none; }
.sheet-danger-arm { color: #ef817d; }
body.sheet-open { overflow: hidden; }


/* ==========================================================================
   Review V2: Desktop Workstation (>=1024px) & Tightened Mobile (<1024px)
   ========================================================================== */

.desktop-only { display: none !important; }
.mobile-only { display: flex; }

.review-screen {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.review-nav {
  flex: 0 0 auto;
  min-height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--edge);
  background: var(--surface);
}
.review-nav-center {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.review-opening-tag {
  display: none;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.review-opening-tag::before {
  content: "·";
  margin-right: 8px;
  color: var(--faint);
}
.nav-desktop-btn {
  display: none;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.nav-desktop-btn:hover { color: var(--text); background: var(--surface-raised); }
.nav-desktop-btn.active { color: var(--text); background: var(--surface-raised); border-color: var(--edge); }

/* Mobile Coach Strip */
.coach-strip.mobile-only {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 14px 9px;
  border: 0;
  border-bottom: 1px solid var(--edge);
  border-radius: 0;
  background: var(--surface);
}
.coach-strip.mobile-only.is-brilliant {
  border-bottom-color: rgba(27,173,166,.55);
  background: linear-gradient(135deg, rgba(27,173,166,.14), var(--surface) 62%);
}
.coach-strip-head small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coach-strip-cls { font-weight: 750; }
.coach-strip-cls.tone-brilliant { color: #26c6be; }
.coach-strip-cls.tone-great { color: #6ea3cc; }
.coach-strip-cls.tone-best, .coach-strip-cls.tone-excellent { color: var(--best); }
.coach-strip-cls.tone-good { color: #a7b18a; }
.coach-strip-cls.tone-inaccuracy { color: var(--inaccuracy); }
.coach-strip-cls.tone-mistake { color: var(--mistake); }
.coach-strip-cls.tone-blunder { color: #ef6a66; }
.coach-strip p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.review-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.review-stage {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.review-board-column {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.review-player-strip { display: none; }
.review-board-shell {
  position: relative;
  width: min(100vw, 47dvh);
  max-width: 100vw;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
}
.review-board {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}
.review-meter {
  position: absolute;
  z-index: 7;
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  background: #1b1917;
  overflow: hidden;
}
.review-meter i {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f1efea;
  transition: height 220ms var(--ease-out);
}
.eval-meter-label { display: none; }

/* Chess.com Area-Fill Eval Graph */
.review-chart {
  flex: 0 0 auto;
  height: 62px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #35322e;
}
.review-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.eval-bg-top { fill: #35322e; }
.eval-bg-bottom { fill: #292623; }
.eval-area-white { fill: rgba(241, 239, 234, .92); }
.eval-area-black { fill: #151311; }
.eval-zero { stroke: rgba(255,255,255,.32); stroke-width: 1; stroke-dasharray: none; }
.eval-line { fill: none; stroke: rgba(215, 212, 205, .85); stroke-width: 1.25; stroke-linejoin: round; }
.eval-key-dot { stroke: #211f1c; stroke-width: 1.25; pointer-events: none; }
.eval-scrub-line { stroke: var(--accent); stroke-width: 1.75; opacity: .92; }
.eval-current-dot { fill: var(--accent); stroke: #f1efea; stroke-width: 1.5; }

/* Mobile Review Deck (reusing .review-rail below board on <1024px) */
.review-rail {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--edge);
  background: var(--surface-inset);
  overflow: hidden;
}
.mobile-eval-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.mobile-eval-row .review-best-copy {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11.5px;
}
.mobile-mini-btn {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--edge-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.mobile-mini-btn.accent {
  border-color: rgba(129,182,76,.5);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Mobile Action Bar (4 slots: Prev | Primary | Chat | Next) */
.review-action-bar.mobile-only {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px 46px;
  align-items: center;
  gap: 7px;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--edge);
  background: var(--surface);
}
.review-stepper {
  width: 46px;
  height: 44px;
  font-size: 26px;
}
.review-primary-pill {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
}
.review-chat-fab {
  width: 46px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(129,182,76,.45);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
}

/* Classification badges & Brilliant celebration */
.move-grade.xs { width: 15px; min-width: 15px; height: 15px; font-size: 8px; }
.move-grade.lg { width: 32px; min-width: 32px; height: 32px; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.32); }
.grade-brilliant {
  background: linear-gradient(135deg, #26c6be, #1bada6);
  color: #fff;
  box-shadow: 0 0 10px rgba(27,173,166,.55);
}
.move-grade.brilliant-pop {
  animation: brilliantPop 520ms var(--ease-spring) both;
}
.sq.sq-brilliant {
  box-shadow: inset 0 0 0 3px #1bada6, inset 0 0 16px rgba(27,173,166,.45);
}
@keyframes brilliantPop {
  0% { transform: scale(.4) rotate(-18deg); }
  60% { transform: scale(1.26) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.brilliant-celebration {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(27,173,166,.65);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(27,173,166,.26), rgba(27,173,166,.08) 70%);
}
.brilliant-star {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1bada6;
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  box-shadow: 0 0 16px rgba(27,173,166,.65);
  animation: brilliantPulse 1.8s ease-in-out infinite;
}
.brilliant-celebration > div strong {
  display: block;
  color: #63efe7;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
}
.brilliant-celebration > div span {
  display: block;
  color: var(--text);
  font-size: 11.5px;
  opacity: .9;
}
.brilliant-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.brilliant-burst span {
  position: absolute;
  top: 50%;
  left: 28px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #63efe7;
  opacity: 0;
  animation: sparkFly 950ms var(--ease-out) both;
}
.brilliant-burst span:nth-child(1) { --tx: -18px; --ty: -16px; animation-delay: 40ms; }
.brilliant-burst span:nth-child(2) { --tx: 16px; --ty: -20px; animation-delay: 90ms; background: #f1efea; }
.brilliant-burst span:nth-child(3) { --tx: 32px; --ty: -8px; animation-delay: 140ms; }
.brilliant-burst span:nth-child(4) { --tx: 26px; --ty: 16px; animation-delay: 110ms; background: #81b64c; }
.brilliant-burst span:nth-child(5) { --tx: -12px; --ty: 18px; animation-delay: 70ms; }
.brilliant-burst span:nth-child(6) { --tx: 48px; --ty: 4px; animation-delay: 180ms; background: #f1efea; }
@keyframes brilliantPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(27,173,166,.45); transform: scale(1); }
  50% { box-shadow: 0 0 22px rgba(99,239,231,.75); transform: scale(1.06); }
}
@keyframes sparkFly {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx, 20px), var(--ty, -14px)) scale(1.1); }
}

/* Accuracy Rings, Subtle Phase Line & Collapsible Breakdown */
.rail-overview {
  display: grid;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--edge);
  background: var(--surface);
}
.acc-gauges-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.acc-gauge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  min-width: 0;
}
.acc-gauge + .acc-gauge {
  border-left: 1px solid var(--edge);
}
.acc-gauge.is-focus {
  background: rgba(129,182,76,.045);
}
.acc-ring-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
}
.acc-ring {
  width: 42px;
  height: 42px;
  transform: rotate(-90deg);
}
.acc-ring-track {
  fill: none;
  stroke: rgba(255,255,255,.08);
  stroke-width: 3.5;
}
.acc-ring-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 400ms var(--ease-out);
}
.acc-ring-num {
  position: absolute;
  font-size: 11px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.acc-meta { min-width: 0; display: grid; gap: 2px; }
.acc-player { display: flex; align-items: center; gap: 5px; min-width: 0; }
.acc-player strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 750;
  color: var(--text);
}
.color-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,.25);
}
.color-swatch.white { background: #f1efea; }
.color-swatch.black { background: #1e1c1a; }
.acc-sub { color: var(--faint); font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums; }

.overview-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  border-top: 1px solid var(--edge);
  font-size: 11px;
  color: var(--muted);
}
.phase-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.phase-item { color: var(--muted); font-weight: 600; }
.phase-item strong { color: var(--muted); font-weight: 750; }
.phase-item.active,
.phase-item.active strong { color: var(--text); }
.meta-sep { color: var(--faint); }
.overview-breakdown-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.overview-breakdown-btn:hover { color: var(--text); }
.overview-breakdown-btn .chev { font-size: 9px; opacity: .8; }

.grade-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--edge);
  background: var(--surface-inset);
}
.breakdown-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.breakdown-label { color: var(--muted); font-weight: 600; }
.breakdown-item strong { color: var(--text); font-weight: 800; }

/* Editorial Coach Card — Flat, Restrained, Chess.com Rhythm */
.coach-card-body {
  display: grid;
  gap: 12px;
}
.coach-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.coach-move-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 16px;
  font-weight: 850;
  color: var(--text);
}
.coach-class-word { font-size: 13px; font-weight: 750; }
.coach-class-word.tone-brilliant { color: #26c6be; }
.coach-class-word.tone-great { color: #6ea3cc; }
.coach-class-word.tone-best, .coach-class-word.tone-excellent { color: var(--best); }
.coach-class-word.tone-good { color: #a7b18a; }
.coach-class-word.tone-inaccuracy { color: var(--inaccuracy); }
.coach-class-word.tone-mistake { color: var(--mistake); }
.coach-class-word.tone-blunder { color: #ef6a66; }

.coach-eval-readout {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.coach-assessment {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
}
.coach-detail {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin: 0;
}

/* Single Bordered Inline Variation Panel (Chess.com notation flow) */
.variation-panel {
  display: grid;
  gap: 6px;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1px solid var(--edge);
  background: var(--surface-inset);
}
.var-line {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.var-line.subordinate {
  font-size: 12px;
  color: var(--muted);
}
.var-prefix {
  font-weight: 750;
  margin-right: 4px;
  color: var(--muted);
}
.var-prefix.best { color: var(--best); }
.var-flow {
  display: inline;
}
.var-move {
  display: inline;
  padding: 1px 3px;
  margin: 0 1px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.var-line.subordinate .var-move { font-weight: 600; }
.var-move:hover {
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.var-move.active {
  background: var(--accent);
  color: #fff;
}
.var-move .var-num {
  color: var(--faint);
  font-weight: 550;
  margin-right: 1px;
}
.var-move.active .var-num { color: rgba(255,255,255,.8); }

.var-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.var-preview-btns { display: flex; align-items: center; gap: 4px; }
.var-nav-btn,
.var-exit-btn {
  min-height: 24px;
  padding: 1px 7px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}
.var-nav-btn:hover,
.var-exit-btn:hover { border-color: var(--edge-strong); }
.var-exit-btn { color: var(--accent); }

/* Progressive Disclosure: Single Flat "Why?" Block */
.why-disclosure {
  padding-top: 8px;
  border-top: 1px solid var(--edge);
}
.why-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
}
.why-toggle:hover { color: var(--text); }
.why-toggle .chev { font-size: 10px; opacity: .8; }
.why-body {
  display: grid;
  gap: 9px;
  padding-top: 9px;
}
.why-item {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.48;
}
.why-lead {
  font-weight: 750;
  color: var(--text);
}
.why-lead.best { color: var(--best); }
.why-principle {
  margin: 0;
  padding-top: 7px;
  border-top: 1px solid var(--edge);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.44;
  font-style: italic;
}

/* Two-Column Algebraic Move List — Quiet, Uncluttered */
.move-table {
  display: grid;
  font-variant-numeric: tabular-nums;
}
.mt-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 2px;
  padding: 1px 8px;
}
.mt-row.alt { background: rgba(255,255,255,.018); }
.mt-num {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  padding-left: 4px;
}
.mt-move {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 27px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  min-width: 0;
}
.mt-move:hover { background: rgba(255,255,255,.05); }
.mt-move.active {
  background: rgba(129,182,76,.2);
  box-shadow: inset 2px 0 0 var(--accent);
  color: #fff;
}
.mt-move.is-brilliant:not(.active) { background: rgba(27,173,166,.1); }
.mt-san { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-right { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.mt-eval { color: var(--text); opacity: .4; font-size: 10px; font-weight: 650; text-align: right; }
.mt-move.active .mt-eval { opacity: .72; }

/* Ask Coach Chat Panel */
.chat-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 12px;
  overflow: hidden;
}
.chat-scope-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--edge);
}
.chat-scope-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 12px;
}
.chat-scope-line .muted { color: var(--muted); }
.chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-right: 2px;
  scrollbar-width: thin;
}
.chat-empty {
  margin: auto 0;
  padding: 20px 14px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
}
.chat-empty-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
}
.chat-empty strong { color: var(--text); font-size: 14px; }
.chat-empty p { font-size: 12.5px; max-width: 280px; }
.chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 92%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.chat-ply-ref {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-inset);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.chat-src { color: var(--accent); }
.chat-bubble {
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.44;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: rgba(129,182,76,.22);
  border: 1px solid rgba(129,182,76,.35);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--surface-inset);
  border: 1px solid var(--edge);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.chat-msg.pending .chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.chat-error {
  padding: 7px 10px;
  border-radius: 7px;
  background: rgba(202,52,49,.14);
  border: 1px solid rgba(202,52,49,.35);
  color: #ef817d;
  font-size: 12px;
  font-weight: 700;
}
.chat-suggestions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chat-chip {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--edge-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
}
.chat-chip:hover { border-color: var(--accent); color: var(--accent); }
.chat-form {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  align-items: center;
}
.chat-input,
.quick-ask-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--edge-strong);
  border-radius: 8px;
  background: var(--surface-inset);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.chat-input:focus,
.quick-ask-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(129,182,76,.18);
}
.chat-send {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 13px;
}

/* Mobile Deep Analysis & Chat Drawer */
.mobile-drawer-backdrop {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15,13,11,.72);
}
.mobile-drawer {
  width: min(100%, 540px);
  height: 82dvh;
  max-height: calc(100dvh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--edge-strong);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: 0 -10px 30px rgba(0,0,0,.45);
  animation: sheetRise 260ms var(--ease-ios) both;
}
.mobile-drawer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 0 4px;
  border-bottom: 1px solid var(--edge);
}
.mobile-drawer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  flex: 1 1 auto;
}
.mobile-drawer-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.mobile-drawer-tabs button.active {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.mobile-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-drawer.chat .mobile-drawer-body { overflow: hidden; }
.mobile-analysis-card {
  padding: 14px;
  border-bottom: 1px solid var(--edge);
}
.mobile-move-list-section {
  padding: 12px 14px 20px;
}
.mobile-move-list-section h3 {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* Subtle per-move engine recommendation */
.best-move-note {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.best-move-note-label {
  flex: 0 0 auto;
  color: var(--best);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.best-move-note-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-eval-row { flex-wrap: wrap; row-gap: 4px; }
.mobile-eval-row .review-best-copy {
  flex: 1 0 100%;
  order: 5;
  font-size: 11px;
}
.review-rail {
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ==========================================================================
   DESKTOP WORKSTATION (>= 1024px) — Chess.com Split Anatomy, Zero Dead Space
   ========================================================================== */
@media (min-width: 1024px) {
  .desktop-only { display: flex !important; }
  .mobile-only { display: none !important; }
  .mobile-drawer-backdrop { display: none !important; }

  .review-nav {
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
  }
  .review-nav-center { justify-content: flex-start; padding-left: 8px; }
  .review-title { font-size: 15px; text-align: left; }
  .review-opening-tag { display: inline-flex; align-items: center; }
  .nav-desktop-btn { display: inline-flex; }
  .review-nav-trailing { gap: 8px; }
  .review-accuracy-pill { display: none; }
  .nav-overflow { display: none; }

  .review-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(410px, 37vw, 520px);
    align-items: stretch;
    height: calc(100dvh - 48px);
    overflow: hidden;
  }

  /* Left Stage: Big Board + 24px Vertical Eval Bar + Player Bars + Transport */
  .review-stage {
    min-width: 0;
    min-height: 0;
    padding: 12px 20px;
    background: var(--bg);
    overflow: hidden;
  }
  .review-board-column {
    --desk-board: min(calc(100dvh - 186px), calc(100% - 38px), 700px);
    width: calc(var(--desk-board) + 36px);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }
  .review-player-strip {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 34px;
    padding-left: 36px;
  }
  .review-player-strip .player-id { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .review-avatar {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 900;
  }
  .review-avatar.white { background: #f1efea; color: #262421; }
  .review-avatar.black { background: #191715; color: #f1efea; border: 1px solid var(--edge-strong); }
  .player-acc-badge {
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--surface);
    border: 1px solid var(--edge);
    font-size: 11.5px;
    font-weight: 850;
  }

  .review-board-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
  }
  .review-meter {
    grid-column: 1;
    position: relative;
    width: 28px;
    border-radius: 4px;
    background: #403d39;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  }
  .review-board { grid-column: 2; }
  .review-meter i { background: #f1efea; }
  .eval-meter-label {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9.5px;
    font-weight: 850;
    line-height: 1;
    z-index: 3;
    pointer-events: none;
  }
  .eval-meter-label.bottom { bottom: 5px; color: #262421; }
  .eval-meter-label.top { top: 5px; color: #f1efea; }

  .review-board .chessboard {
    border-radius: 4px;
    box-shadow: 0 6px 24px rgba(0,0,0,.38);
  }
  .review-board .coord.rank { left: 4px; font-size: 11px; }
  .review-board .coord.file { font-size: 11px; }
  .review-board .sq .move-grade {
    width: 24px;
    min-width: 24px;
    height: 24px;
    top: -4px;
    right: -4px;
    font-size: 11px;
    z-index: 8;
    box-shadow: 0 2px 6px rgba(0,0,0,.45);
  }

  .review-transport.desktop-only {
    width: 100%;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-left: 36px;
    margin-top: 2px;
  }
  .transport-nav { display: flex; align-items: center; gap: 5px; }
  .transport-btn {
    width: 40px;
    height: 38px;
    border: 1px solid var(--edge);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
  }
  .transport-btn:hover:not(:disabled) { background: var(--surface-raised); border-color: var(--edge-strong); }
  .transport-cta .review-primary-pill {
    min-height: 38px;
    padding: 0 18px;
    font-size: 13px;
    border-radius: 8px;
  }
  .transport-ply { color: var(--muted); font-size: 12px; font-weight: 750; }

  /* Right Rail: Editorial Analysis Panel */
  .review-rail {
    height: 100%;
    padding: 0;
    gap: 0;
    justify-content: flex-start;
    overflow: hidden;
    border-top: 0;
    border-left: 1px solid var(--edge);
    background: var(--surface);
  }
  .rail-top-group.desktop-only { display: block !important; flex: 0 0 auto; }
  .review-rail .review-chart {
    height: 58px;
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--edge);
    border-radius: 0;
  }
  .rail-tabs.desktop-only {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--edge);
    border-radius: 0;
    background: transparent;
  }
  .rail-tab {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 750;
  }
  .rail-tab:hover { color: var(--text); }
  .rail-tab.active {
    background: transparent;
    color: var(--text);
    box-shadow: inset 0 -2px 0 var(--accent);
  }
  .tab-badge {
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
  }

  .rail-body.desktop-only {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .coach-card-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 16px 14px;
    scrollbar-width: thin;
  }
  .move-table-wrap {
    flex: 0 0 auto;
    height: 196px;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--edge);
    background: var(--surface-inset);
  }
  .move-table-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-bottom: 1px solid var(--edge);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
  }
  .move-table-head span:last-child { color: var(--faint); font-weight: 600; }
  .move-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 4px 0;
  }
  .rail-quick-ask {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-top: 1px solid var(--edge);
    background: var(--surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brilliant-star,
  .brilliant-burst span,
  .move-grade.brilliant-pop {
    animation: none !important;
  }
}
.train-shell, .train-drill, .train-detail-sheet {
  --train-panel: #302d29;
  --train-edge: #3a3631;
  --train-text: #f1efea;
  --train-muted: #b5afa6;
  --train-warm: #e6b450;
  --train-low: #f08f85;
  color: var(--train-text);
}
.train-home, .train-drill { width: min(100%, 552px); margin-inline: auto; }
.train-home .native-title-row { margin-bottom: 10px; }
.train-focus, .train-ladder, .train-detail {
  border: 1px solid var(--train-edge);
  border-radius: 12px;
  background: var(--train-panel);
}
.train-focus { padding: 16px; }
.train-focus h2 { font-size: 20px; line-height: 25px; }
.train-focus p { margin-top: 4px; color: var(--train-muted); font-size: 14px; }
.train-focus-actions { display: flex; align-items: center; gap: 14px; margin-top: 13px; }
.train-focus .btn, .train-detail .btn, .train-detail-sheet .btn { min-height: 44px; }
.train-see-games {
  min-height: 44px;
  border: 0;
  padding: 0 4px;
  background: transparent;
  color: var(--train-muted);
  font-size: 14px;
  font-weight: 650;
}
.train-see-games:hover { color: var(--train-text); text-decoration: underline; }
.train-skills-title { margin: 19px 0 8px; font-size: 17px; line-height: 22px; }
.train-skill {
  display: grid;
  width: 100%;
  height: 56px;
  align-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--train-text);
  text-align: left;
}
.train-skill + .train-skill { border-top: 1px solid var(--train-edge); }
.train-skill:first-child { border-radius: 11px 11px 0 0; }
.train-skill:last-child { border-radius: 0 0 11px 11px; }
.train-skill:hover { background: rgba(255,255,255,.035); }
.train-skill:focus-visible { outline-offset: -2px; }
.train-skill-line { display: flex; align-items: center; gap: 10px; height: 20px; }
.train-skill-name { margin-inline-end: auto; font-size: 15px; font-weight: 600; }
.train-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.train-score.train-unscored, .train-chevron { color: var(--train-muted); }
.train-delta { color: var(--accent); font-size: 13px; font-weight: 700; }
.train-chevron { font-size: 18px; line-height: 1; }
.train-track {
  position: relative;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg);
}
.train-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.train-fill.mid { background: var(--train-warm); }
.train-fill.low { background: var(--train-low); }
.train-notch {
  position: absolute;
  top: 0;
  left: clamp(0px, calc(var(--prior-score) - 1px), calc(100% - 2px));
  width: 2px;
  height: 100%;
  background: rgba(241,239,234,.52);
}
.train-caption { margin-top: 9px; color: var(--train-muted); font-size: 12px; }
.train-detail-sheet { background: var(--train-panel); }
.train-detail { display: grid; gap: 14px; padding: 16px; }
.train-detail header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.train-detail .sheet-close { flex: 0 0 34px; }
.train-tags, .train-evidence { list-style: none; margin: 0; padding: 0; }
.train-tags { display: grid; gap: 5px; font-size: 14px; color: var(--train-muted); }
.train-evidence a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--train-edge);
  color: var(--train-text);
  font-size: 14px;
  text-decoration: none;
}
.train-evidence a:hover { color: var(--accent); }
.train-drill-nav { display: flex; min-height: 44px; align-items: center; justify-content: space-between; }
.train-drill-nav span { color: var(--train-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.train-drill-layout { display: grid; gap: 12px; }
.train-drill-prompt p, .train-drill-feedback p, .train-drill-state p { color: var(--train-muted); }
.train-board { width: min(100%, 62svh); margin-inline: auto; }
.train-drill-feedback { display: grid; gap: 8px; justify-items: start; }
.train-drill-feedback p { min-height: 1.5em; }
.train-drill-feedback .train-correct, .train-drill-accuracy { color: var(--accent); }
.train-delta.train-down, .train-drill-feedback .train-down { color: var(--train-low); }
.train-drill-state { display: grid; justify-items: start; gap: 12px; padding-block: 24px; }
.train-drill-accuracy { font-size: 44px; font-variant-numeric: tabular-nums; }

@media (min-width: 900px) {
  .mobile-tabs { inset-inline: 0; width: min(100%, 640px); margin-inline: auto; border-inline: 1px solid #3a3631; border-radius: 12px 12px 0 0; }
  .view:has(.train-shell), .view:has(.train-drill) { width: min(100%, 1200px); padding-top: 34px; }
  .train-shell:has(.train-detail) {
    display: grid;
    grid-template-columns: minmax(0, 552px) minmax(260px, 300px);
    align-items: start;
    justify-content: center;
    gap: 24px;
  }
  .train-detail { margin-top: 54px; }
  .train-drill:has(.train-board) { width: min(100%, 858px); }
  .train-drill-nav { margin-bottom: 12px; }
  .train-drill-layout { grid-template-columns: minmax(0, 552px) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 16px 28px; }
  .train-board { grid-column: 1; grid-row: 1 / span 2; width: 100%; }
  .train-drill-prompt, .train-drill-feedback { grid-column: 2; align-self: start; }
}
@media (min-width: 1200px) {
  .train-shell:has(.train-detail) { grid-template-columns: 1fr 552px 1fr; }
  .train-shell:has(.train-detail) .train-home { grid-column: 2; }
}
