/* ═══════════════════════════════════════════════════════════════
   ChessReview — tournament-hall dark theme
   One neutral ramp, one accent (green, used sparingly).
   The board and the eval graph carry the color; chrome stays quiet.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #2a2825;            /* page */
  --bg-deep: #211f1d;       /* topbar, wells */
  --panel: #2e2b28;         /* cards */
  --panel-2: #363230;       /* hover / raised */
  --card: #3a3633;
  --border: #3d3936;
  --hairline: rgba(255, 255, 255, 0.08);
  --text: #f0eee9;          /* primary */
  --text-dim: #b5b1ab;      /* secondary */
  --text-muted: #86827c;    /* muted */

  --green: #7fae4c;         /* accent — actions & verdicts only */
  --green-hover: #8cbd59;
  --green-bevel: #5e873a;
  --green-text: #8fc45a;    /* accent as text (dark surfaces) */
  --amber: #d6b25e;         /* title badges, caution */

  --loss: #e05a4e;
  --win: #7fae4c;
  --draw: #9a968f;

  --sq-light: #d9a677;
  --sq-dark: #b06f3d;
  --sq-light-g: #ebecd0;
  --sq-dark-g: #739552;
  --hl: rgba(247, 247, 105, 0.45);

  --radius: 12px;
  --radius-s: 8px;
  --font: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Consolas', 'SF Mono', monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--green-text); }
button { font-family: inherit; cursor: pointer; }
img { -webkit-user-drag: none; user-select: none; }

