/* thinklikebot — design system
   Warm paper, ink, serif display, terracotta accent.
   Quiet, editorial, hairline borders, no gradients, no glass. */

:root {
  --serif: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --paper: #F2EFE7;          /* page background */
  --paper-deep: #EBE7DC;     /* subtle alternate */
  --card: #FBFAF6;           /* raised surfaces */
  --ink: #1F1E1A;
  --ink-soft: #6E6A5E;
  --muted: #98937f;
  --line: #E2DDD0;
  --line-strong: #D3CDBD;

  --accent: #C15F3C;         /* terracotta */
  --accent-deep: #A34D2E;
  --accent-tint: #F4E4DB;

  --sage: #5F7A55;
  --sage-tint: #EFF3EA;
  --sage-border: #CBD8C0;
  --brick: #A34D3B;
  --brick-tint: #F7ECE7;
  --brick-border: #E9D2CA;
  --amber: #B08430;

  --sq-light: #EADFC8;
  --sq-dark: #AE8E68;

  --r-lg: 16px;
  --r-md: 12px;
}
html.theme-dark {
  --paper: #141310;
  --paper-deep: #221F18;
  --card: #1B1914;
  --ink: #EDE8DA;
  --ink-soft: #A9A293;
  --muted: #7B7566;
  --line: #2E2A21;
  --line-strong: #453E2F;
  --accent: #D97B55;
  --accent-deep: #E08A64;
  --accent-tint: #33241C;
  --sage: #93B283;
  --sage-tint: #232A1B;
  --sage-border: #3A4531;
  --brick: #D0836A;
  --brick-tint: #33211B;
  --brick-border: #4A2E24;
  --amber: #D0A24E;
  --sq-light: #A5825A;
  --sq-dark: #5E4A30;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
}
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; }
.smallcaps {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 11px; font-weight: 600; color: var(--ink-soft);
}
.serif { font-family: var(--serif); }

