/* ==========================================================================
   Design tokens — mirrors the original's oklch palette (dark default, light opt-in)
   ========================================================================== */
:root {
  /* ChessOpener palette (dark) */
  --background: #0A0C10;
  --surface: #14171E;
  --surface-hover: #1B1F28;
  --surface-strong: #232833;
  --border-subtle: #262B36;
  --text-primary: #F4F5F7;
  --text-secondary: #9AA1AE;
  --text-muted: #6E7684;
  --brand: #2FD483;
  --brand-deep: #0E7A4A;
  --brand-fg: #0A0C10;
  --gold: #F5B940;
  --danger: #FF5A5F;
  --info: #5AA9FF;
  --win: #2FD483;
  --loss: #FF5A5F;
  --draw: #9AA1AE;
  --chess-light-sq: oklch(90% .03 85);
  --chess-dark-sq: oklch(60% .07 55);
  --chess-last-move: oklch(85% .15 120 / .5);
  --chess-highlight: color-mix(in oklch, var(--brand) 55%, transparent);
  --hero-a: #0F3A27;
  --hero-b: #0B1712;
  --hero-c: #0A0C10;
  --page: #0A0C10;
  --overlay: oklch(0% 0 0 / .45);
  --on-hero: #F4F5F7;
  --shadow-card: 0 1px 0 oklch(100% 0 0 / .04) inset, 0 10px 30px -12px oklch(0% 0 0 / .6);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius: 10px;
  color-scheme: dark;

  /* move-classification palette */
  --c-brilliant: #2CC5C0;
  --c-great: var(--info);
  --c-book: #B89263;
  --c-best: var(--brand);
  --c-excellent: #7FE0AE;
  --c-good: #8FB8A2;
  --c-inaccuracy: var(--gold);
  --c-mistake: #FF9447;
  --c-miss: #FF7A7E;
  --c-blunder: var(--danger);
}

:root[data-theme="light"] {
  /* ChessOpener palette (light) */
  --background: #F6F7F9;
  --surface: #FFFFFF;
  --surface-hover: #F0F2F5;
  --surface-strong: #E6E9EE;
  --border-subtle: #E2E5EA;
  --text-primary: #0E1116;
  --text-secondary: #5B6270;
  --text-muted: #7A818E;
  --brand: #12A862;
  --brand-deep: #0B7A46;
  --brand-fg: #0A0C10;
  --gold: #D99A12;
  --danger: #E5383B;
  --info: #2F80ED;
  --win: #12A862;
  --loss: #E5383B;
  --draw: #5B6270;
  --hero-a: #D3F5E3;
  --hero-b: #EEF8F2;
  --hero-c: #F6F7F9;
  --page: #F6F7F9;
  --overlay: oklch(100% 0 0 / .7);
  --on-hero: #0E1116;
  --shadow-card: 0 10px 30px -14px oklch(0% 0 0 / .18);
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.tabular { font-variant-numeric: tabular-nums; }
.win { color: var(--win); } .loss { color: var(--loss); } .draw { color: var(--draw); }
.link { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in oklch, currentColor 40%, transparent); }
.link:hover { color: var(--text-primary); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ==========================================================================
   Logo mark
   ========================================================================== */
.logo { display: inline-flex; align-items: center; gap: 8px; transition: opacity .2s; }
.logo:hover { opacity: .8; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2FD483, #0E7A4A);
  border: 1px solid color-mix(in oklch, var(--brand) 50%, transparent);
  color: #0A0C10; font-size: 17px; line-height: 1;
}
.logo-text { font-weight: 700; letter-spacing: -.02em; font-size: 1rem; text-transform: uppercase; }

/* ==========================================================================
   Top header (marketing pages)
   ========================================================================== */
.site-header { position: relative; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 12px 16px; }
.nav { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.nav-pill-wrap { position: relative; display: inline-flex; }
.nav-pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
  border-radius: 9px; font-size: .875rem; font-weight: 500;
  color: oklch(100% 0 0 / .8);
  background: oklch(100% 0 0 / .06);
  border: 1px solid oklch(100% 0 0 / .12);
  backdrop-filter: blur(8px);
  transition: background .2s, color .2s, border-color .2s;
}
:root[data-theme="light"] .nav-pill { color: var(--text-secondary); background: oklch(100% 0 0 / .6); border-color: var(--border-subtle); }
.nav-pill:hover { background: oklch(100% 0 0 / .12); color: var(--text-primary); }
.nav-new-badge {
  position: absolute; top: -8px; left: 50%; transform: translateX(-10%);
  font-size: 9px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 999px;
  color: var(--brand-fg);
  background: linear-gradient(110deg, var(--brand) 30%, #C9FBE2 50%, var(--brand) 70%);
  background-size: 200% 100%; animation: shimmer 2.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
  transition: background .2s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.community-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: .875rem; font-weight: 500;
  border: 1px solid oklch(58% .2 275 / .5); background: oklch(58% .2 275 / .15);
}
.community-btn:hover { background: oklch(58% .2 275 / .25); }
.signin { font-size: .875rem; font-weight: 500; color: var(--text-muted); }
.signin:hover { color: var(--text-primary); }
.burger { display: none; }

/* ==========================================================================
   Hero
   ========================================================================== */
.home-root { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); }
.hero { position: relative; isolation: isolate; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(120% 90% at 70% 0%, var(--hero-a) 0%, var(--hero-b) 45%, var(--hero-c) 100%); }
.hero-fade { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, oklch(0% 0 0 / .45), oklch(0% 0 0 / .15) 50%, var(--background)); }
:root[data-theme="light"] .hero-fade { background: linear-gradient(to bottom, transparent, transparent 60%, var(--page)); }