.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* live dot — the "we're watching" signature */
.dot-live {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); margin-right: 8px; vertical-align: 1px;
  animation: dot-pulse 2.4s ease infinite;
}
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { display: flex; width: 26px; height: 26px; color: var(--green); }
.brand-logo svg { width: 26px; height: 26px; display: block; }
.brand-text { font-size: 18px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.brand-text em { font-style: normal; color: var(--green-text); }
.topnav { display: flex; align-items: center; gap: 24px; }
.topnav > a:not(.btn) { color: var(--text-dim); font-weight: 500; font-size: 14px; }
.topnav > a:not(.btn):hover { color: var(--text); }
@media (max-width: 640px) { .topnav > a:not(.btn) { display: none; } }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  border: none; border-radius: var(--radius-s);
  font-weight: 600; letter-spacing: 0.1px;
  padding: 11px 22px; font-size: 14.5px;
  transition: background 0.15s var(--ease), transform 0.06s ease;
}
.btn:active { transform: translateY(1px); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 2px 0 var(--green-bevel); }
.btn-green:hover { background: var(--green-hover); }
.btn-green:active { box-shadow: 0 1px 0 var(--green-bevel); }
.btn-green:disabled { background: #57683f; color: #b6c9a4; cursor: default; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border);
  padding: 9px 16px; font-weight: 500; font-size: 13.5px;
}
.btn-ghost:hover { color: var(--text); border-color: #57534e; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; display: block; }
.link-btn {
  background: none; border: none; color: var(--green-text);
  font-size: 13px; font-weight: 500; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ── Account area ────────────────────────────────────────────── */
#authArea { display: inline-flex; gap: 8px; }
#authArea[hidden], #userArea[hidden], .user-menu.hidden { display: none !important; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius-s); padding: 5px 12px 5px 6px;
  color: var(--text); font-weight: 500; font-size: 13.5px;
}
.user-chip:hover { background: var(--panel-2); }
.caret { color: var(--text-muted); font-size: 10px; }
.user-menu {
  position: absolute; top: 62px; right: max(16px, calc(50% - 620px)); width: 300px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); padding: 16px; z-index: 100;
}
.user-menu-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.menu-name { font-weight: 600; font-size: 15px; }
.menu-sub { color: var(--text-muted); font-size: 12px; }
.menu-section-title {
  font-size: 12px; color: var(--text-muted); font-weight: 500; margin: 14px 0 8px;
}
.link-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-s); background: var(--bg-deep);
  margin-bottom: 6px; font-size: 13.5px;
}
.platform-tag {
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: 4px; background: rgba(255, 255, 255, 0.07); color: var(--text-dim);
}
.link-row .handle { font-weight: 600; }
.v-chip {
  font-size: 11px; font-weight: 500; border-radius: 4px;
  padding: 2px 6px; background: rgba(217, 178, 94, 0.14); color: var(--amber);
}
.v-chip.ok { background: rgba(127, 174, 76, 0.16); color: var(--green-text); }
.v-btn {
  margin-left: auto; border: 1px solid var(--border); color: var(--text-dim); background: none;
  font-size: 12px; font-weight: 500; border-radius: 6px; padding: 3px 9px;
}
.v-btn:hover { color: var(--text); border-color: #57534e; }
.link-row .unlink {
  margin-left: auto; background: none; border: none; color: var(--text-muted);
  font-size: 12px; padding: 2px 6px; border-radius: 4px;
}
.link-row:has(.v-btn) .unlink { margin-left: 0; }
.link-row .unlink:hover { color: var(--loss); }
.link-form { display: flex; gap: 6px; margin-top: 4px; }
.link-form select, .link-form input {
  background: var(--bg-deep); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-size: 13px; padding: 7px 8px; outline: none; min-width: 0;
}
.link-form input { flex: 1; }
.link-form input:focus, .link-form select:focus { border-color: var(--green); }
.menu-logout { width: 100%; margin-top: 12px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 14, 13, 0.65); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 360px; max-width: 100%; padding: 24px; position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  color: var(--text-muted); font-size: 15px;
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 19px; font-weight: 600; margin-bottom: 16px; }
.modal .seg { margin-bottom: 16px; }
.field-label {
  display: block; font-size: 13px; color: var(--text-muted); margin: 12px 0 6px;
}
.modal input {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-s); padding: 10px 12px; font-size: 14px; font-family: inherit; outline: none;
}
.modal input:focus { border-color: var(--green); }
.modal .btn-block { margin-top: 18px; }
.auth-note { color: var(--text-muted); font-size: 12.5px; margin-top: 14px; line-height: 1.55; }
.error-msg {
  margin-top: 12px; background: rgba(224, 90, 78, 0.1); border: 1px solid rgba(224, 90, 78, 0.4);
  color: #f0b5ad; padding: 9px 12px; border-radius: var(--radius-s); font-size: 13.5px;
}
.error-msg.ok-msg {
  background: rgba(127, 174, 76, 0.1); border-color: rgba(127, 174, 76, 0.4); color: #c2ddb0;
}
.verify-intro { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; margin: 4px 0 16px; }
.verify-code {
  font-family: var(--mono); font-size: 21px; font-weight: 700; text-align: center;
  background: var(--bg-deep); border: 1px dashed var(--border); border-radius: var(--radius-s);
  padding: 13px; margin-bottom: 10px; letter-spacing: 2px; color: var(--green-text);
  user-select: all;
}
#verifyCopy { display: block; margin: 0 auto 14px; }

