/* Platinum Chess */
:root {
  --bg: #0e0d10;
  --bg2: #16151a;
  --panel: #1b1a20;
  --panel2: #232229;
  --line: #2f2d36;
  --text: #ece7dc;
  --muted: #9a93a3;
  --gold: #d4af37;
  --gold2: #f1d77c;
  --gold-dk: #8a6a12;
  --crimson: #8e1426;
  --crimson2: #b8243a;
  --good: #5fb85f;
  --warn: #e0b23a;
  --bad: #d9534f;
  --blunder: #c0392b;
  --mistake: #e67e22;
  --inacc: #e6c229;
  --best: #2fb58c;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --bsize: min(calc(100vh - 196px), calc(100vw - 480px), 880px);
}
:root[data-theme="light"] {
  --bg: #efe9df; --bg2: #e6dfd2; --panel: #fbf8f2; --panel2: #f1ece2; --line: #d9d0c0;
  --text: #24201a; --muted: #6f665a; --shadow: 0 12px 34px rgba(60,40,10,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(212,175,55,.10), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(142,20,38,.18), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.w100 { width: 100%; }
.center { text-align: center; justify-content: center; }
.error { color: var(--bad); min-height: 1em; }

/* ---------- top bar ---------- */
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(212,175,55,.4)); }
.brand-name { font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.brand-name em { font-style: normal; color: var(--gold); }
.topnav { display: flex; gap: 8px; align-items: center; }

.btn {
  border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 9px;
  font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--gold-dk); background: var(--panel); }