.floating-pieces { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.fp { position: absolute; will-change: transform; }
.fp-drift { animation: fp-drift 14s ease-in-out infinite alternate; }
.fp-glyph {
  display: block; pointer-events: auto; user-select: none; line-height: 1;
  color: oklch(86% .005 265); transition: transform .3s;
  text-shadow: 0 6px 18px oklch(0% 0 0 / .7);
  font-family: "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", serif;
}
:root[data-theme="light"] .fp-glyph { color: oklch(35% .02 60); text-shadow: 0 6px 18px oklch(0% 0 0 / .15); }
.fp-glyph:hover { transform: scale(1.25) rotate(-6deg); }
@keyframes fp-drift {
  0% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(14px, -18px) rotate(4deg); }
  100% { transform: translate(-10px, 10px) rotate(-2deg); }
}

.hero-inner {
  position: relative; z-index: 1; margin: 0 auto; max-width: 1024px; width: 100%;
  min-height: 88svh; padding: 32px 16px 80px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .25em; text-transform: uppercase; color: color-mix(in oklch, var(--on-hero) 70%, transparent); margin-bottom: 16px; }
.hero h1 {
  font-size: clamp(3rem, 9vw, 6rem); font-weight: 900; letter-spacing: -.05em; line-height: 1;
  color: var(--text-primary); text-wrap: balance;
}
.hero-sub { margin-top: 12px; font-size: clamp(1.25rem, 2.4vw, 1.5rem); font-weight: 600; letter-spacing: -.02em; color: color-mix(in oklch, var(--on-hero) 70%, transparent); }
.hero-desc { margin-top: 24px; max-width: 42rem; font-size: clamp(1.125rem, 2vw, 1.25rem); color: color-mix(in oklch, var(--on-hero) 80%, transparent); text-wrap: balance; }

.counter {
  margin-top: 32px; display: inline-flex; align-items: center; gap: 12px; padding: 12px 24px; border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--brand) 30%, transparent);
  background: linear-gradient(90deg, color-mix(in oklch, var(--brand) 15%, transparent), var(--overlay), color-mix(in oklch, var(--brand) 15%, transparent));
  box-shadow: var(--shadow-card); backdrop-filter: blur(12px);
  font-size: 1.125rem; color: color-mix(in oklch, var(--on-hero) 85%, transparent);
}
.counter strong { font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text-primary); }
.ping { position: relative; display: flex; width: 10px; height: 10px; }
.ping::before, .ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--brand); }
.ping::before { animation: ping 1s cubic-bezier(0, 0, .2, 1) infinite; opacity: .75; }
@keyframes ping { 75%, 100% { transform: scale(2); opacity: 0; } }

