/* ============================================================
   Mathematics Mastery — Design System & Layout
   ============================================================ */

:root {
  color-scheme: light;

  /* Core palette (light) */
  --bg: #eef1f9;
  --bg-soft: #f6f8fd;
  --surface: #ffffff;
  --surface-2: #f3f5fb;
  --primary: #6366f1;
  --primary-strong: #4f46e5;
  --primary-soft: #eef0ff;
  --primary-dark: #312e81;
  --accent: #8b5cf6;
  --text: #0f172a;
  --text-muted: #5b6472;
  --text-faint: #8a94a6;
  --border: #e4e8f2;
  --ring: rgba(99, 102, 241, 0.28);
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #be123c;
  --danger-soft: #fff1f2;
  --header-bg: rgba(255, 255, 255, 0.82);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.14), 0 6px 14px rgba(15, 23, 42, 0.08);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #0e1428;
  --surface: #131a2e;
  --surface-2: #1a2238;
  --primary: #818cf8;
  --primary-strong: #6366f1;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --primary-dark: #c7d2fe;
  --accent: #a78bfa;
  --text: #e6e9f2;
  --text-muted: #a5b0c6;
  --text-faint: #78839a;
  --border: #25304a;
  --ring: rgba(129, 140, 248, 0.35);
  --success: #34d399;
  --success-soft: rgba(16, 185, 129, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(244, 63, 94, 0.14);
  --header-bg: rgba(19, 26, 46, 0.82);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(1100px 540px at 100% -12%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(900px 480px at -8% 0%, rgba(139, 92, 246, 0.12), transparent 55%);
  background-attachment: fixed;
}

img, svg, video, canvas { max-width: 100%; display: block; }

::selection { background: rgba(99, 102, 241, 0.25); }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 0.8rem; }

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--grad-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.4);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}
.brand-text .tagline { font-size: 0.78rem; color: var(--text-muted); }

.header-actions { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 0.3rem;
  padding: 0.28rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 0.45rem 0.8rem;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Theme toggle */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); transform: translateY(-1px); }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun { display: inline; }

/* Level filter nav */
.level-nav {
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.level-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.level-btn {
  padding: 0.5rem 1.15rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text-muted);
  transition: var(--transition);
}
.level-btn:hover { border-color: var(--primary); color: var(--text); }
.level-btn.active {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.35);
}

/* ---------- Layout container ---------- */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 2.4rem 2.2rem;
  border-radius: var(--radius-lg);
  background: var(--grad-primary);
  color: #fff;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}
.hero-inner { position: relative; z-index: 1; max-width: 680px; }
.hero-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
}
.hero-subtitle { margin: 0; font-size: 1rem; opacity: 0.92; }
.hero-symbol {
  position: absolute;
  font-size: 5rem;
  font-weight: 800;
  opacity: 0.16;
  user-select: none;
  pointer-events: none;
  animation: float 7s ease-in-out infinite;
}
.hero-symbol.s1 { top: 4%; right: 8%; }
.hero-symbol.s2 { bottom: 8%; right: 26%; animation-delay: 1.2s; font-size: 4rem; }
.hero-symbol.s3 { top: 12%; right: 34%; animation-delay: 2.1s; font-size: 3.2rem; }
.hero-symbol.s4 { bottom: 2%; right: 6%; animation-delay: 3s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(6deg); }
}

/* ---------- Topic cards ---------- */
.section-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-label .count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
}

.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  position: relative;
}
.topic-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}
.topic-card:active { transform: translateY(-2px); }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}
.card-level {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
}
.card-level.beginner { background: var(--success-soft); color: var(--success); }
.card-level.intermediate { background: var(--warning-soft); color: var(--warning); }
.card-level.advanced { background: var(--danger-soft); color: var(--danger); }

.topic-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.card-desc { font-size: 0.9rem; color: var(--text-muted); margin: 0; }
.card-footer {
  margin-top: auto;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
  font-size: 0.78rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 4.5rem 2rem;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  gap: 0.5rem;
}
.empty-state .empty-icon { font-size: 3.2rem; }
.empty-state p { margin: 0; }

/* ---------- Topic detail ---------- */
.topic-detail {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.breadcrumb {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.back-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateX(-2px); }

.topic-head {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.topic-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  margin: 0 0 0.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.topic-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.badge {
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge.beginner { background: var(--success-soft); color: var(--success); }
.badge.intermediate { background: var(--warning-soft); color: var(--warning); }
.badge.advanced { background: var(--danger-soft); color: var(--danger); }
.badge.lang { background: var(--primary-soft); color: var(--primary-strong); }

.topic-desc { margin: 0; font-size: 1.02rem; color: var(--text-muted); }

/* Diagram figure & inline SVG images */
.figure { margin: 1.25rem 0 0; }
.figure-img {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.figure-img svg { width: 100%; height: auto; max-width: 480px; }
.figcaption {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.6rem;
}

/* Adaptive colors for inline SVG diagrams */
.figure svg text { font-family: var(--font-body); font-size: 14px; }
.figure svg .fill-primary { fill: var(--primary); }
.figure svg .fill-accent { fill: var(--accent); }
.figure svg .fill-success { fill: var(--success); }
.figure svg .fill-soft { fill: var(--primary-soft); }
.figure svg .fill-surface { fill: var(--surface); }
.figure svg .fill-text { fill: var(--text); }
.figure svg .fill-muted { fill: var(--text-muted); }
.figure svg .stroke-primary { stroke: var(--primary); }
.figure svg .stroke-accent { stroke: var(--accent); }
.figure svg .stroke-muted { stroke: var(--text-faint); }
.figure svg .axis { stroke: var(--text-faint); }

/* Video lesson */
.video-section { margin-top: 1.25rem; }
.video-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin: 0 0 0.75rem; }
.topic-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
  display: block;
}

/* Steps */
.steps-section { padding: 1.5rem; }
.steps-section h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 1rem;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.step-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  transition: var(--transition);
  overflow: hidden;
}
.step-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.step-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.9rem; }
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.35);
  flex-shrink: 0;
}
.step-card h4 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; margin: 0; }
.step-body { font-size: 0.95rem; display: grid; gap: 0.85rem; }
.step-body > p { margin: 0; color: var(--text-muted); }

.formula-box {
  background: var(--primary-soft);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-left: 4px solid var(--primary);
  padding: 0.9rem 1.1rem;
  border-radius: 0 10px 10px 0;
  overflow-x: auto;
  font-size: 1.05rem;
}
.formula-box .katex-display { margin: 0; padding: 0.2rem 0; }

.example-box {
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  background: var(--success-soft);
}
.example-title { font-weight: 700; color: var(--success); margin-bottom: 0.55rem; font-size: 0.95rem; }
.example-body { font-size: 0.92rem; }
.example-body p { margin: 0.28rem 0; }
.final-answer {
  margin-top: 0.55rem;
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  color: var(--primary-dark);
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: 1.8rem 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.app-footer p { margin: 0; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .app-header { padding: 0.75rem 1rem; }
  .container { padding: 1.25rem 1rem; }
  .hero { padding: 1.8rem 1.4rem; }
  .hero-title { font-size: 1.55rem; }
  .topic-title { font-size: 1.5rem; }
  .steps-grid { grid-template-columns: 1fr; }
  .topic-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .lang-switcher { width: 100%; }
  .lang-btn { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Action buttons ---------- */
.topic-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.25rem; }
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 12px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.35);
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(99, 102, 241, 0.45); }
.primary-btn.outline {
  background: var(--surface);
  color: var(--primary-strong);
  border: 1.5px solid var(--primary);
  box-shadow: none;
}
.primary-btn.outline:hover { background: var(--primary-soft); transform: translateY(-2px); }