/* ── Toasts ──────────────────────────────────────────────────── */
#toastStack {
  position: fixed; left: 20px; bottom: 20px; z-index: 300; display: flex;
  flex-direction: column; gap: 10px; max-width: 340px;
}
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--green);
  border-radius: var(--radius-s); padding: 12px 14px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.22s var(--ease);
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-head { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.toast-body { color: var(--text-dim); font-size: 13px; }
.toast-body b { color: var(--text); font-weight: 600; }
.toast-actions { display: flex; gap: 8px; margin-top: 10px; }
.toast .btn-sm { padding: 6px 12px; font-size: 12.5px; }
.toast.dismiss { animation: toast-out 0.2s ease forwards; }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

.watch-hint {
  margin-top: 12px; font-size: 13px; color: var(--text-dim);
  background: var(--bg-deep); border: 1px solid var(--hairline);
  border-radius: var(--radius-s); padding: 10px 12px;
}
.watch-hint b { color: var(--text); font-weight: 600; }

/* ── Hero: asymmetric split ──────────────────────────────────── */
.view { max-width: 1240px; margin: 0 auto; padding: 0 24px 48px; width: 100%; }
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px;
  align-items: center; padding: 64px 0 48px;
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 44px 0 36px; }
}
.hero h1 {
  font-size: clamp(30px, 4vw, 42px); font-weight: 600; letter-spacing: -0.8px;
  line-height: 1.12; margin: 0 0 16px;
}
.hero h1 .accent { color: var(--green-text); }
.hero-sub { color: var(--text-dim); max-width: 46ch; margin: 0 0 20px; font-size: 15.5px; }
.hero-badges {
  display: flex; gap: 8px; flex-wrap: wrap;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
}
.hero-badges span::after { content: "·"; margin: 0 8px; color: var(--border); }
.hero-badges span:last-child::after { content: ""; margin: 0; }

/* ── Search card ─────────────────────────────────────────────── */
.search-card {
  background: var(--panel); border: 1px solid var(--hairline);
  border-radius: 14px; padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.seg { display: flex; background: var(--bg-deep); border-radius: var(--radius-s); padding: 3px; margin-bottom: 16px; }
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--text-dim);
  padding: 9px 0; border-radius: 6px; font-weight: 500; font-size: 14px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.seg-btn.active { background: var(--green); color: #fff; }
.search-row { display: flex; gap: 10px; }
.search-row input {
  flex: 1; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-s); padding: 11px 14px; font-size: 14.5px; font-family: inherit; outline: none; min-width: 0;
}
.search-row input:focus { border-color: var(--green); }
.or-divider {
  display: flex; align-items: center; gap: 12px; color: var(--text-muted);
  font-size: 12.5px; margin: 16px 0 0;
}
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.pgn-details summary { cursor: pointer; color: var(--text-dim); font-weight: 500; font-size: 14px; padding: 8px 0; }
.pgn-details summary:hover { color: var(--text); }
.pgn-details textarea {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-s); padding: 10px; font-size: 12.5px; font-family: var(--mono);
  resize: vertical; margin-bottom: 10px;
}
.pgn-details textarea:focus { outline: none; border-color: var(--green); }

/* ── Extension strip ─────────────────────────────────────────── */
.ext-card {
  max-width: 560px; margin: 16px auto 0; display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); font-size: 13.5px; line-height: 1.5;
  padding: 14px 16px; background: var(--bg-deep); border: 1px solid var(--hairline);
  border-radius: var(--radius); flex-wrap: wrap;
}
@media (min-width: 981px) { .ext-card { margin: 16px 0 0; } }
.ext-icon { display: flex; width: 22px; height: 22px; color: var(--green); flex: none; }
.ext-icon svg { width: 22px; height: 22px; }
.ext-info { flex: 1; min-width: 220px; }
.ext-title { font-weight: 600; color: var(--text); font-size: 14px; }
.ext-why { margin-top: 2px; }
.ext-why b { color: var(--text); font-weight: 600; }
.ext-steps { display: none; }
.ext-download { flex: none; }

/* ── Loading ─────────────────────────────────────────────────── */
.loading-card {
  max-width: 560px; margin: 22px auto 0; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 14px;
  color: var(--text-dim); font-weight: 500;
}
.spinner {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  border: 2px solid var(--border); border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Profile + games table ───────────────────────────────────── */
#gamesWrap { padding-top: 40px; }
.profile-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.profile-chip { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px;
  overflow: hidden; flex: none;
}
.avatar.sm { width: 34px; height: 34px; font-size: 15px; }
.avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.avatar-img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel-2); }
.profile-name { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.title-badge {
  background: var(--amber); color: #211f1d; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px;
}
.profile-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); }
.table-card { overflow-x: auto; }
.games-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.games-table th {
  text-align: left; font-size: 12.5px; color: var(--text-muted); font-weight: 500;
  padding: 12px 14px; border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.games-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--hairline); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.games-table tbody tr { cursor: pointer; transition: background 0.12s var(--ease); }