/* Analyze form */
.analyze-form {
  margin-top: 40px; width: 100%; max-width: 36rem; padding: 16px; border-radius: 16px; display: grid; gap: 12px;
  border: 1px solid oklch(100% 0 0 / .1); background: var(--overlay); backdrop-filter: blur(12px); box-shadow: var(--shadow-card);
}
:root[data-theme="light"] .analyze-form { border-color: var(--border-subtle); }
.seg { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.chip {
  padding: 4px 10px; font-size: .75rem; font-weight: 500; border-radius: 6px; border: 1px solid oklch(100% 0 0 / .1);
  background: transparent; color: var(--text-muted); transition: border-color .15s, color .15s, background .15s;
}
:root[data-theme="light"] .chip { border-color: var(--border-subtle); }
.chip:hover { border-color: var(--text-muted); color: var(--text-primary); }
.chip[aria-pressed="true"], .chip.active { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.chip.lg { padding: 8px 16px; font-size: .9375rem; display: inline-flex; align-items: center; gap: 8px; }
.input-row { display: flex; gap: 8px; }
.input {
  width: 100%; min-width: 0; height: 48px; padding: 0 12px; border-radius: 8px; border: 1px solid oklch(100% 0 0 / .1);
  background: oklch(100% 0 0 / .05); outline: none; transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="light"] .input { border-color: var(--border-subtle); background: var(--surface); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 20%, transparent); }
.input::placeholder { color: var(--text-muted); }
textarea.input { height: 140px; padding: 10px 12px; resize: vertical; font-family: var(--font-mono); font-size: .8125rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font-size: .875rem; font-weight: 500;
  transition: filter .15s, background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-fg); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--border-subtle); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-lg { height: 48px; padding: 0 22px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: .8125rem; }
.caption { font-size: .75rem; }
.form-note { text-align: center; font-size: .75rem; color: color-mix(in oklch, var(--on-hero) 50%, transparent); }
.pill-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .75rem;
  border: 1px solid var(--border-subtle); background: color-mix(in oklch, var(--surface) 60%, transparent); color: var(--text-secondary);
}
.pill-link:hover { background: var(--surface-strong); }
.scroll-cue { position: absolute; bottom: 24px; color: color-mix(in oklch, var(--on-hero) 40%, transparent); animation: bounce 1s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(.8, 0, 1, 1); } 50% { transform: none; animation-timing-function: cubic-bezier(0, 0, .2, 1); } }

/* ==========================================================================
   Lower page
   ========================================================================== */
.lower { position: relative; display: flex; flex-direction: column; align-items: center; padding: 24px 16px 0; }
.lower-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, #0A0C10 0%, #0B0F0E 20%, #0A0D0C 45%, #0C1210 70%, #0A0C10 100%); }
:root[data-theme="light"] .lower-bg { background: var(--page); }
.lower > * { position: relative; z-index: 1; }
.container { width: 100%; max-width: 56rem; }
.container-sm { width: 100%; max-width: 48rem; }
.container-lg { width: 100%; max-width: 64rem; }
.card { border-radius: 16px; border: 1px solid var(--border-subtle); background: var(--surface); }
.prose-card { padding: 24px; }
.prose-card h2, .section-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.prose-card p, .prose { color: var(--text-secondary); font-size: .9375rem; line-height: 1.7; }
.prose p + p { margin-top: 12px; }
.prose strong, .prose-card strong { color: var(--text-primary); font-weight: 600; }
.section-lead { color: var(--text-secondary); font-size: .9375rem; margin-bottom: 18px; }
.mt-6 { margin-top: 24px; } .mt-10 { margin-top: 40px; } .mt-12 { margin-top: 48px; } .mt-16 { margin-top: 64px; } .mt-20 { margin-top: 80px; }

ol.why { margin: 0; padding: 0; list-style: none; counter-reset: why; display: grid; gap: 12px; }
ol.why li { counter-increment: why; display: grid; grid-template-columns: 28px 1fr; gap: 6px; color: var(--text-secondary); font-size: .9375rem; line-height: 1.6; }
ol.why li::before { content: counter(why) "."; font-weight: 700; color: var(--brand); }
ol.why b { color: var(--text-primary); font-weight: 600; }
.fine { margin-top: 16px; font-size: .8125rem; color: var(--text-muted); line-height: 1.6; }