/* ---------- Quiz ---------- */
.quiz-section { padding: 1.5rem; border-top: 1px solid var(--border); }
.quiz-section h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin: 0 0 0.75rem; }
.quiz-score {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.quiz-question { margin-bottom: 1.5rem; }
.quiz-q-text { font-weight: 600; margin: 0 0 0.7rem; }
.quiz-options { display: grid; gap: 0.5rem; }
.quiz-option {
  text-align: left;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.quiz-option:disabled { cursor: default; opacity: 0.92; }
.quiz-option.correct { border-color: var(--success); background: var(--success-soft); color: var(--success); font-weight: 700; animation: answer-pop 0.38s cubic-bezier(.2, 1.5, .4, 1); }
.quiz-option.wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); animation: answer-wiggle 0.32s ease-in-out; }
@keyframes answer-pop { 50% { transform: scale(1.025); } }
@keyframes answer-wiggle { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.quiz-feedback { margin: 0.6rem 0 0; font-size: 0.9rem; }
.quiz-feedback.ok { color: var(--success); }
.quiz-feedback.bad { color: var(--danger); }
.quiz-empty { color: var(--text-muted); }

/* ---------- Card progress badges ---------- */
.card-progress { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.mini-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
}
.mini-badge.done { background: var(--success-soft); color: var(--success); }
.mini-badge.score { background: var(--primary-soft); color: var(--primary-strong); }

/* ---------- Lesson player (video-style) ---------- */
body.no-scroll { overflow: hidden; }
.lesson-player {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lesson-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 22, 0.72);
  backdrop-filter: blur(4px);
}
.lesson-modal {
  position: relative;
  width: min(760px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.lesson-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.lesson-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.lesson-close {
  border: none;
  background: var(--surface-2);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.lesson-close:hover { background: var(--danger-soft); color: var(--danger); }
.lesson-stage { padding: 1.5rem; overflow-y: auto; max-height: 60vh; }
.lesson-step-num {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.lesson-slide h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin: 0 0 0.75rem; }
.lesson-body { color: var(--text-muted); margin: 0 0 0.85rem; }
.lesson-progress { height: 6px; background: var(--surface-2); }
.lesson-progress-fill { height: 100%; width: 0%; background: var(--grad-primary); transition: width 0.4s ease; }
.lesson-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.lesson-btn {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--transition);
}
.lesson-btn:hover { border-color: var(--primary); }
.lesson-btn.play {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  width: 58px;
  height: 58px;
  font-size: 1.3rem;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.4);
}
.lesson-counter { font-size: 0.9rem; font-weight: 700; color: var(--text-muted); margin-left: 0.5rem; }

@media (max-width: 640px) {
  .lesson-stage { max-height: 55vh; padding: 1.1rem; }
  .topic-actions { flex-direction: column; }
  .primary-btn { justify-content: center; }
}

/* ---------- Clearer discovery and video-first home ---------- */
:root {
  --bg: #f5f6fb;
  --bg-soft: #fafaff;
  --surface: #fff;
  --surface-2: #f1f2fa;
  --primary: #6255d8;
  --primary-strong: #5044c3;
  --primary-soft: #eeedff;
  --accent: #a46fe8;
  --border: #e7e8f2;
  --grad-primary: linear-gradient(135deg, #5b55d9 0%, #9a66e8 100%);
}

[data-theme="dark"] {
  --bg: #0d1020;
  --bg-soft: #11162a;
  --surface: #151a30;
  --surface-2: #1c2240;
  --primary: #9690ff;
  --primary-strong: #b8b3ff;
  --primary-soft: rgba(130, 122, 255, 0.17);
  --accent: #c08cff;
  --border: #2a3150;
  --grad-primary: linear-gradient(135deg, #645adf 0%, #8d5bd0 100%);
}

.app-header { padding-block: 0.72rem; }
.logo { font-family: var(--font-display); font-size: 1.55rem; font-weight: 800; }
.level-nav { padding-block: 0.6rem; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.level-nav-inner { justify-content: flex-start; }
.level-btn { background: transparent; padding: 0.44rem 0.95rem; }
.level-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-strong); box-shadow: none; }

.container { max-width: 1180px; padding-top: 1.7rem; }
.hero {
  padding: clamp(2rem, 4vw, 3.5rem);
  min-height: 280px;
  display: flex;
  align-items: center;
  background:
    radial-gradient(circle at 84% 30%, rgba(202, 190, 255, 0.23), transparent 22%),
    linear-gradient(120deg, #151c48 0%, #3939a6 58%, #754ec0 100%);
  box-shadow: 0 24px 50px rgba(54, 48, 139, 0.22);
}
.hero-inner { max-width: 660px; }
.hero-kicker { letter-spacing: 0.08em; font-size: 0.76rem; }
.hero-title { max-width: 650px; font-size: clamp(2.2rem, 4.6vw, 3.55rem); letter-spacing: -0.05em; }
.hero-subtitle { max-width: 570px; font-size: 1.04rem; line-height: 1.7; color: rgba(255, 255, 255, 0.84); }
.hero-symbol { opacity: 0.11; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1.1rem; margin-top: 1.35rem; }
.hero-cta { background: #fff; color: #38308f; box-shadow: 0 10px 25px rgba(19, 16, 72, 0.2); text-decoration: none; }
.hero-cta:hover { background: #f5f3ff; box-shadow: 0 12px 28px rgba(19, 16, 72, 0.25); }
.hero-link { color: #fff; text-decoration: none; font-size: 0.93rem; font-weight: 700; }
.hero-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.continue-card {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin: -0.7rem 0 2rem;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.continue-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--primary-strong); background: var(--primary-soft); font-size: 1.25rem; }
.continue-card p { margin: 0 0 0.12rem; color: var(--text-muted); font-size: 0.78rem; }
.continue-card strong { font-family: var(--font-display); font-size: 0.98rem; }
.continue-btn { margin-left: auto; border: 0; border-radius: 10px; padding: 0.65rem 0.9rem; background: var(--primary-soft); color: var(--primary-strong); font: 700 0.85rem var(--font-body); cursor: pointer; }
.continue-btn:hover { background: var(--primary); color: #fff; }

.video-library, .lesson-browser { margin: 2.4rem 0 3rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; }
.section-eyebrow { color: var(--primary-strong); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.1em; margin: 0 0 0.35rem; text-transform: uppercase; }
.section-title { display: flex; align-items: center; gap: 0.55rem; margin: 0; font: 800 clamp(1.45rem, 2.5vw, 1.9rem)/1.2 var(--font-display); letter-spacing: -0.035em; }
.section-description { color: var(--text-muted); font-size: 0.92rem; margin: 0.4rem 0 0; }
.section-pill { flex-shrink: 0; margin-bottom: 0.15rem; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); padding: 0.38rem 0.72rem; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.video-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.video-card { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 17px; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); }
.video-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: var(--shadow); }
.video-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #151a31; isolation: isolate; }
.video-art { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; color: #f5f2ff; background: radial-gradient(ellipse at 80% 25%, rgba(157, 122, 255, 0.38), transparent 33%), linear-gradient(140deg, #151b3b, #332f81 64%, #6854af); }
.video-art-grid { position: absolute; inset: 0; opacity: 0.23; background-image: linear-gradient(rgba(255,255,255,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.15) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(120deg, #000 0%, transparent 90%); }
.video-art-mark { position: absolute; left: 1rem; top: 0.7rem; z-index: 1; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.24); border-radius: 11px; background: rgba(255,255,255,.11); font-size: 1.25rem; }
.video-art-equation { position: relative; z-index: 1; padding: 0.3rem 0.8rem; font: 700 clamp(1.05rem, 1.8vw, 1.5rem) var(--font-display); text-align: center; text-shadow: 0 3px 16px rgba(0,0,0,.28); }
.video-preview { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s ease; }
.video-frame.is-playing .video-preview { opacity: 1; }
.video-preview-trigger { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 0.52rem; border: 1px solid rgba(255,255,255,.46); border-radius: 999px; background: rgba(20, 22, 55, .78); color: #fff; padding: 0.45rem 0.8rem 0.45rem 0.45rem; font: 700 0.75rem var(--font-body); white-space: nowrap; cursor: pointer; backdrop-filter: blur(8px); }
.video-preview-trigger:hover { background: #fff; color: #39308f; }
.video-frame.is-playing .video-preview-trigger { display: none; }
.video-play-mark { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #fff; color: #3d368e; font-size: 0.7rem; padding-left: 2px; }
.video-card-content { padding: 0.95rem 1rem 1.05rem; }
.video-card-meta { display: flex; align-items: center; gap: 0.5rem; color: var(--text-faint); font-size: 0.72rem; font-weight: 700; }
.video-card-meta .card-level { letter-spacing: 0; text-transform: none; padding: 0.2rem 0.55rem; font-size: 0.68rem; }
.video-card h3 { margin: 0.55rem 0 0.32rem; font: 700 1rem/1.35 var(--font-display); }
.video-title-button { border: 0; padding: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.video-title-button:hover { color: var(--primary-strong); }
.video-card-content > p { min-height: 2.6em; margin: 0; color: var(--text-muted); font-size: 0.81rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-open-link { border: 0; padding: 0; margin-top: 0.75rem; color: var(--primary-strong); background: none; font: 700 0.81rem var(--font-body); cursor: pointer; }
.video-open-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.video-more-btn { display: block; margin: 1rem auto 0; border: 1px solid var(--border); border-radius: 999px; padding: 0.64rem 1rem; background: var(--surface); color: var(--primary-strong); font: 700 0.84rem var(--font-body); cursor: pointer; }
.video-more-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

.lesson-browser { padding-top: 0.35rem; }
.browse-heading { align-items: center; margin-bottom: 1.1rem; }
.section-title .count { font: 700 0.76rem var(--font-body); }
.search-box { display: flex; align-items: center; gap: 0.7rem; max-width: 680px; height: 52px; margin: 0 0 1.2rem; padding: 0 0.9rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text-faint); box-shadow: var(--shadow-sm); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.search-box > span:first-child { font-size: 1.55rem; line-height: 1; }
.search-box input { width: 100%; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: 0.91rem var(--font-body); }
.search-box input::placeholder { color: var(--text-faint); }
.search-shortcut { flex-shrink: 0; border: 1px solid var(--border); border-radius: 7px; padding: 0.15rem 0.42rem; color: var(--text-faint); font-size: 0.69rem; }
.topic-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.topic-card { min-width: 0; min-height: 225px; padding: 1.05rem; border-radius: 16px; }
.topic-card:hover { transform: translateY(-2px); }
.topic-card h3 { font-size: 1.02rem; }
.card-icon { width: 40px; height: 40px; }
.card-desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.83rem; line-height: 1.55; }
.card-footer { padding-top: 0.6rem; font-size: 0.73rem; }
.empty-state { margin: 0; padding: 2.2rem 1rem; border: 1px dashed var(--border); border-radius: 16px; background: var(--surface); }
.clear-search-btn { border: 0; border-radius: 9px; padding: 0.5rem 0.75rem; background: var(--primary-soft); color: var(--primary-strong); font: 700 0.82rem var(--font-body); cursor: pointer; }

.topic-head { padding: clamp(1.2rem, 3vw, 2.2rem); }
.voice-explanation { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.3rem; padding: 1rem; border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border)); border-radius: 15px; background: linear-gradient(110deg, var(--primary-soft), var(--surface)); }
.voice-copy { display: flex; align-items: flex-start; gap: 0.7rem; min-width: 0; }
.voice-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; background: var(--surface); font-size: 1rem; }
.voice-copy h3 { margin: 0 0 0.2rem; font: 700 0.9rem var(--font-display); }
.voice-copy p { margin: 0; color: var(--text-muted); font-size: 0.82rem; line-height: 1.55; }
.voice-actions { display: flex; flex-shrink: 0; gap: 0.45rem; }
.voice-btn, .voice-stop { border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.75rem; background: var(--surface); color: var(--primary-strong); font: 700 0.8rem var(--font-body); cursor: pointer; }
.voice-btn { border-color: transparent; background: var(--primary); color: #fff; }
.voice-btn:hover { filter: brightness(1.08); }
.voice-stop { color: var(--text-muted); }
.voice-stop:hover { border-color: var(--danger); color: var(--danger); }
.voice-status { position: absolute; left: 3.9rem; bottom: -1.15rem; margin: 0; color: var(--text-faint); font-size: 0.7rem; }
.topic-actions { margin-top: 1.6rem; }
.steps-section { padding: clamp(1.1rem, 3vw, 1.8rem); }
.step-card { border-radius: 16px; }

@media (max-width: 900px) {
  .video-list, .topic-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .app-header { padding-inline: 0.85rem; }
  .header-inner { align-items: flex-start; }
  .brand-text h1 { font-size: 1.06rem; }
  .brand-text .tagline { font-size: 0.7rem; }
  .header-actions { justify-content: flex-end; gap: 0.45rem; }
  .lang-switcher { width: auto; padding: 0.2rem; }
  .lang-btn { padding: 0.42rem 0.5rem; font-size: 0.76rem; }
  .level-nav-inner { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding: 0 0.1rem 0.2rem; }
  .level-btn { flex-shrink: 0; font-size: 0.78rem; }
  .container { padding: 1rem 0.9rem; }
  .hero { min-height: 0; padding: 1.75rem 1.3rem; border-radius: 19px; }
  .hero-title { font-size: clamp(2rem, 9vw, 2.65rem); }
  .hero-subtitle { font-size: 0.92rem; }
  .hero-symbol.s2, .hero-symbol.s3 { display: none; }
  .hero-actions { gap: 0.8rem; }
  .hero-cta { padding: 0.65rem 0.9rem; }
  .continue-card { margin-top: 0; gap: 0.65rem; padding: 0.75rem; }
  .continue-mark { width: 34px; height: 34px; }
  .continue-card strong { font-size: 0.82rem; }
  .continue-btn { padding: 0.55rem 0.62rem; font-size: 0.75rem; }
  .video-library, .lesson-browser { margin: 2rem 0 2.3rem; }
  .section-heading { align-items: flex-start; }
  .section-description { font-size: 0.83rem; }
  .section-pill { margin-top: 0.3rem; font-size: 0.68rem; }
  .video-list, .topic-list { grid-template-columns: 1fr; gap: 0.8rem; }
  .video-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); align-items: stretch; }
  .video-frame { min-height: 100%; aspect-ratio: auto; }
  .video-card-content { padding: 0.7rem; }
  .video-card-meta { gap: 0.35rem; font-size: 0.65rem; }
  .video-card h3 { font-size: 0.88rem; margin-top: 0.4rem; }
  .video-card-content > p { min-height: 0; font-size: 0.73rem; -webkit-line-clamp: 2; }
  .video-open-link { margin-top: 0.55rem; font-size: 0.74rem; }
  .video-art-mark { left: 0.5rem; top: 0.5rem; width: 28px; height: 28px; font-size: 1rem; }
  .video-art-equation { padding: 0.25rem; font-size: 0.9rem; }
  .video-preview-trigger { gap: 0; padding: 0.32rem; }
  .video-preview-trigger > span:last-child { display: none; }
  .video-play-mark { width: 29px; height: 29px; }
  .search-box { height: 48px; }
  .search-shortcut { display: none; }
  .topic-card { min-height: 0; }
  .voice-explanation { align-items: flex-start; flex-direction: column; padding: 0.85rem; }
  .voice-actions { padding-left: 2.75rem; }
  .voice-status { position: static; margin: -0.55rem 0 0 2.75rem; }
  .topic-actions { flex-direction: row; }
  .topic-actions .primary-btn { flex: 1; padding-inline: 0.65rem; font-size: 0.82rem; }
}

@media (max-width: 380px) {
  .lang-btn { font-size: 0.68rem; padding-inline: 0.35rem; }
  .theme-toggle { width: 36px; height: 36px; }
  .video-card { grid-template-columns: 39% minmax(0, 1fr); }
  .topic-actions { flex-direction: column; }
}

/* ---------- Playful quest layer ---------- */
.quest-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(290px, 0.88fr);
  align-items: center;
  gap: 1.2rem;
  overflow: hidden;
  margin: 1.15rem 0 2.35rem;
  padding: 1.2rem 1.35rem;
  border: 1px solid #e5dcff;
  border-radius: 20px;
  background: linear-gradient(115deg, #fff7dd 0%, #fffdf4 45%, #f1edff 100%);
  box-shadow: 0 8px 26px rgba(87, 67, 156, 0.09);
}
[data-theme="dark"] .quest-card { border-color: #3b3358; background: linear-gradient(115deg, #29223c 0%, #211f34 46%, #282343 100%); }
.quest-card::after { content: '✦  ·  ✧'; position: absolute; right: 28%; top: -0.45rem; color: rgba(151, 111, 225, 0.16); font-size: 4rem; letter-spacing: 0.2em; pointer-events: none; transform: rotate(-12deg); }
.quest-intro { position: relative; z-index: 1; display: flex; align-items: center; gap: 1rem; }
.quest-mascot { display: grid; place-items: center; flex: 0 0 88px; height: 88px; border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 25px; background: linear-gradient(145deg, #fff, #f2eaff); box-shadow: 0 8px 18px rgba(69, 53, 141, 0.12); font-size: 3.3rem; animation: mascot-bob 3.2s ease-in-out infinite; }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(2deg); } }
.quest-intro .section-eyebrow { color: #8261c1; margin-bottom: 0.2rem; }
.quest-intro h2 { margin: 0; color: #282447; font: 800 clamp(1.12rem, 2vw, 1.45rem)/1.25 var(--font-display); letter-spacing: -0.035em; }
[data-theme="dark"] .quest-intro h2 { color: var(--text); }
.quest-subtitle { margin: 0.35rem 0 0.75rem; color: #6e6980; font-size: 0.81rem; }
[data-theme="dark"] .quest-subtitle { color: var(--text-muted); }
.surprise-btn { border: 0; border-radius: 10px; padding: 0.57rem 0.82rem; background: #594bc5; color: #fff; box-shadow: 0 5px 13px rgba(75, 59, 174, 0.23); font: 700 0.8rem var(--font-body); cursor: pointer; transition: var(--transition); }
.surprise-btn:hover { transform: translateY(-2px) rotate(-1deg); background: #4337a8; box-shadow: 0 8px 16px rgba(75, 59, 174, 0.28); }
.quest-scoreboard { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; padding: 0.8rem; border: 1px solid rgba(255,255,255,.85); border-radius: 16px; background: rgba(255,255,255,.74); box-shadow: 0 5px 17px rgba(75, 59, 174, 0.07); backdrop-filter: blur(8px); }
[data-theme="dark"] .quest-scoreboard { border-color: rgba(255,255,255,.08); background: rgba(13,16,32,.48); }
.quest-stat { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.quest-stat-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; background: #fff1bc; font-size: 1.15rem; }
.quest-stat:nth-child(2) .quest-stat-icon { background: #eee7ff; }
.quest-stat div { display: flex; flex-direction: column; line-height: 1.15; }
.quest-stat strong { color: var(--text); font: 800 1.1rem var(--font-display); }
.quest-stat div > span { margin-top: 0.12rem; color: var(--text-muted); font-size: 0.66rem; font-weight: 700; }
.quest-level { grid-column: 1 / -1; margin-top: 0.1rem; }
.quest-level-row { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.4rem; color: var(--text-muted); font-size: 0.69rem; font-weight: 700; }
.quest-level-row span:first-child { color: var(--primary-strong); }
.quest-meter { height: 9px; overflow: hidden; border-radius: 999px; background: #e9e5f4; }
.quest-meter > span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffbd48, #f38e57, #9363de); transition: width 0.45s ease; }
[data-theme="dark"] .quest-meter { background: #37324b; }
.daily-quest { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.65rem; padding: 0.62rem 0.7rem; border: 1px dashed #d8c7ff; border-radius: 13px; background: rgba(246, 241, 255, 0.76); transition: background var(--transition), border-color var(--transition), transform var(--transition); }
[data-theme="dark"] .daily-quest { border-color: #554679; background: rgba(49, 40, 73, 0.6); }
.daily-quest-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background: #fff1c8; font-size: 1.15rem; }
.daily-quest-copy { display: grid; min-width: 0; line-height: 1.35; }
.daily-quest-copy strong { color: var(--text); font-size: 0.7rem; font-weight: 850; }
.daily-quest-copy span { margin-top: 0.12rem; color: var(--text-muted); font-size: 0.65rem; }
.daily-quest-btn { border: 1px solid #d7c9ff; border-radius: 999px; padding: 0.43rem 0.65rem; background: #fff; color: #5942b3; font: 800 0.65rem var(--font-body); cursor: pointer; transition: transform var(--transition), background var(--transition); white-space: nowrap; }
.daily-quest-btn:hover:not(:disabled) { transform: translateY(-2px) rotate(-1deg); background: #f1ebff; }
.daily-quest-btn:disabled { cursor: default; opacity: 0.78; }
[data-theme="dark"] .daily-quest-btn { border-color: #5c4c7d; background: #2b2441; color: #e1d5ff; }
.daily-quest.is-cleared { border-style: solid; border-color: #a7e3c5; background: rgba(236, 253, 245, 0.8); }
[data-theme="dark"] .daily-quest.is-cleared { border-color: #397659; background: rgba(24, 53, 43, 0.72); }
.daily-quest.is-cleared .daily-quest-icon { background: #d9f8e9; }
.points-pop { animation: points-pop 0.52s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes points-pop { 45% { transform: scale(1.35) rotate(-5deg); color: #e08b19; } }
.quest-mascot.is-cheering { animation: mascot-cheer 0.72s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes mascot-cheer { 25% { transform: translateY(-12px) rotate(-12deg) scale(1.16); } 55% { transform: translateY(2px) rotate(10deg) scale(.96); } 78% { transform: translateY(-5px) rotate(-5deg) scale(1.06); } }
.sparkle-burst { position: absolute; z-index: 4; inset: 0; overflow: hidden; pointer-events: none; }
.sparkle-burst span { position: absolute; top: 50%; left: 50%; font-size: 1.1rem; opacity: 0; animation: sparkle-flight 0.95s cubic-bezier(.1, .7, .3, 1) var(--delay) forwards; }
@keyframes sparkle-flight { 12% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(110deg) scale(.35); } }
.reward-toast { position: fixed; z-index: 300; right: 1.2rem; bottom: 1.2rem; max-width: min(92vw, 380px); padding: 0.8rem 1rem; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; background: #282447; color: #fff; box-shadow: 0 16px 40px rgba(20, 17, 52, .3); font-weight: 800; animation: toast-pop 0.25s ease-out; }
.reward-toast::before { content: '✨'; margin-right: 0.5rem; }
@keyframes toast-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.card-reward { align-self: flex-start; margin-top: 0.05rem; border: 1px solid #f4e3ab; border-radius: 999px; padding: 0.16rem 0.5rem; background: #fff8df; color: #9a6910; font-size: 0.66rem; font-weight: 800; }
[data-theme="dark"] .card-reward { border-color: #534636; background: #3a3120; color: #f3cc6f; }
.topic-card:hover .card-icon { transform: rotate(-5deg) scale(1.05); transition: transform 0.2s ease; }

@media (max-width: 760px) {
  .quest-card { grid-template-columns: 1fr; gap: 0.9rem; padding: 1rem; }
  .quest-mascot { flex-basis: 68px; height: 68px; border-radius: 20px; font-size: 2.65rem; }
  .quest-card::after { right: 5%; top: -0.9rem; font-size: 3rem; }
}
@media (max-width: 420px) {
  .quest-intro { align-items: flex-start; gap: 0.7rem; }
  .quest-mascot { flex-basis: 54px; height: 54px; border-radius: 16px; font-size: 2rem; }
  .quest-intro h2 { font-size: 1.08rem; }
  .quest-subtitle { font-size: 0.75rem; }
  .quest-scoreboard { padding: 0.65rem; }
  .daily-quest { grid-template-columns: auto minmax(0, 1fr); }
  .daily-quest-btn { grid-column: 2; justify-self: start; }
}

/* ---------- Adventure map and AI practice ---------- */
.auth-widget { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; min-width: 0; }
.auth-status { max-width: 210px; overflow: hidden; color: var(--text-muted); font-size: 0.68rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.auth-btn { flex: 0 0 auto; border: 1px solid #d9d5ff; border-radius: 999px; padding: 0.48rem 0.72rem; background: #f2efff; color: #4b3ca6; font: 800 0.72rem var(--font-body); cursor: pointer; transition: var(--transition); }
.auth-btn:hover:not(:disabled) { transform: translateY(-1px); background: #e7e0ff; }
.auth-btn.is-connected { border-color: #b9edd8; background: #edfbf4; color: #08734a; }
.auth-btn:disabled { opacity: 0.64; cursor: not-allowed; }
[data-theme="dark"] .auth-btn { border-color: #494064; background: #292440; color: #ddd5ff; }
[data-theme="dark"] .auth-btn.is-connected { border-color: #285641; background: #17372a; color: #9be8c0; }

.adventure-map { margin: 2.1rem 0 2.3rem; padding: 1.3rem; border: 1px solid #dfd7fb; border-radius: 22px; background: linear-gradient(145deg, #fff 0%, #f8f5ff 62%, #fff9e8 100%); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .adventure-map { border-color: #393250; background: linear-gradient(145deg, #151a2d, #1d1b31 62%, #28243a); }
.board-heading { align-items: center; margin-bottom: 1rem; }
.math-board { display: grid; gap: 0.9rem; }
.board-track { min-width: 0; padding: 0.85rem 0.85rem 1rem; border: 1px solid var(--border); border-radius: 16px; background: color-mix(in srgb, var(--surface) 88%, var(--primary-soft)); }
.board-track.beginner { border-color: #c9e8c7; background: linear-gradient(125deg, color-mix(in srgb, var(--surface) 82%, #daf4d8), var(--surface)); }
.board-track.intermediate { border-color: #f1d7ad; background: linear-gradient(125deg, color-mix(in srgb, var(--surface) 82%, #fff0d3), var(--surface)); }
.board-track.advanced { border-color: #d8c9f6; background: linear-gradient(125deg, color-mix(in srgb, var(--surface) 82%, #ece2ff), var(--surface)); }
[data-theme="dark"] .board-track.beginner { border-color: #31553e; background: linear-gradient(125deg, #182d25, var(--surface)); }
[data-theme="dark"] .board-track.intermediate { border-color: #655034; background: linear-gradient(125deg, #2b251d, var(--surface)); }
[data-theme="dark"] .board-track.advanced { border-color: #493862; background: linear-gradient(125deg, #251d35, var(--surface)); }
.board-track-title { margin: 0 0 0.65rem; color: var(--text-muted); font: 800 0.75rem var(--font-body); letter-spacing: 0.06em; text-transform: uppercase; }
.board-track.beginner .board-track-title::before { content: '🌿'; margin-right: 0.45rem; }
.board-track.intermediate .board-track-title::before { content: '⛰️'; margin-right: 0.45rem; }
.board-track.advanced .board-track-title::before { content: '🚀'; margin-right: 0.45rem; }
.board-path { display: flex; align-items: center; gap: 0.4rem; overflow-x: auto; padding: 0.3rem 0.1rem 0.6rem; scrollbar-width: thin; }
.board-node { position: relative; display: flex; flex: 0 0 130px; min-height: 112px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.2rem; border: 1px solid var(--border); border-radius: 16px; padding: 0.65rem; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition); }
.board-node:hover { z-index: 1; transform: translateY(-3px) rotate(-1deg); border-color: var(--primary); box-shadow: var(--shadow); }
.board-node:active { transform: translateY(1px) scale(.97); }
.board-node.is-cleared { border-color: #9ce1c2; background: linear-gradient(145deg, #f0fff7, var(--surface)); }
.board-node.is-next { border: 2px solid #9b7cec; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12); animation: map-glow 2.8s ease-in-out infinite; }
.board-node.is-next::after { content: '➜'; position: absolute; top: -0.42rem; right: -0.28rem; border-radius: 999px; padding: 0.12rem 0.38rem; background: #8059d6; color: #fff; font-size: 0.7rem; font-weight: 900; transform: rotate(-12deg); }
.board-node.is-cleared::after { content: '⭐'; position: absolute; top: 0.25rem; right: 0.32rem; font-size: 0.67rem; filter: drop-shadow(0 1px 1px rgba(120, 83, 20, .2)); }
[data-theme="dark"] .board-node.is-cleared { border-color: #397659; background: linear-gradient(145deg, #18352b, var(--surface)); }
.board-node-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: var(--primary-soft); font-size: 1.15rem; }
.board-node.is-cleared .board-node-icon { background: var(--success-soft); color: var(--success); font-weight: 900; }
.board-node-title { display: -webkit-box; width: 100%; overflow: hidden; color: var(--text); font: 800 0.72rem/1.3 var(--font-display); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.board-node-state { color: var(--text-muted); font-size: 0.63rem; font-weight: 700; }
.board-node.is-next .board-node-state { color: var(--primary-strong); }
.board-trail { flex: 0 0 22px; color: #b5a1ed; text-align: center; }
@keyframes map-glow { 0%, 100% { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.10); } 50% { box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.18); } }

.practice-studio { margin: 2rem 0 2.4rem; padding: clamp(1rem, 3vw, 1.45rem); border: 1px solid #d7e4f9; border-radius: 22px; background: linear-gradient(135deg, #f1f8ff 0%, var(--surface) 54%, #f4f0ff 100%); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .practice-studio { border-color: #2b3d5e; background: linear-gradient(135deg, #141f32, #151a2d 54%, #201c35); }
.practice-studio-heading { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; }
.practice-studio-heading .section-title { margin-bottom: 0.3rem; }
.practice-studio-heading .section-description { margin: 0; }
.practice-studio-mascot { display: grid; place-items: center; flex: 0 0 58px; height: 58px; border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); font-size: 2rem; }
.practice-controls { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, 0.7fr) minmax(250px, 1.25fr) auto; align-items: end; gap: 0.75rem; }
.practice-select-label { display: grid; gap: 0.32rem; color: var(--text-muted); font-size: 0.72rem; font-weight: 800; }
.practice-select-label select { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 11px; padding: 0 0.7rem; background: var(--surface); color: var(--text); font: 700 0.78rem var(--font-body); }
.learner-mode-group { display: grid; gap: 0.32rem; color: var(--text-muted); font-size: 0.72rem; font-weight: 800; }
.learner-mode-group > div { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.learner-mode-btn { min-height: 42px; border: 1px solid var(--border); border-radius: 11px; padding: 0.4rem 0.62rem; background: var(--surface); color: var(--text-muted); font: 700 0.73rem var(--font-body); cursor: pointer; }
.learner-mode-btn.active { border-color: #a796ee; background: #efebff; color: #4b3ca6; box-shadow: inset 0 0 0 1px #c2b5f5; }
[data-theme="dark"] .learner-mode-btn.active { background: #30284a; color: #e0d6ff; }
.generate-practice-btn { min-height: 44px; border: 0; border-radius: 12px; padding: 0.7rem 0.85rem; background: linear-gradient(135deg, #4e74dc, #7656cc); color: #fff; box-shadow: 0 5px 15px rgba(85, 94, 196, 0.2); font: 800 0.75rem var(--font-body); cursor: pointer; transition: transform var(--transition), filter var(--transition); }
.generate-practice-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.07); }
.generate-practice-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.practice-status { min-height: 1.4rem; margin: 0.75rem 0; color: var(--text-muted); font-size: 0.76rem; font-weight: 700; }
.generated-exercises { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.exercise-card { min-width: 0; padding: 0.9rem; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04); }
.exercise-question { margin: 0 0 0.75rem; font: 800 0.9rem/1.45 var(--font-display); }
.exercise-options { display: grid; gap: 0.42rem; }
.exercise-option { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 0.56rem 0.65rem; background: var(--surface-2); color: var(--text); font: 650 0.78rem/1.4 var(--font-body); text-align: left; cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.exercise-option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.exercise-option.correct { border-color: #5ac28e; background: var(--success-soft); color: var(--success); font-weight: 800; animation: answer-pop 0.38s cubic-bezier(.2, 1.5, .4, 1); }
.exercise-option.wrong { border-color: #ee879c; background: var(--danger-soft); color: var(--danger); animation: answer-wiggle 0.32s ease-in-out; }
.exercise-option:disabled { cursor: default; }
.exercise-hint, .exercise-explanation { margin-top: 0.65rem; border-radius: 10px; padding: 0.52rem 0.65rem; background: var(--surface-2); color: var(--text-muted); font-size: 0.75rem; }
.exercise-hint summary, .exercise-explanation summary { color: var(--primary-strong); font-weight: 800; cursor: pointer; }
.exercise-hint p, .exercise-explanation-body p { margin: 0.5rem 0 0; }
.exercise-feedback { margin: 0.6rem 0 0; font-size: 0.77rem; font-weight: 800; }
.exercise-feedback.is-correct { color: var(--success); }
.exercise-feedback.is-incorrect { color: var(--warning); }
.exercise-explanation { color: var(--text); font-weight: 500; }
.exercise-explanation-body ol { margin: 0.45rem 0; padding-left: 1.25rem; color: var(--text-muted); }
.exercise-explanation-body li { padding: 0.1rem 0; }
.exercise-speak-btn { border: 1px solid var(--border); border-radius: 9px; padding: 0.35rem 0.55rem; background: var(--surface); color: var(--primary-strong); font: 750 0.72rem var(--font-body); cursor: pointer; }

/* ---------- Chess Quest ---------- */
.chess-hub { margin: 2.35rem 0 2.5rem; scroll-margin-top: 1rem; }
.chess-section-heading { align-items: center; margin-bottom: 1rem; }
.chess-section-heading .section-title { display: flex; align-items: center; gap: .42rem; }
.chess-title-sparkle { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #fff; background: linear-gradient(140deg, #f1a541, #d86c48); font-size: 1.1rem; transform: rotate(7deg); box-shadow: 0 6px 14px #d46d4935; }
.chess-xp { border-color: #f0d797; background: linear-gradient(135deg, #fff7d6, #ffefd0); color: #805923; font-size: .77rem; white-space: nowrap; }
.chess-xp.xp-pop { animation: chess-star-pop .55s cubic-bezier(.2,1.5,.4,1); }
@keyframes chess-star-pop { 40% { transform: scale(1.13) rotate(-3deg); } }
.chess-layout { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(330px, .94fr); align-items: start; gap: 1rem; }
.chess-game-card, .chess-coach-card, .chess-openings-card { min-width: 0; overflow: hidden; border: 1px solid #e8dfcf; border-radius: 22px; background: var(--surface); box-shadow: 0 12px 30px rgba(58, 48, 83, .075); }
.chess-game-card { padding: clamp(.9rem, 2.3vw, 1.35rem); background: linear-gradient(160deg, #fff 0%, #fffdf7 55%, #faf6ff 100%); }
[data-theme="dark"] .chess-game-card, [data-theme="dark"] .chess-coach-card, [data-theme="dark"] .chess-openings-card { border-color: #39354d; background: linear-gradient(155deg, #181b2d, #201e32); box-shadow: 0 14px 32px rgba(0,0,0,.18); }
.chess-card-heading, .chess-side-heading { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.chess-card-heading { margin-bottom: .95rem; }
.chess-heading-icon, .chess-mini-mascot { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 15px; background: linear-gradient(145deg, #e9e2ff, #fff0d5); color: #51418e; font-size: 1.45rem; box-shadow: inset 0 0 0 1px #fff8; }
.chess-card-heading h3, .chess-side-heading h3 { margin: 0 0 .16rem; color: var(--text); font: 800 1.03rem/1.3 var(--font-display); }
.chess-card-heading p, .chess-side-heading p { margin: 0; color: var(--text-muted); font-size: .75rem; line-height: 1.45; }
.chess-turn-pill { display: grid; place-items: center; flex: 0 0 36px; height: 36px; margin-left: auto; border: 1px solid #e8e1d5; border-radius: 12px; background: #fff; color: #383046; font-size: 1.27rem; }
[data-theme="dark"] .chess-turn-pill { border-color: #49445e; background: #27243b; color: #fff; }
.chess-turn-pill.is-thinking { animation: chess-thinking 1s ease-in-out infinite alternate; }
@keyframes chess-thinking { to { transform: rotate(-9deg) scale(1.08); } }
.chess-controls { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(155px, 1.1fr) auto; align-items: end; gap: .5rem; }
.chess-select-label { display: grid; min-width: 0; gap: .28rem; color: var(--text-muted); font-size: .67rem; font-weight: 800; }
.chess-select-label select { width: 100%; min-width: 0; height: 42px; border: 1px solid var(--border); border-radius: 11px; padding: 0 .56rem; background: var(--surface); color: var(--text); font: 700 .72rem var(--font-body); }
.chess-new-game, .chess-demo-next-btn { min-height: 42px; border: 0; border-radius: 11px; padding: .58rem .76rem; background: linear-gradient(135deg, #6456ce, #8561cd); color: #fff; box-shadow: 0 5px 12px #6456ce29; font: 800 .73rem var(--font-body); cursor: pointer; transition: transform var(--transition), filter var(--transition); }
.chess-new-game:hover, .chess-demo-next-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.chess-status { display: flex; align-items: center; min-height: 40px; margin: .72rem 0 .45rem; border: 1px solid #ddd6f5; border-radius: 12px; padding: .48rem .7rem; background: linear-gradient(100deg, #f3f0ff, #fbf9ff); color: #504593; font-size: .76rem; font-weight: 800; line-height: 1.4; }
.chess-status.is-check { border-color: #f5b3a8; background: #fff1ed; color: #a53f32; animation: answer-wiggle .3s ease-in-out; }
.chess-status.is-over { border-color: #f0d797; background: #fff8dc; color: #805923; }
.chess-status.is-reward { border-color: #afdcb9; background: #effff0; color: #347648; }
[data-theme="dark"] .chess-status { border-color: #423d61; background: #25223b; color: #d7ceff; }
[data-theme="dark"] .chess-status.is-check { border-color: #693a3d; background: #371f2a; color: #ffb4a8; }
[data-theme="dark"] .chess-status.is-over { border-color: #665431; background: #332d1f; color: #ffdf9d; }
[data-theme="dark"] .chess-status.is-reward { border-color: #315c3d; background: #1d3825; color: #a5efb7; }
.chess-board-wrap { width: min(100%, 520px); margin-inline: auto; overflow: hidden; border: 1px solid #d9cbb7; border-radius: 19px; padding: .55rem; background: linear-gradient(145deg, #826c52, #c8a77d 50%, #735c48); box-shadow: 0 9px 22px rgba(77, 57, 37, .18), inset 0 1px 1px #fff8; }
.chess-board-ribbon { display: flex; align-items: center; justify-content: space-between; padding: .04rem .34rem .35rem; color: #fff5df; font-size: .55rem; font-weight: 900; letter-spacing: .15em; }
.chess-board-ribbon > span:last-child { font-size: .9rem; }
.chess-board-ribbon.bottom { padding: .35rem .38rem .03rem; letter-spacing: .12em; }
.chess-board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; overflow: hidden; border: 2px solid #5c4938; border-radius: 8px; box-shadow: 0 4px 10px #3c2e2233; }
.chess-board-frame { width: 100%; overflow: hidden; border-radius: 9px; }
.chess-square { position: relative; display: grid; place-items: center; min-width: 0; aspect-ratio: 1; overflow: hidden; border: 0; padding: 0; color: #302c31; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.chess-square.light { background: #f2e8d5; }
.chess-square.dark { background: #819879; }
.chess-square.last-move::before { position: absolute; inset: 0; background: rgba(255, 218, 92, .32); content: ''; pointer-events: none; }
.chess-square.selected { z-index: 1; box-shadow: inset 0 0 0 4px #f1b936; }
.chess-square:focus-visible { z-index: 2; outline: 3px solid #7654d7; outline-offset: -3px; }
.chess-square.legal-target::after { position: absolute; width: 25%; height: 25%; border-radius: 50%; background: rgba(50, 45, 43, .31); content: ''; pointer-events: none; }
.chess-square.capture-target::after { position: absolute; inset: 4px; border: 4px solid rgba(174, 60, 54, .52); border-radius: 50%; content: ''; pointer-events: none; }
.chess-square.in-check { background: radial-gradient(circle, #f58167 0%, #e59a79 44%, #f2e8d5 83%) !important; }
.chess-piece { position: relative; z-index: 1; display: block; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", serif; font-size: clamp(1.38rem, 5vw, 2.65rem); line-height: 1; transition: transform .15s cubic-bezier(.2,1.5,.4,1); pointer-events: none; }
.chess-square:active .chess-piece { transform: scale(.84); }
.chess-piece.white-piece { color: #fffdf5; -webkit-text-stroke: 1px #6b5947; text-shadow: 0 2px 1px #544231, 0 3px 3px #3e302866; }
.chess-piece.black-piece { color: #302b37; -webkit-text-stroke: .45px #18151d; text-shadow: 0 2px 1px #fff8; }
.chess-coord { position: absolute; z-index: 2; color: #504840; font: 800 clamp(.45rem, 1.3vw, .63rem)/1 var(--font-body); pointer-events: none; }
.chess-coord.rank { top: 3px; left: 4px; }
.chess-coord.file { right: 4px; bottom: 3px; }
.chess-square.dark .chess-coord { color: #f4eddd; }
.chess-game-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .72rem; }
.chess-action-btn { min-height: 39px; border: 1px solid var(--border); border-radius: 10px; padding: .46rem .72rem; background: var(--surface); color: var(--text-muted); font: 750 .73rem var(--font-body); cursor: pointer; }
.chess-action-btn:hover { border-color: #a995ea; background: var(--primary-soft); color: var(--primary-strong); }
.chess-action-btn.voice { margin-left: auto; color: #51418e; }
.chess-move-trail { margin-top: .8rem; border: 1px solid var(--border); border-radius: 13px; padding: .62rem .7rem; background: color-mix(in srgb, var(--surface) 84%, var(--primary-soft)); }
.chess-move-title { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .71rem; }
.chess-move-title span { color: var(--primary); }
.chess-moves { display: flex; flex-wrap: wrap; gap: .3rem; max-height: 92px; overflow: auto; padding-top: .42rem; }
.chess-move-row { display: inline-flex; align-items: center; gap: .32rem; min-height: 26px; border-radius: 7px; padding: .2rem .4rem; background: var(--surface); color: var(--text); font: 700 .69rem var(--font-body); }
.chess-move-row b { color: var(--text-faint); font-size: .61rem; }
.chess-no-moves { color: var(--text-faint); font-size: .69rem; }
.chess-side-column { display: grid; gap: 1rem; }
.chess-coach-card, .chess-openings-card { padding: 1rem; }
.chess-side-heading { align-items: flex-start; margin-bottom: .75rem; }
.chess-mini-mascot { flex-basis: 39px; height: 39px; border-radius: 13px; background: #e9f5e4; font-size: 1.22rem; }
.chess-mini-mascot.opening { background: #ffeed8; }
.chess-side-heading h3 { font-size: .96rem; }
.chess-side-heading p { max-width: 38rem; font-size: .71rem; }
.chess-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.chess-rule-card { min-width: 0; border: 1px solid #e6e1d9; border-radius: 13px; padding: .62rem .66rem; background: #fffefa; }
.chess-rule-card.finish { background: #fff8e8; border-color: #f0dfb5; }
.chess-rule-card.pieces { background: #f1f7ec; border-color: #d9e8ce; }
.chess-rule-card.plan { background: #f3f0ff; border-color: #dfd8f4; }
.chess-rule-card.magic { background: #fff0eb; border-color: #f3dbd1; }
.chess-rule-card h4 { margin: 0 0 .3rem; color: var(--text); font: 800 .72rem/1.3 var(--font-display); }
.chess-rule-card p { margin: 0; color: var(--text-muted); font-size: .66rem; line-height: 1.5; }
[data-theme="dark"] .chess-rule-card, [data-theme="dark"] .chess-rule-card.finish, [data-theme="dark"] .chess-rule-card.pieces, [data-theme="dark"] .chess-rule-card.plan, [data-theme="dark"] .chess-rule-card.magic { border-color: #454057; background: #252438; }
.chess-speech-link { min-height: 37px; margin-top: .65rem; border: 0; border-radius: 10px; padding: .45rem .65rem; background: #eee9ff; color: #51418e; font: 800 .69rem var(--font-body); cursor: pointer; }
[data-theme="dark"] .chess-speech-link { background: #302946; color: #ded6ff; }
.chess-opening-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .48rem; }
.chess-opening-card { display: flex; align-items: flex-start; gap: .5rem; min-width: 0; border: 1px solid #e8e0d5; border-radius: 13px; padding: .57rem; background: linear-gradient(145deg, #fff, #fdf9f0); }
.chess-opening-card.sicilian { background: linear-gradient(145deg, #fff, #fff4ee); }
.chess-opening-card.london { background: linear-gradient(145deg, #fff, #f2f5ff); }
.chess-opening-card.queens { background: linear-gradient(145deg, #fff, #fff8df); }
[data-theme="dark"] .chess-opening-card, [data-theme="dark"] .chess-opening-card.sicilian, [data-theme="dark"] .chess-opening-card.london, [data-theme="dark"] .chess-opening-card.queens { border-color: #454057; background: #252438; }
.chess-opening-icon { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 10px; background: #f4edff; font-size: 1.1rem; }
.chess-opening-copy { min-width: 0; }
.chess-opening-tag { color: #827296; font-size: .56rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.chess-opening-copy h4 { margin: .11rem 0 .22rem; color: var(--text); font: 800 .71rem/1.3 var(--font-display); }
.chess-opening-copy p { margin: 0; color: var(--text-muted); font-size: .64rem; line-height: 1.45; }
.chess-opening-button { min-height: 34px; margin-top: .38rem; border: 0; border-radius: 8px; padding: .38rem .48rem; background: #eee9ff; color: #51418e; font: 800 .62rem var(--font-body); text-align: left; cursor: pointer; }
.chess-opening-button:hover { background: #ded6ff; }
[data-theme="dark"] .chess-opening-button { background: #342b4d; color: #e1d7ff; }
.chess-demo { margin-top: .65rem; }
.chess-demo:empty { display: none; }
.chess-demo { border: 1px solid #d8cfef; border-radius: 14px; padding: .67rem; background: linear-gradient(135deg, #f3efff, #fff9ed); }
[data-theme="dark"] .chess-demo { border-color: #49405f; background: linear-gradient(135deg, #29243c, #2e2923); }
.chess-demo-top { display: flex; align-items: center; justify-content: space-between; color: #5e4c9c; font-size: .68rem; font-weight: 900; }
[data-theme="dark"] .chess-demo-top { color: #d6caff; }
.chess-demo-close { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-muted); font-size: 1.1rem; cursor: pointer; }
.chess-demo-note, .chess-demo-next { margin: .42rem 0 0; color: var(--text-muted); font-size: .69rem; line-height: 1.48; }
.chess-demo-next { border-top: 1px dashed #d6cce9; padding-top: .4rem; }
.chess-demo-next strong { color: var(--text); }
.chess-demo-next.complete { color: #4e7550; font-weight: 800; }
.chess-demo-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.chess-demo-next-btn { min-height: 36px; padding: .48rem .6rem; font-size: .65rem; }
.chess-demo-restart { min-height: 36px; border: 1px solid var(--border); border-radius: 9px; padding: .42rem .58rem; background: var(--surface); color: var(--text-muted); font: 750 .64rem var(--font-body); cursor: pointer; }
.chess-demo-restart:hover { border-color: var(--primary); color: var(--primary-strong); }

/* ---------- Brain Games: short, explained mini-challenges ---------- */
.brain-games-hub { position: relative; margin: 2.45rem 0 2.7rem; scroll-margin-top: 1rem; }
.brain-games-app { position: relative; overflow: hidden; border: 1px solid #dcd7f4; border-radius: 26px; padding: clamp(1rem, 3vw, 1.55rem); background: radial-gradient(ellipse at 10% 0%, #e3f8f1 0, transparent 31%), radial-gradient(ellipse at 100% 4%, #f4e8ff 0, transparent 33%), linear-gradient(145deg, #fff 0%, #fbfaff 55%, #fff9ec 100%); box-shadow: 0 16px 35px rgba(62, 52, 113, .08); }
[data-theme="dark"] .brain-games-app { border-color: #39354f; background: radial-gradient(ellipse at 10% 0%, #17392f 0, transparent 31%), radial-gradient(ellipse at 100% 4%, #332541 0, transparent 33%), linear-gradient(145deg, #171b2d 0%, #1b1b30 55%, #242131 100%); box-shadow: 0 16px 35px rgba(0,0,0,.18); }
.brain-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .95rem; }
.brain-heading .section-eyebrow { color: #7662c8; }
.brain-heading .section-title { display: flex; align-items: center; gap: .45rem; }
.brain-heading-star { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(145deg, #ffe78f, #f8ac65); color: #81542d; font-size: 1.15rem; box-shadow: 0 5px 13px #e2ae5635; animation: brain-twinkle 2.8s ease-in-out infinite; }
@keyframes brain-twinkle { 50% { transform: rotate(14deg) scale(1.08); } }
.brain-total { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; border: 1px solid #f0d997; border-radius: 16px; padding: .55rem .72rem; background: linear-gradient(135deg, #fff8d9, #ffeccc); color: #805923; }
.brain-total > span { font-size: 1.3rem; }
.brain-total div { display: grid; gap: .05rem; }
.brain-total strong { font: 800 1rem var(--font-display); }
.brain-total small { font-size: .62rem; font-weight: 800; }
.brain-evolution-wrap { display: flex; align-items: stretch; gap: .65rem; margin-bottom: .78rem; }
.brain-evolution { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; border: 1px solid #d9ecdd; border-radius: 18px; padding: .65rem .85rem; background: linear-gradient(100deg, #f0fff3, #fff 65%); }
[data-theme="dark"] .brain-evolution { border-color: #345441; background: linear-gradient(100deg, #1b3828, #202137 65%); }
.brain-buddy { position: relative; display: grid; place-items: center; flex: 0 0 52px; height: 52px; border-radius: 17px; background: linear-gradient(145deg, #dcf8e4, #ecf0ff); font-size: 1.85rem; box-shadow: inset 0 0 0 1px #fff8, 0 4px 11px #4b8e4b1b; }
.brain-buddy > span { animation: brain-bob 2.7s ease-in-out infinite; }
.brain-buddy i { position: absolute; color: #e7a73d; font-style: normal; font-size: .68rem; }
.brain-buddy i:first-of-type { top: .15rem; right: .4rem; }
.brain-buddy i:last-of-type { bottom: .28rem; left: .28rem; font-size: .5rem; }
@keyframes brain-bob { 50% { transform: translateY(-3px) rotate(-4deg); } }
.brain-evolution-copy { flex: 1; min-width: 0; }
.brain-level-line { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.brain-level-line strong { color: var(--text); font: 800 .8rem var(--font-display); }
.brain-level-line span { border-radius: 999px; padding: .2rem .48rem; background: #e9e4ff; color: #5f4cad; font-size: .63rem; font-weight: 850; white-space: nowrap; }
.brain-evolution-copy > p { margin: .18rem 0 .38rem; color: var(--text-muted); font-size: .66rem; line-height: 1.45; }
.brain-meter { height: 8px; overflow: hidden; border-radius: 99px; background: #e5e3ee; }
.brain-meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #59c991, #7e6ae3 83%, #eea85a); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.brain-evolution-copy > small { display: block; margin-top: .22rem; color: var(--text-faint); font-size: .59rem; font-weight: 750; text-align: right; }
.brain-played-stat { display: grid; place-content: center; justify-items: center; flex: 0 0 95px; gap: .05rem; border: 1px solid #e4dff6; border-radius: 18px; background: linear-gradient(145deg, #f8f4ff, #fff); color: var(--text-muted); text-align: center; }
[data-theme="dark"] .brain-played-stat { border-color: #454057; background: #222137; }
.brain-played-stat span { font-size: 1rem; }
.brain-played-stat strong { color: var(--text); font: 800 1.05rem var(--font-display); }
.brain-played-stat small { font-size: .59rem; font-weight: 800; }
.brain-lobby-note { display: flex; align-items: center; gap: .58rem; margin: 0 0 .8rem; border: 1px dashed #d9d2f2; border-radius: 14px; padding: .55rem .7rem; background: #f9f7ffbd; }
[data-theme="dark"] .brain-lobby-note { border-color: #47405f; background: #211e32bd; }
.brain-note-icon { display: grid; place-items: center; flex: 0 0 31px; height: 31px; border-radius: 10px; background: #fff1c9; font-size: 1rem; }
.brain-lobby-note p { margin: 0; color: var(--text-muted); font-size: .7rem; line-height: 1.5; }
.brain-daily-banner { display: flex; align-items: center; gap: .9rem; margin: .35rem 0 .8rem; border: 1px solid #d9c5f2; border-radius: 19px; padding: .85rem 1rem; background: linear-gradient(105deg, #f4eaff, #fff9e8 75%); box-shadow: 0 8px 22px #7350ac12; }
.brain-daily-icon { display: grid; place-items: center; flex: 0 0 54px; height: 54px; border-radius: 16px; background: #fff; color: #7955b5; font-size: 1.7rem; box-shadow: 0 5px 13px #7456a626; }
.brain-daily-banner > div:nth-child(2) { flex: 1; min-width: 0; }
.brain-daily-banner .brain-game-skill { margin: 0; color: #7254ad; }
.brain-daily-banner h3 { margin: .12rem 0; color: var(--text); font: 800 1rem var(--font-display); }
.brain-daily-banner p { margin: .12rem 0 .28rem; color: var(--text-muted); font-size: .7rem; line-height: 1.45; }
.brain-daily-banner small { color: #71558c; font-size: .62rem; font-weight: 850; }
.brain-daily-banner .brain-main-action { flex: 0 0 auto; margin: 0; }
[data-theme="dark"] .brain-daily-banner { border-color: #5b4770; background: linear-gradient(105deg, #30223f, #343023); }
[data-theme="dark"] .brain-daily-icon { background: #423653; color: #ead3ff; }
[data-theme="dark"] .brain-daily-banner small { color: #d9bdf1; }
.brain-game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .72rem; }
.brain-game-card { position: relative; display: flex; min-width: 0; min-height: 220px; flex-direction: column; align-items: flex-start; border: 1px solid #d9e8dd; border-radius: 19px; padding: .85rem; background: linear-gradient(150deg, #fff, #f1fff5); color: var(--text); text-align: left; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.brain-game-card::after { position: absolute; right: -11px; bottom: 25px; width: 21px; height: 21px; border: 1px solid #e1daf7; border-radius: 50%; background: #fff; color: #a28ee6; content: '✦'; display: grid; place-items: center; font-size: .58rem; }
.brain-game-card:last-child::after { display: none; }
.brain-game-card:hover { z-index: 1; transform: translateY(-4px) rotate(-.5deg); border-color: #9fdbb5; box-shadow: 0 12px 22px rgba(45, 117, 75, .12); }
.brain-game-card.violet { border-color: #e2d9fb; background: linear-gradient(150deg, #fff, #f6f1ff); }
.brain-game-card.violet:hover { border-color: #b6a1ef; box-shadow: 0 12px 22px rgba(92, 68, 169, .12); }
.brain-game-card.peach { border-color: #f1ddd3; background: linear-gradient(150deg, #fff, #fff5ef); }
.brain-game-card.peach:hover { border-color: #eab89d; box-shadow: 0 12px 22px rgba(161, 91, 48, .12); }
.brain-game-card.blue { border-color: #d9e4f4; background: linear-gradient(150deg, #fff, #f1f7ff); }
.brain-game-card.blue:hover { border-color: #a6c6e8; box-shadow: 0 12px 22px rgba(62, 103, 156, .12); }
[data-theme="dark"] .brain-game-card, [data-theme="dark"] .brain-game-card.violet, [data-theme="dark"] .brain-game-card.peach, [data-theme="dark"] .brain-game-card.blue { border-color: #454057; background: linear-gradient(145deg, #24263a, #211f34); }
.brain-card-top { display: flex; align-items: flex-start; justify-content: space-between; width: 100%; }
.brain-game-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #d9eadc; border-radius: 16px; background: #e5f9e9; font-size: 1.65rem; box-shadow: inset 0 1px 0 #fff9; }
.brain-game-card.violet .brain-game-icon { border-color: #e5dafc; background: #eee6ff; }
.brain-game-card.peach .brain-game-icon { border-color: #f5ddd0; background: #ffebe0; }
.brain-game-card.blue .brain-game-icon { border-color: #dbe8f8; background: #eaf3ff; }
.brain-card-number { color: #afa6c7; font: 800 .69rem var(--font-display); letter-spacing: .08em; }
.brain-game-skill { display: block; margin-top: .72rem; color: #6e9a7a; font-size: .56rem; font-weight: 900; letter-spacing: .09em; }
.brain-game-card.violet .brain-game-skill { color: #8270bd; }
.brain-game-card.peach .brain-game-skill { color: #bc805c; }
.brain-game-card.blue .brain-game-skill { color: #648ab4; }
.brain-game-card > strong { margin-top: .18rem; color: var(--text); font: 800 .87rem/1.28 var(--font-display); }
.brain-game-description { display: block; margin-top: .35rem; color: var(--text-muted); font-size: .68rem; line-height: 1.5; }
.brain-card-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: .35rem; width: 100%; margin-top: auto; padding-top: .65rem; color: var(--text-faint); font-size: .59rem; font-weight: 750; }
.brain-play-link { color: #518b65; font-size: .66rem; font-weight: 900; white-space: nowrap; }
.brain-game-card.violet .brain-play-link { color: #6751ae; }
.brain-game-card.peach .brain-play-link { color: #ae6d4a; }
.brain-game-card.blue .brain-play-link { color: #527ca9; }
.brain-stage-heading { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.brain-back { min-height: 39px; border: 1px solid var(--border); border-radius: 11px; padding: .48rem .68rem; background: var(--surface); color: var(--text-muted); font: 750 .7rem var(--font-body); cursor: pointer; white-space: nowrap; }
.brain-back:hover, .brain-secondary-action:hover { border-color: var(--primary); color: var(--primary-strong); }
.brain-stage-title { display: flex; align-items: center; gap: .58rem; min-width: 0; }
.brain-stage-title h2 { margin: .09rem 0 0; color: var(--text); font: 800 1.1rem var(--font-display); }
.brain-stage-title .brain-game-skill { margin: 0; }
.brain-stage-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; background: #e5f9e9; font-size: 1.45rem; }
.brain-stage-icon.violet { background: #eee6ff; }
.brain-stage-icon.peach { background: #ffebe0; }
.brain-stage-icon.blue { background: #eaf3ff; }
.brain-score-chip { margin-left: auto; border: 1px solid #f0d997; border-radius: 999px; padding: .4rem .62rem; background: #fff7d8; color: #805923; font-size: .69rem; font-weight: 850; white-space: nowrap; }
.brain-timer { margin-left: auto; color: var(--text-muted); font-size: .72rem; font-weight: 850; white-space: nowrap; }
.brain-timer + .brain-score-chip { margin-left: 0; }
[data-theme="dark"] .brain-score-chip { border-color: #665431; background: #332d1f; color: #ffdf9d; }
.brain-coach-banner { display: flex; align-items: center; gap: .6rem; margin-bottom: .68rem; border: 1px solid #d9d3f3; border-radius: 15px; padding: .58rem .72rem; background: linear-gradient(100deg, #f6f3ff, #fff); }
[data-theme="dark"] .brain-coach-banner { border-color: #48405f; background: linear-gradient(100deg, #28223b, #222135); }
.brain-coach-banner > span { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 11px; background: #fff; font-size: 1.1rem; }
.brain-coach-banner div { flex: 1; min-width: 0; }
.brain-coach-banner strong { color: var(--text); font: 800 .7rem var(--font-display); }
.brain-coach-banner p { margin: .12rem 0 0; color: var(--text-muted); font-size: .67rem; line-height: 1.45; }
.brain-hear-btn, .brain-hear-explanation { min-height: 34px; border: 1px solid #d8d0f2; border-radius: 9px; padding: .36rem .52rem; background: #fff; color: #6552a9; font: 800 .62rem var(--font-body); cursor: pointer; }
[data-theme="dark"] .brain-hear-btn, [data-theme="dark"] .brain-hear-explanation { border-color: #51486d; background: #302a46; color: #ded5ff; }
.brain-round-progress { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .65rem; color: var(--text-muted); font-size: .68rem; font-weight: 850; }
.brain-round-pips { display: flex; gap: .32rem; }
.brain-round-pips span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text-faint); font-size: .62rem; }
.brain-round-pips span.current { border-color: #7bc49a; background: #e9faed; color: #3c8653; box-shadow: 0 0 0 3px #d8f4df80; }
.brain-round-pips span.done { border-color: #7665ca; background: #7665ca; color: #fff; }
.brain-playfield { max-width: 760px; margin-inline: auto; }
.brain-question-card { border: 1px solid #e3deef; border-radius: 20px; padding: clamp(.9rem, 3vw, 1.35rem); background: linear-gradient(145deg, #fff, #fbfaff); box-shadow: 0 8px 24px rgba(57, 47, 95, .065); }
[data-theme="dark"] .brain-question-card { border-color: #454057; background: linear-gradient(145deg, #222439, #211f34); box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.brain-question-label { display: inline-block; border-radius: 999px; padding: .23rem .5rem; background: #f1edff; color: #705dae; font-size: .59rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.brain-question-card h3 { margin: .46rem 0 .75rem; color: var(--text); font: 800 1rem/1.35 var(--font-display); text-align: center; }
.brain-number-display { display: flex; align-items: center; justify-content: center; gap: .36rem; min-height: 76px; margin: .45rem auto .8rem; overflow-x: auto; border: 1px dashed #ddd7ef; border-radius: 16px; padding: .5rem; background: radial-gradient(ellipse at center, #f5f1ff, #fcfbff 70%); }
[data-theme="dark"] .brain-number-display { border-color: #48405f; background: radial-gradient(ellipse at center, #302844, #242338 70%); }
.brain-number-display span { display: grid; place-items: center; min-width: 48px; height: 48px; border-radius: 13px; background: #fff; color: #4e4185; box-shadow: 0 3px 9px #53438a12; font: 800 1.45rem var(--font-display); }
.brain-number-display.equation span:nth-child(2) { min-width: 36px; background: #eae5ff; color: #725cb4; }
.brain-number-display.sequence span { min-width: 42px; height: 42px; background: #fff; font-size: 1rem; }
.brain-number-display i { color: #a99ed0; font-size: .75rem; font-style: normal; }
.brain-answer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .55rem; }
.brain-answer-option { min-height: 52px; border: 1px solid #e1dcef; border-radius: 14px; background: #fff; color: var(--text); box-shadow: 0 3px 9px #392b6208; font: 800 1.08rem var(--font-display); cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.brain-answer-option:hover:not(:disabled) { transform: translateY(-2px); border-color: #a99ae4; background: #f5f2ff; }
.brain-answer-option.correct { border-color: #78cc93; background: #e9faed; color: #34784a; }
.brain-answer-option.incorrect { border-color: #efa69a; background: #fff0ec; color: #a04a3f; animation: answer-wiggle .28s ease; }
.brain-answer-option:disabled { cursor: default; }
.brain-main-action, .brain-next-action { min-height: 43px; border: 0; border-radius: 12px; padding: .62rem .88rem; background: linear-gradient(135deg, #6857cc, #8e61d0); color: #fff; box-shadow: 0 6px 15px #6957cc28; font: 850 .74rem var(--font-body); cursor: pointer; transition: transform .16s ease, filter .16s ease; }
.brain-main-action:hover, .brain-next-action:hover { transform: translateY(-2px); filter: brightness(1.06); }
.brain-feedback { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .55rem; margin-top: .65rem; border: 1px solid #bce2c4; border-radius: 15px; padding: .65rem .72rem; background: linear-gradient(110deg, #f1fff3, #fff); }
.brain-feedback.coach { border-color: #eadcb2; background: linear-gradient(110deg, #fff9e9, #fff); }
[data-theme="dark"] .brain-feedback, [data-theme="dark"] .brain-feedback.coach { border-color: #345441; background: linear-gradient(110deg, #1d3829, #242338); }
.brain-feedback.coach { border-color: #665431; }
.brain-feedback-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 11px; background: #fff; font-size: 1.1rem; }
.brain-feedback strong { color: var(--text); font: 800 .72rem var(--font-display); }
.brain-feedback p { margin: .16rem 0 0; color: var(--text-muted); font-size: .67rem; line-height: 1.5; }
.brain-feedback .brain-hear-explanation { grid-column: 2; justify-self: start; }
.brain-next-action { grid-column: 3; grid-row: 1 / span 2; white-space: nowrap; }
.brain-memory-card { text-align: center; }
.brain-flash-stage { display: grid; place-content: center; justify-items: center; gap: .35rem; width: min(100%, 320px); height: 130px; margin: .35rem auto .68rem; border: 1px solid #ddd6f5; border-radius: 21px; background: radial-gradient(ellipse, #fff 20%, #eee9ff 100%); color: #5e4e9d; box-shadow: inset 0 0 20px #7760cc0b; }
[data-theme="dark"] .brain-flash-stage { border-color: #49405f; background: radial-gradient(ellipse, #302843 20%, #252238 100%); color: #e4dbff; }
.brain-flash-stage > span { font-size: 3rem; line-height: 1; }
.brain-flash-stage.flashing > span { animation: memory-pop .3s cubic-bezier(.2,1.5,.4,1); }
@keyframes memory-pop { from { transform: scale(.45); opacity: .25; } to { transform: scale(1); opacity: 1; } }
.brain-flash-stage small { font-size: .63rem; font-weight: 850; }
.brain-memory-prompt { margin: 0 0 .6rem; color: var(--text-muted); font-size: .7rem; }
.brain-main-action { margin: .15rem auto; }
.brain-memory-entry { max-width: 400px; margin: .35rem auto 0; }
.brain-memory-entry > span { color: var(--text-muted); font-size: .68rem; font-weight: 850; }
.brain-memory-slots { display: flex; justify-content: center; gap: .25rem; margin: .35rem 0 .2rem; }
.brain-memory-slots i { display: grid; place-items: center; width: 32px; height: 32px; border: 1px dashed #d5cdeb; border-radius: 9px; background: #f8f5ff; color: #745fb4; font: normal 1rem var(--font-display); }
.brain-memory-reveal { display: flex; justify-content: center; flex-wrap: wrap; gap: .25rem; margin: .35rem auto 0; }
.brain-memory-reveal span { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #d7cdef; border-radius: 9px; background: #f5f1ff; font-size: 1rem; animation: memory-pop .3s cubic-bezier(.2,1.5,.4,1); }
.brain-memory-entry > p { min-height: 1rem; margin: .2rem 0 .38rem; color: var(--text-faint); font-size: .65rem; }
.brain-symbol-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: .42rem; }
.brain-symbol-picker button { min-height: 47px; border: 1px solid #e1dcef; border-radius: 12px; background: #fff; font-size: 1.35rem; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.brain-symbol-picker button:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); background: #f4f0ff; }
.brain-symbol-picker button:disabled { opacity: .46; cursor: default; }
.brain-clear-action { margin-top: .48rem; border: 0; background: none; color: #6f5aac; font: 750 .65rem var(--font-body); text-decoration: underline; cursor: pointer; }
.brain-focus-card { text-align: center; }
.brain-focus-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .42rem; max-width: 440px; margin: .35rem auto .7rem; }
.brain-focus-tile { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid #e0dced; border-radius: 14px; background: #fff; font-size: clamp(1.2rem, 4vw, 1.8rem); cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.brain-focus-tile:hover:not(:disabled) { transform: scale(1.05); border-color: #b3a2e8; }
.brain-focus-tile.picked { border-color: #8c73d5; background: #eee8ff; box-shadow: inset 0 0 0 2px #d9d0fa; }
.brain-focus-tile.target-answer { border-color: #82cb96; background: #e9faed; }
.brain-focus-tile.false-pick { border-color: #eeaa9b; background: #fff0ec; }
.brain-focus-tile:disabled { cursor: default; }
.brain-results { display: grid; justify-items: center; border: 1px solid #e4d9b3; border-radius: 22px; padding: 1.2rem; background: radial-gradient(ellipse at 50% 0%, #fff4c9, #fff 68%); text-align: center; }
[data-theme="dark"] .brain-results { border-color: #665431; background: radial-gradient(ellipse at 50% 0%, #352e20, #242338 68%); }
.brain-results.celebrate .brain-result-spark { animation: brain-win .65s cubic-bezier(.2,1.5,.4,1); }
@keyframes brain-win { 40% { transform: scale(1.22) rotate(12deg); } }
.brain-result-spark { display: grid; place-items: center; width: 65px; height: 65px; border-radius: 22px; background: #fff0bf; font-size: 2.1rem; box-shadow: 0 8px 16px #b58a2b1f; }
.brain-results .section-eyebrow { margin: .65rem 0 .1rem; }
.brain-results h3 { margin: 0; color: var(--text); font: 800 1.18rem var(--font-display); }
.brain-result-score { margin-top: .4rem; color: #a66c26; font: 800 .92rem var(--font-display); }
.brain-mind-meter { display: grid; justify-items: center; gap: .25rem; margin: .55rem 0; border: 1px solid #e1d3f2; border-radius: 15px; padding: .65rem .85rem; background: #f7f0ff; }
.brain-mind-meter strong { color: #6748a1; font: 800 .9rem var(--font-display); }
.brain-mind-meter small { max-width: 390px; color: var(--text-muted); font-size: .64rem; line-height: 1.4; }
.brain-mind-meter span { color: #3f8a55; font-size: .67rem; font-weight: 850; }
[data-theme="dark"] .brain-mind-meter { border-color: #58436f; background: #30233d; }
[data-theme="dark"] .brain-mind-meter strong { color: #ddc2ff; }
.brain-results > p { margin: .3rem 0; color: var(--text-muted); font-size: .72rem; }
.brain-new-best { margin-top: .34rem; border-radius: 999px; padding: .32rem .6rem; background: #eaf9ed; color: #357c4b; font-size: .68rem; font-weight: 850; }
.brain-result-growth { display: flex; align-items: center; gap: .55rem; max-width: 470px; margin: .72rem 0; border: 1px solid #dbe8d8; border-radius: 14px; padding: .55rem .7rem; background: #f4fff2; text-align: left; }
[data-theme="dark"] .brain-result-growth { border-color: #345441; background: #1d3829; }
.brain-result-growth > span { font-size: 1.4rem; }
.brain-result-growth p { margin: 0; color: var(--text-muted); font-size: .68rem; line-height: 1.45; }
.brain-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .48rem; }
.brain-secondary-action { min-height: 43px; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .82rem; background: var(--surface); color: var(--text-muted); font: 800 .72rem var(--font-body); cursor: pointer; }
@media (max-width: 980px) {
  .brain-game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brain-game-card { min-height: 190px; }
  .brain-game-card:nth-child(2)::after { display: none; }
  .brain-game-card:nth-child(3)::after { display: grid; }
}
@media (max-width: 640px) {
  .brain-daily-banner { align-items: flex-start; flex-wrap: wrap; gap: .6rem; padding: .72rem; }
  .brain-daily-icon { flex-basis: 42px; height: 42px; font-size: 1.3rem; }
  .brain-daily-banner .brain-main-action { width: 100%; }
  .brain-stage-heading { flex-wrap: wrap; }
  .brain-timer { margin-left: 0; }
  .brain-games-hub { margin: 1.8rem 0 2rem; }
  .brain-games-app { border-radius: 21px; padding: .8rem; }
  .brain-heading { gap: .5rem; }
  .brain-heading .section-title { font-size: 1.45rem; }
  .brain-heading .section-description { max-width: 31rem; font-size: .76rem; }
  .brain-heading-star { width: 29px; height: 29px; font-size: .95rem; }
  .brain-total { gap: .35rem; border-radius: 13px; padding: .45rem .5rem; }
  .brain-total > span { font-size: 1.05rem; }
  .brain-total strong { font-size: .88rem; }
  .brain-total small { font-size: .54rem; }
  .brain-evolution-wrap { gap: .4rem; }
  .brain-evolution { gap: .5rem; padding: .55rem; }
  .brain-buddy { flex-basis: 42px; height: 42px; border-radius: 14px; font-size: 1.5rem; }
  .brain-level-line { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .brain-level-line strong { font-size: .72rem; }
  .brain-level-line span { font-size: .56rem; }
  .brain-evolution-copy > p { font-size: .61rem; }
  .brain-played-stat { flex-basis: 72px; border-radius: 14px; }
  .brain-played-stat small { max-width: 65px; font-size: .52rem; }
  .brain-lobby-note { align-items: flex-start; }
  .brain-game-grid { grid-template-columns: 1fr; gap: .5rem; }
  .brain-game-card { min-height: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: .65rem; padding: .66rem; }
  .brain-game-card::after, .brain-game-card:nth-child(2)::after, .brain-game-card:nth-child(3)::after { display: none; }
  .brain-card-top { grid-row: 1 / span 3; width: auto; align-items: center; gap: .35rem; }
  .brain-game-icon { width: 42px; height: 42px; border-radius: 14px; font-size: 1.4rem; }
  .brain-card-number { display: none; }
  .brain-game-skill { grid-column: 2; margin: 0; font-size: .53rem; }
  .brain-game-card > strong { grid-column: 2; margin: .1rem 0 0; font-size: .79rem; }
  .brain-game-description { grid-column: 2; margin: .12rem 0 0; font-size: .63rem; }
  .brain-card-footer { grid-column: 2; padding-top: .3rem; font-size: .56rem; }
  .brain-stage-heading { gap: .42rem; flex-wrap: wrap; }
  .brain-back { min-height: 37px; padding: .4rem .5rem; font-size: .62rem; }
  .brain-stage-title { gap: .4rem; }
  .brain-stage-title h2 { font-size: .88rem; }
  .brain-stage-icon { flex-basis: 37px; height: 37px; border-radius: 12px; font-size: 1.2rem; }
  .brain-stage-title .brain-game-skill { font-size: .49rem; }
  .brain-score-chip { padding: .35rem .48rem; font-size: .58rem; }
  .brain-coach-banner { align-items: flex-start; gap: .42rem; padding: .48rem; }
  .brain-coach-banner > span { flex-basis: 29px; height: 29px; font-size: .95rem; }
  .brain-coach-banner strong { font-size: .65rem; }
  .brain-coach-banner p { font-size: .61rem; }
  .brain-hear-btn { min-height: 32px; padding-inline: .38rem; font-size: .56rem; white-space: nowrap; }
  .brain-round-pips span { width: 23px; height: 23px; }
  .brain-question-card { border-radius: 17px; padding: .68rem; }
  .brain-question-card h3 { font-size: .86rem; }
  .brain-number-display { min-height: 65px; gap: .22rem; }
  .brain-number-display span { min-width: 40px; height: 42px; font-size: 1.2rem; }
  .brain-number-display.equation span:nth-child(2) { min-width: 31px; }
  .brain-number-display.sequence span { min-width: 32px; height: 35px; font-size: .75rem; }
  .brain-number-display i { font-size: .62rem; }
  .brain-answer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .brain-answer-option { min-height: 47px; }
  .brain-feedback { grid-template-columns: auto minmax(0, 1fr); align-items: start; padding: .55rem; }
  .brain-feedback .brain-hear-explanation { grid-column: 2; }
  .brain-next-action { grid-column: 1 / -1; grid-row: auto; width: 100%; }
  .brain-flash-stage { height: 110px; }
  .brain-memory-slots { flex-wrap: wrap; }
  .brain-memory-slots i { width: 27px; height: 27px; }
  .brain-symbol-picker { grid-template-columns: repeat(3, 1fr); }
  .brain-focus-grid { gap: .27rem; }
  .brain-focus-tile { border-radius: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .brain-heading-star, .brain-buddy > span, .brain-flash-stage.flashing > span { animation: none; }
}

@media (max-width: 980px) {
  .chess-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, .9fr); gap: .75rem; }
  .chess-controls { grid-template-columns: 1fr 1.1fr; }
  .chess-new-game { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .chess-layout { grid-template-columns: minmax(0, 1fr); }
  .chess-game-card { max-width: 590px; width: 100%; margin-inline: auto; }
  .chess-side-column { grid-template-columns: 1fr; }
  .chess-side-column > section { width: 100%; }
  .chess-board-wrap { max-width: 520px; }
  .chess-section-heading { align-items: flex-start; }
  .chess-xp { margin-top: .3rem; }
}
@media (max-width: 480px) {
  .chess-hub { margin: 1.65rem 0 2rem; }
  .chess-layout { gap: .75rem; }
  .chess-game-card, .chess-coach-card, .chess-openings-card { border-radius: 18px; }
  .chess-game-card { padding: .78rem; }
  .chess-heading-icon { flex-basis: 38px; height: 38px; border-radius: 13px; }
  .chess-card-heading h3 { font-size: .94rem; }
  .chess-card-heading p { font-size: .69rem; }
  .chess-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .42rem; }
  .chess-select-label select { font-size: .68rem; }
  .chess-new-game { min-height: 44px; }
  .chess-board-wrap { padding: .37rem; border-radius: 15px; }
  .chess-board-ribbon { font-size: .45rem; }
  .chess-board-ribbon.bottom { font-size: .46rem; }
  .chess-coord.rank { top: 2px; left: 2px; }
  .chess-coord.file { right: 2px; bottom: 2px; }
  .chess-piece { font-size: clamp(1.35rem, 8vw, 2.35rem); }
  .chess-square.selected { box-shadow: inset 0 0 0 3px #f1b936; }
  .chess-square.capture-target::after { inset: 2px; border-width: 3px; }
  .chess-game-actions { gap: .35rem; }
  .chess-action-btn { min-height: 42px; flex: 1; padding-inline: .42rem; font-size: .67rem; }
  .chess-action-btn.voice { margin-left: 0; }
  .chess-rule-grid, .chess-opening-list { grid-template-columns: 1fr 1fr; }
  .chess-rule-card { padding: .55rem; }
  .chess-rule-card p { font-size: .64rem; }
  .chess-opening-card { gap: .38rem; padding: .48rem; }
  .chess-opening-copy p { font-size: .61rem; }
  .chess-opening-button { width: 100%; text-align: center; }
  .chess-demo-actions > button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .chess-xp.xp-pop, .chess-turn-pill.is-thinking { animation: none; }
}

/* ---------- Learning Studio page navigation and focused hubs ---------- */
.brand-link { color: inherit; text-decoration: none; }
.brand-link .brand-text strong { font: 800 1.18rem/1.15 var(--font-display); letter-spacing: -.025em; }
.brand-link:hover .brand-text strong { color: var(--primary-strong); }
.learning-nav { padding: .42rem 1rem .58rem; border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent); }
.learning-nav-inner { display: flex; width: fit-content; max-width: 100%; gap: .28rem; margin: 0 auto; overflow-x: auto; border: 1px solid var(--border); border-radius: 15px; padding: .27rem; background: color-mix(in srgb, var(--surface-2) 78%, transparent); scrollbar-width: none; }
.learning-nav-inner::-webkit-scrollbar { display: none; }
.learning-nav-link { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: .48rem; border: 1px solid transparent; border-radius: 11px; padding: .42rem .92rem; color: var(--text-muted); font-size: .78rem; font-weight: 800; text-decoration: none; white-space: nowrap; transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition); }
.learning-nav-link:hover { transform: translateY(-1px); background: var(--surface); color: var(--text); }
.learning-nav-link.is-active { border-color: color-mix(in srgb, var(--primary) 17%, transparent); background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow-sm); }
.learning-nav-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #eeecff; color: #5d53bd; font-size: 1rem; line-height: 1; }
.learning-nav-icon.chess { background: #e3f3eb; color: #327b57; }
.learning-nav-icon.brain { background: #f5eaff; color: #8653bd; }
[data-theme="dark"] .learning-nav-link.is-active { border-color: #48405f; background: #24243a; color: #c9c2ff; }
[data-theme="dark"] .learning-nav-icon { background: #302d50; color: #d0caff; }
[data-theme="dark"] .learning-nav-icon.chess { background: #203c32; color: #a8e2c0; }
[data-theme="dark"] .learning-nav-icon.brain { background: #3a2a4c; color: #e0bdff; }
.experience-page { padding-top: 1.45rem; }
.experience-hero { position: relative; display: grid; min-height: 352px; grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr); align-items: center; gap: 1rem; overflow: hidden; margin: .1rem 0 1.75rem; border: 1px solid #dce7e1; border-radius: 27px; padding: clamp(1.25rem, 4vw, 2.65rem); background: radial-gradient(ellipse at 88% 10%, #e5f4eb 0, transparent 39%), linear-gradient(130deg, #fff 3%, #f3faf5 62%, #eaf7ef 100%); box-shadow: 0 19px 45px rgba(37, 86, 61, .09); }
.experience-hero::before { position: absolute; right: 25%; bottom: -105px; width: 360px; height: 220px; border-radius: 50%; background: #fff8; content: ''; filter: blur(25px); }
.brain-experience-hero { border-color: #e3d9f0; background: radial-gradient(ellipse at 90% 0%, #eee4ff 0, transparent 40%), linear-gradient(132deg, #fff 0%, #faf6ff 59%, #f0eaff 100%); box-shadow: 0 19px 45px rgba(91, 61, 142, .09); }
[data-theme="dark"] .experience-hero { border-color: #30463a; background: radial-gradient(ellipse at 90% 0%, #203d31 0, transparent 44%), linear-gradient(132deg, #171e25 0%, #182a25 100%); box-shadow: 0 19px 45px rgba(0, 0, 0, .2); }
[data-theme="dark"] .brain-experience-hero { border-color: #46385c; background: radial-gradient(ellipse at 90% 0%, #3b2b50 0, transparent 43%), linear-gradient(132deg, #1a1928 0%, #282039 100%); }
.experience-hero-copy { position: relative; z-index: 1; max-width: 640px; }
.experience-kicker { display: flex; align-items: center; gap: .48rem; margin: 0 0 .65rem; color: #3f8a61; font-size: .63rem; font-weight: 900; letter-spacing: .13em; }
.experience-kicker > span:first-child { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: #dff3e6; color: #338355; font-size: .95rem; letter-spacing: 0; }
.brain-experience-hero .experience-kicker { color: #7750a4; }
.brain-experience-hero .experience-kicker > span:first-child { background: #eee3ff; color: #8654bd; }
[data-theme="dark"] .experience-kicker { color: #9bd9b1; }
[data-theme="dark"] .experience-kicker > span:first-child { background: #244431; color: #a4e2b5; }
[data-theme="dark"] .brain-experience-hero .experience-kicker { color: #d4afff; }
[data-theme="dark"] .brain-experience-hero .experience-kicker > span:first-child { background: #432f58; color: #d8b5ff; }
.experience-hero h1 { max-width: 610px; margin: 0; color: #182b20; font: 800 clamp(2.2rem, 4.8vw, 3.65rem)/1.04 var(--font-display); letter-spacing: -.055em; }
.brain-experience-hero h1 { color: #2d2140; }
[data-theme="dark"] .experience-hero h1, [data-theme="dark"] .brain-experience-hero h1 { color: var(--text); }
.experience-subtitle { max-width: 590px; margin: .8rem 0 1.02rem; color: #52675b; font-size: .93rem; line-height: 1.72; }
.brain-experience-hero .experience-subtitle { color: #655d71; }
[data-theme="dark"] .experience-subtitle, [data-theme="dark"] .brain-experience-hero .experience-subtitle { color: var(--text-muted); }
.experience-highlights { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.05rem; }
.experience-highlights > span { display: inline-flex; align-items: center; gap: .34rem; border: 1px solid #dce9df; border-radius: 999px; padding: .33rem .52rem; background: #ffffffb8; color: #4d6655; font-size: .63rem; font-weight: 750; }
.brain-experience-hero .experience-highlights > span { border-color: #e5dbf0; color: #6b5a7c; }
.experience-highlights i { color: #4e9a6a; font-size: .55rem; font-style: normal; font-weight: 900; }
.brain-experience-hero .experience-highlights i { color: #9162c3; }
[data-theme="dark"] .experience-highlights > span { border-color: #385345; background: #1b2b23b8; color: #c0d5c6; }
[data-theme="dark"] .brain-experience-hero .experience-highlights > span { border-color: #4a3c5d; background: #2a2236b8; color: #d4c2e3; }
.experience-cta { display: inline-flex; min-height: 45px; align-items: center; gap: .7rem; border: 1px solid #367e53; border-radius: 13px; padding: .65rem .9rem; background: linear-gradient(135deg, #438e60, #2f7650); color: #fff; font-size: .74rem; font-weight: 850; text-decoration: none; box-shadow: 0 8px 17px #34835325; transition: transform var(--transition), box-shadow var(--transition); }
.experience-cta:hover { transform: translateY(-2px); box-shadow: 0 12px 22px #34835338; }
.experience-cta > span:last-child { font-size: 1.05rem; }
.brain-experience-hero .experience-cta { border-color: #7755b4; background: linear-gradient(135deg, #8362c1, #6a4aa7); box-shadow: 0 8px 17px #7455ab2a; }
.brain-experience-hero .experience-cta:hover { box-shadow: 0 12px 22px #7455ab45; }
.experience-art { position: relative; z-index: 1; display: grid; min-height: 265px; place-items: center; }
.chess-art-board { position: relative; display: grid; width: min(238px, 68vw); aspect-ratio: 1; grid-template-columns: repeat(4, 1fr); overflow: hidden; transform: rotate(4deg); border: 8px solid #fff; border-radius: 21px; background: repeating-conic-gradient(#6b9a79 0 25%, #e9f1df 0 50%) 50% / 50% 50%; box-shadow: 0 22px 36px #31583c2e, inset 0 0 0 1px #ffffffad; }
.chess-art-board span { display: grid; place-items: center; color: #244c35; font: 2.35rem/1 Georgia, serif; text-shadow: 0 2px 1px #fff8; }
.chess-art-board span:nth-child(3n) { color: #faf9ef; text-shadow: 0 2px 2px #234b3680; }
.chess-art-orbit { position: absolute; width: 285px; height: 152px; border: 1px solid #76ae8a6b; border-radius: 50%; transform: rotate(-27deg); }
.chess-art-orbit.orbit-two { width: 312px; height: 188px; transform: rotate(35deg); border-color: #aacfb26b; }
.chess-art-note { position: absolute; right: -2%; bottom: 4%; display: flex; align-items: center; gap: .42rem; max-width: 205px; border: 1px solid #dceadd; border-radius: 12px; padding: .55rem .65rem; background: #fffffff0; color: #4d6655; font-size: .61rem; font-weight: 800; box-shadow: 0 8px 18px #31583c19; }
.chess-art-note > span:first-child { color: #d79c40; font-size: 1rem; }
.brain-experience-art { min-height: 270px; }
.brain-art-glow { position: absolute; width: 230px; height: 230px; border-radius: 50%; background: radial-gradient(circle, #e8d8ff 0, #ebdcff7a 48%, transparent 72%); filter: blur(4px); }
.brain-art-orbit { position: absolute; width: 290px; height: 142px; border: 1px solid #a280c855; border-radius: 50%; transform: rotate(25deg); }
.brain-art-orbit.orbit-two { width: 236px; height: 188px; transform: rotate(-35deg); border-color: #bb9bdd55; }
.brain-art-core { position: relative; z-index: 1; display: grid; width: 125px; height: 125px; place-items: center; border: 1px solid #fff; border-radius: 38px; background: linear-gradient(145deg, #fff, #f0e7ff); font-size: 4.4rem; box-shadow: 0 18px 35px #8060ae36, inset 0 1px 0 #fff; transform: rotate(-8deg); }
.brain-art-card { position: absolute; z-index: 2; display: flex; align-items: center; gap: .32rem; border: 1px solid #e5d9f3; border-radius: 13px; padding: .5rem .58rem; background: #fff; color: #614d7b; box-shadow: 0 10px 22px #73569b1b; font-weight: 850; }
.brain-card-number { top: 8%; left: 0; transform: rotate(-8deg); font: 800 .88rem var(--font-display); }
.brain-card-number i { color: #a27bcc; font-size: .72rem; font-style: normal; }
.brain-card-number b { color: #9a6acc; }
.brain-card-memory { right: 0; bottom: 21%; gap: .24rem; font-size: .84rem; transform: rotate(7deg); }
.brain-card-memory i { margin-left: .1rem; color: #937fa7; font-size: .56rem; font-style: normal; }
.brain-art-note { position: absolute; right: 0; bottom: 2%; border: 1px solid #e5d9f3; border-radius: 12px; padding: .48rem .6rem; background: #fff; color: #6b5a7c; font-size: .59rem; font-weight: 800; box-shadow: 0 8px 18px #73569b17; }
.brain-art-note > span:first-child { color: #aa7bd0; }
[data-theme="dark"] .chess-art-board { border-color: #26372f; box-shadow: 0 22px 36px #0005, inset 0 0 0 1px #ffffff1a; }
[data-theme="dark"] .chess-art-note, [data-theme="dark"] .brain-art-card, [data-theme="dark"] .brain-art-note { border-color: #48405a; background: #262336f2; color: #d2c9dd; }
[data-theme="dark"] .brain-art-core { border-color: #514364; background: linear-gradient(145deg, #342a45, #282237); }
[data-theme="dark"] .brain-art-glow { background: radial-gradient(circle, #4a3262 0, #3a2b4c88 48%, transparent 72%); }
.page-game-section { scroll-margin-top: 1rem; }
.page-game-section.chess-hub { margin-top: .5rem; }
.page-game-section.brain-games-hub { margin-top: .4rem; }
.suite-footer { display: flex; align-items: center; justify-content: center; gap: .8rem 1.2rem; flex-wrap: wrap; }
.suite-footer a { color: var(--primary-strong); font-size: .78rem; font-weight: 800; text-decoration: none; }
.suite-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .learning-nav { padding: .35rem .65rem .48rem; }
  .learning-nav-inner { width: 100%; justify-content: stretch; gap: .16rem; }
  .learning-nav-link { flex: 1 1 0; min-width: 0; min-height: 40px; gap: .35rem; padding: .38rem .45rem; font-size: .7rem; }
  .learning-nav-icon { width: 22px; height: 22px; border-radius: 7px; font-size: .86rem; }
  .experience-page { padding: 1rem 1rem 1.5rem; }
  .experience-hero { min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(185px, .65fr); gap: .4rem; padding: 1.2rem; }
  .experience-hero h1 { font-size: clamp(2rem, 5.4vw, 2.8rem); }
  .experience-subtitle { font-size: .8rem; line-height: 1.6; }
  .experience-highlights > span { font-size: .58rem; }
  .experience-art { min-height: 220px; }
  .chess-art-board { width: min(190px, 37vw); }
  .chess-art-board span { font-size: 1.85rem; }
  .chess-art-orbit { width: 230px; height: 125px; }
  .chess-art-orbit.orbit-two { width: 245px; height: 150px; }
  .chess-art-note { right: -1%; bottom: 0; max-width: 170px; font-size: .55rem; }
  .brain-experience-art { min-height: 220px; }
  .brain-art-core { width: 102px; height: 102px; border-radius: 31px; font-size: 3.6rem; }
  .brain-art-orbit { width: 230px; height: 116px; }
  .brain-art-orbit.orbit-two { width: 205px; height: 150px; }
  .brain-card-number { top: 3%; left: -2%; }
  .brain-card-memory { right: -2%; bottom: 18%; }
  .brain-art-note { right: -2%; bottom: -1%; font-size: .53rem; }
}
@media (max-width: 560px) {
  .brand-link .brand-text strong { font-size: 1rem; }
  .brand-link .tagline { font-size: .62rem; }
  .suite-header .brand-link .tagline { display: none; }
  .suite-header { padding: .48rem .65rem 0; }
  .suite-header .header-inner { align-items: center; gap: .35rem; flex-wrap: nowrap; }
  .suite-header .brand { gap: .48rem; min-width: 0; }
  .suite-header .logo { width: 38px; height: 38px; border-radius: 12px; font-size: 1.2rem; }
  .suite-header .header-actions { flex: 0 0 auto; gap: .35rem; flex-wrap: nowrap; }
  .suite-header .lang-switcher { gap: .1rem; padding: .16rem; border-radius: 10px; }
  .suite-header .lang-btn { min-width: 31px; padding: .3rem; font-size: .77rem; }
  .suite-header .lang-name { display: none; }
  .suite-header .theme-toggle { width: 36px; height: 36px; border-radius: 10px; }
  .learning-nav-link { min-width: 0; gap: .24rem; padding-inline: .2rem; font-size: .62rem; }
  .learning-nav-link > span:last-child { min-width: 0; overflow-wrap: anywhere; text-align: center; }
  .experience-page { padding: .75rem .72rem 1.2rem; }
  .experience-hero { grid-template-columns: minmax(0, 1fr); gap: .3rem; margin-bottom: 1rem; border-radius: 22px; padding: 1.05rem; }
  .experience-hero h1 { max-width: 440px; font-size: clamp(2rem, 9vw, 2.75rem); }
  .experience-subtitle { margin: .55rem 0 .75rem; font-size: .78rem; }
  .experience-highlights { gap: .32rem; margin-bottom: .78rem; }
  .experience-highlights > span { gap: .23rem; padding: .31rem .42rem; font-size: .54rem; }
  .experience-highlights i { font-size: .48rem; }
  .experience-cta { min-height: 42px; padding: .58rem .77rem; font-size: .69rem; }
  .experience-art { min-height: 185px; }
  .chess-art-board { width: min(176px, 48vw); }
  .chess-art-board span { font-size: 1.75rem; }
  .chess-art-orbit { width: 225px; height: 112px; }
  .chess-art-orbit.orbit-two { width: 215px; height: 135px; }
  .chess-art-note { right: 0; bottom: 0; }
  .brain-experience-art { min-height: 190px; }
  .brain-art-core { width: 100px; height: 100px; font-size: 3.4rem; }
  .brain-art-card { padding: .42rem .48rem; }
  .brain-card-number { left: 2%; }
  .brain-card-memory { right: 2%; }
  .brain-art-note { right: 0; bottom: -1%; }
  .suite-footer { gap: .4rem; padding: 1.1rem .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .learning-nav-link, .experience-cta { transition: none; }
}

@media (max-width: 480px) {
  .brand-text .tagline { display: none; }
  .header-inner { align-items: center; }
  .header-actions { gap: .35rem; }
  .lang-name { display: none; }
}

@media (max-width: 980px) {
  .practice-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .auth-widget { order: 3; width: 100%; justify-content: flex-end; }
  .auth-status { max-width: 48vw; }
  .adventure-map { margin: 1.5rem 0; padding: 0.9rem; }
  .board-track { padding: 0.7rem; }
  .practice-controls { grid-template-columns: 1fr; }
  .learner-mode-group > div { display: grid; grid-template-columns: 1fr 1fr; }
  .generate-practice-btn { width: 100%; }
  .generated-exercises { grid-template-columns: 1fr; }
  .practice-studio-heading { align-items: flex-start; }
  .practice-studio-mascot { flex-basis: 46px; height: 46px; border-radius: 14px; font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .board-node.is-next { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .quest-mascot { animation: none; }
  .reward-toast { animation: none; }
  .points-pop, .quest-mascot.is-cheering, .sparkle-burst span, .quiz-option.correct, .quiz-option.wrong, .exercise-option.correct, .exercise-option.wrong { animation: none; }
}