.games-table tbody tr:hover { background: var(--panel-2); }
.games-table tbody tr:last-child td { border-bottom: none; }
.games-table .col-result { width: 44px; }
.games-table .col-opening { width: 28%; }
.games-table .col-time { width: 108px; }
.games-table .col-moves { width: 64px; text-align: center; }
.games-table .col-date { width: 104px; }
.games-table .col-action { width: 92px; }
@media (max-width: 900px) {
  .games-table .col-moves, .games-table .th-moves { display: none; }
  .games-table .col-opening { width: 22%; }
}
@media (max-width: 720px) {
  .games-table .col-date, .games-table .th-date,
  .games-table .col-opening, .games-table .th-opening { display: none; }
}
.res-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  font-weight: 600; font-size: 12.5px; color: #fff;
}
.res-pill.win { background: var(--win); }
.res-pill.loss { background: var(--loss); }
.res-pill.draw { background: var(--draw); }
.opp-cell { display: flex; align-items: center; gap: 10px; }
.opp-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px;
  overflow: hidden; flex: none;
}
.opp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.opp-meta { min-width: 0; }
.opp-name { font-weight: 500; }
.opp-sub, .cell-dim { color: var(--text-muted); font-size: 12.5px; }
.color-chip {
  display: inline-flex; width: 14px; height: 14px; border-radius: 4px;
  vertical-align: -2px; margin-left: 6px; border: 1px solid var(--border);
}
.color-chip.w { background: #eceae6; }
.color-chip.b { background: #26241f; }
.review-btn {
  background: var(--green); border: none; color: #fff; font-weight: 600;
  padding: 7px 16px; border-radius: 6px; font-size: 13px;
}
.review-btn:hover { background: var(--green-hover); }

/* ── Home sections ───────────────────────────────────────────── */
.home-sections { padding-top: 56px; max-width: 880px; }
.home-sections h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 16px; }
.steps { display: flex; flex-direction: column; margin-bottom: 48px; }
.step {
  display: flex; gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
  color: var(--text-dim); font-size: 14px;
}
.step b { color: var(--text); font-weight: 600; }
.step-num {
  font-family: var(--mono); color: var(--text-muted); font-size: 13px; flex: none; width: 20px;
}
.legend-sub { color: var(--text-muted); margin: -6px 0 16px; font-size: 14px; }
.legend-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 24px; margin-bottom: 48px; }
@media (max-width: 800px) { .legend-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .legend-grid { grid-template-columns: 1fr; } }
.legend-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  font-size: 13.5px; color: var(--text-dim); font-weight: 500;
}
.faq details {
  border-bottom: 1px solid var(--hairline); padding: 14px 0;
}
.faq summary { cursor: pointer; font-weight: 500; font-size: 14.5px; color: var(--text); }
.faq p { color: var(--text-dim); margin: 10px 0 0; font-size: 14px; }

/* ── Badge icons ─────────────────────────────────────────────── */
.badge-icon {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; color: #fff;
  font-weight: 600; font-size: 12px; flex: none;
}
.badge-icon svg { width: 13px; height: 13px; }
.badge-icon.lg { width: 32px; height: 32px; font-size: 15px; }
.badge-icon.lg svg { width: 17px; height: 17px; }
.badge-icon.sm { width: 17px; height: 17px; font-size: 9.5px; }
.badge-icon.sm svg { width: 9.5px; height: 9.5px; }

/* ── Review head ─────────────────────────────────────────────── */
.review-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 0 14px; flex-wrap: wrap;
}
.review-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-chip {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 6px;
  padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--text-dim);
}
.meta-chip.link { color: var(--green-text); }

