/* ChessLab — design system */
:root {
  --bg: #0a0d0c;
  --bg-soft: #101513;
  --surface-1: #121815;
  --surface-2: #171e1a;
  --panel: rgba(255, 255, 255, 0.028);
  --panel-hi: rgba(255, 255, 255, 0.055);
  --panel-solid: #161c19;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --text: #eceae1;
  --text-2: #c2c6bc;
  --dim: #8c948b;
  --accent: #e0ad5b;
  --accent-2: #f1c67e;
  --accent-deep: #b8863a;
  --accent-soft: rgba(224, 173, 91, 0.13);
  --accent-line: rgba(224, 173, 91, 0.55);
  --green: #83bd4e;
  --red: #e0575c;
  --blue: #6d97f0;
  --radius: 12px;
  --r-sm: 9px;
  --r-lg: 16px;
  --sh-1: 0 1px 2px rgba(0,0,0,.3);
  --sh-2: 0 6px 20px rgba(0,0,0,.35);
  --sh-3: 0 18px 50px rgba(0,0,0,.5);
  --glow: 0 0 24px rgba(224,173,91,.18);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* board themes */
:root, :root[data-board-theme="walnut"] { --sq-light: #ecdbc0; --sq-dark: #a97d55; --board-edge: #6d4c33; }
:root[data-board-theme="tournament"] { --sq-light: #eef0d4; --sq-dark: #6d9558; --board-edge: #44603a; }
:root[data-board-theme="ocean"] { --sq-light: #e2e9ee; --sq-dark: #7f9bab; --board-edge: #4d6472; }
:root[data-board-theme="slate"] { --sq-light: #e0e2e7; --sq-dark: #707a87; --board-edge: #454d58; }

* { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 560px at 88% -12%, rgba(224, 173, 91, 0.07), transparent 62%),
    radial-gradient(1000px 640px at -12% 112%, rgba(131, 189, 78, 0.05), transparent 56%),
    linear-gradient(180deg, #0b0f0d, var(--bg));
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; transition: color .12s; }
a:hover { color: var(--accent-2); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 .5em; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 27px; font-weight: 700; } h2 { font-size: 21px; } h3 { font-size: 16px; } h4 { font-size: 13.5px; margin-top: 1.2em; letter-spacing: .01em; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); background-clip: padding-box; }
ul { margin: .4em 0; padding-left: 1.3em; }
li { margin: .25em 0; }
.dim { color: var(--dim); }
.mono { font-family: var(--font-mono); font-size: 13px; }
.small { font-size: 12.5px; }
.pad { padding: 16px; }
.pad-t { padding-top: 12px; }
.spacer { flex: 1; }

/* ---------- icons ---------- */
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  color: var(--dim); transition: color .16s, filter .16s; }
.btn .ic { width: 16px; height: 16px; }
.btn-ic .ic { width: 19px; height: 19px; }
.pv-title { display: inline-flex; align-items: center; gap: 7px; }
.pv-title .ic { width: 17px; height: 17px; color: var(--accent-2); }
.opening-info summary .ic { width: 16px; height: 16px; color: var(--accent); margin-right: 4px; vertical-align: -3px; }
.pc-deep .ic, #eg-coach .ic, #coach-explain .ic, #sum-narrate .ic, .pr-ask-go .ic { color: var(--accent-2); }
/* liquid-glass utility */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.02));
  backdrop-filter: blur(22px) saturate(165%); -webkit-backdrop-filter: blur(22px) saturate(165%);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -1px 0 rgba(0,0,0,.25), 0 10px 34px rgba(0,0,0,.42);
}

/* ---------- app frame ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.topbar { display: none; }
.logo-tile {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(155deg, rgba(241,198,126,.28), rgba(184,134,58,.12) 60%, rgba(255,255,255,.04));
  border: 1px solid rgba(241,198,126,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 6px rgba(120,80,20,.35), 0 4px 14px rgba(0,0,0,.4);
}
.logo-tile .ic { width: 24px; height: 24px; color: var(--accent-2); fill: currentColor; stroke: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.sidebar {
  width: 216px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg, rgba(24,31,27,.72), rgba(10,13,12,.5));
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.04);
  padding: 20px 14px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; text-decoration: none !important; }
.logo-knight { font-size: 30px; line-height: 1; color: var(--accent); filter: drop-shadow(0 2px 8px rgba(224,173,91,.4)); }
.logo-text { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.logo-text b { color: var(--accent); }
nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--dim); font-weight: 500; font-size: 14.5px; text-decoration: none !important;
  transition: color .14s, background .14s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-item:hover .nav-ic { color: var(--text); }
.nav-item.active { color: var(--text); background: var(--accent-soft); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.nav-item.active .nav-ic { color: var(--accent-2); filter: drop-shadow(0 0 6px rgba(224,173,91,.4)); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: var(--glow); }
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; padding: 10px 4px 0; }
main { flex: 1; overflow-y: auto; padding: 28px 34px 64px; }

.view-head { margin-bottom: 20px; }
.view-head h1 { background: linear-gradient(180deg, #fff, #d8d4c6); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.view-head .sub, .sub { color: var(--dim); margin: 4px 0 0; max-width: 640px; font-size: 14.5px; }

/* ---------- primitives ---------- */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012)),
    var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.panel::before { content: ''; position: absolute; inset: 0 0 auto; height: 1px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent); }