ul.tool-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
ul.tool-list li { font-size: .8125rem; color: var(--text-muted); line-height: 1.55; }
ul.tool-list b { color: var(--text-primary); font-weight: 600; }

.spotlight {
  position: relative; overflow: hidden; padding: 24px; border-radius: 16px; display: grid; grid-template-columns: 44px 1fr; gap: 16px;
  border: 1px solid color-mix(in oklch, var(--brand) 18%, transparent);
  background: radial-gradient(80% 140% at 100% 0%, color-mix(in oklch, var(--brand) 10%, transparent), transparent 60%), var(--surface);
}
.spot-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: var(--brand);
  background: color-mix(in oklch, var(--brand) 12%, transparent); border: 1px solid color-mix(in oklch, var(--brand) 30%, transparent); }
.spotlight h3 { font-size: 1.0625rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.spotlight p { color: var(--text-secondary); font-size: .875rem; line-height: 1.65; }
.badge-new { font-size: .6875rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: var(--brand); border: 1px solid color-mix(in oklch, var(--brand) 35%, transparent); background: color-mix(in oklch, var(--brand) 12%, transparent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: .6875rem; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border-subtle); color: var(--text-secondary); background: var(--background); }

.kicker { text-align: center; font-size: .6875rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.kicker.left { text-align: left; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.feature-card { padding: 16px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--surface); transition: border-color .2s, transform .2s, background .2s; }
.feature-card:hover { border-color: color-mix(in oklch, var(--brand) 35%, transparent); background: var(--surface-hover); transform: translateY(-2px); }
.feature-card .fi { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-strong); color: var(--text-secondary); margin-bottom: 12px; }
.feature-card h3 { font-size: .875rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: .75rem; line-height: 1.6; color: var(--text-muted); }

/* Demo carousel */
.demo-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 12px; }
.demo-tabs::-webkit-scrollbar { display: none; }
.demo-tabs .chip { white-space: nowrap; border-radius: 999px; padding: 5px 12px; }
.demo-shell { display: grid; grid-template-columns: 40px 1fr 40px; gap: 12px; align-items: stretch; }
.demo-arrow { border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--surface); color: var(--text-secondary); display: grid; place-items: center; }
.demo-arrow:hover { background: var(--surface-hover); color: var(--text-primary); }
.demo-panel { min-width: 0; }
.demo-head { display: flex; align-items: baseline; gap: 10px; }
.demo-head .num { font-family: var(--font-mono); font-size: .75rem; color: var(--text-muted); }
.demo-head h3 { font-size: 1.125rem; font-weight: 700; }
.demo-desc { color: var(--text-secondary); font-size: .875rem; margin: 6px 0 14px; max-width: 40rem; }

/* Screenshot gallery */
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.shot figure { margin: 0; }
.shot .frame { border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--surface); padding: 14px; overflow: hidden; }
.shot figcaption { margin-top: 8px; font-size: .8125rem; color: var(--text-muted); }

/* Tool links */
.tool-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tool-link { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--surface); transition: background .15s, border-color .15s; }
.tool-link:hover { background: var(--surface-hover); border-color: color-mix(in oklch, var(--brand) 30%, transparent); }
.tool-link b { display: block; font-size: .875rem; margin-bottom: 2px; }
.tool-link span { font-size: .75rem; color: var(--text-muted); }