/* ── Review layout ───────────────────────────────────────────── */
.review-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start;
}
@media (min-width: 1081px) {
  .review-layout { height: calc(100vh - 128px); grid-template-rows: minmax(0, 1fr); }
  .review-sidebar { height: 100%; min-height: 0; overflow: hidden; }
  .board-col { width: min(100%, calc(100vh - 300px)); max-width: 880px; margin: 0; }
  .review-sidebar .move-list-wrap { flex: 1 1 0; min-height: 70px; max-height: none; }
  .review-sidebar .acc-rows { max-height: 160px; overflow-y: auto; }
}
@media (max-width: 1080px) { .review-layout { grid-template-columns: 1fr; } }

.board-col { max-width: 880px; }
@media (max-width: 1080px) { .board-col { max-width: 640px; margin: 0 auto; width: 100%; } }

.player-bar { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.player-name { font-weight: 600; font-size: 15px; }
.player-rating { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.move-badge-slot { display: flex; align-items: center; gap: 8px; }
.move-badge-label { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.clock-pill {
  margin-left: auto; background: #eceae6; color: #211f1d; border-radius: 6px;
  font-weight: 600; font-size: 14px; padding: 3px 10px; min-width: 52px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.clock-pill.inactive { background: var(--panel-2); color: var(--text-muted); }

.board-row { display: flex; gap: 10px; }
.eval-bar {
  width: 18px; border-radius: 5px; background: #1d1b19; position: relative; overflow: hidden;
  flex: none; align-self: stretch; border: 1px solid var(--border);
}
.eval-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 50%;
  background: #eceae6; transition: height 0.35s var(--ease);
}
.eval-bar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--green);
}
.eval-num {
  position: absolute; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 600;
  font-family: var(--mono); z-index: 2; pointer-events: none;
}
.eval-num.top { top: 0; color: #8d8a86; }
.eval-num.bot { bottom: 0; color: #57534e; }

.board-outer { position: relative; flex: 1; min-width: 0; }
.board {
  width: 100%; aspect-ratio: 1 / 1; display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 12px 32px rgba(0, 0, 0, 0.4);
  touch-action: manipulation;
}
.board.green-theme .sq.light { background: var(--sq-light-g); }
.board.green-theme .sq.dark  { background: var(--sq-dark-g); }
.sq { position: relative; }
.sq.light { background: var(--sq-light); }
.sq.dark  { background: var(--sq-dark); }
.sq .coord {
  position: absolute; font-size: clamp(8px, 1.3vw, 11px); font-weight: 600; opacity: 0.75; pointer-events: none;
}
.sq .coord.file { right: 3px; bottom: 2px; }
.sq .coord.rank { left: 3px; top: 2px; }
.sq.light .coord { color: var(--sq-dark); }
.sq.dark .coord  { color: var(--sq-light); }
.sq.last-move::before { content: ""; position: absolute; inset: 0; background: var(--hl); }
.sq.check::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255, 40, 40, 0.7), rgba(231, 0, 0, 0.25) 60%, transparent 75%);
}
.sq.selected::before { content: ""; position: absolute; inset: 0; background: rgba(127, 174, 76, 0.5); }
.sq .dot, .sq .ring {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
}
.sq .dot { width: 30%; height: 30%; background: rgba(20, 20, 20, 0.22); }
.sq .ring { width: 88%; height: 88%; border: 4px solid rgba(20, 20, 20, 0.22); background: none; }

.piece {
  position: absolute; width: 12.5%; height: 12.5%; padding: 0; z-index: 3;
  transition: transform 0.24s var(--ease); will-change: transform; pointer-events: none;
}
.piece img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35)); }
.piece.just-moved img { animation: land 0.28s ease; }
@keyframes land { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }

.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* on-board classification badge — top-right corner of the destination square */
.sq-badge {
  position: absolute; width: 42%; height: 42%; left: 68%; top: -6%; z-index: 6;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: clamp(12px, 2.2vw, 18px); line-height: 1;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.55), 0 0 0 1.5px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.sq-badge svg { width: 62%; height: 62%; }