.panel-inner { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 13px; margin: 8px 0; }
.btn {
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 15px; font-size: 13.5px; font-weight: 600; font-family: var(--font-body);
  cursor: pointer; transition: transform .1s ease, background .14s, border-color .14s, box-shadow .14s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none !important;
  min-height: 38px;
}
.btn:hover { background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.05)); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent-deep); color: #1a1206; box-shadow: 0 2px 12px rgba(224,173,91,.22); text-shadow: 0 1px 0 rgba(255,255,255,.25); }
.btn-primary:hover { background: linear-gradient(180deg, #f6ce88, var(--accent-2)); border-color: var(--accent); box-shadow: 0 4px 18px rgba(224,173,91,.32); }
.btn-mini { padding: 5px 11px; font-size: 12.5px; min-height: 30px; }
.btn-ic {
  padding: 8px 11px; font-size: 15px; min-height: 40px; border-radius: 11px;
  background: linear-gradient(180deg, rgba(255,255,255,.11), rgba(255,255,255,.03));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 2px 8px rgba(0,0,0,.25);
  color: var(--text-2);
}
.btn-ic:hover { color: var(--text); border-color: var(--border-strong); }
.btn.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
input[type="text"], input[type="password"], textarea, select {
  background: rgba(0,0,0,.28); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 11px; font-size: 15px; font-family: var(--font-body);
  outline: none; min-width: 0; transition: border-color .14s, box-shadow .14s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #6b726a; }
textarea { width: 100%; resize: vertical; font-family: var(--font-mono); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 7px; color: var(--dim); font-size: 13px; cursor: pointer; user-select: none; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.chip-row { display: flex; gap: 7px; margin: 12px 0; flex-wrap: wrap; }
.chip { background: rgba(255,255,255,.045); border: 1px solid var(--border); color: var(--text-2); border-radius: 99px; padding: 6px 14px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all .14s; min-height: 32px; display: inline-flex; align-items: center; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); font-weight: 600; }

/* toasts */
.toast-host { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  color: var(--text); padding: 11px 16px; border-radius: 8px; font-size: 13.5px; max-width: 420px;
  opacity: 0; transform: translateY(8px); transition: all .25s ease; box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-warn { border-left-color: var(--accent); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; animation: modalIn .18s ease; }
@keyframes modalIn { from { opacity: 0; } }
.modal[hidden] { display: none; }
.modal-box { width: 420px; max-width: 100%; background: var(--surface-2); box-shadow: var(--sh-3); max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.set-row:last-of-type { border-bottom: none; }
.set-row input[type="range"] { width: 150px; accent-color: var(--accent); }

/* ---------- THE BOARD ---------- */
.cl-board {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 7px; overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.5),
    0 0 0 5px var(--board-edge),
    0 0 0 6px rgba(255,255,255,.06),
    0 22px 50px -12px rgba(0,0,0,.7);
  user-select: none; touch-action: none;
}
.cl-board .squares { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.cl-board .sq.light { background: var(--sq-light); }
.cl-board .sq.dark { background: var(--sq-dark); }
.cl-board .sq { position: relative; }
.cl-board .sq.light::after, .cl-board .sq.dark::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.05), transparent 45%, rgba(0,0,0,.05));
  pointer-events: none;
}
.cl-board .layer { position: absolute; inset: 0; pointer-events: none; }
.cl-board .layer.pieces { pointer-events: auto; }
.cl-board .overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.cl-board .piece {
  position: absolute; width: 12.5%; height: 12.5%;
  background-size: 82%; background-position: center; background-repeat: no-repeat;
  cursor: grab;
  transition: transform 140ms cubic-bezier(.2, .75, .3, 1);
  will-change: transform;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.28));
}
.cl-board .piece.no-anim { transition: none; }
.cl-board .piece.dragging { transition: none; z-index: 30; cursor: grabbing; transform-origin: center; scale: 1.12; filter: drop-shadow(0 8px 10px rgba(0,0,0,.4)); }
.cl-board .piece.fade-in { animation: pieceIn .16s ease; }
.cl-board .piece.fade-out { opacity: 0; transition: opacity .13s ease; }
@keyframes pieceIn { from { opacity: 0; scale: .8; } }

