
/* Layout: phone-first single column (max ~560px) with a bottom tab bar; from 900px the tab bar becomes a left rail and play/review screens split into board + side panel. */
:root {
  --ink: #11151b;
  --panel: #19202a;
  --raised: #222b37;
  --line: #2d3744;
  --text: #ede7da;
  --muted: #97a1ae;
  --brass: #d8a64a;
  --brass-hi: #f0c873;
  --on-brass: #1c1407;
  --win: #74c27a;
  --loss: #e5675c;
  --draw: #a9b0ba;
  --c-best: #81b64c;
  --c-excellent: #96bc4b;
  --c-good: #96af8b;
  --c-inacc: #f0bd3e;
  --c-mistake: #ff9f4f;
  --c-blunder: #f24a35;
  --c-forced: #8a96a6;
  --c-book: #a88865;
  --c-miss: #ff7769;
  --light: #ecd6b0;
  --dark: #a87b54;
  --hl: rgba(255, 212, 84, .45);
  --f-display: "Young Serif", Georgia, "Times New Roman", serif;
  --f-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: dark;
}
html { height: 100%; box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body { height: 100%; margin: 0; background: var(--ink); color: var(--text); font-family: var(--f-ui); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

#app { height: 100%; display: flex; flex-direction: column; }
#main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.screen { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 14px 28px; display: flex; flex-direction: column; gap: 18px; }
.screen.wide { max-width: 1120px; }

/* tab bar */
#tabs { order: 2; display: flex; justify-content: space-around; align-items: stretch; background: var(--panel); border-top: 1px solid var(--line); padding-inline: 4px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-block: 8px 7px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.tab[aria-current="page"] { color: var(--brass-hi); }
.rail-brand { display: none; }
body.immersive #tabs { display: none; }

@media (min-width: 900px) {
  #app { flex-direction: row; }
  #tabs { order: -1; flex-direction: column; justify-content: flex-start; gap: 4px; width: 92px; border-top: 0; border-right: 1px solid var(--line); padding-block: 14px; }
  .tab { flex: none; padding-block: 12px; font-size: 12px; border-radius: 10px; margin-inline: 8px; }
  .tab:hover { background: var(--raised); color: var(--text); }
  .rail-brand { display: grid; place-items: center; margin-bottom: 14px; }
  body.immersive #tabs { display: flex; }
}

/* type */
.display { font-family: var(--f-display); font-weight: 400; letter-spacing: .005em; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* brand header */
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-size: 26px; }
.mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brass); display: grid; place-items: center; }
.mark span { width: 30px; height: 30px; background-size: 100%; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding-inline: 18px; border-radius: 12px; font-weight: 700; font-size: 16px; background: var(--raised); border: 1px solid var(--line); transition: transform .08s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brass); color: var(--on-brass); border-color: transparent; box-shadow: 0 3px 0 #9c7426; }
.btn.primary:hover { background: var(--brass-hi); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; font-size: 14px; padding-inline: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--text); }
.icon-btn:hover { background: var(--raised); }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--f-mono); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }

.hero-play { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 14px; align-items: center; background: linear-gradient(135deg, #222b37, #1a2029); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.hero-play h2 { font-family: var(--f-display); font-size: 24px; font-weight: 400; line-height: 1.15; }
.hero-play .mini { width: 132px; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.li:last-child { border-bottom: 0; }
.li:hover { background: rgba(255,255,255,.02); }

.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding-inline: 7px; border-radius: 7px; font-size: 12px; font-weight: 800; }
.chip.w { background: rgba(116, 194, 122, .22); background: color-mix(in srgb, var(--win) 22%, transparent); color: var(--win); }
.chip.l { background: rgba(229, 103, 92, .22); background: color-mix(in srgb, var(--loss) 22%, transparent); color: var(--loss); }
.chip.d { background: rgba(169, 176, 186, .22); background: color-mix(in srgb, var(--draw) 22%, transparent); color: var(--draw); }

/* avatars */
.ava { width: 40px; height: 40px; border-radius: 9px; background: var(--ava, #3a4656); display: grid; place-items: center; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.ava span { width: 82%; height: 82%; background-size: 100%; }
.ava.lg { width: 72px; height: 72px; border-radius: 16px; }
.ava.sm { width: 32px; height: 32px; border-radius: 8px; }

/* segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 38px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }

/* bot grid */
.bots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.botbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 2px solid transparent; background: var(--panel); }
.botbtn .ava { width: 52px; height: 52px; border-radius: 12px; }
.botbtn b { font-size: 13px; }
.botbtn small { font-size: 11px; color: var(--muted); font-family: var(--f-mono); }
.botbtn[aria-pressed="true"] { border-color: var(--brass); background: var(--raised); }
.botcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.botcard h3 { font-family: var(--f-display); font-weight: 400; font-size: 22px; }
.quote { font-size: 14px; color: var(--muted); }

.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.opt { min-height: 44px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.opt[aria-pressed="true"] { border-color: var(--brass); color: var(--brass-hi); background: var(--raised); }
.opt .kq { width: 22px; height: 22px; background-size: 100%; }
.optlabel { font-size: 13px; font-weight: 700; color: var(--muted); }

/* ---------- board ---------- */
.board { position: relative; width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: 4px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.board .sqs { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; }
.sq.l { background: var(--light); }
.sq.d { background: var(--dark); }
.sq.l.last, .sq.l.sel { background: var(--hl-l); }
.sq.d.last, .sq.d.sel { background: var(--hl-d); }
.sq.hint::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(90, 170, 255, .45); }
.sq.check { background-image: radial-gradient(circle, rgba(255, 40, 40, .95) 0, rgba(230, 30, 30, .7) 30%, rgba(200, 0, 0, 0) 72%); }
.sq.dot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(0, 0, 0, .14); z-index: 1; }
.sq.cap::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: radial-gradient(circle, transparent 0 60%, rgba(0, 0, 0, .14) 61%); z-index: 1; }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .6); }
.co { position: absolute; font-size: clamp(8px, 1.5vmin, 11px); font-weight: 700; line-height: 1; pointer-events: none; z-index: 1; opacity: .92; }
.sq.ann { background-image: linear-gradient(rgba(235, 97, 80, .8), rgba(235, 97, 80, .8)); }
.co-r { left: 4%; top: 5%; }
.co-f { right: 5%; bottom: 4%; }
.sq.l .co { color: var(--dark); }
.sq.d .co { color: var(--light); }
.board.nocoords .co { display: none; }
.pieces { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 2; }
.pc { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; background-size: 100%; background-repeat: no-repeat; will-change: transform; }
.pc.anim { transition: transform .2s cubic-bezier(.3, .7, .3, 1); }
.pc.ghost { transition: opacity .2s ease; opacity: 0; }
.pc.drag { z-index: 10; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
.board .arrows { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.board .marks { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 5; }
.mk { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; }
.mk i { position: absolute; right: -9%; top: -9%; width: 44%; height: 44%; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: clamp(9px, 2vmin, 14px); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.85); }
.mk i svg { width: 64%; height: 64%; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.mk.er i { right: 2%; } .mk.et i { top: 2%; }
.mk.pop i { animation: pop .28s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.promo { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 20; background: rgba(10, 12, 16, .55); }
.promo .col { position: absolute; width: 12.5%; display: flex; flex-direction: column; background: var(--text); border-radius: 6px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.promo .col button { aspect-ratio: 1; background-size: 88%; background-position: center; background-repeat: no-repeat; }
.promo .col button:hover { background-color: #d9cfb9; }

/* player bars */
.pbar { display: flex; align-items: center; gap: 10px; min-height: 50px; padding-block: 6px; position: relative; }
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pname { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname .prating { color: var(--muted); font-weight: 500; font-family: var(--f-mono); font-size: 13px; }
.caps { display: flex; align-items: center; min-height: 18px; }
.caps span { width: 17px; height: 17px; background-size: 100%; margin-right: -6px; }
.caps span.gap { margin-right: 2px; }
.caps .adv { margin-left: 10px; font-size: 12px; font-weight: 700; color: var(--muted); font-family: var(--f-mono); }
.clock { font-family: var(--f-mono); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; padding: 6px 12px; border-radius: 8px; background: #0b0e12; color: #7d8794; min-width: 92px; text-align: right; }
.clock.active { background: var(--text); color: #11151b; }
.clock.low.active { background: #f2c9c4; color: #7a1610; }
.thinking { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--brass-hi); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
.bubble { position: absolute; left: 52px; top: 50%; transform: translateY(-50%); z-index: 30; max-width: min(72%, 300px); background: var(--text); color: #1b1f26; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 12px; border-bottom-left-radius: 3px; box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: bub .25s ease; pointer-events: none; }
@keyframes bub { from { opacity: 0; transform: translateY(-50%) scale(.85); } }

/* game layout */
.topbar { display: grid; grid-template-columns: 84px minmax(0, 1fr) 84px; align-items: center; gap: 8px; }
.topbar h2 { text-align: center; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-grid { display: grid; gap: 12px; }
.board-col { display: flex; flex-direction: column; min-width: 0; width: 100%; margin-inline: auto; }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.strip { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; padding-block: 4px; font-family: var(--f-mono); font-size: 14px; }
.strip::-webkit-scrollbar { display: none; }
.strip .mn { color: var(--muted); padding: 5px 2px 5px 8px; flex: none; }
.strip button { padding: 5px 7px; border-radius: 6px; flex: none; font-weight: 600; }
.strip button.cur { background: var(--raised); color: var(--brass-hi); }
.strip .empty { color: var(--muted); padding: 5px 8px; font-family: var(--f-ui); }
.mtable { display: none; }
.actionbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.actionbar button { min-height: 52px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.actionbar button svg { color: var(--text); }
.actionbar button[disabled] { opacity: .35; pointer-events: none; }
.status-line { font-size: 14px; color: var(--muted); text-align: center; min-height: 20px; }

@media (min-width: 900px) {
  .game-grid { grid-template-columns: minmax(0, min(calc(100vh - 190px), 720px)) 330px; grid-template-columns: minmax(0, min(calc(100dvh - 190px), 720px)) 330px; align-items: start; justify-content: center; }
  #s-puzzle .game-grid { grid-template-columns: minmax(0, min(calc(100vh - 200px), 720px)) 330px; grid-template-columns: minmax(0, min(calc(100dvh - 200px), 720px)) 330px; }
  #s-review .game-grid { grid-template-columns: minmax(0, min(calc(100vh - 150px), 740px)) 340px; grid-template-columns: minmax(0, min(calc(100dvh - 150px), 740px)) 340px; }
  .board-col { width: 100%; }
  .side { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; height: 100%; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); }
  .strip { display: none; }
  .mtable { display: block; flex: 1; min-height: 120px; overflow-y: auto; font-family: var(--f-mono); font-size: 14px; }
  .mtable .tr { display: grid; grid-template-columns: 44px 1fr 1fr; border-radius: 6px; }
  .mtable .tr:nth-child(odd) { background: rgba(255,255,255,.025); }
  .mtable .tr span { color: var(--muted); padding: 6px 8px; }
  .mtable button { text-align: left; padding: 6px 8px; border-radius: 6px; font-weight: 600; }
  .mtable button.cur { background: var(--raised); color: var(--brass-hi); }
}

/* eval bar + review */
.board-eval { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: stretch; }
.evalbar { position: relative; border-radius: 5px; overflow: hidden; background: #1f242c; }
.evalbar .fill { position: absolute; left: 0; right: 0; bottom: 0; background: #f1ece2; transition: height .3s ease; }
.evalbar .lbl { position: absolute; left: 0; right: 0; font-family: var(--f-mono); font-size: 9.5px; font-weight: 700; text-align: center; }
.evalbar .lbl.top { top: 4px; color: #f1ece2; }
.evalbar .lbl.bot { bottom: 4px; color: #1f242c; }
.acc { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; text-align: center; }
.acc .who { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.acc .who b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.acc .score { font-family: var(--f-mono); font-weight: 700; font-size: 28px; padding: 4px 12px; border-radius: 10px; }
.acc .score.w { background: #f1ece2; color: #14181f; }
.acc .score.b { background: #0b0e12; color: #f1ece2; border: 1px solid var(--line); }
.cls { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 14px; align-items: center; font-size: 14px; }
.cls .n { font-family: var(--f-mono); font-weight: 700; text-align: center; min-width: 28px; }
.cls .lab { display: flex; align-items: center; gap: 8px; }
.dotc { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }
.dotc svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.graph { width: 100%; height: 72px; display: block; border-radius: 8px; cursor: pointer; }
.progress { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brass); width: 0; transition: width .2s; }
.rmoves { display: grid; grid-template-columns: 40px 1fr 1fr; font-family: var(--f-mono); font-size: 14px; max-height: 340px; overflow-y: auto; }
.rmoves > span { color: var(--muted); padding: 6px 4px; }
.rmoves button { text-align: left; padding: 6px 8px; border-radius: 6px; display: flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; }
.rmoves button.cur { background: var(--raised); color: var(--brass-hi); }
.rmoves .dotc { width: 16px; height: 16px; font-size: 8px; }
.rmoves .dotc svg { width: 10px; height: 10px; }
.navbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.navbar button { min-height: 46px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; }

/* puzzles */
.pz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pz-prompt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); min-height: 64px; }
.pz-prompt .side-ico { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.pz-prompt .side-ico span { width: 28px; height: 28px; background-size: 100%; }
.pz-prompt.ok { border-color: #4e7a55; border-color: color-mix(in srgb, var(--win) 60%, var(--line)); }
.pz-prompt.bad { border-color: #8c4c47; border-color: color-mix(in srgb, var(--loss) 60%, var(--line)); }
.pz-prompt b { font-size: 16px; }
.pz-prompt p { font-size: 14px; color: var(--muted); }
.pz-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pz-actions .btn { flex: 1; min-width: 120px; }
.rush-hud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rush-hud > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; align-items: center; }
.rush-hud b { font-family: var(--f-mono); font-size: 24px; font-variant-numeric: tabular-nums; }
.rush-hud small { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.strikes { display: flex; gap: 6px; height: 34px; align-items: center; }
.strikes i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.strikes i.on { background: var(--loss); border-color: var(--loss); }
.strikes i svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3.4; fill: none; stroke-linecap: round; }
.mode-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; text-align: left; width: 100%; }
.mode-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--raised); color: var(--brass-hi); }
.mode-ico svg { width: 26px; height: 26px; }
.mode-card h3 { font-size: 17px; font-weight: 700; }
.mode-card p { font-size: 13px; color: var(--muted); }
.mini { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 6px; overflow: hidden; width: 100%; }
.mini div { aspect-ratio: 1; background-size: 100%; }

/* games list */
.gli { display: grid; grid-template-columns: auto 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.gli .meta { font-size: 12px; color: var(--muted); }
.gli .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accpill { font-family: var(--f-mono); font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.set-row .set-txt { flex: 1; min-width: 0; font-weight: 600; }
.set-row.off { cursor: default; opacity: .55; }
.set-row small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 32px; background: rgba(255, 255, 255, .2); border: 0; transition: background .18s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .18s; }
.switch input:checked + span { background: var(--sw-on, var(--brass)); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled { cursor: default; }
.switch input:focus-visible + span { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
.themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.theme { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.theme .sw { width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; display: grid; grid-template-columns: 1fr 1fr; border: 2px solid transparent; }
.theme[aria-pressed="true"] .sw { border-color: var(--brass); }
.theme[aria-pressed="true"] { color: var(--text); }
.about { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* overlay / sheets */
#overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; background: rgba(6, 8, 11, .62); display: flex; align-items: flex-end; justify-content: center; padding-inline: 12px; padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); animation: fade .15s ease; }
#overlay.center { align-items: center; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; animation: rise .2s cubic-bezier(.2, .9, .3, 1); max-height: 90%; overflow-y: auto; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.sheet h3 { font-family: var(--f-display); font-weight: 400; font-size: 24px; text-align: center; }
.sheet .sub { text-align: center; color: var(--muted); font-size: 14px; }
.menu { display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 14px; padding: 14px 6px; border-bottom: 1px solid var(--line); font-weight: 600; text-align: left; }
.menu button:last-child { border-bottom: 0; }
.menu button[disabled] { opacity: .4; pointer-events: none; }
.menu button.danger { color: var(--loss); }
.result-faces { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.result-faces .who { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; min-width: 0; }
.result-faces .sc { font-family: var(--f-mono); font-size: 22px; font-weight: 700; }
.delta { text-align: center; font-family: var(--f-mono); font-weight: 700; }
.delta.up { color: var(--win); } .delta.down { color: var(--loss); }
textarea.pgn { width: 100%; min-height: 160px; background: #0b0e12; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-family: var(--f-mono); font-size: 12px; resize: vertical; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 200; background: var(--text); color: #14181f; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
#toast.on { opacity: 1; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-title h2 { font-size: 18px; font-weight: 800; }
.linkbtn { color: var(--brass-hi); font-weight: 700; font-size: 14px; }
.empty-note { color: var(--muted); font-size: 14px; padding: 6px 2px; }

/* ---- v2: coach, time controls, piece sets ---- */
.coach { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; align-items: start; min-height: 104px; }
.coach-av { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f3d184, #c99636); display: grid; place-items: center; box-shadow: 0 2px 0 rgba(0,0,0,.25); flex: none; }
.coach-av span { width: 34px; height: 34px; background-size: 100%; }
.coach-bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; border-top-left-radius: 4px; padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.coach-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.coach-head b { font-size: 16px; line-height: 1.3; }
.coach-head .ev { margin-left: auto; font-family: var(--f-mono); font-weight: 700; font-size: 13px; padding: 2px 7px; border-radius: 6px; background: var(--raised); flex: none; }
.coach-text { font-size: 14.5px; line-height: 1.5; color: rgba(237, 231, 218, .86); color: color-mix(in srgb, var(--text) 86%, transparent); }
.coach-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.chipbtn { min-height: 34px; padding-inline: 14px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.chipbtn:hover { border-color: var(--muted); }
.chipbtn.primary { background: var(--brass); color: var(--on-brass); border-color: transparent; }
.chipbtn[disabled] { opacity: .45; pointer-events: none; }
.opening-name { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--brass-hi); text-align: center; }
.phases { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px 10px; align-items: center; text-align: center; padding-block: 4px; border-block: 1px solid var(--line); }
.phases .ph-l { font-size: 13px; font-weight: 700; color: var(--muted); }
.grade { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; }
.km { align-items: flex-start; }
.km b { font-family: var(--f-mono); }
.km small { font-size: 13px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; }
.msg { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; max-width: 92%; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--brass); color: var(--on-brass); border-bottom-right-radius: 4px; font-weight: 600; }
.msg.bot { align-self: flex-start; background: var(--raised); border-bottom-left-radius: 4px; }
.msg p + p, .msg p + ul, .msg ul + p { margin-top: 6px; }
.msg ul { margin: 0; padding-left: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.askrow { display: flex; gap: 8px; }
.askrow input { flex: 1; min-width: 0; min-height: 42px; border-radius: 12px; background: #0b0e12; border: 1px solid var(--line); color: var(--text); padding-inline: 12px; font: inherit; }
.tcbtn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding-inline: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.tcbtn:hover { border-color: var(--muted); }
.tcbtn b { font-size: 16px; display: block; }
.tcbtn small { color: var(--muted); font-size: 12px; font-weight: 600; }
.tc-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--raised); display: grid; place-items: center; flex: none; }
.tc-cat { display: flex; flex-direction: column; gap: 8px; }
.tc-cat-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.tc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tc-grid.one { grid-template-columns: 1fr; }
.tc-grid .opt { font-size: 13px; padding-inline: 2px; }
.hero-tc { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.board-preview { width: 100%; max-width: 240px; align-self: center; }
.pieceset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pieceset button { border: 2px solid transparent; border-radius: 12px; background: var(--raised); padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.pieceset button[aria-pressed="true"] { border-color: var(--brass); color: var(--text); }
.pieceset .row4 { display: flex; justify-content: center; }
.pieceset .row4 span { width: 34px; height: 34px; background-size: 100%; }
@media (min-width: 900px) {
  #s-review .game-grid { grid-template-columns: minmax(0, min(calc(100vh - 240px), 700px)) 360px; grid-template-columns: minmax(0, min(calc(100dvh - 240px), 700px)) 360px; }
  #r-side { overflow-y: auto; }
}

.coach-face { width: 54px; height: 54px; border-radius: 50%; flex: none; overflow: hidden; background: radial-gradient(circle at 35% 30%, #f3d184, #c99636); box-shadow: 0 2px 0 rgba(0,0,0,.25); transition: box-shadow .2s; }
.row .coach-face { width: 44px; height: 44px; }
.coach-face svg { width: 100%; height: 100%; display: block; }
.coach-face .eyes { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.coach-face .m-open { opacity: 0; transform-box: fill-box; transform-origin: center; }
.coach-face.talking .m-smile { opacity: 0; }
.coach-face.talking .m-open { opacity: 1; animation: talk .17s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.2); } to { transform: scaleY(1.05); } }
.coach-face.talking { box-shadow: 0 0 0 3px rgba(129, 182, 76, .55), 0 2px 0 rgba(0,0,0,.25); }
.navbar .playbtn { background: var(--raised); }
.navbar .playbtn.on { background: var(--brass); color: var(--on-brass); border-color: transparent; }
.navbar .playbtn[disabled] { opacity: .4; }
#r-voice[aria-pressed="false"] { color: var(--muted); }
@supports not (aspect-ratio: 1 / 1) {
  .board::before { content: ""; display: block; padding-top: 100%; }
  .mini div, .promo .col button { height: 0; padding-top: 100%; }
  .theme .sw { height: 0; padding-top: 100%; position: relative; }
  .theme .sw i { position: absolute; width: 50%; height: 50%; }
  .theme .sw i:nth-child(1) { top: 0; left: 0; } .theme .sw i:nth-child(2) { top: 0; right: 0; }
  .theme .sw i:nth-child(3) { bottom: 0; left: 0; } .theme .sw i:nth-child(4) { bottom: 0; right: 0; }
}
/* ---- v4: Learn, Watch, More ---- */
.tab[data-go="games"], .tab[data-go="settings"] { display: none; }
@media (min-width: 900px) {
  .tab[data-go="more"] { display: none; }
  .tab[data-go="games"], .tab[data-go="settings"] { display: flex; }
}
@media (max-width: 380px) { .tab { font-size: 10px; } .tab svg.i { width: 21px; height: 21px; } }
/* board additions for lessons */
.sq.lhl::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(90, 170, 255, .36); }
.mk.star span { position: absolute; left: 17%; top: 17%; width: 66%; height: 66%; display: block; animation: starin .35s cubic-bezier(.3, 1.5, .5, 1); }
.mk.star svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
@keyframes starin { from { transform: scale(.3); opacity: 0; } }
.mk.label span { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font: 800 clamp(13px, 3.4vmin, 24px) var(--f-mono); color: #1d2a12; }
.mk.label.corner span { left: auto; right: 4%; top: auto; bottom: 4%; transform: none; background: var(--brass); color: var(--on-brass); border-radius: 999px; padding: 1px 7px; font-size: clamp(10px, 2.4vmin, 15px); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); }
/* learn page */
.learn-hero { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; align-items: start; background: linear-gradient(135deg, #222b37, #1a2029); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.learn-hero .btn { justify-self: start; }
.learn-h { font-size: 22px; line-height: 1.2; margin-top: 2px; }
.unit-head { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.lesson-list { padding-block: 4px; }
.lesson-row b { display: block; font-size: 15px; }
.lesson-row small { display: block; color: var(--muted); font-size: 13px; }
.lesson-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--raised); display: grid; place-items: center; flex: none; }
.lesson-ico span { width: 32px; height: 32px; background-size: 100%; }
.lesson-row.next .lesson-ico { background: var(--brass); }
.chip.next { background: rgba(216, 166, 74, .2); color: var(--brass-hi); padding-inline: 9px; }
/* lesson player */
.lesson-steps { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.lesson-steps button { width: 30px; height: 7px; border-radius: 4px; background: var(--raised); padding: 0; border: 0; }
.lesson-steps button.done { background: var(--c-best); }
.lesson-steps button.cur { background: var(--brass); }
.lesson-steps button.cur.done { background: var(--c-best); box-shadow: 0 0 0 2px var(--brass); }
.lesson-steps button[disabled] { cursor: default; }
.lesson-text { font-size: 15.5px; }
.l-feedback { font-size: 14px; font-weight: 700; padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 8px; line-height: 1.4; }
.l-feedback svg { flex: none; }
.l-feedback.ok { background: rgba(129, 182, 76, .16); color: #b4dc8b; }
.l-feedback.bad { background: rgba(242, 74, 53, .14); color: #ff9585; }
.l-feedback.info { background: var(--raised); color: var(--text); font-weight: 600; }
#l-actions .btn { flex: 1; min-width: 110px; }
#s-lesson .coach { min-height: 0; }
@media (min-width: 900px) {
  #s-lesson .game-grid { grid-template-columns: minmax(0, min(calc(100vh - 250px), 660px)) 340px; grid-template-columns: minmax(0, min(calc(100dvh - 250px), 660px)) 340px; }
}
/* watch page */
.portals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .portals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.portal { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 12px 30px 12px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; min-width: 0; }
.portal b { display: flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; }
.portal small { color: var(--muted); font-size: 12.5px; }
.portal .dot, .pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); flex: none; }
.portal:hover, .pill:hover { border-color: var(--muted); }
.ext { width: 14px; height: 14px; margin-left: auto; color: var(--muted); flex: none; }
.portal .ext { position: absolute; top: 13px; right: 10px; }
#s-watch { max-width: 1000px; }
#s-lesson .side { height: auto; }
@media (min-width: 900px) { #s-watch .ev-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } #s-watch .st-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pill .ext { margin-left: 2px; width: 12px; height: 12px; }
.ev-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ev-card.is-live { border-color: rgba(242, 74, 53, .6); }
.ev-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ev-status { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.ev-status.live { background: rgba(242, 74, 53, .16); color: #ff8070; }
.ev-status.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff5a47; animation: livepulse 1.4s ease-in-out infinite; }
@keyframes livepulse { 50% { opacity: .25; } }
.ev-status.soon { background: rgba(216, 166, 74, .16); color: var(--brass-hi); }
.ev-status.week { background: rgba(129, 182, 76, .16); color: #b4dc8b; }
.ev-status.tba, .ev-status.done { background: var(--raised); color: var(--muted); }
.ev-dates { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-card h3 { font-size: 17px; font-weight: 800; }
.ev-meta { font-size: 13px; color: var(--muted); }
.ev-about { font-size: 14px; line-height: 1.5; }
.ev-when { font-size: 13px; font-weight: 700; color: var(--brass-hi); }
.ev-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding-inline: 12px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; }
.st-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 700px) { .st-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.st-card { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; align-items: start; }
.st-ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; background: hsl(var(--h), 42%, 38%); }
.st-card h3 { font-size: 16px; font-weight: 800; }
.st-card .who { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.st-card .about { font-size: 13.5px; line-height: 1.45; margin-top: 4px; }
.watch-note { font-size: 12.5px; color: var(--muted); }
.live-ico { background: rgba(242, 74, 53, .16); color: #ff8070; }
.more-row b { display: block; font-size: 15px; }
.more-row small { display: block; color: var(--muted); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 380px) {
  .bots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clock { min-width: 80px; font-size: 18px; }
  .hero-play { grid-template-columns: minmax(0, 1fr) 104px; }
  .hero-play .mini { width: 104px; }
}
/* ===== v5: modern look ===== */
:root {
  --ink: #0c1016;
  --panel: #151a22;
  --raised: #1e2530;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .13);
  --text: #eef1f5;
  --muted: #8f99a7;
  --brass: #f4b740;
  --brass-hi: #ffcb5c;
  --on-brass: #1b1204;
  --grad: linear-gradient(135deg, #ffd166 0%, #f59e3a 100%);
  --f-display: "Bricolage Grotesque", "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 16px;
  --lv-b: #5cc98a; --lv-i: #4ea8ff; --lv-p: #ff6b5a;
  --shadow: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 10px 28px -16px rgba(0, 0, 0, .75);
}
body { background: radial-gradient(900px 520px at 50% -260px, rgba(244, 183, 64, .10), transparent 70%), var(--ink); }
.display, .wordmark, .hero-play h2, .botcard h3, .sheet h3 { font-family: var(--f-display); font-weight: 750; letter-spacing: -.02em; }
h1.display { font-size: 30px !important; }
.wordmark { font-size: 24px; font-weight: 800; }
.mark { background: var(--grad); border-radius: 11px; box-shadow: 0 6px 16px -6px rgba(245, 158, 58, .6), inset 0 1px 0 rgba(255, 255, 255, .4); }
.section-title h2 { font-family: var(--f-display); font-size: 19px; font-weight: 750; letter-spacing: -.01em; }

/* surfaces */
.card, .stat, .tcbtn { border-radius: var(--r); border-color: var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .022), rgba(255, 255, 255, 0) 60%), var(--panel); box-shadow: var(--shadow); }
.stat b { font-family: var(--f-display); font-size: 25px; font-weight: 750; letter-spacing: -.02em; }
.sheet { border-radius: 22px; border-color: var(--line-2); background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, 0) 40%), var(--panel); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
#overlay { background: rgba(5, 7, 10, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* buttons */
.btn { border-radius: 14px; border-color: var(--line-2); }
.btn.primary { background: var(--grad); color: var(--on-brass); box-shadow: 0 8px 20px -10px rgba(245, 158, 58, .85), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.primary:hover { background: var(--grad); filter: brightness(1.06); }
.opt, .seg { border-radius: 13px; border-color: var(--line); }
.opt[aria-pressed="true"] { border-color: var(--brass); background: rgba(244, 183, 64, .1); }
.seg { background: var(--panel); }
.seg button { border-radius: 10px; }

/* tab bar: icon pill + duotone */
#tabs { background: rgba(14, 18, 24, .92); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px); border-color: var(--line); }
.tab { gap: 3px; padding-block: 7px 8px; font-weight: 650; }
.tab svg.i { box-sizing: border-box; width: 56px; height: 30px; padding: 4px 17px; border-radius: 999px; transition: background .2s ease, color .2s ease; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg.i { background: rgba(244, 183, 64, .17); color: var(--brass-hi); }
svg.i .tone { fill: currentColor; stroke: none; opacity: 0; transition: opacity .2s ease; }
.tab[aria-current="page"] svg.i .tone { opacity: .3; }
.mode-ico svg.i .tone { opacity: .28; }
@media (min-width: 900px) {
  .tab svg.i { width: 48px; height: 32px; padding: 5px 13px; }
  .tab:hover { background: transparent; }
  .tab:hover svg.i { background: var(--raised); }
}

/* mode tiles */
.mode-ico { border-radius: 16px; color: #fff; background: linear-gradient(135deg, #3a4558, #252d3a); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 18px -10px rgba(0, 0, 0, .8); }
.mode-ico svg { stroke: #fff; }
#pm-rated .mode-ico, .tile-rated { background: linear-gradient(135deg, #9b7bff, #5b3fd6); }
#pm-rush .mode-ico, #h-rush .mode-ico, .tile-rush { background: linear-gradient(135deg, #ffa24c, #e8453c); }
#h-learn .mode-ico { background: linear-gradient(135deg, #5fd69a, #1f8f6a); }
#h-watch .mode-ico { background: linear-gradient(135deg, #ff7aa8, #c4325d); }
#h-watch .mode-ico.live-ico { background: linear-gradient(135deg, #ff6a5a, #d12b3d); }
.mode-card h3 { font-size: 16.5px; }
.mode-card .mini, .mode-card > div > .mini { border-radius: 10px; overflow: hidden; }

/* hero */
.hero-play { grid-template-columns: minmax(0, 1fr) auto; border-radius: 22px; border-color: var(--line-2); padding: 20px; background: radial-gradient(360px 220px at 100% 0%, rgba(244, 183, 64, .2), transparent 65%), radial-gradient(300px 200px at 0% 100%, rgba(78, 168, 255, .1), transparent 70%), linear-gradient(160deg, #1b222d, #12171e); box-shadow: var(--shadow); }
.hero-play h2 { font-size: 25px; line-height: 1.1; }
.hero-ava { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hero-cat { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brass-hi); background: rgba(244, 183, 64, .13); padding: 3px 9px; border-radius: 999px; }

/* portraits */
.ava { border-radius: 11px; }
.ava.portrait { overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 4px 12px -6px rgba(0, 0, 0, .6); }
.ava.portrait svg { width: 100%; height: 100%; display: block; }
.ava.xs { width: 26px; height: 26px; border-radius: 8px; }
.ava.sm { width: 34px; height: 34px; border-radius: 10px; }
.ava.md { width: 52px; height: 52px; border-radius: 15px; }
.ava.lg { width: 72px; height: 72px; border-radius: 20px; }
.ava.xl { width: 104px; height: 104px; border-radius: 28px; }
.mode-card > .ava.md { width: 52px; height: 52px; }

/* play: bot picker */
.botcard { gap: 16px; border-radius: 22px; padding: 16px; }
.botcard h3 { font-size: 26px; }
.botcard .ava.xl { width: 96px; height: 96px; border-radius: 26px; }
.enginecard { background: radial-gradient(320px 180px at 0% 50%, rgba(255, 140, 60, .2), transparent 70%), #0f1319; border-color: rgba(255, 179, 71, .35); }
.rating-pill { font-family: var(--f-mono); font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(244, 183, 64, .14); color: var(--brass-hi); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--text); }
.tag.cat { background: rgba(78, 168, 255, .14); border-color: transparent; color: #9fcbff; }
.tag.won { background: rgba(116, 194, 122, .15); border-color: transparent; color: var(--win); }
.catnav { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -6px -16px -4px; padding: 10px 16px; background: linear-gradient(var(--ink) 72%, rgba(12, 16, 22, 0)); }
.catnav::-webkit-scrollbar { display: none; }
.catnav button { flex: none; padding: 7px 13px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.catnav button[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: transparent; }
.botcat { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 60px; }
.catcap { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.catcap h3 { font-family: var(--f-display); font-size: 20px; font-weight: 750; letter-spacing: -.015em; }
.range { font-family: var(--f-mono); font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; }
.catblurb { font-size: 13px; color: var(--muted); margin-top: -6px; }
.bots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.botbtn { position: relative; gap: 5px; padding: 11px 4px 9px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--panel); transition: transform .1s ease, border-color .15s ease; }
.botbtn:hover { border-color: var(--line-2); }
.botbtn:active { transform: scale(.97); }
.botbtn .ava { width: 58px; height: 58px; border-radius: 17px; }
.botbtn b { font-size: 12.5px; line-height: 1.2; text-align: center; text-wrap: balance; overflow-wrap: anywhere; }
.botbtn small { font-size: 11px; }
.botbtn[aria-pressed="true"] { border-color: var(--brass); background: rgba(244, 183, 64, .08); box-shadow: 0 0 0 3px rgba(244, 183, 64, .14); }
.ava-wrap { position: relative; display: block; }
.beat { position: absolute; right: -5px; bottom: -5px; width: 21px; height: 21px; border-radius: 50%; background: var(--win); display: grid; place-items: center; border: 2.5px solid var(--panel); }
.beat svg { width: 11px; height: 11px; fill: none; stroke: #0c1016; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.gm-progress { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; color: var(--muted); }
.gm-progress .bar, .cycle-bar { flex: 1; height: 6px; background: var(--raised); border-radius: 999px; overflow: hidden; }
.gm-progress .bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.engine-tile { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border-radius: 20px; text-align: left; background: radial-gradient(320px 160px at 0% 50%, rgba(255, 140, 60, .2), transparent 70%), #0e1218; border: 1.5px solid rgba(255, 179, 71, .38); box-shadow: var(--shadow); }
.engine-tile[aria-pressed="true"] { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(244, 183, 64, .18); }
.engine-tile b { display: block; font-family: var(--f-display); font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.engine-tile small { display: block; color: var(--muted); font-size: 13px; }
.engine-tile.locked > .ava { filter: saturate(.4) brightness(.75); }
.gmsteps { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.gmstep { position: relative; display: block; }
.gmstep:not(.done) .ava { filter: grayscale(1) brightness(.55); }
.gmstep i { position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--win); display: grid; place-items: center; border: 2px solid #0e1218; }
.gmstep i svg { width: 8px; height: 8px; fill: none; stroke: #0c1016; stroke-width: 4; stroke-linecap: round; }
.gmsteps em { font-style: normal; font-family: var(--f-mono); font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.lockb { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: var(--muted); }
svg.lock { width: 20px; height: 20px; }
.btn svg.lock { width: 18px; height: 18px; }
.game-opts { gap: 16px; }
.play-cta { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; margin: 0 -16px -28px; padding: 12px 16px 14px; background: rgba(12, 16, 22, .88); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.play-cta .btn { min-height: 50px; }
.unlock-banner { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; text-align: left; background: radial-gradient(260px 120px at 0% 50%, rgba(255, 140, 60, .22), transparent 70%), rgba(255, 179, 71, .07); border: 1px solid rgba(255, 179, 71, .38); }
.unlock-banner[role="button"] { cursor: pointer; }
.unlock-banner b { display: block; font-size: 15px; }
.unlock-banner small { display: block; color: var(--muted); font-size: 13px; }
.unlock-banner.gm { background: var(--raised); border-color: var(--line); }
.unlock-banner.gm > svg { width: 26px; height: 26px; margin-inline: 6px; color: var(--brass-hi); }

/* puzzles: levels, rush, daily cycle */
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .levels { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.lvlbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 12px; border-radius: 14px; background: var(--raised); border: 1.5px solid transparent; text-align: left; position: relative; overflow: hidden; }
.lvlbtn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lv, var(--brass)); opacity: .9; }
.lvlbtn b { font-size: 14px; }
.lvlbtn small { font-size: 12px; color: var(--muted); font-weight: 600; }
.lvlb-beginner { --lv: var(--lv-b); } .lvlb-intermediate { --lv: var(--lv-i); } .lvlb-professional { --lv: var(--lv-p); } .lvlb-adaptive { --lv: var(--brass); }
.lvlbtn[aria-pressed="true"] { border-color: var(--lv); background: color-mix(in srgb, var(--lv) 13%, var(--panel)); }
.lvl { display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.lvl-beginner { color: var(--lv-b); background: rgba(92, 201, 138, .14); }
.lvl-intermediate { color: var(--lv-i); background: rgba(78, 168, 255, .14); }
.lvl-professional { color: var(--lv-p); background: rgba(255, 107, 90, .14); }
.cycle { position: relative; display: flex; gap: 3px; height: 6px; margin-top: 9px; }
.cycle span { flex: 1; border-radius: 999px; opacity: .32; }
.cy-b { background: var(--lv-b); } .cy-i { background: var(--lv-i); } .cy-p { background: var(--lv-p); }
.cycle i { position: absolute; top: -3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--panel); z-index: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { padding: 8px 14px; min-height: 38px; border-radius: 999px; background: var(--raised); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; }
.chipbtn[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: transparent; }
.rush-best { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--raised); }
.rush-best span { font-size: 13px; font-weight: 700; color: var(--muted); }
.rush-best b { font-family: var(--f-display); font-size: 26px; font-weight: 750; }
.rush-best small { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }

/* voice settings */
.select { width: 100%; min-height: 46px; border-radius: 12px; background: var(--raised); color: var(--text); border: 1px solid var(--line-2); padding-inline: 12px; font: inherit; font-size: 15px; }
input[type="range"] { width: 100%; accent-color: var(--brass); }
.voice-card .btn.small { align-self: flex-start; }
@media (min-width: 900px) { .catnav { flex-wrap: wrap; } }
.card-h { font-family: var(--f-display); font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
/* ===== v6: home background, saved games, music, trial ===== */
#s-home { position: relative; isolation: isolate; }
#s-home > .card:not(.hero-play), #s-home .stat, #s-home .card.list { background: rgba(21, 26, 34, .82); }
.pay-note { font-size: 12.5px; text-align: center; }
.hero-play { background: radial-gradient(360px 220px at 100% 0%, rgba(244, 183, 64, .16), transparent 65%), linear-gradient(160deg, rgba(22, 28, 38, .5), rgba(14, 18, 24, .62)); -webkit-backdrop-filter: blur(2.5px) saturate(125%); backdrop-filter: blur(2.5px) saturate(125%); border-color: rgba(255, 255, 255, .14); }
.hero-play h2, .hero-play .eyebrow, .hero-play .hero-tc { text-shadow: 0 1px 10px rgba(0, 0, 0, .7); }
.saved-hero, .trial-banner { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.saved-hero { background: rgba(21, 26, 34, .72); }
.brandbar .right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brandbar .greet { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.music-btn { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(21, 26, 34, .7); border: 1px solid var(--line-2); color: var(--text); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.music-btn svg.i { width: 19px; height: 19px; }
.eq { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.eq i { width: 3px; border-radius: 2px; background: var(--brass-hi); animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.35s; } .eq i:nth-child(3) { animation-delay: -.7s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 15px; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 10px; } }

/* trial banner */
.trial-banner { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 16px; background: linear-gradient(135deg, rgba(255, 209, 102, .16), rgba(245, 158, 58, .1)), rgba(21, 26, 34, .82); border: 1px solid rgba(244, 183, 64, .35); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.trial-banner.over { background: linear-gradient(135deg, rgba(255, 107, 90, .18), rgba(245, 158, 58, .1)), rgba(21, 26, 34, .85); border-color: rgba(255, 107, 90, .45); }
.trial-banner b { display: block; font-size: 14.5px; }
.trial-banner small { display: block; font-size: 12.5px; color: var(--muted); }
.tb-ico { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: var(--on-brass); }
.tb-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.tb-cta { flex: none; font-size: 13px; font-weight: 800; padding: 7px 12px; border-radius: 999px; background: var(--text); color: var(--ink); }
.pay-hero { display: grid; place-items: center; }
.pay-hero .ava { box-shadow: 0 0 0 6px rgba(244, 183, 64, .12), 0 16px 40px -12px rgba(255, 140, 60, .6); }
.pay-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pay-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.pay-list li::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--win) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230c1016' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
.pay-price { display: flex; align-items: baseline; justify-content: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--raised); }
.pay-price b { font-family: var(--f-display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.pay-price span { color: var(--muted); font-size: 13px; font-weight: 600; }
.input { min-height: 46px; border-radius: 12px; background: var(--raised); color: var(--text); border: 1px solid var(--line-2); padding-inline: 14px; font: inherit; font-size: 16px; width: 100%; }
.input:focus { outline: 2px solid var(--brass-hi); outline-offset: 1px; }
a.btn { text-decoration: none; }

/* welcome */
.welcome-hero { display: flex; justify-content: center; gap: -10px; }
.welcome-hero .ava { margin-inline: -6px; border: 3px solid var(--panel); }
.welcome-hero .ava:nth-child(2) { transform: translateY(-8px) scale(1.12); z-index: 1; }
.trial-note { display: flex; gap: 10px; font-size: 13px; color: var(--muted); line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: var(--raised); }
.trial-note svg { flex: none; width: 18px; height: 18px; color: var(--brass-hi); fill: none; stroke: currentColor; stroke-width: 2; margin-top: 1px; }

/* saved games */
.saved-hero { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; align-items: center; text-align: left; width: 100%; }
.saved-hero .mini { width: 116px; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .8); }
.saved-hero h3 { font-family: var(--f-display); font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.saved-hero p { font-size: 13px; color: var(--muted); }
.saved-hero .who { display: flex; align-items: center; gap: 8px; }
.saved-actions { display: flex; gap: 8px; margin-top: 8px; }
.saved-actions .btn { min-height: 40px; font-size: 14px; padding-inline: 14px; }
.saved-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.saved-row .mini { width: 46px; border-radius: 7px; overflow: hidden; }
.saved-row b { display: block; font-size: 14.5px; }
.saved-row small { display: block; color: var(--muted); font-size: 12.5px; }
.del-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.del-btn:hover { background: var(--raised); color: var(--loss); }
.del-btn svg { width: 18px; height: 18px; }
.actionbar { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.actionbar [hidden] { display: none !important; }
#g-save svg { color: var(--brass-hi); }

/* music */
.np { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: linear-gradient(135deg, rgba(155, 123, 255, .18), rgba(78, 168, 255, .1)), var(--raised); }
.np-art { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #9b7bff, #3f6fd6); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.np-art svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
.np b { display: block; font-size: 15.5px; }
.np small { display: block; color: var(--muted); font-size: 12.5px; }
.transport { display: flex; justify-content: center; align-items: center; gap: 14px; }
.transport button { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line-2); }
.transport button.big { width: 60px; height: 60px; background: var(--grad); color: var(--on-brass); border: 0; box-shadow: 0 8px 20px -10px rgba(245, 158, 58, .9); }
.transport svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }
.tracks { display: flex; flex-direction: column; }
.track { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; text-align: left; width: 100%; }
.track:hover { background: rgba(255, 255, 255, .03); }
.track .n { width: 22px; text-align: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.track b { display: block; font-size: 14.5px; font-weight: 650; }
.track small { display: block; font-size: 12px; color: var(--muted); }
.track[aria-current="true"] b { color: var(--brass-hi); }
.profile-row { display: flex; gap: 8px; }

/* screens that the shell hides */
[hidden] { display: none !important; }

/* ===== phones turned sideways: board on the left, controls on the right ===== */
@media (orientation: landscape) and (max-height: 560px) {
  body.immersive .screen.wide { --vh: 100vh; max-width: none; height: 100%; margin: 0; padding: 6px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
    display: grid; column-gap: 16px; row-gap: 8px; grid-template-columns: var(--bw) minmax(0, 1fr); align-content: stretch; }
  @supports (height: 100dvh) { body.immersive .screen.wide { --vh: 100dvh; } }
  body.immersive .screen.wide > .game-grid { display: contents; }
  body.immersive .screen.wide > .topbar { grid-area: top; }
  body.immersive .screen.wide .side { grid-area: side; min-height: 0; overflow-y: auto; align-self: stretch; }
  #s-game { --bw: calc(var(--vh) - 104px); grid-template-areas: "board top" "board side"; grid-template-rows: auto minmax(0, 1fr); }
  #s-game .board-col { grid-area: board; width: var(--bw); }
  #s-game .pbar { min-height: 40px; padding-block: 3px; }
  #s-game .pbar .ava { width: 32px; height: 32px; }
  #s-puzzle { --bw: calc(var(--vh) - 16px); grid-template-areas: "board top" "board hud" "board side"; grid-template-rows: auto auto minmax(0, 1fr); }
  #s-puzzle .board-col { display: contents; }
  #s-puzzle #p-hud { grid-area: hud; }
  #s-puzzle .board-col > div:not([id]) { display: none; }
  #s-puzzle #p-board { grid-area: board; width: var(--bw); align-self: start; }
  #s-review { --bw: calc(var(--vh) - 74px); grid-template-columns: calc(var(--bw) + 30px) minmax(0, 1fr); grid-template-areas: "board top" "board coach" "board side" "nav side"; grid-template-rows: auto auto minmax(0, 1fr) auto; }
  #s-review .board-col { display: contents; }
  #s-review #r-coach { grid-area: coach; min-height: 0; }
  #s-review .board-eval { grid-area: board; align-self: start; }
  #s-review .navbar { grid-area: nav; }
  #s-lesson { --bw: calc(var(--vh) - 16px); grid-template-areas: "board top" "board steps" "board coach" "board side"; grid-template-rows: auto auto auto minmax(0, 1fr); }
  #s-lesson .board-col { display: contents; }
  #s-lesson .lesson-steps { grid-area: steps; }
  #s-lesson #l-coach { grid-area: coach; }
  #s-lesson #l-board { grid-area: board; width: var(--bw); align-self: start; }
}

/* ================= v7: online play ================= */
.flag { display: inline-block; font-size: 1.05em; line-height: 1; vertical-align: -0.08em; margin-right: 1px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; }
.flag.code { font-family: var(--f-mono); font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 4px; border-radius: 4px; background: var(--raised); border: 1px solid var(--line-2, var(--line)); color: var(--text); vertical-align: 0.1em; }
.pname .flag { margin-right: 5px; }
.ava.person { display: grid; place-items: center; }
.ava.person span { width: auto; height: auto; color: #fff; font-family: var(--f-display); font-weight: 400; font-size: 20px; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.35); background: none; }
.ava.person.sm span, .ava.person.xs span { font-size: 15px; }
.ava.person.md span { font-size: 24px; }
.ava.person.lg span { font-size: 34px; }
.ava.person.xl span { font-size: 48px; }
.online-banner { margin-top: 8px; }
.ob { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.ob span { flex: 1; min-width: 150px; }
.ob.muted { color: var(--muted); font-weight: 600; }
.ob.warn { border-color: color-mix(in srgb, var(--brass) 55%, var(--line)); background: color-mix(in srgb, var(--brass) 12%, var(--raised)); }
.tc-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tc-quick button { min-height: 68px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .12s ease, border-color .12s ease; }
.tc-quick button:hover { border-color: var(--brass); }
.tc-quick button:active { transform: scale(.97); }
.tc-quick b { font-family: var(--f-display); font-size: 19px; font-weight: 400; }
.tc-quick small { font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
@media (max-width: 360px) { .tc-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.online-me { display: flex; align-items: center; gap: 12px; width: 100%; }
.online-me b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.online-me small { color: var(--muted); font-size: 13px; font-family: var(--f-mono); }
.online-count { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; padding-inline: 2px; }
.online-count i { width: 8px; height: 8px; border-radius: 50%; background: var(--win); box-shadow: 0 0 0 3px color-mix(in srgb, var(--win) 25%, transparent); animation: livepulse 2s ease-in-out infinite; }
.online-hero { text-align: center; align-items: center; }
.online-hero h3 { font-family: var(--f-display); font-size: 22px; font-weight: 400; }
.hero-flags { display: flex; gap: 6px; justify-content: center; font-size: 22px; }
.hero-flags .flag.code { font-size: 10px; }
.tile-online { background: linear-gradient(135deg, #4cc3ff, #1d6fd1) !important; }
.tile-leaders { background: linear-gradient(135deg, #ffd24c, #d68a12) !important; }
.rating-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; text-align: left; background: linear-gradient(135deg, color-mix(in srgb, #1d6fd1 22%, var(--panel)), var(--panel) 70%); }
.rc-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-left b { font-family: var(--f-display); font-size: 38px; font-weight: 400; line-height: 1.05; letter-spacing: -.01em; }
.rc-left b i, .big-rating i { font-style: normal; color: var(--muted); font-size: .55em; margin-left: 2px; vertical-align: .55em; }
.rc-left small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.rc-left .eyebrow .flag { font-size: 14px; letter-spacing: 0; margin-right: 4px; }
.spark { width: 120px; height: 46px; flex: none; overflow: visible; }
.spark .line { fill: none; stroke: #6cc0ff; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .area { fill: rgba(108, 192, 255, .14); stroke: none; }
.spark .dot { fill: #fff; stroke: #6cc0ff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-card h3 { font-family: var(--f-display); font-size: 26px; font-weight: 400; word-break: break-word; }
.big-rating { font-family: var(--f-display); font-size: 44px; line-height: 1.05; }
.profile-card + .card .spark, #s-profile .spark { width: 150px; height: 60px; }
.wdl { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--raised); }
.wdl i { display: block; min-width: 0; }
.wdl .w { background: var(--win); } .wdl .d { background: var(--draw); } .wdl .l { background: var(--loss); } .wdl .e { background: var(--raised); }
.invite-code { font-family: var(--f-mono); font-size: 34px; font-weight: 800; letter-spacing: .22em; text-align: center; padding: 14px 10px; border-radius: 14px; background: var(--raised); border: 1px dashed var(--brass); color: var(--brass-hi); user-select: all; -webkit-user-select: all; }
.invite-code.key { font-size: 13px; letter-spacing: 0; word-break: break-all; font-weight: 600; color: var(--text); }
.seek-anim { display: flex; justify-content: center; gap: 10px; padding: 8px 0 4px; }
.seek-anim span { width: 14px; height: 14px; border-radius: 50%; background: var(--brass); animation: seekdot 1.2s ease-in-out infinite; }
.seek-anim span:nth-child(2) { animation-delay: .15s; } .seek-anim span:nth-child(3) { animation-delay: .3s; }
@keyframes seekdot { 0%, 100% { transform: scale(.5); opacity: .4; } 50% { transform: scale(1); opacity: 1; } }
.lb-row { display: grid; grid-template-columns: 28px 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.lb-row .rank { font-family: var(--f-mono); font-weight: 800; color: var(--muted); text-align: center; }
.lb-row:nth-child(1) .rank { color: #ffd24c; } .lb-row:nth-child(2) .rank { color: #d6dbe2; } .lb-row:nth-child(3) .rank { color: #e0a36a; }
.lb-row b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row small { font-size: 12px; }
.lb-row .num { font-family: var(--f-mono); font-size: 15px; }
.lb-row.me { background: color-mix(in srgb, var(--brass) 12%, transparent); border-radius: 10px; }
.chat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 4px 0 6px; }
.chat-grid .chipbtn { min-height: 44px; }
.bubble.mine { background: var(--brass-hi); color: var(--on-brass); border-bottom-left-radius: 12px; border-top-left-radius: 3px; }
.live-card { border-color: color-mix(in srgb, var(--win) 55%, var(--line)); background: linear-gradient(135deg, color-mix(in srgb, var(--win) 14%, var(--panel)), var(--panel) 70%); }
.live-card .ava { width: 52px; height: 52px; }
.result-faces .who .nm { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-faces .who small { font-size: 12.5px; margin-top: -4px; }
.gli .nm .flag { margin-right: 2px; }
#s-home > .rating-card { background: linear-gradient(135deg, rgba(24, 52, 92, .9), rgba(21, 26, 34, .9) 72%); -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%); border-color: rgba(108, 192, 255, .28); }
#s-home > .live-card { background: linear-gradient(135deg, rgba(36, 74, 44, .9), rgba(21, 26, 34, .9) 72%); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#s-home > .card.list, #s-home > .mode-card { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* ===== v7: Puzzle Streak and Coordinates ===== */
.tile-streak { background: linear-gradient(135deg, #ff6aa2, #b8327a) !important; }
.tile-coords { background: linear-gradient(135deg, #5fd6c4, #1f7f8f) !important; }
.c-wrap { position: relative; }
.coord-target { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; pointer-events: none; z-index: 40; }
.coord-target b { font-family: var(--f-display); font-weight: 400; font-size: clamp(64px, 24vw, 128px); line-height: 1; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, .55), 0 0 2px rgba(0, 0, 0, .8); opacity: .92; }
.coord-target small { font-family: var(--f-display); font-size: clamp(26px, 9vw, 46px); color: rgba(255, 255, 255, .55); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); align-self: flex-end; margin-bottom: 18%; }
.coord-target.shake b { animation: cshake .3s ease; color: #ffb4ab; }
@keyframes cshake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.c-track { height: 6px; border-radius: 99px; background: var(--raised); overflow: hidden; margin-top: 8px; }
.c-track i { display: block; height: 100%; background: linear-gradient(90deg, #5fd6c4, #1f9fae); transition: width .1s linear; }
#c-side .chips { display: flex; gap: 8px; flex-wrap: wrap; }
#c-side .chipbtn[aria-pressed="true"] { background: var(--brass); color: var(--on-brass); border-color: transparent; }
@media (orientation: landscape) and (max-height: 560px) {
  #s-coords { --bw: calc(var(--vh) - 16px); grid-template-areas: "board top" "board hud" "board side"; grid-template-rows: auto auto minmax(0, 1fr); }
  #s-coords .board-col { display: contents; }
  #s-coords #c-hud { grid-area: hud; }
  #s-coords .board-col > div:not([id]):not(.c-wrap) { display: none; }
  #s-coords .c-wrap { grid-area: board; width: var(--bw); align-self: start; }
}

/* ===== v8 ===== */
.online-note svg { color: #6cc0ff; }
.online-note b { color: var(--text); }
.btn.soon { opacity: .6; cursor: default; pointer-events: none; }
.online-lock { border-color: color-mix(in srgb, var(--brass) 55%, var(--line)); }
.online-lock .mode-ico { background: linear-gradient(135deg, #ffb347, #d97a1d) !important; }
.online-lock .mode-ico svg { width: 24px; height: 24px; }
.card.about .notice { display: block; margin-top: 8px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.card.about .notice a { color: var(--brass-hi); }

/* ===== v12: ocean blue on every screen ===== */
:root { --ink: #0b3354; --panel: #0a2843; --raised: #10375a; --line: rgba(150, 205, 255, .11); }
html, body { background-color: var(--ink); }
body { background:
    radial-gradient(90% 55% at 50% 30%, rgba(80, 175, 255, .12), rgba(80, 175, 255, 0) 70%),
    linear-gradient(180deg, #0f4470 0%, #0c3a60 40%, #0a3152 70%, #08273f 100%),
    var(--ink); background-attachment: fixed; }
#app, #main, .screen { background: transparent; }
#tabs { background: rgba(6, 30, 51, .95); border-color: rgba(150, 205, 255, .12); }
.catnav { background: rgba(10, 48, 80, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.play-cta { background: rgba(8, 37, 62, .92); border-color: rgba(150, 205, 255, .12); }
.overlay, #overlay { background-color: rgba(2, 12, 24, .62); }
#s-home > .card:not(.hero-play), #s-home .stat, #s-home .card.list { background: rgba(8, 37, 62, .82); }
#s-home > .card.rating-card { background: linear-gradient(135deg, rgba(36, 104, 170, .55), rgba(8, 37, 62, .85) 72%); border-color: rgba(120, 200, 255, .3); }
.saved-hero { background: rgba(8, 37, 62, .72); }
.music-btn { background: rgba(8, 37, 62, .7); }
.trial-banner { background: linear-gradient(135deg, rgba(255, 209, 102, .16), rgba(245, 158, 58, .1)), rgba(8, 37, 62, .82); }
.trial-banner.over { background: linear-gradient(135deg, rgba(255, 107, 90, .18), rgba(245, 158, 58, .1)), rgba(8, 37, 62, .85); }
.rc-cat { background: rgba(255, 255, 255, .045); }

/* ===== v10 ===== */
.casual-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 14.5px; }
.casual-note svg { width: 16px; height: 16px; color: var(--brass-hi); flex: none; }

/* ===== v11: Bullet, Blitz and Rapid ===== */
.rating-card { flex-direction: column; align-items: stretch; gap: 10px; }
.rc3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.rc-cat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); text-align: left; min-width: 0; }
.rc-cat.on { border-color: color-mix(in srgb, var(--brass) 60%, var(--line)); background: color-mix(in srgb, var(--brass) 10%, transparent); }
.rc-cat .rc-h { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rc-cat b { font-family: var(--f-display); font-size: 26px; font-weight: 400; line-height: 1.1; }
.rc-cat b i { font-style: normal; color: var(--muted); font-size: .55em; margin-left: 1px; vertical-align: .55em; }
.rc-cat small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
button.rc-cat { cursor: pointer; }
.rc-trend { display: flex; align-items: center; gap: 6px; }
.rc-trend small { color: var(--muted); font-size: 11px; font-weight: 700; }
.rc-trend .spark { width: 90px; height: 30px; }
.tc-group { display: flex; flex-direction: column; gap: 6px; }
.tcg-h { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tcg-h .muted { margin-left: auto; font-size: 12.5px; font-family: var(--f-mono); }
.cat-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.lb-you { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; }
.lb-you .lb-r { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.lb-you em { font-style: normal; color: var(--muted); font-family: var(--f-mono); font-size: 12.5px; }
.lb-you em.on { color: var(--brass-hi); font-weight: 700; }

/* ===== v12: simpler Home, Leaderboard under More ===== */
.rc2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.rc-cat.sm { flex-direction: row; align-items: center; flex-wrap: wrap; column-gap: 8px; padding: 9px 12px; }
.rc-cat.sm .rc-h { width: 100%; }
.rc-cat.sm b { font-size: 21px; }
.rating-card button.rc-cat:hover { border-color: color-mix(in srgb, var(--brass) 45%, var(--line)); }
.rc-join { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(150, 205, 255, .35); background: rgba(80, 175, 255, .08); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 700; text-align: left; cursor: pointer; }
.rc-join span { flex: 1; }
.rc-join svg.i { width: 18px; height: 18px; color: var(--muted); }
#play-saved { gap: 10px; }
@media (min-width: 900px) { .tab[data-go="more"] { display: flex; } }

/* ===== v15: Inspirations ===== */
.lg-intro { font-size: 14px; margin: 0 2px; }
.lg-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; color: var(--text); }
.lg-card .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lg-card b { font-size: 16.5px; }
.lg-card small { color: var(--muted); font-size: 12.5px; }
.lg-tag { font-size: 13px; line-height: 1.4; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }
.lg-live-chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; color: #86efac; background: rgba(60, 200, 120, .12); border: 1px solid rgba(60, 200, 120, .3); }
.lg-live-chip i, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .2); display: inline-block; flex: none; }
.live-dot { margin-right: 7px; vertical-align: 1px; }
.lg-badge { flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--lc) 65%, #fff), var(--lc) 55%, color-mix(in srgb, var(--lc) 55%, #000)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2), 0 6px 16px rgba(0, 0, 0, .28); }
.lg-badge b { font-family: var(--f-display); letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.lg-md { width: 54px; height: 54px; } .lg-md b { font-size: 19px; }
.lg-xl { width: 84px; height: 84px; } .lg-xl b { font-size: 30px; }
.lg-hero { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--lc) 30%, var(--panel)), var(--panel) 72%); }
.lg-hero h3 { font-size: 23px; }
.lg-quote { font-family: var(--f-display); font-size: 17px; line-height: 1.45; margin: 0 4px; }
.lg-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lg-facts div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.lg-facts span { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.lg-facts b { font-size: 14px; line-height: 1.35; font-weight: 700; }
.lg-story p { margin: 0 0 11px; line-height: 1.62; font-size: 15px; }
.lg-story p:last-child { margin: 0; }
.vcard { display: grid; grid-template-columns: minmax(0, 1fr); border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.vthumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer; background: linear-gradient(135deg, #12405f, #06192b); }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vplay { position: absolute; left: 50%; top: 50%; width: 60px; height: 42px; transform: translate(-50%, -50%); border-radius: 12px; background: rgba(230, 20, 20, .9); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.vplay svg { width: 22px; height: 22px; fill: #fff; }
.vframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; grid-column: 1 / -1; }
.vbody { display: flex; flex-direction: column; gap: 3px; padding: 11px 14px 13px; min-width: 0; }
.vbody b { font-size: 15px; line-height: 1.3; }
.vsub { color: var(--muted); font-size: 12.5px; }
.vbody p { margin: 3px 0 2px; font-size: 13.5px; line-height: 1.5; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.vsrc { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; margin-top: 3px; }
.vsrc .yt { width: 18px; height: 18px; flex: none; }
.vsrc .ext { width: 12px; height: 12px; }
.lg-live { gap: 10px; border-color: rgba(74, 222, 128, .3); }
.lg-new-sub { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; }
.vcard.compact { grid-template-columns: 132px minmax(0, 1fr); }
.vcard.compact .vthumb { height: 100%; min-height: 76px; }
.vcard.compact .vplay { width: 40px; height: 28px; border-radius: 8px; }
.vcard.compact .vplay svg { width: 16px; height: 16px; }
.vcard.compact .vbody { padding: 9px 12px; }
.vcard.compact .vbody b { font-size: 14px; }
.lg-live .rc-cat b { font-size: 22px; }
.lg-note { font-size: 12px; line-height: 1.5; }
.lg-note a { color: var(--brass-hi); }
@media (min-width: 700px) {
  .vcard { grid-template-columns: 250px minmax(0, 1fr); }
  .vthumb { height: 100%; min-height: 141px; }
}

/* ===== v16: featured game on Home, Books ===== */
.feat-card { display: grid; grid-template-columns: minmax(128px, 47%) minmax(0, 1fr); gap: 14px; align-items: center; }
.feat-board { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .8); }
.feat-board .mini { border-radius: 10px; }
.feat-info { gap: 4px; min-width: 0; }
.feat-info h3 { font-size: 19px; }
.feat-moves { margin: 4px 0 0; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.7; }
.feat-moves .fm-n { color: var(--muted); }
.feat-moves .fm { padding: 1px 3px; border-radius: 5px; }
.feat-moves .fm.on { background: var(--brass); color: var(--on-brass); font-weight: 800; }
.feat-moves .fm.later { opacity: .35; }
.feat-res { font-size: 13px; color: var(--muted); }
.feat-res b { color: var(--text); margin-right: 3px; }
.feat-btns { gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.feat-btns .btn svg.i { width: 14px; height: 14px; fill: currentColor; stroke: none; margin-right: 2px; }
@media (min-width: 700px) { .feat-card { grid-template-columns: 220px minmax(0, 1fr); } }
.bk-level { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.bk-head { display: flex; align-items: center; gap: 12px; margin: 6px 2px 0; }
.bk-head h3 { font-size: 18px; }
.bk-step { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--bc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bc) 25%, transparent); }
.bk-card { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--text); }
.bk-cover { position: relative; flex: none; width: 70px; height: 98px; border-radius: 4px 8px 8px 4px; padding: 8px 5px 6px 11px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--bc) 85%, #fff 15%), color-mix(in srgb, var(--bc) 70%, #000 30%)); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .8), inset -2px 0 0 rgba(255, 255, 255, .12); }
.bk-cover i { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: rgba(0, 0, 0, .25); }
.bk-cover b { font-family: var(--f-display); font-size: 10.5px; line-height: 1.15; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .3); }
.bk-cover small { font-size: 7px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-transform: uppercase; color: rgba(255, 255, 255, .85); }
.bk-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bk-body > b { font-size: 15.5px; line-height: 1.3; }
.bk-n { display: inline-block; min-width: 20px; color: var(--muted); font-weight: 700; }
.bk-why { font-size: 13.5px; line-height: 1.45; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.bk-read { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12.5px; font-weight: 800; color: var(--brass-hi); }
.bk-read .ext { width: 12px; height: 12px; }

/* ===== v17: native look. Apple (iPhone, iPhone Duo, iPad, Mac) and Samsung One UI (Galaxy phones, Flip, Fold, Tab) =====
   Fonts are the device's own system fonts (San Francisco on Apple devices, Samsung's font on Galaxy devices); nothing is
   bundled. Text sizes follow Apple's Human Interface Guidelines and Samsung's One UI guidelines, by screen size, and scale
   with the user's text-size setting (--dt from Dynamic Type on Apple devices; Android applies its font size to the page). */

/* ---------- Apple: type scale (iOS / iPadOS default "Large" Dynamic Type sizes) ---------- */
html[data-ui="apple"] {
  --f-ui: -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", sans-serif;
  --f-display: -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", sans-serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --t-large: calc(34px * var(--dt, 1)); --w-large: 700;
  --t-title1: calc(28px * var(--dt, 1));
  --t-title2: calc(22px * var(--dt, 1));
  --t-title3: calc(20px * var(--dt, 1));
  --t-headline: calc(17px * var(--dt, 1));
  --t-body: calc(17px * var(--dt, 1));
  --t-callout: calc(16px * var(--dt, 1));
  --t-subhead: calc(15px * var(--dt, 1));
  --t-footnote: calc(13px * var(--dt, 1));
  --t-cap1: calc(12px * var(--dt, 1));
  --t-cap2: calc(11px * var(--dt, 1));
  --t-tab: 10px; --w-tab: 600;
  --t-nav: calc(17px * var(--dt, 1));
  --t-btn: calc(17px * var(--dt, 1)); --t-btn-sm: calc(15px * var(--dt, 1));
  --icon-stroke: 1.7;
  --r: 22px;
}
/* Mac: macOS text styles (macOS has no Dynamic Type) */
html[data-ui="apple"][data-form="desktop"] {
  --t-large: 26px; --t-title1: 22px; --t-title2: 17px; --t-title3: 15px; --t-headline: 13px; --t-body: 13px;
  --t-callout: 12px; --t-subhead: 11px; --t-footnote: 10px; --t-cap1: 10px; --t-cap2: 10px; --t-tab: 13px; --t-nav: 13px;
  --t-btn: 13px; --t-btn-sm: 12px;
  --icon-stroke: 1.6; --r: 14px;
}

/* ---------- Samsung One UI: type scale (One UI text sizes, in sp; Android's own font-size setting scales them) ---------- */
html[data-ui="oneui"] {
  /* the phone's own font: One UI Sans / SamsungOne on Galaxy phones when the WebView offers it, otherwise the system font */
  --f-ui: "One UI Sans", "One UI Sans App VF", "SamsungOneUI", "SamsungOne", system-ui, Roboto, sans-serif;
  --f-display: "One UI Sans", "One UI Sans App VF", "SamsungOneUI", "SamsungOne", system-ui, Roboto, sans-serif;
  --f-mono: ui-monospace, "Roboto Mono", "Droid Sans Mono", monospace;
  --t-large: 34px; --w-large: 700;        /* expanded app bar title */
  --t-title1: 28px;
  --t-title2: 24px;
  --t-title3: 20px;                       /* title */
  --t-headline: 17px;                     /* list primary text */
  --t-body: 16px;
  --t-callout: 15px;
  --t-subhead: 14px;                      /* body 1 */
  --t-footnote: 12px;                     /* list secondary text, captions */
  --t-cap1: 13px;                         /* subheader */
  --t-cap2: 12px;
  --t-tab: 10px; --w-tab: 600;            /* floating bottom bar labels */
  --t-nav: 19px;                          /* app bar title */
  --t-btn: 15px; --t-btn-sm: 14px;        /* buttons */
  --icon-stroke: 1.6;
  --r: 26px;                              /* One UI's rounded corners */
}


/* ---------- shared: text roles ---------- */
html:not([data-ui="kingside"]) body { font-size: var(--t-body); line-height: 1.35; }
html:not([data-ui="kingside"]) :is(.display, .wordmark, .hero-play h2, .botcard h3, .sheet h3, .section-title h2, .stat b, .rc-cat b, .big-rating, .lg-quote, .bk-cover b) { font-family: var(--f-display); letter-spacing: normal; }
html:not([data-ui="kingside"]) h1.display { font-size: var(--t-large) !important; font-weight: var(--w-large); line-height: 1.15; }
html:not([data-ui="kingside"]) .wordmark { font-size: var(--t-title1); font-weight: 700; }
html:not([data-ui="kingside"]) .topbar h2 { font-size: var(--t-nav); font-weight: 600; }
html:not([data-ui="kingside"]) .section-title h2 { font-size: var(--t-title3); font-weight: 700; }
html:not([data-ui="kingside"]) :is(.lg-hero h3, .feat-info h3, .profile-card h3, .botcard h3, .online-hero h3) { font-size: var(--t-title2); font-weight: 700; }
html:not([data-ui="kingside"]) :is(.card h3, .mode-card h3, .card-h, .sheet h3, .lg-card b, .bk-body > b, .vbody b, .online-me b, .more-row b, .bk-head h3) { font-size: var(--t-headline); font-weight: 600; }
html:not([data-ui="kingside"]) :is(.mode-card p, p.muted, .lg-tag, .bk-why, .vbody p, .quote, .sub, .set-row .set-txt, .li .nm) { font-size: var(--t-subhead); }
html[data-ui="apple"] { --sw-on: #30d158; }
html[data-ui="apple"] .set-row .set-txt { font-weight: 400; font-size: var(--t-body); }
html[data-ui="oneui"] { --sw-on: #3e91ff; }
html[data-ui="oneui"] .switch { width: 48px; height: 28px; }
html[data-ui="oneui"] .switch span::after { width: 22px; height: 22px; }
html:not([data-ui="kingside"]) :is(.lg-story p, .lg-quote) { font-size: var(--t-body); }
html:not([data-ui="kingside"]) :is(small, .vsub, .meta, .lg-card small, .bk-body small, .more-row small, .set-row small, .bk-read, .vsrc, .lg-note, .feat-res) { font-size: var(--t-footnote); }
html:not([data-ui="kingside"]) :is(.eyebrow, .optlabel, .rc-cat .rc-h, .lg-facts span) { font-size: var(--t-cap1); }
html:not([data-ui="kingside"]) .btn { font-size: var(--t-btn); font-weight: 600; }
html:not([data-ui="kingside"]) .btn.small { font-size: var(--t-btn-sm); }
html:not([data-ui="kingside"]) .tab { font-size: var(--t-tab); font-weight: var(--w-tab); letter-spacing: 0; }
html:not([data-ui="kingside"]) svg.i { stroke-width: var(--icon-stroke); }
html:not([data-ui="kingside"]) svg.i .fill { fill: currentColor; stroke: none; }
html:not([data-ui="kingside"]) svg.i .fill.s { stroke: currentColor; stroke-linejoin: round; }
html:not([data-ui="kingside"]) svg.i .dot { stroke-width: 3.2; }
/* tab icons: outline normally; filled for the selected tab in a bottom bar */
html:not([data-ui="kingside"]) .tab .ic-f { display: none; }
html:not([data-ui="kingside"]) .tab[aria-current="page"] .ic-o { display: none; }
html:not([data-ui="kingside"]) .tab[aria-current="page"] .ic-f { display: inline; }

/* ---------- Apple: shapes, bars and sidebar ---------- */
html[data-ui="apple"] .btn, html[data-ui="apple"] .seg, html[data-ui="apple"] .seg button { border-radius: 999px; }
html[data-ui="apple"] .btn.small { border-radius: 999px; }
html[data-ui="apple"] .card, html[data-ui="apple"] .stat, html[data-ui="apple"] .tcbtn { box-shadow: none; }
/* iPhone (and iPhone Duo, iPad in narrow windows): a floating glass tab bar, content scrolls underneath */
@media (max-width: 899px) {
  html[data-ui="apple"] #app { position: relative; }
  html[data-ui="apple"] #tabs { position: absolute; z-index: 20; left: 50%; bottom: 8px; transform: translateX(-50%); width: min(calc(100% - 24px), 560px);
    border-radius: 999px; padding: 5px; gap: 2px; border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(18, 38, 60, .58); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .14); }
  html[data-ui="apple"] .tab { border-radius: 999px; padding: 6px 0 5px; gap: 2px; color: rgba(235, 242, 250, .75); transition: background .2s ease, color .2s ease; }
  html[data-ui="apple"] .tab svg.i { width: 26px; height: 26px; padding: 0; background: none !important; }
  html[data-ui="apple"] .tab[aria-current="page"] { background: rgba(255, 255, 255, .14); color: var(--brass-hi); }
  html[data-ui="apple"] #main { padding-bottom: 86px; }
  html[data-ui="apple"] .play-cta { bottom: 80px; border-radius: 22px; margin-inline: -4px; }
  html[data-ui="apple"] body.immersive #main { padding-bottom: 0; }
}
@media (max-width: 899px) and (prefers-contrast: more) { html[data-ui="apple"] #tabs { background: #0a2238; -webkit-backdrop-filter: none; backdrop-filter: none; } }
/* iPad (wide) and Mac: a sidebar with outlined icons and labels beside them */
@media (min-width: 900px) {
  html[data-ui="apple"] #tabs { width: 240px; padding: 14px 10px; gap: 2px; align-items: stretch; background: rgba(255, 255, 255, .04); border-right: 1px solid rgba(255, 255, 255, .08); }
  html[data-ui="apple"][data-form="tablet"] #tabs { margin: 10px 0 10px 10px; border-radius: 26px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(18, 38, 60, .5); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); }
  html[data-ui="apple"] .rail-brand { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin: 2px 8px 14px; }
  html[data-ui="apple"] .rail-brand b { font-size: var(--t-headline); font-weight: 700; }
  html[data-ui="apple"] .tab { flex-direction: row; justify-content: flex-start; gap: 10px; margin: 0; padding: 8px 10px; border-radius: 10px; font-size: var(--t-body); font-weight: 500; color: var(--text); }
  html[data-ui="apple"] .tab svg.i { width: 22px; height: 22px; padding: 0; background: none !important; color: var(--brass-hi); }
  html[data-ui="apple"] .tab:hover { background: rgba(255, 255, 255, .06); }
  html[data-ui="apple"] .tab[aria-current="page"] { background: rgba(255, 255, 255, .12); color: var(--text); }
  html[data-ui="apple"] .tab[aria-current="page"] .ic-o { display: inline; }
  html[data-ui="apple"] .tab[aria-current="page"] .ic-f { display: none; }
}

/* ---------- Apple: iPhone Duo open (and other foldables): the tab bar floats vertically on the right edge ---------- */
@media (max-width: 899px) {
  html[data-ui="apple"][data-form="fold"] #tabs { left: auto; right: 8px; bottom: auto; top: 50%; transform: translateY(-50%); width: 72px; flex-direction: column; border-radius: 36px; padding: 6px; }
  html[data-ui="apple"][data-form="fold"] .tab { flex: none; padding: 8px 0; }
  html[data-ui="apple"][data-form="fold"] #main { padding-bottom: 0; padding-right: 84px; }
  html[data-ui="apple"][data-form="fold"] .play-cta { bottom: 0; }
}

/* ---------- Samsung One UI: shapes, bars, rail ---------- */
html[data-ui="oneui"] .btn { border-radius: 18px; }
html[data-ui="oneui"] .btn.small { border-radius: 16px; }
html[data-ui="oneui"] .seg { border-radius: 26px; }
html[data-ui="oneui"] .seg button { border-radius: 22px; }
html[data-ui="oneui"] .card, html[data-ui="oneui"] .stat, html[data-ui="oneui"] .tcbtn { border-color: transparent; box-shadow: none; }
html[data-ui="oneui"] .sheet { border-radius: 26px; }
html[data-ui="oneui"] svg.i { stroke-linejoin: miter; }   /* One UI: rounded stroke ends, sharp corners */
html[data-ui="oneui"] .eyebrow, html[data-ui="oneui"] .optlabel { letter-spacing: 0; text-transform: none; font-weight: 700; color: var(--brass-hi); }
html[data-ui="oneui"] .topbar h2 { font-weight: 700; }
/* phones: the floating bottom bar (56 dp high, up to 430 dp wide), the selected item in a pill */
@media (max-width: 599px) {
  html[data-ui="oneui"] #app { position: relative; }
  html[data-ui="oneui"] #tabs { position: absolute; z-index: 20; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(calc(100% - 24px), 430px); height: 56px;
    border-radius: 28px; padding: 4px; gap: 0; border: 0; align-items: stretch;
    background: rgba(12, 30, 48, .86); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .7); }
  html[data-ui="oneui"] .tab { justify-content: center; border-radius: 24px; padding: 0; gap: 1px; color: rgba(235, 242, 250, .7); }
  html[data-ui="oneui"] .tab svg.i { width: 24px; height: 24px; padding: 0; background: none !important; }
  html[data-ui="oneui"] .tab[aria-current="page"] { background: rgba(255, 255, 255, .13); color: var(--text); font-weight: 800; }
  html[data-ui="oneui"] .tab[aria-current="page"] svg.i { color: var(--brass-hi); }
  html[data-ui="oneui"] #main { padding-bottom: 76px; }
  html[data-ui="oneui"] .play-cta { bottom: 70px; border-radius: 26px; margin-inline: -4px; }
  html[data-ui="oneui"] body.immersive #main { padding-bottom: 0; }
}
/* Flip cover screen and other tiny screens: icons only */
@media (max-width: 599px) and (max-height: 479px), (max-width: 339px) {
  html[data-ui="oneui"] .tab span { display: none; }
  html[data-ui="oneui"] #tabs { height: 48px; }
}
/* the expanded app bar: on phones tall enough (580 dp+), a screen's title sits in a big centred area within thumb's reach of the content */
@media (max-width: 599px) and (min-height: 580px) {
  html[data-ui="oneui"] .screen > .spread:is(:first-child, .nav-back + .spread):has(> h1.display) { min-height: calc(39.67vh - 70px); justify-content: center; align-items: center; }
  html[data-ui="oneui"] .screen > .nav-back:not([hidden]) + .spread:has(> h1.display) { min-height: calc(39.67vh - 114px); }
  html[data-ui="oneui"] .screen > .spread:is(:first-child, .nav-back + .spread) > h1.display { text-align: center; }
}
/* Fold main screen, tablets: a navigation rail with icons above labels */
@media (min-width: 600px) {
  html[data-ui="oneui"] #app { flex-direction: row; }
  html[data-ui="oneui"] #tabs { order: -1; flex-direction: column; justify-content: flex-start; gap: 6px; width: 88px; border-top: 0; border-right: 1px solid rgba(255, 255, 255, .06); padding: 14px 0; background: rgba(8, 26, 44, .55); }
  html[data-ui="oneui"] .rail-brand { display: grid; place-items: center; margin-bottom: 12px; }
  html[data-ui="oneui"] .rail-brand b { display: none; }
  html[data-ui="oneui"] .tab { flex: none; padding: 6px 0; gap: 4px; margin: 0 6px; border-radius: 16px; font-size: 12px; color: rgba(235, 242, 250, .72); }
  html[data-ui="oneui"] .tab svg.i { width: 56px; height: 32px; padding: 4px 16px; border-radius: 16px; background: none; }
  html[data-ui="oneui"] .tab[aria-current="page"] { color: var(--text); font-weight: 800; }
  html[data-ui="oneui"] .tab[aria-current="page"] svg.i { background: rgba(255, 255, 255, .13) !important; color: var(--brass-hi); }
  html[data-ui="oneui"] body.immersive #tabs { display: none; }
  html[data-ui="oneui"] .tab[data-go="games"], html[data-ui="oneui"] .tab[data-go="settings"] { display: flex; }
}
@media (min-width: 600px) and (max-height: 640px) { html[data-ui="oneui"] .tab span { display: none; } html[data-ui="oneui"] #tabs { gap: 2px; } }


/* ---- v18: back button ---- */
.nav-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -6px 0 2px -10px; padding: 4px 12px 4px 4px; border: 0; border-radius: 12px; background: none; color: var(--brass-hi); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nav-back svg.i { width: 26px; height: 26px; stroke-width: 2.4; }
.nav-back:active { opacity: .55; }
.nav-back[hidden] { display: none !important; }
html[data-ui="apple"] .nav-back { font-size: var(--t-body); font-weight: 400; gap: 0; }
html[data-ui="apple"] .nav-back svg.i { width: 28px; height: 28px; stroke-width: 2.6; margin-right: -2px; }
html[data-ui="oneui"] .nav-back { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; color: var(--text); margin-left: -8px; }
html[data-ui="oneui"] .nav-back span { display: none; }
html[data-ui="oneui"] .nav-back svg.i { width: 24px; height: 24px; stroke-width: 2.2; }

/* ---- v19: locked controls ---- */
.online-locked { opacity: .6; cursor: default; }
.online-locked .mode-ico svg.lock { width: 22px; height: 22px; }
.locked-btn { opacity: .7; }
.locked-btn svg.lock, .name-lock svg.lock { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.name-lock { display: grid; place-items: center; width: 44px; color: var(--muted); }
.name-lock svg.lock { margin: 0; width: 20px; height: 20px; }
#set-name:disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); background: rgba(255, 255, 255, .04); }
.key-input { text-transform: uppercase; letter-spacing: .08em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- v21: player codes, invites ---- */
.pcode { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .1); color: var(--brass-hi); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .12em; vertical-align: 1px; }
.pcode-in { text-transform: uppercase; letter-spacing: .14em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.invite-from { display: flex; justify-content: center; margin-bottom: 6px; }
.hero-flags { flex-wrap: wrap; }

/* ---- v24: the board never taller than the screen allows (one-column layout on screens under 900px wide) ---- */
@media (max-width: 899px) and (min-height: 561px) {
  #s-game .board-col, #s-puzzle .board-col, #s-review .board-col, #s-lesson .board-col { max-width: min(100%, calc(100vh - 330px)); margin-inline: auto; }
  @supports (height: 100dvh) { #s-game .board-col, #s-puzzle .board-col, #s-review .board-col, #s-lesson .board-col { max-width: min(100%, calc(100dvh - 330px)); } }
}

/* ---- v25: Your name and Your Country fields match ---- */
#s-settings label.card-h { display: block; margin-top: 4px; color: var(--text); }
.pfield { min-height: 48px; font-size: 16px; padding-inline: 14px; }
html:not([data-ui="kingside"]) .pfield { font-size: var(--t-body); }

/* ---- v31: the greeting never gets cut off ---- */
.brandbar .greet { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.2; }
.brandbar .greet > span { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandbar .greet > span + span { color: var(--text); }
@media (max-width: 349px) { .brandbar .greet { display: none; } }

/* ---- v33: "Kingside Chess Club" wordmark: the name, with CHESS CLUB in small capitals beneath ---- */
.wordmark .wm { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.wordmark .wm-a { white-space: nowrap; }
.wordmark .wm-b { font-family: var(--f-ui, system-ui), system-ui, sans-serif; font-size: .38em; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--brass-hi); margin-top: .3em; white-space: nowrap; }
html[data-ui="apple"] .rail-brand b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .brandbar .wordmark .wm-a { font-size: .86em; } .brandbar .wordmark { gap: 8px; } .brandbar .greet { font-size: 12px; } .brandbar { gap: 8px; } }

/* ---- v35: short landscape: the board leaves at least ~300px for the panel beside it ---- */
@media (orientation: landscape) and (max-height: 560px) {
  #s-game { --bw: min(calc(var(--vh) - 104px), calc(100vw - 340px)); }
  #s-puzzle, #s-lesson, #s-coords { --bw: min(calc(var(--vh) - 16px), calc(100vw - 330px)); }
  #s-review { --bw: min(calc(var(--vh) - 74px), calc(100vw - 360px)); }
}
/* tiny cover screens (a Galaxy Z Flip's outside screen) keep the board as large as the height allows */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 520px) {
  #s-game { --bw: calc(var(--vh) - 104px); }
  #s-puzzle, #s-lesson, #s-coords { --bw: calc(var(--vh) - 16px); }
  #s-review { --bw: calc(var(--vh) - 74px); }
}

/* ---- v36: small locks on what needs the unlock after the trial ---- */
.botbtn .ava-wrap { position: relative; }
.tl-lock { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ink, #06243a); border: 1px solid var(--line-2); color: var(--brass-hi); }
.tl-lock svg.lock { width: 13px; height: 13px; margin: 0; }
.mode-card { position: relative; }
.tl-lock.tl-row { position: static; flex: none; width: 28px; height: 28px; margin-left: auto; }
.tl-lock.tl-row svg.lock { width: 15px; height: 15px; }
.botbtn.trial-locked .ava-wrap > :first-child { opacity: .55; filter: grayscale(.4); }
.pay-free { font-size: 13px; text-align: center; margin: 2px 0 0; }

/* ---- v37: COMPUTER chip for Kingside's own online players ---- */
.cpu-chip { display: inline-block; vertical-align: middle; margin-left: 4px; padding: 1px 6px; border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; line-height: 1.5; color: var(--brass-hi); background: color-mix(in srgb, var(--brass) 18%, transparent); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent); white-space: nowrap; }
.pname .cpu-chip { font-size: 9.5px; }
.profile-card h3 .cpu-chip { font-size: 11px; vertical-align: 3px; }
.result-faces .who .cpu-chip, .who .nm .cpu-chip { display: block; width: max-content; margin: 3px auto 0; }

/* ---- v44: gliding moves, capture effects, the Shop ---- */
.pc.anim { transition: transform var(--mv, .22s) cubic-bezier(.25, .8, .25, 1), scale .16s ease, filter .16s ease; }
.pc.fly { scale: 1.08; filter: drop-shadow(0 9px 7px rgba(0, 0, 0, .36)); z-index: 6; }
.pc.land { animation: pcLand .34s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes pcLand { 0% { scale: 1.08; } 45% { scale: .96; } 100% { scale: 1; } }
.board .fx { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.fxd { position: absolute; display: block; border-radius: 50%; pointer-events: none; will-change: transform, opacity; }
.fxd.star { border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); -webkit-clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.fxd.chip { border-radius: 2px; }
.fx-piece { position: absolute; width: 12.5%; height: 12.5%; background-size: 100%; background-repeat: no-repeat; pointer-events: none; will-change: transform, opacity; }
.board .sqs { background: var(--board-bg, transparent); }
.board .sqs::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--tex, none); background-size: 100% 100%; mix-blend-mode: var(--tex-blend, normal); opacity: var(--tex-op, 0); pointer-events: none; }
.sq.l .co { color: var(--co-on-l, var(--dark)); }
.sq.d .co { color: var(--co-on-d, var(--light)); }
.theme .sw.tsw { position: relative; background: var(--board-bg, transparent); }
.theme .sw.tsw i.l, .shop-sw i.l { background: var(--light); }
.theme .sw.tsw i.d, .shop-sw i.d { background: var(--dark); }
.theme .sw.tsw::after, .shop-sw::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background-image: var(--tex, none); background-size: 100% 100%; mix-blend-mode: var(--tex-blend, normal); opacity: var(--tex-op, 0); pointer-events: none; }
.shop-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 2px; }
.crown { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.crown-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding-inline: 9px 11px; border-radius: 999px; background: rgba(244, 183, 64, .14); border: 1px solid rgba(244, 183, 64, .35); color: var(--brass-hi); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.crown-chip:hover { background: rgba(244, 183, 64, .22); }
.reward-pill { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: rgba(244, 183, 64, .14); border: 1px solid rgba(244, 183, 64, .35); color: var(--brass-hi); font-weight: 800; font-size: 14px; animation: rewardIn .5s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: .25s; }
.reward-pill small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
@keyframes rewardIn { from { opacity: 0; transform: scale(.6); } }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shop-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.shop-pv-card { display: flex; flex-direction: column; gap: 12px; }
.shop-pv { width: 100%; max-width: 360px; align-self: center; }
.shop-pv-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shop-pv-info h3 { font-family: var(--f-display); font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.shop-pv-info p { font-size: 13.5px; color: var(--muted); }
.shop-actions { display: flex; gap: 8px; }
.shop-actions .btn { flex: 1; }
.shop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 520px) { .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.shop-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 9px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); text-align: center; min-width: 0; }
.shop-item[aria-pressed="true"] { border-color: var(--brass); background: rgba(244, 183, 64, .08); }
.shop-item b { font-size: 12.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shop-item .tag { font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; gap: 3px; color: var(--brass-hi); font-variant-numeric: tabular-nums; }
.shop-item .tag.own { color: var(--muted); }
.shop-item .tag.on { color: var(--win); }
.shop-item .tag .crown { width: 14px; height: 14px; vertical-align: -2px; }
.shop-thumb { width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; position: relative; }
.shop-sw { display: grid; grid-template-columns: 1fr 1fr; width: 100%; height: 100%; position: relative; background: var(--board-bg, transparent); }
.shop-pcs { display: grid; grid-template-columns: 1fr 1fr; place-items: center; width: 100%; height: 100%; background: var(--raised); }
.shop-pcs span { width: 88%; aspect-ratio: 1; background-size: 100%; background-repeat: no-repeat; }
.shop-fx { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; }
.shop-fx svg { width: 46%; height: 46%; }
.earn-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; font-size: 14px; }
.earn-list span:nth-child(even) { font-weight: 800; color: var(--brass-hi); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shop-new { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center; text-align: left; width: 100%; }
.shop-new .mode-ico { background: linear-gradient(135deg, #ffd166, #e08a1e); }
@media (min-width: 900px) {
  .shop-stage { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
  .shop-pv-card { position: sticky; top: 0; }
}
/* ---- v41: cinematic welcome ---- */
#overlay.cinematic { padding: 0; background: #04111f; -webkit-backdrop-filter: none; backdrop-filter: none; align-items: stretch; }
#overlay.cinematic .sheet { max-width: none; width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; padding: 0; background: #04111f; box-shadow: none; animation: none; gap: 0; overflow: hidden; }
#overlay.cine-out { animation: cineOut .35s ease forwards; }
@keyframes cineOut { to { opacity: 0; transform: scale(1.03); } }
.cine { position: relative; width: 100%; height: 100%; overflow: hidden; color: #ede7da; }
.cine-sky { position: absolute; inset: 0; background: radial-gradient(120% 70% at 50% 30%, #12507f 0%, #0a3356 38%, #061e36 68%, #04111f 100%); }
.cine-floor { position: absolute; left: -40%; right: -40%; bottom: -8%; height: 62%; perspective: 520px; perspective-origin: 50% 0; }
.cine-grid { position: absolute; inset: 0; transform-origin: 50% 0; transform: rotateX(63deg) translateY(var(--cy, 0px));
  background-image: linear-gradient(90deg, rgba(240, 200, 115, .16) 1px, transparent 1px), linear-gradient(0deg, rgba(240, 200, 115, .16) 1px, transparent 1px),
    conic-gradient(rgba(255, 255, 255, .055) 25%, transparent 0 50%, rgba(255, 255, 255, .055) 0 75%, transparent 0);
  background-size: 120px 120px, 120px 120px, 240px 240px;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0) 100%); mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 10%, rgba(0, 0, 0, 0) 100%);
  animation: cineFloor 18s linear infinite; }
@keyframes cineFloor { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 0 240px, 0 240px, 0 240px; } }
.cine-glow { position: absolute; left: 50%; top: 18%; width: 140vmin; height: 70vmin; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(240, 200, 115, .22), rgba(240, 200, 115, 0)); filter: blur(10px); animation: cineGlow 9s ease-in-out infinite alternate; }
@keyframes cineGlow { from { opacity: .55; transform: translateX(-52%) scale(.95); } to { opacity: 1; transform: translateX(-48%) scale(1.05); } }
.cine-vig { position: absolute; inset: 0; background: radial-gradient(90% 80% at 50% 45%, transparent 55%, rgba(2, 8, 16, .85) 100%); pointer-events: none; }
.cine-body { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: max(28px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; text-align: center; }
.cine-knight { width: 96px; height: 96px; filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .6)) drop-shadow(0 0 24px rgba(240, 200, 115, .25)); animation: cineRise 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.cine-knight .pc-wN { display: block; width: 100%; height: 100%; background-size: contain; background-repeat: no-repeat; background-position: center; }
@keyframes cineRise { from { opacity: 0; transform: translateY(40px) scale(.9); } to { opacity: 1; transform: none; } }
.cine-word { display: flex; gap: .04em; font-family: var(--f-display); font-weight: 800; font-size: clamp(40px, 11vw, 64px); letter-spacing: .14em; line-height: 1; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); margin-top: 6px; }
.cine-word i { font-style: normal; display: inline-block; opacity: 0; animation: cineLetter .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(.55s + var(--k) * .07s); }
@keyframes cineLetter { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.cine-rule { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: .34em; color: #f0c873; animation: cineFade .8s ease both; animation-delay: 1.25s; }
.cine-rule i { width: 44px; height: 1px; background: linear-gradient(90deg, transparent, #f0c873); }
.cine-rule i:last-child { background: linear-gradient(90deg, #f0c873, transparent); }
.cine-tag { margin: 6px 0 0; font-size: 15px; letter-spacing: .22em; color: rgba(237, 231, 218, .72); text-transform: uppercase; animation: cineFade .8s ease both; animation-delay: 1.5s; }
@keyframes cineFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cine-form { width: 100%; max-width: 380px; margin-top: 22px; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 18px; border-radius: 20px;
  background: rgba(6, 22, 40, .55); border: 1px solid rgba(240, 200, 115, .22); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
  animation: cineFade .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: 1.8s; }
.cine-lead { margin: 0 0 4px; font-size: 13.5px; line-height: 1.45; color: rgba(237, 231, 218, .78); }
.cine-lbl { font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: #f0c873; margin-top: 4px; }
.cine-in { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; }
.cine-in:focus { border-color: #f0c873; box-shadow: 0 0 0 3px rgba(240, 200, 115, .18); }
.cine-msg { margin: 2px 0 0; font-size: 12.5px; color: rgba(237, 231, 218, .62); }
.cine-go { margin-top: 10px; min-height: 52px; font-size: 16px; letter-spacing: .02em; box-shadow: 0 12px 30px -8px rgba(240, 200, 115, .55); }
.cine-fine { margin: 4px 0 0; font-size: 11.5px; line-height: 1.45; color: rgba(237, 231, 218, .5); text-align: center; }
@media (max-height: 640px) { .cine-knight { width: 64px; height: 64px; } .cine-word { font-size: clamp(32px, 9vw, 44px); } .cine-tag { display: none; } .cine-form { margin-top: 12px; padding: 14px; } .cine-fine { display: none; } .cine-body { justify-content: flex-start; } }
@media (orientation: landscape) and (max-height: 560px) { .cine-body { display: grid; grid-template-columns: 1fr minmax(300px, 380px); grid-template-areas: "k f" "w f" "r f" "t f"; column-gap: 28px; row-gap: 6px; align-content: center; justify-content: center; align-items: center; justify-items: center; padding: 14px 24px; }
  .cine-knight { grid-area: k; width: 56px; height: 56px; align-self: end; } .cine-word { grid-area: w; font-size: clamp(28px, 5vw, 44px); margin: 0; } .cine-rule { grid-area: r; } .cine-tag { grid-area: t; display: block; margin: 0; font-size: 12px; align-self: start; }
  .cine-form { grid-area: f; margin-top: 0; padding: 12px 14px; gap: 5px; max-height: calc(100vh - 28px); overflow-y: auto; } .cine-lead { font-size: 12.5px; } .cine-fine { display: none; } .cine-go { min-height: 44px; margin-top: 6px; } }
@media (prefers-reduced-motion: reduce) { .cine-grid, .cine-glow { animation: none; } .cine-knight, .cine-word i, .cine-rule, .cine-tag, .cine-form { animation-duration: .01s; animation-delay: 0s; } }