/* brilliant celebration */
.sq-badge.brilliant-celebrate {
  text-shadow: 0 0 10px rgba(38, 194, 163, 0.95);
  box-shadow: 0 0 24px rgba(38, 194, 163, 0.85), 0 3px 10px rgba(0, 0, 0, 0.45);
}
.sq-badge.brilliant-celebrate::before,
.sq-badge.brilliant-celebrate::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid rgba(38, 194, 163, 0.9); animation: ring-out 1.1s ease-out 0.1s;
}
.sq-badge.brilliant-celebrate::after { animation-delay: 0.4s; }
.brilliant-ring {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid rgba(38, 194, 163, 0.75);
  animation: ring-out 1.2s ease-out 0.7s both;
}
@keyframes ring-out { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.6); opacity: 0; } }
.sparkle {
  position: absolute; left: 50%; top: 50%; width: 16%; height: 16%;
  background: #7ef0d6; border-radius: 50%;
  box-shadow: 0 0 10px rgba(38, 194, 163, 0.95);
  animation: sparkle-fly 0.95s cubic-bezier(0.12, 0.65, 0.3, 1) both;
}
@keyframes sparkle-fly {
  0% { transform: rotate(var(--a)) translateY(-8%) scale(0.3); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(calc(-1 * var(--d, 400%))) scale(1.15); opacity: 0; }
}
.brilliant-glow {
  position: absolute; inset: 0; z-index: 7; pointer-events: none; border-radius: 4px;
  box-shadow: inset 0 0 90px rgba(38, 194, 163, 0.55);
  background: radial-gradient(circle at 50% 45%, rgba(38, 194, 163, 0.18), transparent 65%);
  animation: glow-fade 1s ease-out both;
}
@keyframes glow-fade { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }
.brilliant-confetti { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; border-radius: 4px; }
.brilliant-confetti span {
  position: absolute; left: 50%; top: 46%; width: 7px; height: 11px; border-radius: 2px;
  animation: confetti-fly 1.25s cubic-bezier(0.15, 0.6, 0.35, 1) both;
}
@keyframes confetti-fly {
  0% { transform: rotate(var(--a)) translateY(0) rotate(0deg) scale(var(--s, 1)); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateY(calc(-1 * var(--d, 300%))) rotate(540deg) scale(var(--s, 1)); opacity: 0; }
}
.brilliant-chip {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%); z-index: 10;
  background: #1aa88d; color: #fff; font-size: clamp(15px, 2.4vw, 22px); font-weight: 600;
  letter-spacing: 1px; padding: 7px 20px; border-radius: 999px; pointer-events: none;
  box-shadow: 0 6px 22px rgba(38, 194, 163, 0.55);
  animation: chip-in-out 1.8s ease both;
}
@keyframes chip-in-out {
  0% { transform: translateX(-50%) translateY(-16px) scale(0.7); opacity: 0; }
  14% { transform: translateX(-50%) translateY(0) scale(1.06); opacity: 1; }
  22% { transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translateX(-50%) translateY(-10px); opacity: 0; }
}
.board-pulse { animation: board-pulse 0.45s ease; }
@keyframes board-pulse { 0% { transform: scale(1); } 30% { transform: scale(1.012); } 60% { transform: scale(0.997); } 100% { transform: scale(1); } }