.btn:active { transform: translateY(1px); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, #a8851f); color: #2a1d00; border-color: #c39d2c;
  box-shadow: 0 2px 10px rgba(212,175,55,.25), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-gold:hover { background: linear-gradient(180deg, #fbe59a, #e1bd48 55%, #b48f25); border-color: #e1bd48; }
.btn-lg { padding: 11px 26px; font-size: 15px; }
.btn.danger { color: var(--bad); }
.btn:disabled, .act:disabled { opacity: .4; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { border-color: var(--gold-dk); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-btn { border: 0; background: var(--panel2); padding: 8px 12px; font-weight: 700; font-size: 13px; }
.seg-btn.on { background: var(--gold); color: #2a1d00; }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: auto minmax(320px, 400px); gap: 22px;
  justify-content: center; align-items: start; padding: 14px 20px 20px;
}
body.zen .side { display: none; }
body.zen .layout { grid-template-columns: auto; }
body.zen { --bsize: min(calc(100vh - 196px), calc(100vw - 80px), 980px); }

.board-col { display: flex; flex-direction: column; gap: 8px; }
.board-row { display: flex; gap: 8px; align-items: stretch; }
.board-holder { position: relative; }

/* ---------- player cards ---------- */
.player {
  display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 4px 0 8px;
  width: calc(var(--bsize) + 0px);
}
.player .avatar {
  width: 40px; height: 40px; border-radius: 10px; background: var(--panel2) center/78% no-repeat;
  border: 1px solid var(--line); flex: none;
}
.player .pinfo { min-width: 0; flex: 1; }
.player .pname { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .prating { color: var(--muted); font-weight: 500; font-size: 13px; }
.player .ptitle { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #2a1d00; background: var(--gold); padding: 1px 6px; border-radius: 4px; }
.player .caps { display: flex; align-items: center; height: 20px; margin-top: 2px; }
.player .caps img { width: 18px; height: 18px; margin-right: -6px; }
.player .caps .gap { width: 10px; }
.player .caps .adv { margin-left: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.thinking { display: inline-flex; gap: 3px; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: blink 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%,80%,100% { opacity: .2 } 40% { opacity: 1 } }

.clock {
  font-family: var(--mono); font-size: 26px; font-weight: 700; padding: 6px 14px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--line); min-width: 120px; text-align: right; color: var(--muted);
  transition: background .2s, color .2s;
}
.clock.on { background: #f3efe6; color: #111; border-color: #fff; box-shadow: 0 0 0 2px rgba(212,175,55,.35); }
:root[data-theme="light"] .clock.on { background: #1d1b20; color: #fff; }
.clock.low.on { background: #c0392b; color: #fff; border-color: #ff6b5b; animation: pulse 1s infinite; }
.clock.flag { background: #5c1414; color: #fff; }
.clock .delay { font-size: 12px; color: var(--gold); margin-right: 6px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(192,57,43,.25); } }

/* ---------- board ---------- */
.board-frame {
  width: var(--bsize); padding: calc(var(--bsize) * .022); border-radius: 10px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.25), inset 0 -2px 0 rgba(0,0,0,.35);
  background-size: 300% 300%; position: relative;
}
.board-frame.glass { backdrop-filter: blur(6px); }
.board { position: relative; width: 100%; aspect-ratio: 1; user-select: none; touch-action: none; border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 3px 10px rgba(0,0,0,.35); }
.board-frame.glass .board { box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.board-holder:has(.glass)::before { content: ''; position: absolute; inset: -14px; border-radius: 22px; background: var(--under, transparent); z-index: 0; }
.board-holder > .board-frame { position: relative; z-index: 1; }
.sq-layer { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; }
.board-frame.glass .sq.light { box-shadow: inset 0 0 0 .5px rgba(255,255,255,.35); }
.coord { position: absolute; font-size: calc(var(--bsize) * .019); font-weight: 700; pointer-events: none; opacity: .85; }
.coord.rank { left: 4%; top: 3%; }
.coord.file { right: 5%; bottom: 2%; }
.sq.light .coord { color: var(--coord-on-light, rgba(0,0,0,.55)); }
.sq.dark .coord { color: var(--coord-on-dark, rgba(255,255,255,.75)); }

.hl-layer, .pc-layer, .badge-layer, .promo-layer { position: absolute; inset: 0; pointer-events: none; }
.hl { position: absolute; width: 12.5%; height: 12.5%; left: 0; top: 0; }
.hl.last { background: rgba(255, 214, 79, .38); }
.hl.sel { background: rgba(255, 214, 79, .55); }
.hl.pre { background: rgba(70, 120, 200, .45); }
.hl.check { background: radial-gradient(circle, rgba(255,40,40,.95) 0%, rgba(230,20,20,.6) 30%, rgba(200,0,0,0) 72%); }
.hl.dest::after { content: ''; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 20, 20, .28); }
.hl.dest.cap::after { left: 2%; top: 2%; width: 96%; height: 96%; background: none; border: calc(var(--bsize) * .008) solid rgba(20,20,20,.3); box-sizing: border-box; }
.hl.hover { box-shadow: inset 0 0 0 calc(var(--bsize) * .006) rgba(255,255,255,.75); }

.piece {
  position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%;
  background: center/90% no-repeat; will-change: transform; pointer-events: none;
  filter: drop-shadow(0 calc(var(--bsize) * .004) calc(var(--bsize) * .004) rgba(0,0,0,.35));
}
.piece.dragging { z-index: 20; filter: drop-shadow(0 calc(var(--bsize) * .015) calc(var(--bsize) * .012) rgba(0,0,0,.45)); }
.piece.appear { opacity: 0; }
.piece { transition: opacity .2s; }
.piece.vanish { opacity: 0; transition: opacity .18s !important; }

.arrow-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; }
.badge-layer { z-index: 9; }
.badge {
  position: absolute; transform: translate(-75%, -25%); width: 4.2%; height: 4.2%; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--bsize) * .019); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.5); border: 2px solid #fff;
}
.badge.blunder { background: var(--blunder); } .badge.mistake { background: var(--mistake); }
.badge.inaccuracy { background: var(--inacc); color: #222; } .badge.best { background: var(--best); } .badge.good { background: #6d8f6d; }

.promo-layer { z-index: 30; }
.promo-layer.on { pointer-events: auto; background: rgba(0,0,0,.45); }
.promo-choice {
  position: absolute; width: 12.5%; height: 12.5%; border: 0; border-radius: 50%;
  background: radial-gradient(circle, #f6f1e6 55%, #c9bfae 100%) ; background-size: 86%; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 4px 14px rgba(0,0,0,.5); transition: transform .12s, border-radius .12s;
}
.promo-choice { background-color: #f2ece0; }
.promo-choice:hover { transform: scale(1.06); border-radius: 18%; background-color: #ffd86b; }

.board-frame.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px) } 75% { transform: translateX(4px) } }

.board-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,8,12,.62); backdrop-filter: blur(5px); border-radius: 10px; z-index: 40; }
.overlay-card { text-align: center; background: var(--panel); padding: 24px 32px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.overlay-title { font-family: var(--serif); font-size: 28px; font-weight: 700; }

/* eval bar */
.evalbar { width: 22px; border-radius: 6px; background: #2b2a2f; position: relative; overflow: hidden; border: 1px solid var(--line); }
.ev-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: linear-gradient(180deg, #fff, #e6e1d6); transition: height .45s ease; }
.ev-label { position: absolute; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 800; font-family: var(--mono); bottom: 4px; color: #222; z-index: 1; }
.evalbar.black-adv .ev-label { top: 4px; bottom: auto; color: #eee; }

/* ---------- side panel ---------- */
.side {
  background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; height: calc(var(--bsize) + 124px); min-height: 520px; overflow: hidden;
}
.game-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.game-title { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.opening { color: var(--gold); font-size: 13px; font-weight: 600; margin-top: 2px; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opening .eco { color: var(--muted); margin-right: 6px; font-family: var(--mono); }

.tabs { display: flex; border-bottom: 1px solid var(--line); padding: 0 10px; }
.tab { background: none; border: 0; padding: 11px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--gold); }
.tabs.small { padding: 0 18px; }
.tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab-body[data-body="analysis"], .tab-body[data-body="info"] { overflow: auto; padding: 14px 16px; gap: 12px; }

.movelist { flex: 1; overflow-y: auto; padding: 6px 0; font-size: 14.5px; counter-reset: none; }
.mrow { display: grid; grid-template-columns: 46px 1fr 1fr; align-items: stretch; }
.mrow:nth-child(odd) { background: rgba(255,255,255,.025); }
:root[data-theme="light"] .mrow:nth-child(odd) { background: rgba(0,0,0,.03); }
.mnum { color: var(--muted); padding: 6px 0 6px 14px; font-family: var(--mono); font-size: 12.5px; display: flex; align-items: center; }
.mv { padding: 6px 10px; cursor: pointer; border-radius: 5px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.mv:hover { background: rgba(212,175,55,.12); }
.mv.cur { background: rgba(212,175,55,.28); color: var(--gold2); }
:root[data-theme="light"] .mv.cur { color: #6b4e00; }
.mv .fig { font-size: 1.15em; margin-right: 1px; }
.mv .glyph { font-weight: 800; font-size: 12px; }
.mv .glyph.blunder { color: var(--blunder); } .mv .glyph.mistake { color: var(--mistake); } .mv .glyph.inaccuracy { color: var(--inacc); } .mv .glyph.best { color: var(--best); }
.mv .mt { color: var(--muted); font-size: 11px; font-weight: 500; font-family: var(--mono); }
.result-row { text-align: center; padding: 12px; font-weight: 700; color: var(--gold); }
.result-row small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.empty-moves { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 14px; }

.view-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; background: rgba(70,120,200,.18); font-size: 13px; }
.navbar { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.nav-btn { background: none; border: 0; padding: 11px 0; font-size: 16px; color: var(--muted); }
.nav-btn:hover { background: rgba(255,255,255,.04); color: var(--text); }

.actions { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); }
.act { background: none; border: 0; padding: 10px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.act .ai { font-size: 18px; color: var(--text); line-height: 1; }
.act:hover:not(:disabled) { background: rgba(212,175,55,.08); color: var(--text); }
.status { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13.5px; font-weight: 600; min-height: 40px; display: flex; align-items: center; gap: 8px; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 1px solid var(--line); }

/* analysis */
.engine-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.engine-name { font-weight: 700; font-size: 14px; }
.engine-meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.engine-eval { font-family: var(--mono); font-weight: 800; font-size: 20px; padding: 4px 10px; border-radius: 7px; background: var(--panel2); min-width: 72px; text-align: center; }
.engine-eval:empty { display: none; }
.pv-lines { display: flex; flex-direction: column; gap: 6px; }
.pv { display: grid; grid-template-columns: 58px 1fr; gap: 8px; align-items: start; font-size: 13px; padding: 7px 8px; border-radius: 8px; background: var(--panel2); cursor: pointer; }
.pv:hover { outline: 1px solid var(--gold-dk); }
.pv .pv-ev { font-family: var(--mono); font-weight: 800; text-align: center; border-radius: 5px; padding: 2px 0; background: #eee; color: #111; }
.pv .pv-ev.neg { background: #222; color: #eee; }
.pv .pv-moves { color: var(--text); line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv .pv-moves b { color: var(--muted); font-weight: 500; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #444; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::before { transform: translateX(20px); }
.review-progress { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.review-progress .bar { height: 8px; border-radius: 99px; background: var(--panel2); overflow: hidden; }
.review-progress .bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dk), var(--gold2)); transition: width .2s; }
.review-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rs-side { background: var(--panel2); border-radius: 10px; padding: 12px; }
.rs-side .rs-name { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-side .rs-acc { font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--gold2); line-height: 1.1; }
.rs-side .rs-acc small { font-size: 14px; color: var(--muted); font-family: var(--font); }
.rs-counts { display: grid; grid-template-columns: 1fr auto; font-size: 12.5px; gap: 2px 8px; margin-top: 6px; }
.rs-counts .c-blunder { color: var(--blunder); } .rs-counts .c-mistake { color: var(--mistake); } .rs-counts .c-inaccuracy { color: var(--inacc); } .rs-counts .c-best { color: var(--best); }
.eval-graph { width: 100%; height: 100px; background: #1e1d22; border-radius: 10px; cursor: pointer; flex: none; }
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; font-weight: 600; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- modals ---------- */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(560px, 94vw); width: 100%; }
.modal.wide { max-width: min(860px, 96vw); }
.modal::backdrop { background: rgba(5,4,8,.66); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0 } }
.modal-inner { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); max-height: 90vh; display: flex; flex-direction: column; position: relative; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; }
.modal-head h2, .modal-body h2, .over h2 { font-family: var(--serif); font-size: 28px; margin: 0; }
.x { background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); padding: 4px 8px; }
.over .x { position: absolute; right: 10px; top: 8px; }
.modal-body { padding: 10px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal-foot.center { justify-content: center; }
.modal-foot .btn-gold { margin-left: auto; }
.modal-foot.center .btn-gold { margin-left: 0; }

.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.mode-card input, .color-pick input, .tc-btn input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card > div { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: var(--panel2); cursor: pointer; height: 100%; transition: .15s; }
.mode-card img { width: 46px; height: 46px; }
.mode-card b { font-size: 14.5px; }
.mode-card span { font-size: 12px; color: var(--muted); }
.mode-card input:checked + div { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 6px 20px rgba(212,175,55,.15); background: linear-gradient(180deg, rgba(212,175,55,.12), var(--panel2)); }
.mode-card.disabled > div { opacity: .45; cursor: not-allowed; }

.field { margin-bottom: 18px; }
.field-label { font-weight: 700; margin-bottom: 8px; display: flex; align-items: baseline; gap: 10px; }
.field-label output { font-family: var(--serif); font-size: 26px; color: var(--gold2); }
.elo-title { font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--gold); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.rated-row { margin-top: 8px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }

.color-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color-pick span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); cursor: pointer; font-weight: 600; }
.color-pick img { width: 30px; height: 30px; }
.color-pick img.half { width: 22px; margin-right: -8px; }
.color-pick input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.tc-group { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.tc-btn span { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); cursor: pointer; }
.tc-btn b { font-family: var(--mono); font-size: 16px; }
.tc-btn small { font-size: 11px; color: var(--muted); }
.tc-btn input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.14), var(--panel2)); }
.tc-custom, .tc-mode { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.tc-custom label, .tc-mode label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
input[type=number], select, textarea {
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit;
}
textarea { width: 100%; font-family: var(--mono); font-size: 13px; resize: vertical; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gal-group { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; margin-top: 6px; }
.gal-item { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--panel2); cursor: pointer; text-align: center; transition: .15s; }
.gal-item:hover { border-color: var(--gold-dk); }
.gal-item.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.gal-item .gal-name { font-size: 12.5px; font-weight: 600; margin-top: 6px; }
.gal-item .gal-sub { font-size: 10.5px; color: var(--muted); }
.mini-board { display: grid; grid-template-columns: repeat(4, 1fr); aspect-ratio: 1; border-radius: 6px; overflow: hidden; padding: 5px; position: relative; }
.mini-board div { aspect-ratio: 1; background-size: cover; position: relative; }
.mini-board img { position: absolute; inset: 6%; width: 88%; height: 88%; }
.piece-prev { display: grid; grid-template-columns: repeat(4, 1fr); background: #cdbfa5; border-radius: 6px; padding: 4px; }
.piece-prev:nth-child(1) { }
.piece-prev img { width: 100%; aspect-ratio: 1; }
.piece-prev .d { background: #8d6a46; }
.piece-prev .l { background: #e6d5b3; }

.opts { display: flex; flex-direction: column; gap: 4px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.opt-text b { display: block; font-size: 14.5px; }
.opt-text span { font-size: 12.5px; color: var(--muted); }
.opt select { min-width: 140px; }
.opt input[type=range] { width: 160px; }

/* stats */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat-card .sv { font-family: var(--serif); font-size: 32px; font-weight: 700; color: var(--gold2); line-height: 1.05; }
.stat-card .sl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.stat-card .ss { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stats-h { font-family: var(--serif); font-size: 21px; margin: 18px 0 8px; }
.rating-chart { width: 100%; height: 170px; background: var(--panel2); border-radius: 12px; border: 1px solid var(--line); }
.wdl { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--panel2); }
.wdl .w { background: var(--good); } .wdl .d { background: #8d8a93; } .wdl .l { background: var(--bad); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.res-w { color: var(--good); font-weight: 700; } .res-l { color: var(--bad); font-weight: 700; } .res-d { color: var(--muted); font-weight: 700; }
.delta-pos { color: var(--good); } .delta-neg { color: var(--bad); }
.tbl .link { font-size: 12.5px; margin-right: 8px; }

/* game over */
.over { padding: 30px 26px 24px; text-align: center; align-items: center; }
.over-icon { width: 84px; height: 84px; margin: 0 auto 6px; background: center/contain no-repeat; filter: drop-shadow(0 6px 16px rgba(212,175,55,.45)); }
.over-rating { font-family: var(--serif); font-size: 22px; margin: 6px 0 16px; }
.over-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* toasts */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: pop .2s ease-out; max-width: 90vw; }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  :root { --bsize: min(calc(100vw - 24px), calc(100vh - 210px), 720px); }
  .layout { grid-template-columns: 1fr; justify-items: center; padding: 10px 12px 20px; gap: 14px; }
  .side { width: min(100%, 720px); height: auto; min-height: 0; }
  .movelist { max-height: 220px; }
  .topnav { overflow-x: auto; scrollbar-width: none; }
  .topnav .btn { white-space: nowrap; }
  .brand-name { font-size: 21px; }
  .board-row .evalbar { width: 14px; }
}
@media (max-width: 1000px) and (orientation: portrait) {
  :root { --bsize: min(calc(100vw - 24px), 720px); }
}
@media (max-width: 560px) {
  .clock { font-size: 20px; min-width: 92px; padding: 5px 10px; }
  .mode-cards { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 10px; gap: 8px; }
  .brand-name { display: none; }
  .topnav .btn { padding: 7px 10px; font-size: 13px; }
  .seg { display: none; }
}

/* ---------- 3D view ---------- */
#board3d {
  width: var(--bsize); height: var(--bsize); position: relative; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px var(--line); background: #0b0709; touch-action: none;
}
#board3d .gl { display: block; width: 100%; height: 100%; cursor: grab; }
#board3d .gl:active { cursor: grabbing; }
#board3d::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 14px;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.38) 100%); }
.loading3d { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 24px; color: var(--gold2); background: #0b0709; z-index: 2; }
.promo3d { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(0,0,0,.45); backdrop-filter: blur(3px); }
.promo3d-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; box-shadow: var(--shadow); text-align: center; }
.promo3d-title { font-family: var(--serif); font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.promo3d-row { display: flex; gap: 10px; }
.promo3d-btn { width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--line); background: radial-gradient(circle, #f6f1e6 50%, #cbbfa8); padding: 6px; transition: transform .12s; }
.promo3d-btn:hover { transform: translateY(-3px); border-color: var(--gold); }
.promo3d-btn img { width: 100%; height: 100%; }

.board-holder { position: relative; }
.tb3d { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 2px; align-items: center; z-index: 6;
  background: rgba(16,14,18,.72); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 4px; backdrop-filter: blur(8px); white-space: nowrap; }
.tb3d button { border: 0; background: none; color: #ddd6c8; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; }
.tb3d button:hover { background: rgba(255,255,255,.08); }
.tb3d button.on { background: rgba(212,175,55,.28); color: #fff3cc; }
.tb3d .tb-gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #2a1d00; }
.tb3d .tb-gold:hover { background: linear-gradient(180deg, #fbe59a, #e1bd48); }
.tb-sep { width: 1px; height: 18px; background: rgba(255,255,255,.18); margin: 0 4px; }
body:not(.view3d) #builderBtn { display: none; }

/* Set Builder drawer */
.drawer { position: fixed; inset: 60px 0 0 auto; margin: 0; width: min(440px, 100vw); height: calc(100vh - 60px); max-height: none; padding: 0;
  border: 0; background: transparent; color: var(--text); z-index: 50; }
.drawer[open] { animation: slidein .22s ease-out; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0 } }
.drawer-inner { height: 100%; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--panel), var(--bg2)); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0,0,0,.45); }
.drawer-body { overflow-y: auto; padding: 4px 20px 30px; }
.drawer-body section { padding: 12px 0 14px; border-bottom: 1px solid var(--line); }
.drawer-body h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 10px; }
.sb-sub { grid-column: 1 / -1; font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; margin-top: 6px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.sw { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; position: relative; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 2px 6px rgba(0,0,0,.4); }
.sw span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); font-size: 9.5px; color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.sw:hover span, .sw.on span { opacity: 1; }
.sw.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.35), 0 2px 6px rgba(0,0,0,.4); }
.sw-grid .sw { margin-bottom: 10px; }
.sb-custom { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.sb-custom input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); padding: 2px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); }
.preset:hover { border-color: var(--gold-dk); }
.preset .preset-sw { grid-row: 1 / 3; }
.preset b { font-size: 13.5px; } .preset small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.preset-sw { display: inline-flex; align-items: center; }
.preset-sw i { width: 24px; height: 24px; border-radius: 50%; display: block; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.preset-sw i + i { margin-left: -8px; }
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--gold); background: rgba(212,175,55,.18); }
.env-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); }
.bsw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.bsw { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; }
.bsw.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.bsw-sq { display: grid; grid-template-columns: 1fr 1fr; width: 46px; height: 46px; border-radius: 4px; overflow: hidden; }
.bsw-sq i { display: block; }
.sb-check { display: flex; margin-top: 10px; }
.save-row { display: flex; gap: 8px; }
.save-row input { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
.my-sets { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.my-set { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--panel2); border-radius: 8px; }
.my-set b { flex: 1; font-size: 13.5px; }
.link.danger { color: var(--bad); }
@media (max-width: 1000px) {
  .drawer { inset: auto 0 0 0; width: 100vw; height: 62vh; }
  .tb3d button { padding: 6px 8px; font-size: 11.5px; }
  .tb3d [data-cam="side"] { display: none; }
}
.contrast { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.ct-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.contrast.good b { color: var(--good); } .contrast.ok b { color: var(--warn); } .contrast.bad b { color: var(--bad); }
.ct-bar { height: 6px; background: rgba(255,255,255,.08); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.ct-bar i { display: block; height: 100%; border-radius: 99px; }
.contrast.good .ct-bar i { background: var(--good); } .contrast.ok .ct-bar i { background: var(--warn); } .contrast.bad .ct-bar i { background: var(--bad); }
.ct-sug { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.ct-sug .chip { padding: 4px 10px; font-size: 12px; }
.sb-range { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; margin-top: 12px; font-weight: 600; font-size: 14px; }
.sb-range .small { grid-column: 1 / -1; font-weight: 400; }

/* ---------- online ---------- */
.btn-online { background: linear-gradient(180deg, #2f5e9e, #1e3f70); border-color: #3f73b8; color: #fff; }
.btn-online:hover { background: linear-gradient(180deg, #3a6db3, #24497f); border-color: #5b8fd4; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.acct { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 7px 13px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.acct:hover { border-color: var(--gold-dk); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #666; flex: none; }
.dot.on { background: #4caf50; box-shadow: 0 0 6px #4caf50; }
.dot.busy { background: var(--gold); }
.conn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.conn.on { background: #4caf50; } .conn.off { background: var(--bad); animation: pulse 1s infinite; }
.hub-acct { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 22px 12px; }
.hub-name { font-family: var(--serif); font-size: 20px; margin-right: 4px; }
.rchip { display: inline-flex; flex-direction: column; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; font-weight: 700; font-family: var(--mono); font-size: 14px; line-height: 1.2; }
.rchip small { font-family: var(--font); font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.hub-acct .link { margin-left: auto; }
.hub-body { min-height: 360px; }
.hub-sec { padding: 6px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.hub-sec:last-child { border-bottom: 0; }
.hub-sec h3 { font-family: var(--serif); font-size: 21px; margin: 4px 0 6px; }
.hub-sec.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.hub-cta { display: flex; flex-direction: column; gap: 2px; background: rgba(47,94,158,.18); border: 1px solid #3f73b8; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.qp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 8px; }
.qp { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.qp b { font-family: var(--mono); font-size: 20px; }
.qp small { font-size: 11px; color: var(--muted); }
.qp:hover { border-color: var(--gold-dk); }
.qp.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: linear-gradient(180deg, rgba(212,175,55,.16), var(--panel2)); }
.searching { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(212,175,55,.3); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.form-row label.check { flex-direction: row; color: var(--text); padding-bottom: 8px; }
.form-row input[type=text], .form-row input[type=number] { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
.form-row input[type=number] { width: 70px; }
#cgCustom { flex-direction: row; align-items: center; }
.invite { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.invite-row { display: flex; gap: 6px; }
.invite-row input { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 8px; font-family: var(--mono); font-size: 12px; }
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.pl { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--panel2); border-radius: 8px; }
.pl-act { margin-left: auto; display: flex; gap: 8px; }
.prof-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.prof-head h3 { margin: 0; }
.prof-head .btn { margin-left: auto; }
.auth-body { display: flex; flex-direction: column; gap: 12px; }
.auth-body label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.auth-body input { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; }
.challenge-box { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 120; }
.ch-card { background: var(--panel); border: 1px solid var(--gold-dk); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); min-width: 260px; animation: pop .2s ease-out; }
.ch-btns { display: flex; gap: 8px; margin-top: 8px; }
.offer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); background: rgba(212,175,55,.1); font-size: 13.5px; font-weight: 600; }
.offer-bar span { flex: 1; min-width: 150px; }
.tab-body[data-body="chat"] { padding: 0; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.cmsg b { color: var(--gold2); margin-right: 4px; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 10px; font: inherit; }
.tab[data-unread]:not([data-unread=""])::after { content: attr(data-unread); margin-left: 5px; background: var(--crimson2); color: #fff; font-size: 10.5px; border-radius: 99px; padding: 1px 6px; }
@media (max-width: 760px) { .hub-sec.two { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .acct { padding: 6px 9px; font-size: 12px; } }

/* ---------- variants ---------- */
.vchips { display: flex; flex-wrap: wrap; gap: 8px; }
.vchip input { position: absolute; opacity: 0; pointer-events: none; }
.vchip span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.vchip input:checked + span { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: rgba(212,175,55,.16); }
#variantBlurb { margin: 8px 0 0; min-height: 1.2em; }
.board-frame.koth .sq[data-sq="d4"]::after, .board-frame.koth .sq[data-sq="e4"]::after,
.board-frame.koth .sq[data-sq="d5"]::after, .board-frame.koth .sq[data-sq="e5"]::after {
  content: ''; position: absolute; inset: 8%; border: calc(var(--bsize) * .005) solid rgba(212,175,55,.85); border-radius: 50%;
  box-shadow: 0 0 calc(var(--bsize) * .01) rgba(212,175,55,.6), inset 0 0 calc(var(--bsize) * .01) rgba(212,175,55,.4); pointer-events: none;
}
.checks { display: inline-flex; gap: 3px; margin-right: 8px; }
.checks i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--crimson2); }
.checks i.on { background: var(--crimson2); box-shadow: 0 0 6px var(--crimson2); }
.hub-variants { margin-bottom: 2px; }
.vtag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #2a1d00; background: var(--gold); border-radius: 4px; padding: 1px 6px; margin-left: 4px; }

/* ---------- puzzles ---------- */
.tab-body[data-body="puzzle"], .tab-body[data-body="explorer"] { overflow-y: auto; padding: 14px 16px; }
.pz, .ex { display: flex; flex-direction: column; gap: 12px; }
.pz-modes { display: flex; gap: 6px; flex-wrap: wrap; }
.pz-rating, .rush-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pz-rating > div, .rush-bar > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.pz-rating small, .rush-bar small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; }
.pz-rating b, .rush-bar b { font-family: var(--serif); font-size: 26px; color: var(--gold2); }
.rush-bar b { font-family: var(--mono); font-size: 22px; }
.strikes { color: var(--bad) !important; letter-spacing: 2px; } .strikes span { color: var(--line); }
.pz-theme { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pz-theme select { flex: 1; }
.pz-prompt { display: flex; gap: 12px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 12px; }
.pz-prompt.win { border-left-color: var(--good); background: rgba(95,184,95,.1); }
.pz-prompt.fail { border-left-color: var(--bad); background: rgba(217,83,79,.08); }
.pz-prompt > div { display: flex; flex-direction: column; gap: 2px; }
.pz-king { width: 40px; height: 40px; flex: none; background: center/contain no-repeat; }
.pz-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 600; background: rgba(212,175,55,.14); border: 1px solid var(--gold-dk); color: var(--gold2); border-radius: 999px; padding: 2px 10px; }
:root[data-theme="light"] .tag { color: #6b4e00; }
.pz-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pz-hero { text-align: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pz-hero p { margin: 0; }
.pz-big { font-family: var(--serif); font-size: 56px; font-weight: 700; color: var(--gold2); line-height: 1; }

/* ---------- opening explorer ---------- */
.ex-search input { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 9px 12px; font: inherit; }
.ex-cur { display: flex; gap: 8px; align-items: baseline; color: var(--gold2); }
.eco { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ex-head { display: grid; grid-template-columns: 62px 1fr 40px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; padding: 0 8px; }
.ex-list { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; }
.ex-row { display: grid; grid-template-columns: 62px 1fr 40px; gap: 6px; align-items: center; text-align: left; background: var(--panel2); border: 1px solid transparent; border-radius: 8px; padding: 7px 8px; font-size: 13.5px; }
.ex-row:hover { border-color: var(--gold-dk); }
.ex-row small { color: var(--muted); text-align: right; }
.ex-row .eco { font-size: 11.5px; }
.ex-san { font-size: 15px; }
.ex-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rep { border-top: 1px solid var(--line); padding-top: 10px; }
.rep-head { display: flex; align-items: center; justify-content: space-between; }
.rep-head h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 6px; }
.rep-list { display: flex; flex-direction: column; gap: 4px; }
.rep-row { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 8px; padding: 7px 10px; }
.rep-row > div { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rep-row b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-row small { color: var(--muted); font-size: 11.5px; }
.rep-col { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid var(--line); }
.rep-col.w { background: #f4f0e6; } .rep-col.b { background: #141414; }
.stars { color: var(--gold); letter-spacing: 1px; } .stars span { color: var(--line); }
.due { color: var(--warn); font-weight: 700; }
.rep-act { display: flex; gap: 10px; }
.drill-card { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 14px; }
.drill-card.win { border-left-color: var(--good); } .drill-card.fail { border-left-color: var(--warn); }
.drill-card h3 { font-family: var(--serif); font-size: 22px; margin: 2px 0 8px; }
.drill-card small { color: var(--muted); }
.drill-card p { margin: 8px 0 0; }
.drill-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.drill-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dk), var(--gold2)); }
body.view3d .toasts { bottom: 86px; }