/* ======================================================= LANDING */
.page-landing { background: var(--paper); color: var(--ink); }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px clamp(24px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 1.2vw, 30px); }
.landing-nav .links { display: flex; gap: 32px; }
.landing-nav .links a {
  color: var(--ink-soft); font-size: 13px; font-weight: 500;
  transition: color .15s;
}
.landing-nav .links a:hover { color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 10px; padding: clamp(10px, 0.65vw, 13px) clamp(18px, 1.2vw, 24px); font-size: var(--fs-ui-md); font-weight: 600;
  transition: transform .06s ease, background .15s, border-color .15s;
}
.pill:active { transform: scale(0.98); }
.pill.solid-light { background: var(--ink); color: var(--paper); }
.pill.solid-light:hover { background: #33312a; }
.pill.ghost-light { border: 1px solid var(--line-strong); color: var(--ink); background: transparent; }
.pill.ghost-light:hover { border-color: var(--ink-soft); }
.pill.solid-dark { background: var(--ink); color: var(--paper); border-radius: 10px; }
.pill.solid-dark:hover { background: #33312a; }
.pill.ghost-dark { border: 1px solid var(--line-strong); color: var(--ink); border-radius: 10px; }

.hero { text-align: center; padding: 84px 24px 0; position: relative; z-index: 2; }
.hero .eyebrow { margin-bottom: 26px; }
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(44px, 6.2vw, 116px); line-height: 1.06; letter-spacing: -0.015em;
  color: var(--ink);
}
.hero h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
.hero .sub { color: var(--ink-soft); font-size: 16.5px; line-height: 1.65; max-width: 480px; margin: 26px auto 0; }
.hero .cta { display: flex; gap: 12px; justify-content: center; margin-top: 34px; }
.hero .stats {
  display: flex; justify-content: center; margin-top: 54px;
  color: var(--muted); font-size: 13px;
}
.hero .stats span { padding: 0 26px; border-left: 1px solid var(--line-strong); }
.hero .stats span:first-child { border-left: none; }
.hero .stats b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.hero-board-wrap { display: flex; justify-content: center; perspective: 1400px; margin-top: 30px; padding-bottom: 90px; }
.hero-board {
  transform: rotateX(52deg) rotateZ(-42deg);
  box-shadow: 0 50px 90px rgba(52, 44, 28, 0.18);
}
.hero-board .board { width: min(30vw, 560px); height: min(30vw, 560px); }
.hero-board .sq.light { background: #F6F1E4; }
.hero-board .sq.dark { background: #26241F; }

/* ===================================================== DASHBOARD */
.page-dash { background: var(--paper); color: var(--ink); padding-bottom: 80px; }
.dash-nav { display: flex; justify-content: center; padding: 24px 0 10px; }
.dash-nav .bar {
  background: transparent; border: none;
  padding: 0; display: flex; gap: 24px; align-items: center;
}
.dash-nav .bar a, .dash-nav .bar button {
  border-radius: 0; padding: 6px 1px; font-size: 14px; font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.dash-nav .bar a.active { color: var(--ink); border-bottom-color: var(--accent); background: transparent; }
.dash-nav .bar a:hover:not(.active) { color: var(--ink); }

.dash-wrap { max-width: min(94vw, 2400px); margin: 0 auto; padding: clamp(30px, 2.4vw, 60px) clamp(24px, 2.4vw, 60px) 0; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 18px 0 30px; }
.dash-head h1 { font-family: var(--serif); font-size: clamp(32px, 3.2vw, 62px); font-weight: 600; letter-spacing: -0.01em; }
.dash-head h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
.dash-head .sub { color: var(--ink-soft); margin-top: 8px; font-size: 15px; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.hero-card {
  border-radius: var(--r-lg); padding: 26px 28px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
}
.hero-card .label { color: var(--ink-soft); }
.hero-card .big {
  font-family: var(--serif); font-size: clamp(46px, 4.8vw, 96px); font-weight: 600;
  margin: 12px 0 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.hero-card .delta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper-deep); border-radius: 8px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.hero-card .delta b { color: var(--ink); }
.hero-card .spark { display: flex; align-items: flex-end; gap: 5px; height: 84px; margin-top: 26px; }
.hero-card .spark i {
  flex: 1; background: var(--paper-deep); border-radius: 3px 3px 1px 1px; min-height: 6px;
}
.hero-card .spark i.hot { background: var(--accent); }
.hero-card .chips { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.hero-card .chips span {
  background: var(--paper-deep); border-radius: 8px; padding: 6px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}

.card {
  background: var(--card); border-radius: var(--r-lg); padding: 24px 26px;
  border: 1px solid var(--line);
}
.card h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 4px; }
.card .muted { color: var(--ink-soft); font-size: 13px; }
.mini .big { font-family: var(--serif); font-size: 36px; font-weight: 600; margin-top: 14px; font-variant-numeric: tabular-nums; }

.weak-list { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.weak-row { display: grid; grid-template-columns: 150px 1fr 74px; gap: 14px; align-items: center; }
.weak-row .name { font-size: 13.5px; font-weight: 600; }
.weak-row .name i { font-style: normal; color: var(--ink-soft); font-weight: 500; }
.weak-row .track { height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.weak-row .fill { height: 100%; border-radius: 3px; background: var(--accent); }
.weak-row .acc { text-align: right; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.weak-row .acc b { color: var(--ink); font-size: 14.5px; }

/* ========================================================= TRAIN */
.page-train {
  background: var(--paper); color: var(--ink); height: 100vh;
  display: flex; flex-direction: column;
  /* UI type scale — grows with the viewport so the sidebar breathes on big monitors */
  --fs-ui-xs: clamp(10.5px, 0.55vw, 13px);
  --fs-ui-sm: clamp(11px, 0.62vw, 14px);
  --fs-ui: clamp(12px, 0.66vw, 14.5px);
  --fs-ui-md: clamp(13px, 0.72vw, 15.5px);
  --fs-ui-lg: clamp(14px, 0.78vw, 16.5px);
}
.train-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(18px, 3.5vw, 44px);
  border-bottom: 1px solid var(--line);
}
.train-topbar .brand { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 1.2vw, 30px); }
.glass {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.tabs { display: flex; gap: 24px; background: transparent; border: none; padding: 2px 0; }
.tabs button {
  border-radius: 0; padding: 6px 1px; font-size: clamp(14px, 0.95vw, 20px); font-weight: 600; color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: transparent; color: var(--ink); border-bottom-color: var(--accent); }

.iconbtn {
  width: 34px; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; color: var(--ink-soft);
  background: transparent; transition: color .15s;
}
.iconbtn:hover { color: var(--ink); }
.iconbtn.on { color: var(--accent); }
.iconbtn svg { width: 17px; height: 17px; }

.train-grid {
  display: grid; grid-template-columns: clamp(310px, 22vw, 480px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(18px, 1.8vw, 44px); align-items: stretch;
  width: 100%; box-sizing: border-box; flex: 1 1 auto; min-height: 0;
  padding: clamp(20px, 2vw, 44px) clamp(16px, 2.4vw, 64px) 28px;
}
@media (max-width: 920px) { .page-train { height: auto; min-height: 100vh; } .train-grid { flex: 0 0 auto; grid-template-rows: auto; } }
#sidebar { order: -1; }
body.panel-hidden .train-grid { grid-template-columns: minmax(0, 1fr); }
body.panel-hidden #sidebar { display: none; }
/* medium widths: the board keeps the wide column, the panel sits narrow on the right */
@media (min-width: 921px) and (max-width: 1120px) {
  .train-grid { grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); }
  .board-col { order: -1; }
  #sidebar { order: 0; }
}
@media (max-width: 920px) { .train-grid { grid-template-columns: 1fr; } }

.panel {
  padding: clamp(18px, 1.4vw, 30px); display: flex; flex-direction: column;
  height: 100%; box-sizing: border-box;
}
.panel .label { color: var(--ink-soft); margin-bottom: 12px; font-size: var(--fs-ui-sm); }

/* Two halves of the sidebar share its height evenly, divider between them.
   Content flows from the top with even gaps; action buttons pin to the bottom. */
.side-section {
  flex: 1 1 0; min-height: 0; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: flex-start;
  gap: clamp(10px, 1.3vh, 18px); overflow-y: auto;
  scrollbar-width: none;
}
.side-section::-webkit-scrollbar { display: none; }
.side-section > * { flex-shrink: 0; }
.side-section .label { margin-bottom: 5px; }
.side-section .meta-rows { margin-top: 0; }
.side-section .mate-dots { margin: 0; }
.side-section .mate-moves { margin-top: 0; flex-wrap: wrap; }
.side-section .cont-stats { margin-top: 0; }
.side-section .move-list { margin-top: 0; }
.side-section .prompt-sub { margin-top: 0; }
.side-section .tagrow { margin-top: 0; }
/* the visible mode panel fills its half; blocks stack tightly from the top */
.side-section > div {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: flex-start;
  gap: clamp(10px, 1.3vh, 18px);
}
/* action rows (Start/Hint/Next/New game) stick to the bottom of their half */
.side-section .btnrow { margin-top: auto; padding-top: 10px; }
.side-section .btnrow .btn[style*="flex:1"] { flex: 1; }
/* prompt / verdict / done boxes fill the lower half so their button sits low */
#puzzleFeedback > div {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
#puzzleFeedback > div .btnrow { margin-top: auto; padding-top: 10px; }
.verdict-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.verdict-scroll::-webkit-scrollbar { display: none; }
#loadBox { justify-content: center; }
.side-divider { border-top: 1px solid var(--line); margin: 14px 2px; flex-shrink: 0; }
.side-title {
  font-family: var(--serif); font-size: clamp(19px, 1.15vw, 26px);
  font-weight: 600; letter-spacing: -0.01em; line-height: 1.2;
}
.minilabel {
  font-size: var(--fs-ui-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); margin-bottom: 6px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border-radius: 8px; padding: clamp(5px, 0.32vw, 7px) clamp(10px, 0.66vw, 14px);
  font-size: var(--fs-ui); font-weight: 600;
  border: 1px solid var(--line); color: var(--ink-soft); background: var(--card);
  transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active {
  background: var(--accent); border-color: var(--accent); color: #FFF8F2;
}

/* segmented control (difficulty selector) */
.seg {
  display: flex; gap: 3px; padding: 3px; border-radius: 10px;
  background: var(--paper-deep); border: 1px solid var(--line);
}
.seg button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  border-radius: 7px; padding: clamp(6px, 0.42vw, 9px) 2px;
  font-family: inherit; font-size: var(--fs-ui); font-weight: 650; letter-spacing: 0.01em;
  color: var(--ink-soft); transition: all .16s ease;
}
.seg button:hover { color: var(--ink); }
.seg button.active {
  background: var(--accent); color: #FFF8F2;
  box-shadow: 0 1px 4px rgba(52, 44, 28, 0.28);
}

.meta-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.meta-rows.stacked { gap: 14px; }
.meta-rows.stacked .meta-row { display: block; }
.meta-rows.stacked .meta-row .k { display: block; margin-bottom: 4px; }
.meta-rows.stacked .meta-row .v { display: block; text-align: left; font-size: 14px; line-height: 1.45; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-ui-md); }
.meta-row .k { color: var(--ink-soft); flex-shrink: 0; }
.meta-row .v { font-weight: 600; text-align: right; }
.meta-rows.stacked .meta-row .v { font-size: var(--fs-ui-md); }

.seg-progress { display: flex; gap: 5px; margin-top: 0; width: var(--board-size); flex: none; align-self: center; }
.seg-progress i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.seg-progress i.hit { background: var(--sage); }
.seg-progress i.miss { background: var(--brick); }
.seg-progress i.now { background: var(--accent); }

/* board */
.board-col {
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  min-width: 0; height: 100%;
}
/* the frame measures the real available space; board, eval bar and progress
   strip all share --board-size so they always align and always fit */
#boardFrame {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  container-type: size; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  /* 80px: the left+right coordinate rails live outside the board and must
     never push the board wider than its column (horizontal overflow) */
  --board-size: min(calc(100% - 80px), max(560px, calc(100dvh - 300px)), 1180px); /* fallback, no container queries */
}
@supports (width: 1cqh) {
  #boardFrame { --board-size: min(calc(100cqw - 80px), calc(100cqh - 76px)); } /* coord rails 80 + coord rail 40 + eval bar 8 + progress 4 + gaps 24 */
}
.board-outer { position: relative; padding: 0 0 40px; width: var(--board-size); order: -1; } /* bottom padding hosts the file labels */
.board {
  width: 100%;
  margin: 0;
  aspect-ratio: 1; height: auto;
  display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(52, 44, 28, 0.12), 0 12px 32px rgba(52, 44, 28, 0.10);
  user-select: none; -webkit-user-select: none; position: relative;
  touch-action: none;
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.piece-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.piece-layer img.piece {
  position: absolute; z-index: 2; pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(52, 44, 28, 0.25));
  transition: left .18s cubic-bezier(.22,.8,.26,1), top .18s cubic-bezier(.22,.8,.26,1),
              transform .18s cubic-bezier(.22,.8,.26,1);
}
.piece-layer img.piece.targeted {
  transform: scale(0.7);
  /* shrink in sync with the ring ripple: same --d delay, same curve */
  animation: shrinkin .18s cubic-bezier(.22,.8,.26,1) both;
  animation-delay: var(--d, 0s);
}
@keyframes shrinkin { from { transform: scale(1); } }
.piece-layer img.piece.no-anim, .piece-layer img.piece.dragging { transition: none; }
.piece-layer img.piece.dragging { z-index: 30; cursor: grabbing; }
.piece-layer img.piece.born { animation: piecein .4s both; animation-delay: var(--d, 0s); }
.piece-layer img.piece.dying { animation: pieceout .18s both; pointer-events: none; }
.piece-layer img.piece.untargeting { animation: growback .16s cubic-bezier(.22,.8,.26,1) both; }
@keyframes growback { from { transform: scale(0.7); } }
@keyframes piecein { from { opacity: 0; } }
@keyframes pieceout { to { opacity: 0; } }
body.board-dragging, body.board-dragging * { cursor: grabbing !important; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq img.piece {
  width: 88%; height: 88%; z-index: 2; pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(52, 44, 28, 0.25));
}
.sq.sel { box-shadow: inset 0 0 0 3px var(--accent); animation: selfade .22s ease; }
@keyframes selfade { from { box-shadow: inset 0 0 0 12px rgba(193, 95, 60, 0); } }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(193, 95, 60, 0.18); z-index: 1; }
.sq.lastmove::after { content: ""; position: absolute; inset: 0; background: rgba(193, 95, 60, 0.32); }
.sq.hint { box-shadow: inset 0 0 0 3px #D9952F; }
.sq.hint::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  animation: hintpulse 1.1s ease-in-out infinite;
  background: radial-gradient(circle, rgba(233, 166, 52, 0.85) 22%, rgba(233, 166, 52, 0) 70%);
}
@keyframes hintpulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.sq.dot .dotmark {
  position: absolute; width: 32%; height: 32%; border-radius: 50%;
  background: rgba(52, 44, 28, 0.45); z-index: 3;
}
.sq.dot .dotmark.in { animation: dotin .22s cubic-bezier(.22,.8,.3,1) both; animation-delay: var(--d, 0s); }
@keyframes dotin { from { opacity: 0; transform: scale(.3); } }
.sq.dot.capture .dotmark {
  width: 86%; height: 86%; background: transparent;
  border: 5px solid rgba(52, 44, 28, 0.45);
}
.arrows { position: absolute; pointer-events: none; z-index: 4; overflow: visible; }
.arrows g { filter: drop-shadow(0 2px 3px rgba(40, 32, 18, 0.35)); }
.arrows .flow {
  animation: dashflow .8s linear infinite;
}
@keyframes dashflow { to { stroke-dashoffset: -14; } }
.coord {
  position: absolute; font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--muted); width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}

.evalbar-wrap { display: flex; align-items: center; gap: 12px; width: var(--board-size); flex: none; }
.evalbar {
  flex: 1; height: 8px; border-radius: 4px; overflow: hidden;
  background: var(--paper-deep); border: 1px solid var(--line);
}
.evalbar .white-share { height: 100%; background: var(--ink); width: 50%; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.eval-num { font-size: 13px; font-weight: 600; color: var(--ink-soft); min-width: 44px; font-variant-numeric: tabular-nums; }

/* right panel */
.prompt-serif { font-family: var(--serif); font-size: clamp(23px, 1.5vw, 40px); font-weight: 600; line-height: 1.28; letter-spacing: -0.01em; }
.prompt-sub { color: var(--ink-soft); font-size: var(--fs-ui-lg); margin-top: 10px; line-height: 1.6; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.tag {
  font-size: var(--fs-ui-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
  background: var(--paper-deep);
}

.verdict-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-ui-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; border-radius: 7px; padding: 6px 12px;
}
.verdict-badge.match { color: var(--sage); background: var(--sage-tint); border: 1px solid var(--sage-border); }
.verdict-badge.miss { color: var(--brick); background: var(--brick-tint); border: 1px solid var(--brick-border); }
.verdict-moves {
  display: flex; flex-direction: column; gap: 2px; margin: 16px 0 4px;
  width: fit-content; align-items: center;   /* vs centres on the lines, not the panel */
}
.verdict-moves .mv {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: clamp(22px, 1.35vw, 31px); font-weight: 600; letter-spacing: -0.01em;
}
.verdict-moves .mv.you { color: var(--ink); }
.verdict-moves .mv.bot { color: var(--accent); }
.verdict-moves .vs {
  color: var(--accent); font-family: var(--serif); font-style: italic;
  font-size: clamp(15px, 0.92vw, 21px); margin: 3px 0;
  align-self: center;
}
.sq-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  vertical-align: -6px;
  box-shadow: inset 0 0 0 1px rgba(52, 44, 28, 0.18);
}
.sq-chip.light { background: var(--sq-light); color: var(--ink); }
.sq-chip.dark { background: var(--sq-dark); color: var(--paper); }
.mv-piece {
  width: 30px; height: 30px; display: inline-block; vertical-align: middle;
  filter: drop-shadow(0 2px 2px rgba(52, 44, 28, 0.3));
}
.mv-word { text-transform: none; }
.vline { font-size: var(--fs-ui-lg); line-height: 1.6; color: var(--ink-soft); margin: 10px 0; }
.vline b { color: var(--ink); }

table.lines { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: var(--fs-ui-md); }
table.lines td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.lines td.cp { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.cp.pos { color: var(--sage); } .cp.neg { color: var(--brick); }

.pv-stepper { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.pv-stepper .pv-label { flex: 1; font-size: 12.5px; color: var(--ink-soft); }
.pv-stepper .pv-label b { color: var(--ink); }

.btnrow { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 10px; padding: clamp(10px, 0.65vw, 13px) clamp(18px, 1.2vw, 24px); font-size: var(--fs-ui-md); font-weight: 600;
  transition: transform .06s ease, background .15s, border-color .15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #33312a; }
.btn.ghost { border: 1px solid var(--line-strong); color: var(--ink); background: var(--card); }
.btn.ghost:hover { border-color: var(--ink-soft); }
.btn .ic { width: 15px; height: 15px; }

/* mate view */
.mate-head { font-family: var(--serif); font-size: clamp(30px, 2vw, 52px); font-weight: 600; letter-spacing: -0.01em; }
.mate-head b { color: var(--accent); }
.mate-dots { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.mate-dots i {
  width: clamp(22px, 1.35vw, 27px); height: clamp(22px, 1.35vw, 27px); border-radius: 50%; border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-ui-xs); font-style: normal; color: var(--ink-soft);
}
.mate-dots i.done { background: var(--sage-tint); border-color: var(--sage-border); color: var(--sage); }
.mate-dots i.now { border-color: var(--accent); color: var(--accent); }
.mate-moves { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.mate-moves span {
  font-size: var(--fs-ui); font-weight: 600; padding: clamp(5px, 0.32vw, 7px) clamp(10px, 0.66vw, 13px); border-radius: 6px;
  background: var(--paper-deep); border: 1px solid var(--line);
}
.mate-moves span.theirs { color: var(--ink-soft); }

/* continuation */
.cont-header { font-family: var(--serif); font-size: clamp(20px, 1.2vw, 27px); font-weight: 600; }
.cont-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.cont-stat {
  background: var(--paper-deep); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.cont-stat .k { font-size: var(--fs-ui-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.cont-stat .v { font-size: clamp(18px, 1.08vw, 24px); font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.move-list { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; max-height: 300px; overflow-y: auto; }
.move-row {
  display: grid; grid-template-columns: 30px 1fr auto auto; gap: 10px; align-items: center;
  font-size: 13.5px; padding: 7px 10px; border-radius: 8px;
}
.move-row:nth-child(odd) { background: var(--paper-deep); }
.move-row .num { color: var(--muted); font-size: 12px; }
.move-row .tier-best { color: var(--sage); font-weight: 700; }
.move-row .tier-excellent { color: #7A8F4C; font-weight: 700; }
.move-row .tier-okay { color: var(--amber); font-weight: 700; }
.move-row .tier-drift { color: var(--brick); font-weight: 700; }
.move-row .tier-engine { color: var(--muted); font-weight: 700; }
.move-row .loss { color: var(--ink-soft); font-size: 12px; font-variant-numeric: tabular-nums; }
.thinking { color: var(--ink-soft); font-size: var(--fs-ui-md); padding: 12px 2px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

.empty-state { color: var(--ink-soft); text-align: center; padding: 30px 8px; font-size: var(--fs-ui-md); line-height: 1.6; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--paper);
  font-size: 13.5px; font-weight: 500;
  border-radius: 10px; padding: 12px 22px; opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 60; max-width: 82vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

/* promotion picker */
.promo {
  position: absolute; z-index: 9; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px;
  overflow: hidden; box-shadow: 0 12px 32px rgba(52, 44, 28, 0.22);
}
.promo button { padding: 6px 12px; transition: background .12s; }
.promo button:hover { background: var(--accent-tint); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i {
  position: absolute; width: 9px; height: 13px; opacity: .95;
  animation: fall 1.15s ease-in forwards;
}
@keyframes fall {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), 78vh) rotate(720deg); opacity: 0; }
}

/* army chips (piece images) */
.chip.army { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; }
.chip.army img {
  width: 27px; height: 27px;
  filter: drop-shadow(0 1px 1px rgba(52, 44, 28, 0.3));
}
.chip.army.active { background: var(--accent-tint); }

/* tooltips */
[data-tip] { cursor: help; }
.tip-label { border-bottom: 1px dotted var(--line-strong); }
#tooltip {
  position: fixed; z-index: 80; max-width: 260px;
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; line-height: 1.5; font-weight: 500;
  padding: 9px 13px; border-radius: 9px;
  opacity: 0; transform: translateY(5px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
#tooltip.show { opacity: 1; transform: translateY(0); }

/* whose turn is it */
.prompt-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.prompt-top .turn-pill { margin-bottom: 0; }
.hearts { display: flex; gap: 4px; }
.hearts .heart { width: 15px; height: 15px; transition: transform .2s ease; }
.hearts .heart.full { fill: var(--brick); }
.hearts .heart.spent { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.turn-pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: var(--fs-ui-md); font-weight: 700;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper-deep); padding: 7px 13px; margin-bottom: 14px;
}
.turn-pill .swatch {
  width: 15px; height: 15px; border-radius: 4px;
  background: #f4efe4; border: 1px solid var(--line-strong);
  box-shadow: 0 1px 2px rgba(52, 44, 28, 0.3);
}
.turn-pill.black .swatch { background: #26241f; }

/* ======================================================== REVIEW */
.review-input, .review-pgn {
  width: 100%; font: inherit; font-size: var(--fs-ui-md);
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 13px; outline: none; transition: border-color .15s;
}
.review-input:focus, .review-pgn:focus { border-color: var(--accent); }
.review-input::placeholder, .review-pgn::placeholder { color: var(--muted); }
.review-pgn { resize: vertical; min-height: 76px; font-family: ui-monospace, monospace; font-size: 12px; }
#reviewPgnWrap { margin-top: 8px; }
.review-opts { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.review-depth { flex: 1; }
.linklike {
  font-size: var(--fs-ui); font-weight: 600; color: var(--ink-soft);
  border-bottom: 1px dotted var(--line-strong); padding: 2px 0; white-space: nowrap;
}
.linklike:hover { color: var(--accent); border-color: var(--accent); }

.review-progress-track {
  height: 6px; border-radius: 3px; background: var(--paper-deep);
  border: 1px solid var(--line); overflow: hidden; margin-top: 4px;
}
.review-progress-track div {
  height: 100%; width: 0%; border-radius: 3px; background: var(--accent);
  transition: width .3s ease;
}
.review-status { font-size: var(--fs-ui); color: var(--ink-soft); margin-top: 8px; line-height: 1.5; }
.review-status.err { color: var(--brick); font-weight: 600; }

.review-games { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.review-who { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.review-who img { width: 30px; height: 30px; border-radius: 8px; }
.review-who a { font-weight: 700; font-size: var(--fs-ui-md); }
.review-who a:hover { color: var(--accent); }
.review-game {
  display: flex; gap: 10px; align-items: center; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  background: var(--card); transition: border-color .15s;
  font-size: var(--fs-ui-md);
}
.review-game:hover { border-color: var(--accent); }
.rg-res {
  font-weight: 800; font-size: var(--fs-ui); min-width: 34px; text-align: center;
  border-radius: 6px; padding: 4px 6px; background: var(--paper-deep); color: var(--ink-soft);
}
.rg-res.w { background: var(--sage-tint); color: var(--sage); border: 1px solid var(--sage-border); }
.rg-res.b { background: var(--brick-tint); color: var(--brick); border: 1px solid var(--brick-border); }
.rg-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rg-main b { font-weight: 650; }
.rg-main b i { font-style: normal; color: var(--muted); font-weight: 500; font-size: var(--fs-ui-xs); }
.rg-main em { font-style: italic; color: var(--muted); font-size: var(--fs-ui-xs); margin: 0 4px; }
.rg-sub { font-size: var(--fs-ui-xs); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.review-head { margin-top: 2px; }
.review-players { font-size: var(--fs-ui-lg); font-weight: 700; }
.review-players em { font-style: italic; color: var(--accent); margin: 0 6px; font-weight: 600; }
.review-sub { font-size: var(--fs-ui-xs); color: var(--ink-soft); margin-top: 3px; }
.review-headline { font-family: var(--serif); font-style: italic; font-size: var(--fs-ui-lg); margin-top: 8px; line-height: 1.45; }

.review-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.acc-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--paper-deep); min-width: 0;
}
.acc-name { font-size: var(--fs-ui-xs); font-weight: 700; display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-name i { font-style: normal; color: var(--muted); font-weight: 500; }
.acc-name .swatch {
  width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0;
  background: #f4efe4; border: 1px solid var(--line-strong);
}
.acc-card.black .acc-name .swatch { background: #26241f; }
.acc-big { font-family: var(--serif); font-size: clamp(28px, 1.7vw, 40px); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.acc-big span { font-size: 0.5em; color: var(--muted); }
.acc-sub { font-size: var(--fs-ui-xs); color: var(--ink-soft); margin-top: 2px; }
.acc-counts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; font-size: var(--fs-ui-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.rcount { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-soft); }

.glyph { font-style: normal; font-weight: 800; font-size: 1.05em; }
.g-brilliant { color: #0E9F8A; } .g-great { color: #65A30D; }
.g-best { color: #3B82F6; } .g-excellent { color: #84A63B; }
.g-good { color: var(--muted); } .g-book { color: #B08430; }
.g-inaccuracy { color: #C99A1F; } .g-mistake { color: #E8822A; }
.g-miss { color: #A855F7; } .g-blunder { color: #D0453E; }

.review-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.review-note {
  font-size: var(--fs-ui); line-height: 1.55; color: var(--ink-soft);
  border-left: 2px solid var(--accent); padding-left: 10px;
}
.review-src { font-size: var(--fs-ui-xs); font-weight: 600; color: var(--ink-soft); margin-top: 10px; display: inline-block; }
.review-src:hover { color: var(--accent); }

#reviewGraph { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; display: block; }
.review-moves {
  display: flex; flex-direction: column; gap: 2px; margin-top: 10px;
  max-height: 260px; overflow-y: auto;
}
.rmove-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 4px; align-items: center; }
.rmove-row .num { color: var(--muted); font-size: var(--fs-ui-xs); text-align: right; padding-right: 6px; font-variant-numeric: tabular-nums; }
.rmove {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-ui-md); font-weight: 600; border-radius: 7px; padding: 5px 9px;
  transition: background .12s;
}
.rmove:hover { background: var(--paper-deep); }
.rmove.now { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent); }
.rmove .glyph { font-size: var(--fs-ui); margin-left: auto; }
#reviewDetail { min-height: 44px; }
#reviewDetail .rclass { font-weight: 700; color: var(--ink); }
#reviewDetail .reval { color: var(--muted); }
#reviewDetail .rline { font-size: var(--fs-ui); }
#reviewDetail .rline.alt { color: var(--muted); }
#reviewDetail .rtime { color: var(--muted); font-size: var(--fs-ui-xs); white-space: nowrap; }
.review-nav { align-items: center; }
.review-plyno { font-size: var(--fs-ui); font-weight: 700; font-variant-numeric: tabular-nums; }
