/* Chess identity: "walnut & maple". A dark study, a walnut frame with brass inlay, ivory and ebony Staunton pieces.
   Cormorant Garamond 700 for display, Nunito Sans for UI. Board colours are shared with render.js through the custom properties below. */
:root {
  --bg: #1a1410; --surface: #261c15; --surface-2: #33261c; --ink: #f3ead9; --ink-2: #b39a7c; --line: #4a3727;
  --accent: #c9a25e; --accent-ink: #1f1409; --ok: #9bd8a6; --warn: #e6c274; --bad: #f08a80; --info: #d9b978;
  --maple: #e9d8bd; --walnut: #5a3f2c; --frame: #3a2416; --frame-2: #24140b; --brass: #c9a25e; --ivory: #f7f1e6; --ebony: #1c130c; --outline: #a88b6a; --coord: #d9b978; --check: #e0332a; --hint: #4fb36a;
  --white-seat: #f3e9d6; --black-seat: #2c1d12;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif; --font-ui: "Nunito Sans", system-ui, sans-serif;
}
:root[data-theme="light"] { --bg: #efe4d2; --surface: #fbf6ec; --surface-2: #eadfcc; --ink: #241810; --ink-2: #6f5a45; --line: #d6c6ad; --accent: #8a6420; --accent-ink: #fff8ea; --info: #8a6420; --coord: #e6cf9f; --frame: #4a2f1c; --frame-2: #2f1c10; --check: #d0261e; }
:root[data-colorblind="1"] { --hint: #56b4e9; --check: #e69f00; }
:root[data-contrast="1"] { --maple: #f4e8d2; --walnut: #4a3020; --ink-2: #d9c7ad; }
:root[data-theme="light"][data-contrast="1"] { --ink-2: #4a3a2a; }
body { background: radial-gradient(ellipse at 50% -10%, #3a2818 0%, var(--bg) 58%), var(--bg); }
:root[data-theme="light"] body { background: radial-gradient(ellipse at 50% -10%, #fff9ee 0%, var(--bg) 60%), var(--bg); }

/* home */
.logo { display: flex; justify-content: center; margin-bottom: -6px; } .logo canvas { width: 240px; height: 96px; }
.title { font-family: var(--font-display); font-weight: 700; font-size: clamp(3.2rem, 17vw, 6rem); letter-spacing: .06em; color: var(--accent); text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 28px color-mix(in oklab, var(--accent) 40%, transparent); }
.tagline { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: .02em; font-style: italic; }
.modes { grid-template-columns: 1fr 1fr; }
.mode b { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .02em; }
.cta { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: .12em; }
.seat-row[data-seat="0"] { --pc: var(--white-seat); } .seat-row[data-seat="1"] { --pc: var(--black-seat); }
.seat-row .swatch { box-shadow: inset 0 -3px 0 rgb(0 0 0 / .25), 0 0 0 1px var(--outline); }
.seat-row .seat-name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.best-line { gap: 14px; }

/* play: hud */
.play .stage { padding: 2px 6px; }
.play .stage-canvas { border-radius: 10px; filter: drop-shadow(0 18px 30px rgba(0,0,0,.5)); }
.hud-pill .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0,0,0,.3), 0 0 0 1px var(--outline); }
.hud-pill .dot-w { background: var(--ivory); } .hud-pill .dot-b { background: var(--ebony); } .hud-pill .sep { color: var(--ink-2); padding: 0 2px; }
.ellipsis { font-size: 1.6rem; line-height: 1; font-weight: 800; letter-spacing: -.05em; transform: translateY(-3px); }
/* rails: one seat per rail with avatar, name/status, captured pieces, clock */
.rail { padding: 4px 10px; min-height: 50px; }
.rail-bottom { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.seat { flex: 1 1 auto; max-width: none; height: 44px; padding: 0 8px 0 5px; gap: 8px; background: color-mix(in oklab, var(--surface) 88%, transparent); }
.seat[data-side="0"] { --pc: var(--white-seat); } .seat[data-side="1"] { --pc: var(--brass); }
.seat .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), inset 0 -3px 0 rgba(0,0,0,.25); object-fit: contain; padding: 1px; }
.seat .who { flex: 0 1 auto; min-width: 54px; }
.seat .who b { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; }
.seat .who small { font-size: .62rem; }
.seat .caps { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; height: 18px; overflow: hidden; margin-left: 2px; }
.seat .caps img { width: 16px; height: 16px; margin-left: -6px; flex: 0 0 auto; }
.seat .caps img:first-child { margin-left: 0; }
.seat .caps em { font-style: normal; font-size: .72rem; font-weight: 800; color: var(--ink-2); margin-left: 5px; flex: 0 0 auto; }
.seat .clock { flex: 0 0 auto; font-weight: 800; font-size: 1.02rem; letter-spacing: .02em; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.seat[data-active="true"] .clock { color: var(--ink); background: color-mix(in oklab, var(--accent) 22%, var(--surface-2)); }
.seat .clock[data-low="true"] { color: #fff; background: var(--check); animation: clock-pulse .8s ease-in-out infinite; }
@keyframes clock-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--check) 60%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
:root[data-motion="reduced"] .seat .clock[data-low="true"] { animation: none; }
/* move strip */
.moves { position: relative; z-index: 3; flex: 0 0 auto; display: flex; align-items: center; gap: 2px; height: 30px; margin: 0 10px; padding: 0 8px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; border-radius: var(--r-pill); background: color-mix(in oklab, var(--surface) 70%, transparent); font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.moves::-webkit-scrollbar { display: none; }
.moves:empty::before { content: "Moves appear here"; color: var(--ink-2); font-weight: 600; opacity: .7; }
.moves .num { color: var(--ink-2); font-weight: 600; margin-left: 6px; } .moves .num:first-child { margin-left: 0; }
.moves .san { padding: 1px 5px; border-radius: 5px; }
.moves .san[data-last="true"] { background: var(--accent); color: var(--accent-ink); }
/* handover */
.overlay h2 { font-family: var(--font-display); text-transform: none; font-weight: 700; font-size: clamp(2.4rem, 11vw, 3.6rem); letter-spacing: .02em; }
.overlay p { color: var(--ink-2); }
.handover-piece { width: 84px; height: 84px; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
:root[data-motion="reduced"] .handover-piece { animation: none; }
/* sheets */
.promo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.promo-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; min-height: 92px; border-radius: var(--r-md); background: var(--surface-2); border: 2px solid transparent; }
.promo-btn img { width: 56px; height: 56px; } .promo-btn span { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.promo-btn:hover, .promo-btn:focus-visible { border-color: var(--accent); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-btn { justify-content: flex-start; padding: 0 18px; min-height: 52px; font-size: 1rem; }
.menu-btn[data-confirm="true"] { background: var(--check); color: #fff; }
.result-verdict { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); }
@container screen (min-width: 640px) { .board-home .modes { grid-template-columns: 1fr 1fr; } }
/* desktop: seats beside the board, move list under the bottom seat in the right column */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .play { grid-template-rows: auto auto 1fr; grid-template-areas: "hud hud hud" "left stage right" "left stage moves"; }
  .play .rail-top, .play .rail-bottom { align-items: stretch; }
  .play .rail-bottom { justify-content: flex-end; padding-bottom: 8px; }
  .play .rail-top { justify-content: flex-start; padding-top: 32px; }
  .play .stage { padding: 12px; }
  .seat { height: 60px; flex: 0 0 auto; width: min(320px, 100%); padding: 0 12px 0 8px; gap: 10px; }
  .seat .avatar { width: 42px; height: 42px; } .seat .who b { font-size: 1.2rem; } .seat .who small { font-size: .7rem; }
  .seat .caps img { width: 20px; height: 20px; margin-left: -7px; } .seat .clock { font-size: 1.25rem; padding: 4px 10px; }
  .moves { grid-area: moves; align-self: start; width: min(320px, 100%); height: auto; max-height: calc(100dvh - 240px); margin: 0 20px; padding: 10px 12px; flex-direction: row; flex-wrap: wrap; align-content: flex-start; white-space: normal; overflow-y: auto; border-radius: var(--r-md); font-size: .95rem; row-gap: 4px; }
  .moves .num { flex: 0 0 34px; margin-left: 0; } .moves .san { flex: 0 0 calc(50% - 20px); }
}