/* FAQ */
.faq { border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--surface); overflow: hidden; }
.faq details { border-top: 1px solid var(--border-subtle); }
.faq details:first-child { border-top: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: .9375rem; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.25rem; color: var(--text-muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { background: var(--surface-hover); }
.faq .ans { padding: 0 18px 16px; color: var(--text-secondary); font-size: .875rem; line-height: 1.7; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s ease-out, transform .7s ease-out; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .fp-drift, .scroll-cue, .ping::before { animation: none; } }

/* Footer */
.site-footer { width: 100%; border-top: 1px solid var(--border-subtle); background: #000; margin-top: 64px; }
:root[data-theme="light"] .site-footer { background: var(--surface); }
.footer-inner { max-width: 72rem; margin: 0 auto; padding: 48px 24px 32px; }
.footer-brand p { font-size: .8125rem; color: var(--text-muted); margin-top: 10px; line-height: 1.6; }
.footer-cols { display: grid; grid-template-columns: repeat(6, 1fr); gap: 24px; margin-top: 40px; }
.footer-cols h4 { font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 12px; font-weight: 600; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-cols a { font-size: .75rem; color: var(--text-muted); line-height: 1.5; }
.footer-cols a:hover { color: var(--text-primary); }
.footer-bottom { margin-top: 40px; font-size: .75rem; color: var(--text-muted); }

/* Help bubble */
.help-hint {
  position: fixed; right: 20px; bottom: 132px; z-index: 40; max-width: 16rem; padding: 10px 16px; border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--brand) 40%, transparent); background: color-mix(in oklch, var(--background) 80%, transparent); backdrop-filter: blur(8px);
  font-size: .875rem; font-weight: 500; box-shadow: var(--shadow-card);
}
.help-face {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 96px; height: 96px; border-radius: 50%;
  border: 1px solid color-mix(in oklch, var(--brand) 50%, transparent); box-shadow: 0 10px 30px oklch(0% 0 0 / .5);
  background: radial-gradient(circle at 40% 30%, #2FD483, #0E7A4A 60%, #08402A 100%);
  display: grid; place-items: center; font-size: 52px; color: #0A0C10; transition: transform .3s;
}
.help-face:hover { transform: scale(1.05); }
.help-close { position: fixed; right: 16px; bottom: 96px; z-index: 41; width: 24px; height: 24px; border-radius: 50%; border: 1px solid oklch(100% 0 0 / .2); background: var(--background); color: var(--text-muted); display: grid; place-items: center; font-size: 12px; }
.help-panel {
  position: fixed; right: 20px; bottom: 130px; z-index: 45; width: min(360px, calc(100vw - 32px)); max-height: 60vh; display: none; flex-direction: column;
  border-radius: 16px; border: 1px solid var(--border-subtle); background: var(--surface); box-shadow: 0 20px 60px oklch(0% 0 0 / .5); overflow: hidden;
}
.help-panel.open { display: flex; }
.help-panel header { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); font-weight: 700; display: flex; justify-content: space-between; }
.help-panel .msgs { padding: 14px 16px; overflow-y: auto; display: grid; gap: 10px; font-size: .875rem; }
.help-panel .msg { padding: 10px 12px; border-radius: 12px; background: var(--surface-strong); color: var(--text-secondary); line-height: 1.55; }
.help-panel .msg.me { background: color-mix(in oklch, var(--brand) 18%, transparent); color: var(--text-primary); justify-self: end; }
.help-panel .qs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 14px; }

/* ==========================================================================
   Chess board + review UI (shared by demo and app)
   ========================================================================== */
.board-wrap { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.evalbar { position: relative; border-radius: 4px; overflow: hidden; background: oklch(25% .005 265); }
.evalbar .fill { position: absolute; left: 0; right: 0; bottom: 0; background: oklch(95% 0 0); transition: height .35s ease; }
.evalbar .lbl { position: absolute; left: 0; right: 0; font-size: 9px; font-weight: 700; text-align: center; font-family: var(--font-mono); }
.evalbar .lbl.bottom { bottom: 3px; color: oklch(20% 0 0); } .evalbar .lbl.top { top: 3px; color: oklch(90% 0 0); }
.board-flipped .evalbar .fill { top: 0; bottom: auto; }
.board { position: relative; width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); border-radius: 4px; overflow: hidden; user-select: none; }
.sq { position: relative; display: grid; place-items: center; }
.sq.l { background: var(--chess-light-sq); } .sq.d { background: var(--chess-dark-sq); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: var(--chess-last-move); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: var(--chess-highlight); }
.sq.hint::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: oklch(0% 0 0 / .2); }
.sq.wrong::before { content: ""; position: absolute; inset: 0; background: color-mix(in oklch, var(--loss) 55%, transparent); }
.sq .coord { position: absolute; font-size: 9px; font-weight: 700; line-height: 1; }
.sq .coord.r { top: 2px; left: 3px; } .sq .coord.f { bottom: 2px; right: 3px; }
.sq.l .coord { color: var(--chess-dark-sq); } .sq.d .coord { color: var(--chess-light-sq); }
.board { container-type: inline-size; }
.pc { position: relative; z-index: 1; display: grid; place-items: center; width: 100%; height: 100%; pointer-events: none;
  font-family: "Apple Symbols", "Segoe UI Symbol", "DejaVu Sans", "Noto Sans Symbols 2", serif; font-size: 10.2cqi; line-height: 1; }