.board-banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 8; background: rgba(20, 18, 16, 0.88); border-radius: var(--radius);
  padding: 16px 36px; text-align: center; pointer-events: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  animation: banner-in 0.45s var(--ease) both;
}
.board-banner-title { font-size: clamp(22px, 4vw, 32px); font-weight: 600; letter-spacing: 2px; color: var(--text); }
.board-banner-sub { font-size: clamp(12px, 1.7vw, 14px); font-weight: 500; color: var(--text-dim); margin-top: 4px; }
@keyframes banner-in {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.flip-btn { position: absolute; top: 8px; right: 8px; z-index: 6; width: 34px; height: 34px; border-radius: 8px; }
.flip-btn svg { width: 17px; height: 17px; }
.theme-btn { position: absolute; top: 48px; right: 8px; z-index: 6; width: 34px; height: 34px; border-radius: 8px; }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn.on { color: var(--green-text); background: rgba(127, 174, 76, 0.14); }
#btnExitExplore {
  position: absolute; top: 8px; left: 8px; z-index: 6; width: auto; padding: 0 12px;
  height: 34px; border-radius: 999px; font-weight: 500; font-size: 12.5px;
  background: rgba(217, 178, 94, 0.18); color: var(--amber);
}
.explore-tag {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: rgba(217, 178, 94, 0.15); color: var(--amber);
  border: 1px solid rgba(217, 178, 94, 0.5);
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 10px;
}

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-s); border: none;
  background: var(--panel-2); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn.xs { width: 30px; height: 30px; font-size: 15px; }