.hl-sq { position: absolute; width: 12.5%; height: 12.5%; }
.hl-last { background: rgba(212, 178, 92, 0.42); }
.hl-selected { background: rgba(129, 182, 76, 0.45); }
.hl-check { background: radial-gradient(circle at 50% 50%, rgba(214, 64, 69, .85), rgba(214, 64, 69, .25) 62%, transparent 72%); }
.target-dot { position: absolute; width: 12.5%; height: 12.5%; display: grid; place-items: center; }
.target-dot::before { content: ''; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 30, 20, 0.28); }
.target-dot.capture::before { width: 84%; height: 84%; background: none; border: 4px solid rgba(20, 30, 20, 0.3); }

.coords { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-mono); font-size: clamp(8px, 1.6vw, 11px); font-weight: 600; }
.coord { position: absolute; }
.coord.rank { left: 3px; }
.coord.file { bottom: 1px; }
.coord.on-light { color: var(--sq-dark); }
.coord.on-dark { color: var(--sq-light); }

.mv-badge {
  position: absolute; z-index: 40; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.4); pointer-events: none;
}
.badge-brilliant { background: #1bada6; } .badge-great { background: #5b8def; }
.badge-best { background: #81b64c; } .badge-inaccuracy { background: #e6b23c; color: #3a2c08; }
.badge-mistake { background: #e0793a; } .badge-blunder { background: #d64045; }
.badge-book { background: #a88865; } .badge-forced { background: #8a9095; }

.promo { position: absolute; inset: 0; background: rgba(10, 12, 10, .55); z-index: 60; }
.promo-col { position: absolute; width: 12.5%; display: flex; flex-direction: column; z-index: 61; }
.promo-btn {
  aspect-ratio: 1; border: none; cursor: pointer;
  background-color: #f4efe4; background-size: 84%; background-position: center; background-repeat: no-repeat;
  border-radius: 4px; margin: 1px; box-shadow: 0 3px 10px rgba(0,0,0,.5);
}
.promo-btn:hover { background-color: var(--accent); }

/* ---------- library ---------- */
.accounts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.account-card h3 { display: flex; align-items: center; gap: 8px; }
.account-card.linked { border-color: rgba(212,162,78,.35); }
.acct-top { display: flex; justify-content: space-between; align-items: center; }
.account-card input[type="text"] { flex: 1; }
.rating-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.rating-chip { background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; font-size: 12.5px; }
.rating-chip b { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }
.rating-chip i { font-style: normal; font-size: 11px; }
.acct-meta { font-size: 12px; margin-bottom: 8px; }
.acct-status { min-height: 16px; font-size: 12px; margin: 4px 0; }
.pgn-card { margin-bottom: 16px; }
.pgn-card h3 { display: flex; align-items: center; gap: 8px; }
.src-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.src-dot.chesscom { background: #7fa650; } .src-dot.lichess { background: #f0f0f0; } .src-dot.pgn { background: var(--accent); }
.import-status { min-height: 18px; font-size: 12.5px; color: var(--dim); }
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.table-head input { width: 260px; }
.table-wrap { overflow-x: auto; }
.games-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.games-table th { text-align: left; color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.games-table td { padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.04); white-space: nowrap; }
.games-table tbody tr { cursor: pointer; }
.games-table tbody tr:hover { background: rgba(255,255,255,.035); }
.games-table .me { color: var(--accent); font-weight: 600; }
.opening-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.result-chip { font-family: var(--font-mono); font-size: 12px; padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.06); }
.result-chip.win { background: rgba(129,182,76,.18); color: var(--green); }
.result-chip.loss { background: rgba(214,64,69,.16); color: #e8767a; }
.result-chip.draw { background: rgba(255,255,255,.08); color: var(--dim); }
.tc-badge { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .04em; color: var(--dim); background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; }
.empty { color: var(--dim); text-align: center; padding: 26px; }

/* ---------- review ---------- */
.review-grid { display: grid; grid-template-columns: minmax(400px, 700px) minmax(340px, 430px); gap: 18px; align-items: start; }
.board-row { display: flex; gap: 10px; }
.board-host { flex: 1; min-width: 0; }
.evalbar { position: relative; width: 17px; border-radius: 5px; overflow: hidden; background: #22282a; display: flex; flex-direction: column-reverse; box-shadow: inset 0 0 0 1px var(--border); }
.evalbar-fill { background: linear-gradient(180deg, #fbf6ea, #e4dcc8); height: 50%; transition: height .4s ease; }
.evalbar-num { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 8.5px; font-weight: 700; color: #333; writing-mode: vertical-rl; }
.evalbar-num.black-side { bottom: auto; top: 4px; color: #ddd; }
.rv-controls { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.rv-graph { margin-top: 10px; padding: 8px; }
.eval-graph { display: block; width: 100%; height: 110px; border-radius: 6px; cursor: crosshair; }
.graph-hint { color: var(--dim); font-size: 13px; text-align: center; padding: 22px 10px; }

.rv-right { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 60px); position: sticky; top: 0; }
.rv-head .players { display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.rv-head .pl i { color: var(--dim); font-style: normal; font-weight: 400; }
.rv-head .pl.me { color: var(--accent); }
.rv-head .vs { color: var(--dim); font-family: var(--font-mono); font-size: 13px; }
.rv-head .meta { font-size: 12.5px; margin-top: 4px; }
.rv-analysis .an-idle, .an-running { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-done { color: var(--green); font-size: 13px; font-weight: 600; }
.an-progress { flex: 1; min-width: 120px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.07); overflow: hidden; }
.an-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .3s; }
.an-label { font-size: 12.5px; color: var(--dim); }

.pvbox { font-size: 13px; }
.pv-head { display: flex; align-items: center; margin-bottom: 6px; }
.pv-title { font-weight: 700; font-family: var(--font-display); font-size: 13px; }
.pv-line { font-family: var(--font-mono); font-size: 12.5px; padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.pv-line b { color: var(--accent); min-width: 46px; }
.pv-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pv-comment { margin-top: 6px; font-size: 13px; }

.rv-tabs { display: flex; gap: 4px; }
.tab { background: none; border: none; color: var(--dim); font-weight: 600; font-size: 13.5px; padding: 7px 13px; cursor: pointer; border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.rv-movelist { overflow-y: auto; flex: 1; min-height: 120px; }
.ml-rows { display: flex; flex-direction: column; }
.ml-row { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 4px; align-items: center; }
.ml-no { color: var(--dim); font-family: var(--font-mono); font-size: 12px; text-align: right; padding-right: 4px; }
.ml-chip {
  background: none; border: none; color: var(--text); text-align: left;
  font-family: var(--font-mono); font-size: 13px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  display: flex; gap: 6px; align-items: center;
}
.ml-chip:hover { background: rgba(255,255,255,.06); }
.ml-chip.current { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.ml-chip .glyph { font-style: normal; font-size: 11px; font-weight: 800; }
.cls-blunder .glyph, .cls-blunder { color: #e8767a; }
.cls-mistake .glyph { color: #e0793a; }
.cls-inaccuracy .glyph { color: #e6b23c; }
.cls-brilliant .glyph { color: #1bada6; }
.cls-great .glyph { color: #5b8def; }
.ml-chip.cls-blunder { color: #e8767a; }
.ml-chip.cls-mistake { color: #e2955f; }
.ml-chip.current.cls-blunder, .ml-chip.current.cls-mistake { color: inherit; }

.acc-cards { display: flex; gap: 10px; }
.acc-card { flex: 1; background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; text-align: center; }
.acc-name { font-size: 12.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-val { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--accent); }
.acc-val i { font-size: 14px; font-style: normal; }
.cnt-grid { margin: 12px 0; }
.cnt-row { display: grid; grid-template-columns: 40px 1fr 40px; text-align: center; font-size: 13px; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.cnt-label { font-weight: 600; }
.coach p { font-size: 13.5px; color: var(--text); margin: 8px 0; }
.moments { display: flex; flex-direction: column; gap: 5px; }
.moment { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; color: var(--text); text-align: left; cursor: pointer; font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.moment:hover { border-color: var(--accent); }
.pr-log { margin-top: 8px; color: var(--dim); max-height: 140px; overflow-y: auto; }
.pr-status { margin: 8px 0; }

/* ---------- explore ---------- */
.explore-grid { display: grid; grid-template-columns: minmax(400px, 640px) minmax(340px, 440px); gap: 18px; align-items: start; }
.ex-opening { padding: 10px 14px; margin-bottom: 10px; }
.fen-input { flex: 1; min-width: 140px; font-family: var(--font-mono); font-size: 11.5px; }
.ex-line { margin-top: 10px; padding: 10px; line-height: 1.9; }
.ex-pane { max-height: calc(100vh - 130px); overflow-y: auto; }
.ex-db-row { display: flex; gap: 16px; margin-bottom: 10px; }
.ex-total { font-size: 13px; margin-bottom: 8px; }
.ex-row { display: grid; grid-template-columns: 64px 70px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.ex-row:hover { background: rgba(255,255,255,.05); }
.ex-san { font-weight: 700; }
.ex-n { font-size: 12px; text-align: right; }
.ex-bar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.05); }
.ex-bar i.w { background: #e8e2d2; } .ex-bar i.d { background: #8a8f8a; } .ex-bar i.b { background: #3a3f3c; }
.ex-wdl { margin-bottom: 10px; }
.ex-wdl .win { color: var(--green); } .ex-wdl .loss { color: #e8767a; }
.ex-mine-list { display: flex; flex-direction: column; gap: 4px; }
.ex-mine-row { padding: 6px 8px; border-radius: 6px; color: var(--text); font-size: 13px; }
.ex-mine-row:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.guide-list { display: flex; flex-direction: column; gap: 6px; }
.guide-item { background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--text); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.guide-item:hover { border-color: var(--accent); }
.guide-item .dim { font-size: 12px; font-family: var(--font-mono); }
.plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trap { margin: 6px 0; }

/* ---------- train / puzzles ---------- */
.train-stats { display: flex; gap: 10px; margin-bottom: 12px; }
.stat-chip { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; display: flex; flex-direction: column; align-items: center; }
.stat-chip b { font-family: var(--font-display); font-size: 19px; color: var(--accent); }
.stat-chip span { font-size: 11.5px; color: var(--dim); }
.train-grid { display: grid; grid-template-columns: minmax(380px, 620px) minmax(300px, 400px); gap: 18px; margin-top: 10px; align-items: start; }
.pz-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pz-turn { width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--border); }
.pz-turn.w { background: #f2ecdc; } .pz-turn.b { background: #2a2d2a; }
.pz-title { font-weight: 700; font-family: var(--font-display); font-size: 14px; }
.pz-controls { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.pz-status { font-size: 13px; font-weight: 600; }
.pz-status.ok { color: var(--green); }
.pz-status.bad { color: #e8767a; }
.pz-status.meh { color: var(--dim); }
.pz.shake .pz-board { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.pz-solved .pz-board .cl-board { box-shadow: 0 0 0 4px var(--green), 0 14px 42px rgba(0,0,0,.5); }
.explain { font-size: 13.5px; }
.explain p { margin: 6px 0; }

/* ---------- endgames ---------- */
.eg-cat { margin: 22px 0 10px; color: var(--accent); }
.eg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.eg-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; color: var(--text); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 7px; transition: border-color .12s, transform .12s; }
.eg-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.eg-card.done { border-color: rgba(129,182,76,.5); }
.eg-name { font-weight: 700; font-family: var(--font-display); font-size: 14px; }
.eg-card.done .eg-name { color: var(--green); }
.eg-meta { display: flex; justify-content: space-between; align-items: center; }
.goal-chip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 5px; }
.goal-chip.win { background: rgba(129,182,76,.15); color: var(--green); }
.goal-chip.draw { background: rgba(91,141,239,.15); color: var(--blue); }
.pips { color: var(--accent); font-size: 10px; letter-spacing: 2px; }
.eg-tech { font-size: 12.5px; }
.eg-play-grid { display: grid; grid-template-columns: minmax(400px, 640px) minmax(300px, 400px); gap: 18px; align-items: start; }
.eg-side h2 { margin-top: 10px; }
.eg-status { margin: 12px 0; font-weight: 600; }
.eg-status.ok { color: var(--green); }
.eg-status.bad { color: #e8767a; }

/* ---------- learn ---------- */
.learn-grid { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.learn-nav { position: sticky; top: 0; max-height: calc(100vh - 60px); overflow-y: auto; }
.learn-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 14px 0 4px; padding: 0 8px; }
.learn-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; background: none; border: none; color: var(--text); text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.learn-link:hover { background: rgba(255,255,255,.05); }
.learn-link.active { background: var(--accent-soft); color: var(--accent); }
.learn-link.big { font-weight: 700; font-family: var(--font-display); }
.learn-link.big .ic { width: 18px; height: 18px; color: var(--accent-2); flex-shrink: 0; }
.learn-link.big .dim { margin-left: auto; }
.learn-pane { min-height: 400px; max-width: 860px; }
.learn-welcome { padding: 30px 10px; }
.lesson-section { margin: 20px 0; }
.lesson-section p { color: #d6d3ca; max-width: 640px; white-space: pre-line; }
.lesson-board-wrap { max-width: 340px; margin: 12px 0; }
.lesson-board-wrap .play-line { margin-top: 8px; }
.motif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }
.motif-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px; color: var(--text); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s; position: relative; }
.motif-card:hover { border-color: var(--accent); }
.motif-card b { font-family: var(--font-display); }
.motif-card .dim { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-chip { font-style: normal; font-size: 10.5px; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.motif-try { max-width: 420px; }
.motif-expl { max-width: 620px; color: #d6d3ca; }

/* principles */
.principle-coach { margin: 14px 0; }
.principle-coach .tutor-feed { max-height: 300px; margin-bottom: 8px; }
.learn-link.big + .learn-link.big { margin-top: 2px; }
.principle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.principle-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 15px; display: flex; flex-direction: column; gap: 7px; }
.pc-cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; }
.principle-card h3 { margin: 0; font-size: 15.5px; }
.pc-rule { font-weight: 600; color: var(--text); font-size: 13.5px; }
.pc-why { color: #d0cdc4; font-size: 13px; line-height: 1.5; margin: 2px 0; }
.pc-board { max-width: 240px; margin: 4px 0; }
.pc-cap { margin-bottom: 2px; }
.pc-deep { align-self: flex-start; }
.pc-out:not(:empty) { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; font-size: 13px; }
.set-row.coach-signin #coach-signin-ctl { display: flex; align-items: center; gap: 6px; }

/* ---------- stats ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-card b { font-family: var(--font-display); font-size: 23px; color: var(--accent); display: block; }
.stat-card span { font-size: 12px; color: var(--dim); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.chart { width: 100%; height: auto; }
.chart-label { fill: var(--dim); font-size: 11px; font-family: var(--font-mono); }
.chart-value { fill: var(--text); font-size: 11px; font-family: var(--font-mono); }
.op-table { display: flex; flex-direction: column; }
.op-row { display: grid; grid-template-columns: minmax(140px, 1.4fr) 70px 1fr 44px 70px; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 13px; }
.op-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- play vs bots ---------- */
.elo-banner { display: flex; gap: 22px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.elo-big { display: flex; align-items: baseline; gap: 8px; }
.elo-big b { font-family: var(--font-display); font-size: 42px; color: var(--accent); }
.elo-big span { color: var(--dim); font-size: 15px; }
.elo-parts { font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.play-opts { margin-bottom: 14px; gap: 16px; }
.play-opts label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--dim); }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px; }
.bot-card {
  position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 14px; color: var(--text); text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; transition: border-color .12s, transform .12s;
}
.bot-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.bot-card.recommended { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rec-chip { position: absolute; top: -9px; right: 10px; background: var(--accent); color: #191207; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 99px; }
.bot-glyph { font-size: 26px; line-height: 1; }
.bot-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.bot-elo { color: var(--accent); font-family: var(--font-mono); font-size: 12.5px; }
.bot-blurb { font-size: 12.5px; }
.bot-record { font-size: 11.5px; }
.play-grid { display: grid; grid-template-columns: minmax(400px, 640px) minmax(320px, 420px); gap: 18px; align-items: start; }
.play-side { display: flex; flex-direction: column; gap: 10px; }
.bot-head { display: flex; gap: 12px; align-items: center; }
.coach-feed { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
.coach-msg { font-size: 13px; padding: 8px 11px; border-radius: 9px; background: rgba(255,255,255,.04); border-left: 3px solid var(--dim); }
.coach-msg.warn { border-left-color: var(--red); background: rgba(214,64,69,.08); }
.coach-msg.opp { border-left-color: var(--green); background: rgba(129,182,76,.08); }
.coach-msg.info { border-left-color: var(--blue); }
.coach-msg.coach { border-left-color: var(--accent); }
.pg-log { max-height: 120px; overflow-y: auto; font-size: 12.5px; color: var(--dim); line-height: 1.8; }
.ok { color: var(--green); } .bad { color: #e8767a; }
.coach-out { font-size: 13.5px; margin-top: 8px; line-height: 1.55; color: #d6d3ca; }
.coach-out:empty { display: none; }

/* ---------- weakness report ---------- */
.weakness-panel { margin-bottom: 14px; }
.wk-row { display: grid; grid-template-columns: 150px 1fr 34px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.wk-bar { height: 12px; border-radius: 6px; background: rgba(255,255,255,.05); overflow: hidden; }
.wk-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #e07b39); border-radius: 6px; }
.wk-advice { font-size: 12.5px; padding: 2px 0 8px; }

/* ---------- theory trainer ---------- */
.theory-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.theory-grid { display: grid; grid-template-columns: minmax(380px, 600px) minmax(300px, 400px); gap: 18px; align-items: start; }
.theory-side h3 { margin-top: 8px; }
.th-status { margin: 10px 0; font-weight: 600; font-size: 14px; }
.th-status.ok { color: var(--green); }
.th-status.bad { color: #e8767a; }
.th-status.meh { color: var(--dim); }
.th-line { padding: 8px 0; color: var(--dim); line-height: 1.8; min-height: 40px; }
.dev-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 13px; }
.theory-right { display: flex; flex-direction: column; gap: 10px; }
.opening-info { margin-top: 10px; font-size: 13px; }
.opening-info summary { cursor: pointer; font-weight: 600; font-family: var(--font-display); }
.opening-info p { color: #d6d3ca; margin: 8px 0; }
.opening-info h4 { margin: 10px 0 4px; }
.opening-info ul { margin: 0; padding-left: 1.2em; color: #d6d3ca; }
.tutor-panel { display: flex; flex-direction: column; gap: 8px; }
.tutor-feed { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.tutor-feed:empty { display: none; }
.tutor-ask { flex: 1; min-width: 0; }
.coach-msg.you { border-left-color: var(--accent); background: rgba(212,162,78,.06); }

/* ---------- premium card polish ---------- */
.stat-card, .acc-card, .stat-chip {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.012)), var(--surface-1);
  box-shadow: var(--sh-1); transition: transform .14s, border-color .14s;
}
.stat-card:hover, .acc-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-card b, .stat-chip b, .acc-val { background: linear-gradient(180deg, var(--accent-2), var(--accent-deep)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.elo-big b { background: linear-gradient(180deg, #fff 10%, var(--accent-2) 60%, var(--accent-deep)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -.03em; }
.games-table tbody tr { transition: background .1s; }
.eg-card, .bot-card, .motif-card, .guide-item, .principle-card, .moment { box-shadow: var(--sh-1); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .review-grid, .explore-grid, .train-grid, .eg-play-grid, .play-grid, .theory-grid, .theory-menu, .accounts-grid { grid-template-columns: 1fr; }
  .rv-right { max-height: none; position: static; }
  .learn-grid { grid-template-columns: 1fr; }
  .learn-nav { position: static; max-height: none; }
  main { padding: 26px 24px 60px; }
}

/* ===== MOBILE: top bar + bottom tab nav ===== */
@media (max-width: 820px) {
  .app { flex-direction: column; }

  /* top bar */
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(var(--safe-t) + 10px) 15px 10px;
    background: linear-gradient(180deg, rgba(20,27,23,.82), rgba(12,16,14,.62));
    backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%);
    border-bottom: 1px solid rgba(255,255,255,.09);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 6px 20px rgba(0,0,0,.3);
    position: sticky; top: 0; z-index: 50; flex-shrink: 0;
  }
  .topbar .logo { padding: 0; }
  .topbar .logo-knight { font-size: 24px; }
  .topbar .logo-text { font-size: 18px; }
  .topbar-actions { display: flex; gap: 8px; }

  /* main scroll area between bars */
  main { flex: 1; padding: 18px 16px calc(var(--safe-b) + 84px); }

  /* sidebar → bottom tab bar (liquid glass) */
  .sidebar {
    order: 3; width: 100%; flex-direction: row;
    padding: 7px 8px calc(var(--safe-b) + 7px);
    border-right: none; border-top: 1px solid rgba(255,255,255,.1);
    background: linear-gradient(180deg, rgba(22,29,25,.72), rgba(11,15,13,.9));
    backdrop-filter: blur(26px) saturate(175%); -webkit-backdrop-filter: blur(26px) saturate(175%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 -8px 30px rgba(0,0,0,.4);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  }
  .sidebar nav { position: relative; }
  .nav-item.active { background: linear-gradient(180deg, rgba(241,198,126,.16), rgba(241,198,126,.03)); box-shadow: inset 0 1px 0 rgba(255,255,255,.16); }
  .sidebar > .logo, .sidebar-foot { display: none; }
  .sidebar nav { flex-direction: row; flex: 1; gap: 2px; justify-content: space-around; }
  .nav-item {
    flex-direction: column; gap: 3px; flex: 1; min-width: 0;
    padding: 7px 2px; border-radius: 12px; font-size: 10px; font-weight: 600; text-align: center;
  }
  .nav-item i { width: auto; font-size: 20px; filter: grayscale(.3) opacity(.9); }
  .nav-item span { display: block; letter-spacing: -.01em; opacity: .9; }
  .nav-item.active { background: transparent; color: var(--accent-2); }
  .nav-item.active i { filter: none; transform: translateY(-1px); }
  .nav-item.active::before { display: none; }
  .nav-item.active span { opacity: 1; }

  /* board views stack cleanly, board first & full width */
  .board-row { gap: 8px; }
  .evalbar { width: 14px; }
  .board-host, .board-row { max-width: 560px; }
  .rv-left, .ex-left, .eg-play-grid > div:first-child, .play-grid > div:first-child,
  .theory-grid > div:first-child { max-width: 560px; margin: 0 auto; width: 100%; }
  .rv-right, .play-side, .theory-right, .ex-right { position: static; max-height: none; }

  /* tighten dense grids */
  .bot-grid { grid-template-columns: 1fr 1fr; }
  .principle-grid, .stats-grid, .eg-grid, .motif-grid { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 24px; }
  h1 { font-size: 24px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; padding-bottom: calc(var(--safe-b) + 16px); }
}

@media (max-width: 460px) {
  .bot-grid, .import-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .rv-controls .btn span { display: none; }
  .games-table { font-size: 12.5px; }
  .nav-item span { font-size: 9.5px; }
}

/* ---------- puzzles ---------- */
.pz-arena { display: grid; grid-template-columns: minmax(360px, 620px) minmax(300px, 400px); gap: 18px; align-items: start; margin-top: 12px; }
.pz-arena-board { min-width: 0; }
.pz-arena-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }
.pz-turn-row { font-size: 15px; }
.pz-turn-chip { display: inline-block; width: 15px; height: 15px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.pz-turn-chip.w { background: #f2ecdc; } .pz-turn-chip.b { background: #2a2d2a; }
.pz-find { font-size: 13px; }
.pz-outcome:empty { display: none; }
.pz-verdict { font-family: var(--font-display); font-size: 20px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.pz-verdict .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.pz-verdict.ok { color: var(--green); }
.pz-verdict.bad { color: #e8767a; }
.pz-links { margin-top: 6px; font-size: 12px; }

/* rated stat bar */
.pz-ratebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pz-rate b { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.03em;
  background: linear-gradient(180deg,#fff 8%,var(--accent-2) 58%,var(--accent-deep)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.pz-rate span { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.pz-rate-meta { display: flex; gap: 18px; }
.pz-rate-meta div { text-align: center; }
.pz-rate-meta b { font-family: var(--font-mono); font-size: 17px; color: var(--text); }
.pz-rate-meta span { display: block; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }

/* theme + review bars */
.pz-theme-bar .chip-row { margin: 0; }
.pz-review-bar b { font-size: 20px; color: var(--accent-2); font-family: var(--font-display); }
.pz-review-empty { text-align: center; padding: 30px 20px; }
.pz-review-empty h3 { display: inline-flex; align-items: center; gap: 8px; justify-content: center; color: var(--green); }
.pz-review-empty h3 .ic { width: 22px; height: 22px; stroke-width: 2.4; }
.due-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 6px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700; font-family: var(--font-mono); vertical-align: 1px; }

/* puzzle rush */
.pz-rush-setup { text-align: center; padding: 26px 20px; }
.pz-rush-setup h3 { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.pz-rush-setup .row { justify-content: center; }
.pz-rush-bests { display: flex; gap: 26px; justify-content: center; margin-top: 20px; }
.pz-rush-bests div { text-align: center; }
.pz-rush-bests b { font-family: var(--font-display); font-size: 24px; color: var(--accent-2); display: block; }
.pz-rush-bests span { font-size: 11px; color: var(--dim); }
.pz-rush-hud { display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center; align-items: center; }
.pz-rush-hud > div span { display: block; font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }
.rush-score b { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--accent-2); line-height: 1; }
.rush-timer { font-family: var(--font-mono); font-size: 26px; font-weight: 600; }
.rush-timer.low { color: var(--red); animation: pulse .8s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.rush-strikes { font-size: 22px; letter-spacing: 3px; color: var(--red); }
.rush-right b { font-family: var(--font-display); font-size: 26px; color: var(--text); }
.pz-rush-summary { text-align: center; padding: 34px 20px; }
.pz-rush-summary h2 { font-size: 44px; background: linear-gradient(180deg,#fff,var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.pz-rush-summary .row { justify-content: center; }
.pz-rush-arena .pz-arena-side { gap: 8px; }

@media (max-width: 1080px) { .pz-arena { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .pz-arena-board { max-width: 560px; margin: 0 auto; width: 100%; }
  .pz-arena-side { position: static; }
  .pz-ratebar { justify-content: center; text-align: center; }
  .pz-rate-meta { gap: 14px; }
}

/* captured-pieces tray (review) */
.captured-tray { display: flex; align-items: center; gap: 1px; min-height: 22px; padding: 2px 2px; flex-wrap: wrap; }
.captured-tray:empty { display: none; }
.cap-pc { width: 19px; height: 19px; opacity: .92; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); margin-left: -3px; }
.cap-pc:first-child { margin-left: 0; }
.cap-adv { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent-2); margin-left: 8px; }