.pc span { grid-area: 1 / 1; }
.pc .fill { color: #fff; }
.pc .ink { color: oklch(18% 0 0); }
.pc.b .fill { color: oklch(20% .005 265); }
.pc.b .ink { color: oklch(12% 0 0); }
.pc { filter: drop-shadow(0 1.5px 1px oklch(0% 0 0 / .35)); }
.pc.drag-ghost { opacity: .35; }
.sq .cls-badge { position: absolute; z-index: 3; top: -6%; right: -6%; width: 42%; height: 42%; max-width: 26px; max-height: 26px; }
.board-arrows { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.board.interactive .sq { cursor: pointer; }

.player-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: .875rem; }
.player-row .sw { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--border-subtle); }
.player-row .sw.w { background: oklch(95% 0 0); } .player-row .sw.b { background: oklch(20% 0 0); }
.player-row .name { font-weight: 700; }
.player-row .acc { font-size: .75rem; padding: 1px 6px; border-radius: 4px; background: var(--surface-strong); font-family: var(--font-mono); }
.player-row .clock { margin-left: auto; font-family: var(--font-mono); font-weight: 700; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border-subtle); background: var(--background); }

.cls-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 9px; font-weight: 800; color: #fff; flex-shrink: 0; }
.movelist { font-size: .8125rem; font-family: var(--font-sans); overflow-y: auto; border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--background); }
.movelist .row { display: grid; grid-template-columns: 34px 1fr 1fr; align-items: center; }
.movelist .row:nth-child(odd) { background: oklch(100% 0 0 / .02); }
.movelist .no { color: var(--text-muted); padding-left: 8px; font-size: .75rem; }
.movelist .mv { display: flex; align-items: center; gap: 5px; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.movelist .mv:hover { background: var(--surface-hover); }
.movelist .mv.cur { background: color-mix(in oklch, var(--brand) 20%, transparent); }
.movelist .mv .ev { margin-left: auto; font-family: var(--font-mono); font-size: .6875rem; color: var(--text-muted); }

.acc-table { width: 100%; font-size: .8125rem; border-collapse: collapse; }
.acc-table th { text-align: left; font-weight: 700; padding: 6px 8px; }
.acc-table td { padding: 3px 8px; }
.acc-table td.n { text-align: center; font-family: var(--font-mono); }
.acc-pill { display: inline-block; padding: 1px 8px; border-radius: 4px; font-family: var(--font-mono); font-weight: 700; }
.acc-pill.w { background: oklch(95% 0 0); color: oklch(15% 0 0); } .acc-pill.b { background: oklch(25% 0 0); color: #fff; border: 1px solid var(--border-subtle); }

.evalgraph { width: 100%; height: 90px; display: block; border-radius: 8px; background: oklch(25% .005 265); cursor: pointer; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .nav .hide-lg { display: none; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .nav .hide-md { display: none; }
  .community-btn span { display: none; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  ul.tool-list, .tool-links, .shots { grid-template-columns: 1fr; }
  .floating-pieces { display: none; }
  .demo-shell { grid-template-columns: 1fr; }
  .demo-arrow { display: none; }
  .help-hint { display: none; }
  .help-face { width: 56px; height: 56px; font-size: 30px; }
  .help-close { bottom: 64px; }
  .help-panel { bottom: 90px; }
}
@media (max-width: 560px) {
  .nav { display: none; }
  .input-row { flex-direction: column; }
  .input-row .btn { height: 44px; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .spotlight { grid-template-columns: 1fr; }
  .counter { padding: 10px 16px; font-size: 1rem; }
}