.engine-line {
  margin-top: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 12px;
  font-size: 13px; min-height: 44px; flex-wrap: wrap;
}
.engine-tag {
  background: var(--bg-deep); border-radius: 5px; padding: 3px 9px;
  font-weight: 600; font-size: 12px; color: var(--text-muted); flex: none;
}
.engine-eval {
  font-weight: 600; font-size: 15px; background: var(--bg-deep); padding: 3px 10px;
  border-radius: 5px; color: var(--text); flex: none; min-width: 58px; text-align: center;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.engine-pv { color: var(--text-muted); font-family: var(--mono); font-size: 12.5px; min-width: 0; }

/* ── Review sidebar ──────────────────────────────────────────── */
.review-sidebar { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-bottom: 1px solid var(--hairline); color: var(--text-muted);
}
.sidebar-title { font-weight: 600; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.dot-logo {
  width: 20px; height: 20px; border-radius: 6px; background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.heart, .magnifier { font-size: 15px; }
.heart:hover { color: var(--loss); }

.coach-card { display: flex; gap: 10px; padding: 12px 14px 6px; align-items: flex-start; }
.coach-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); color: var(--text-dim); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 600;
  transition: background 0.2s ease;
}
.coach-avatar.as-badge { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); }
.coach-avatar svg { width: 58%; height: 58%; }
.coach-bubble {
  background: #eceae6; color: #26241f; border-radius: 10px; padding: 9px 12px;
  font-size: 13px; font-weight: 500; line-height: 1.45; position: relative;
}
.coach-bubble::before {
  content: ""; position: absolute; left: -5px; top: 13px; width: 10px; height: 10px;
  background: #eceae6; transform: rotate(45deg); border-radius: 2px;
}
.coach-line { animation: fade-in 0.25s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.coach-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.coach-move { font-weight: 600; }
.coach-eval {
  background: var(--green); color: #fff; font-weight: 600; font-size: 12.5px;
  border-radius: 999px; padding: 2px 9px; font-family: var(--mono); font-variant-numeric: tabular-nums;
}

.start-card { padding: 12px 14px 4px; }
.start-card .depth-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.depth-row select {
  flex: 1; background: var(--bg-deep); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-family: inherit; font-weight: 500; outline: none;
}
.start-card .btn-block { padding: 10px 18px; font-size: 14px; }
.progress-wrap { margin-top: 12px; }
.progress-track { height: 6px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--green); border-radius: 999px; transition: width 0.2s; }
.progress-row { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

.next-key { margin: 10px 12px 0; }
.next-key { font-weight: 600; }

/* accuracy table */
.acc-table { padding: 10px 14px 4px; }
.acc-header {
  display: grid; grid-template-columns: 88px 1fr 1fr; gap: 6px; align-items: center;
  padding-bottom: 8px; border-bottom: 1px solid var(--hairline);
}
.acc-player { display: flex; align-items: center; gap: 7px; min-width: 0; }
.acc-name-box { min-width: 0; }
.acc-name { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-elo { font-size: 11px; color: var(--text-muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.acc-row {
  display: grid; grid-template-columns: 88px 1fr 1fr; gap: 6px; align-items: center;
  padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.acc-row:last-child { border-bottom: none; }
.acc-label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; color: var(--text-dim); }
.acc-label .badge-icon { width: 20px; height: 20px; font-size: 10px; }
.acc-label .badge-icon svg { width: 10px; height: 10px; }
.acc-val {
  justify-self: center; min-width: 40px; text-align: center; font-weight: 600; font-size: 13px;
  border-radius: 999px; padding: 2px 9px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.acc-row.accuracy .acc-val { font-size: 15px; }
.acc-row.accuracy .acc-val.set { color: var(--text); background: var(--bg-deep); }
.acc-val.zero { opacity: 0.4; }

/* eval graph */
.graph-wrap { position: relative; margin: 10px 12px 2px; }
#evalGraph { width: 100%; display: block; border-radius: 8px; background: #1d1b19; cursor: pointer; }
.graph-tip {
  position: absolute; background: #eceae6; color: #211f1d; font-size: 12px; font-weight: 600;
  border-radius: 6px; padding: 4px 8px; pointer-events: none; white-space: nowrap; z-index: 10;
  transform: translate(-50%, -130%); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}
.graph-tip::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px;
  background: #eceae6; transform: translateX(-50%) rotate(45deg); border-radius: 1px;
}

/* move list — light strip */
.move-list-wrap {
  background: #eceae6; margin: 10px 12px; border-radius: 10px; padding: 6px;
  overflow-y: auto; flex: 1 1 auto; min-height: 160px; max-height: 300px;
  position: relative; scrollbar-width: thin;
}
.move-list-wrap::-webkit-scrollbar { width: 8px; }
.move-list-wrap::-webkit-scrollbar-thumb { background: #c5c1bb; border-radius: 6px; }
.ml-row { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 3px; align-items: stretch; padding: 1px 0; }
.ml-num {
  color: #8f8a84; font-size: 12.5px; font-weight: 500; text-align: right;
  padding-right: 4px; align-self: center; font-variant-numeric: tabular-nums;
}
.ml-move {
  display: flex; align-items: center; gap: 5px; border-radius: 5px; padding: 4px 8px;
  cursor: pointer; font-weight: 500; font-size: 13.5px; min-width: 0;
  transition: background 0.12s var(--ease), outline-color 0.12s var(--ease);
}
.ml-move.w { background: #ffffff; color: #26241f; }
.ml-move.b { background: #3a3633; color: #fff; }
.ml-move:hover { outline: 2px solid rgba(127, 174, 76, 0.55); }
.ml-move.active { background: var(--green) !important; color: #fff !important; animation: land 0.25s ease; }
.ml-move .badge-icon.sm { flex: none; animation: fade-in 0.18s var(--ease); }
.ml-move span.san { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* nav controls */
.nav-controls {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  padding: 10px 12px 14px; border-top: 1px solid var(--hairline);
}
.nav-controls .icon-btn.play { background: var(--green); color: #fff; }
.nav-controls .icon-btn.play:hover { background: var(--green-hover); }
.nav-controls .icon-btn.muted { color: #6d6963; }
.sound-select {
  background: var(--bg-deep); color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; font-weight: 500; font-size: 11.5px;
  padding: 5px 4px; outline: none; max-width: 108px;
}
.sound-select:hover { color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--hairline); padding: 24px; text-align: center;
  color: var(--text-muted); font-size: 13px; max-width: 760px; margin: 40px auto 0;
}
.footer b { color: var(--text-dim); font-weight: 600; }
.footer-sub { font-size: 12px; margin-top: 8px; color: #6d6963; }
.footer a { color: var(--text-dim); text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #454140; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #57534e; }
