/* ============================================================
   Polysparks – Shared Design System v2
   Sidebar-based layout, clean neutral palette
   ============================================================ */

html { scrollbar-gutter: stable; min-width: 440px; overflow-x: auto; }

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Core palette */
  --canvas:      #f4f4f7;
  --white:       #ffffff;
  --ink:         #1a1a2e;
  --ink-muted:   #585870;

  /* Accents */
  --accent-blue:   #3b82f6;
  --accent-amber:  #f59e0b;
  --accent-green:  #10b981;
  --accent-orange: #f97316;

  /* Structural */
  --border:      #e2e2eb;
  --radius:      12px;
  --hover-row:   #f0f0f5;
  --soft-bg:     #f8f8fb;
  --pill-bg:     #eeeef3;
  --sidebar-w:   260px;

  /* ─── Legacy variable aliases ────────────────────────────
     Existing page CSS references these; map them to new values
     so colour updates propagate automatically.               */
  --bg:              var(--canvas);
  --surface:         var(--white);
  --text-primary:    var(--ink);
  --text-secondary:  var(--ink-muted);
  --text-muted:      #8896a9;
  --text-1:          var(--ink);
  --text-2:          var(--ink-muted);
  --text-3:          #8896a9;

  /* Blue → accent-blue */
  --blue:      var(--accent-blue);
  --aqua:      #00C9B1;
  --aqua-dark: #009985;
  --orange:    var(--accent-orange);
  --navy:      #1a1a2e;

  /* Accent helpers used by practice/unit cards */
  --accent:        var(--accent-blue);
  --accent-dark:   #2563eb;
  --accent-soft:   rgba(59,130,246,0.10);
  --accent-border: rgba(59,130,246,0.20);

  /* Border aliases */
  --border-md: var(--border);

  /* Extra tokens */
  --accent-purple: #8b5cf6;
  --header-border: #d8d8e3;
  --dot-grid:      #b4b5c8;
  --hero-rule:     #cfcfdb;
  --heat-zero:     #d5d6df;
  --selected-row:  #eef4ff;

  /* Error/heat-map-related */
  --hm-accent:      #E11D48;
  --hm-accent-soft: rgba(225,29,72,0.09);
  --correct:   #10b981;
  --error:     #ef4444;
  --stuck:     #f59e0b;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas:      #0f0f14;
  --white:       #17171f;
  --ink:         #e8e8ef;
  --ink-muted:   #9494a8;
  --border:      #2c2c38;
  --hover-row:   #23232c;
  --soft-bg:     #1b1b24;
  --pill-bg:     #25252e;
  --dot-grid:    #56586a;
  --hero-rule:   #45475a;
  --header-border: #2a2a32;
  --heat-zero:   #353542;
  --selected-row: #243548;
}

/* ── RESET / BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  min-width: 440px;
}

/* Gradient backgrounds removed — body is now a clean flat colour */
body { background-image: none !important; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
aside.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 0.75rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

/* Brand */
.sidebar-brand-block {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 1.5rem;
  min-height: 48px;
}

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--ink);
  margin-left: -12px;
  margin-top: -3px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  height: 52px;
}

.brand img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  object-position: center;
}

.brand > span {
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  /* Override any gradient text from inline styles */
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: var(--ink) !important;
  color: var(--ink);
}

/* Nav menu */
.nav-menu {
  flex: 1;
  list-style: none;
  min-height: 0;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
  margin-bottom: 4px;
}

.nav-item a i {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1;
}

.nav-item a:hover {
  background: var(--hover-row);
  color: var(--ink);
}

.nav-item a.active {
  background: var(--ink);
  color: var(--white);
}

/* Sidebar upgrade button */
.sidebar-upgrade {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 4px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: #6c5ce7;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar-upgrade:hover { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); }
[data-theme="dark"] .sidebar-upgrade { background: rgba(108,92,231,0.18); color: #a78bfa; }
[data-theme="dark"] .sidebar-upgrade:hover { background: rgba(108,92,231,0.28); }
.sidebar-upgrade-icon { font-size: 1.15rem; flex-shrink: 0; }

/* Sidebar footer */
.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 1.25rem;
}

.sidebar-dash {
  height: 0;
  margin: 0 0 1rem;
  border: none;
  border-top: 1px dashed var(--border);
  opacity: 0.75;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink-muted);
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  background: var(--hover-row);
  color: var(--ink);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.theme-toggle-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* ── VIEWPORT ──────────────────────────────────────────────── */
main.viewport {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* SPA pages use height: 100vh + overflow: hidden instead of scroll */
main.viewport.spa-viewport {
  height: 100vh;
  min-height: unset;
  overflow: hidden;
}

/* ── PAGE HEADER (top bar) ─────────────────────────────────── */
.page-header {
  flex-shrink: 0;
  padding: 0.75rem 3rem;
  border-bottom: 1px solid var(--header-border);
  background: var(--canvas);
  display: flex;
  align-items: center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-left .page-title,
.top-bar .page-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ── NAV-RIGHT / PROFILE MENU ──────────────────────────────── */
/* These IDs are populated by existing renderNav() JS. */

#navRight {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user-wrap { position: relative; }

/* Profile trigger — pill button with avatar + name + caret */
.profile-trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.profile-trigger:hover {
  background: var(--soft-bg);
}

.profile-trigger[aria-expanded="true"] {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.profile-trigger .profile-avatar {
  width: 40px;
  height: 40px;
  background: var(--accent-amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--white);
  flex-shrink: 0;
}

.profile-trigger .profile-name-only {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--ink);
}

.profile-trigger .profile-caret {
  font-size: 1rem;
  color: var(--ink-muted);
  transition: transform 0.2s;
}

.profile-trigger[aria-expanded="true"] .profile-caret {
  transform: rotate(180deg);
}

/* Profile dropdown */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 11rem;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(26,26,46,0.12);
  z-index: 200;
}

.profile-dropdown[hidden] { display: none !important; }

.profile-dropdown a,
.profile-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

.profile-dropdown a:hover,
.profile-dropdown button:hover { background: var(--hover-row); }

.profile-dropdown .profile-dropdown-signout { color: #dc2626; }
.profile-dropdown .profile-dropdown-signout:hover { background: #fef2f2; }
.profile-dropdown .profile-dropdown-upgrade { color: #6c5ce7; font-weight: 600; }
.profile-dropdown .profile-dropdown-upgrade:hover { background: #f3f0ff; }

/* Legacy classes kept for renderNav() backward compat */
.nav-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-amber);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.nav-avatar:hover { opacity: 0.82; }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 11rem;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(26,26,46,0.12);
  z-index: 200;
}
.nav-dropdown:not(.open) { display: none; }

.nav-dd-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.nav-dd-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}
.nav-dd-btn {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.12s;
}
.nav-dd-btn:hover { background: var(--hover-row); }
.nav-dd-btn.danger { color: #dc2626; }
.nav-dd-btn.danger:hover { background: #fef2f2; }

/* Upgrade button */
.nav-upgrade {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(120deg, var(--accent-orange), #9333ea);
  color: white;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.nav-upgrade:hover { opacity: 0.88; }

/* Sign-in link */
.nav-signin {
  display: flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 8px;
  background: var(--accent-blue);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.nav-signin:hover { opacity: 0.88; }

/* PRO badge */
.nav-pro-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
}

/* ── SCROLLABLE PAGE BODY ──────────────────────────────────── */
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 3rem;
}

.page-body::-webkit-scrollbar { width: 4px; }
.page-body::-webkit-scrollbar-thumb { background: rgba(26,26,46,0.12); border-radius: 2px; }

/* ── OVERRIDES: clean up gradient/glass effects ────────────── */

/* Remove backdrop-filter glassmorphism from any leftover .nav */
.nav {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: var(--white) !important;
}

/* Cards: subtle borders, less shadow */
.unit-card,
.p-card,
.s-card,
.stats-card,
.notebook-card,
.hm-unit-card {
  border-color: var(--border) !important;
}

/* Primary buttons: use accent-blue instead of old blue */
.qz-btn-gen,
.qz-btn-submit,
.book-cta,
.cv-upload-btn {
  background: var(--accent-blue) !important;
}

/* CTA buttons */
.btn-math {
  background: var(--accent-blue) !important;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 80px; }

  aside.sidebar {
    padding: 0.75rem 0.5rem 1.5rem;
  }

  .sidebar-brand-block .brand > span { display: none; }
  .sidebar-brand-block .brand { margin-left: 0; }
  .sidebar-brand-block { justify-content: center; }

  .nav-item a {
    width: 48px;
    height: 48px;
    padding: 0;
    gap: 0;
    justify-content: center;
    align-items: center;
    margin-left: auto;
    margin-right: auto;
  }

  .nav-item a span { display: none; }
  .nav-item a i { font-size: 1.35rem; width: auto; }

  .sidebar-footer .sidebar-upgrade span,
  .sidebar-footer .theme-toggle span { display: none; }
  .sidebar-footer .sidebar-upgrade {
    width: 48px;
    height: 48px;
    padding: 0;
    gap: 0;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    border-radius: 50%;
  }
  .sidebar-footer .theme-toggle {
    width: 48px;
    height: 48px;
    padding: 0;
    gap: 0;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    border-radius: 50%;
  }

  .page-body { padding: 1.25rem; }
  .page-header { padding: 0.75rem 1.25rem; }
}

@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  aside.sidebar { display: none; }
}

/* ── Lesson modal ── */
.lesson-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  background: rgba(10,15,30,0.65); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.lesson-modal.open { display: flex; }
.lesson-card {
  background: var(--white); border-radius: 24px;
  width: min(980px, 95vw); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.32);
  animation: lsCardIn 0.32s cubic-bezier(0.34,1.2,0.64,1);
}
@keyframes lsCardIn { from { opacity:0; transform:scale(0.94) translateY(20px); } to { opacity:1; transform:none; } }
.lesson-progress-track { height: 3px; background: var(--border); flex-shrink: 0; }
.lesson-progress-fill {
  height: 100%; background: var(--accent); width: 0%;
  transition: width 0.5s ease; border-radius: 0 3px 3px 0;
}
.lesson-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.lesson-concept-title {
  flex: 1; font-size: 0.9rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-close-btn {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px;
  border: none; background: var(--pill-bg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem; transition: background 0.15s;
}
.lesson-close-btn:hover { background: var(--hover-row); }
.lesson-scroll-body {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 32px 40px 12px;
  display: flex; flex-direction: column; gap: 20px;
}
.lesson-card-footer {
  padding: 16px 32px 20px; flex-shrink: 0;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}
.lesson-done-btn {
  padding: 11px 32px; border-radius: 12px;
  background: var(--accent); border: none; color: white;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: opacity 0.15s, transform 0.15s;
}
.lesson-done-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.lesson-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px; gap: 14px; color: var(--text-muted); font-size: 0.88rem;
  flex: 1;
}
.lesson-loading-spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: lspin 0.8s linear infinite;
}
@keyframes lspin { to { transform: rotate(360deg); } }

/* Slide section entrance — spring feel */
.ls-section {
  opacity: 0; transform: translateY(16px) scale(0.985);
  transition: opacity 0.42s cubic-bezier(0.22,1,0.36,1),
              transform 0.42s cubic-bezier(0.22,1,0.36,1);
}
.ls-section.ls-visible { opacity: 1; transform: translateY(0) scale(1); }

/* Within-slide element animations */
@keyframes lsSlideDown  { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
@keyframes lsSlideUp    { from { opacity:0; transform:translateY(10px);  } to { opacity:1; transform:translateY(0); } }
@keyframes lsScaleIn    { from { opacity:0; transform:scale(0.92);       } to { opacity:1; transform:scale(1);    } }
@keyframes lsFromLeft   { from { opacity:0; transform:translateX(-14px); } to { opacity:1; transform:translateX(0); } }
@keyframes lsFromRight  { from { opacity:0; transform:translateX(14px);  } to { opacity:1; transform:translateX(0); } }
@keyframes lsFadeIn     { from { opacity:0; }                               to { opacity:1; }                        }

/* ── rule_card animations ── */
.ls-section.ls-visible .slide-rule-top {
  animation: lsSlideDown 0.38s cubic-bezier(0.22,1,0.36,1) 0.06s both;
}
.ls-section.ls-visible .slide-rule-formula {
  animation: lsScaleIn 0.42s cubic-bezier(0.34,1.25,0.64,1) 0.18s both;
}
.ls-section.ls-visible .slide-rule-bullet:nth-child(1) { animation: lsSlideUp 0.3s ease 0.22s both; }
.ls-section.ls-visible .slide-rule-bullet:nth-child(2) { animation: lsSlideUp 0.3s ease 0.30s both; }
.ls-section.ls-visible .slide-rule-bullet:nth-child(3) { animation: lsSlideUp 0.3s ease 0.38s both; }
.ls-section.ls-visible .slide-rule-bullet:nth-child(4) { animation: lsSlideUp 0.3s ease 0.46s both; }
.ls-section.ls-visible .slide-rule-bullet:nth-child(n+5) { animation: lsSlideUp 0.3s ease 0.52s both; }

/* ── formula_breakdown animations ── */
.ls-section.ls-visible .slide-breakdown-formula {
  animation: lsScaleIn 0.42s cubic-bezier(0.34,1.25,0.64,1) 0.1s both;
}
.ls-section.ls-visible .slide-breakdown-legend-item:nth-child(1) { animation: lsSlideUp 0.28s ease 0.22s both; }
.ls-section.ls-visible .slide-breakdown-legend-item:nth-child(2) { animation: lsSlideUp 0.28s ease 0.30s both; }
.ls-section.ls-visible .slide-breakdown-legend-item:nth-child(3) { animation: lsSlideUp 0.28s ease 0.38s both; }
.ls-section.ls-visible .slide-breakdown-legend-item:nth-child(n+4) { animation: lsSlideUp 0.28s ease 0.46s both; }
.ls-section.ls-visible .slide-breakdown-explanation {
  animation: lsFadeIn 0.35s ease 0.38s both;
}

/* ── comparison animations — wrong slides in from left, right from right ── */
.ls-section.ls-visible .slide-cmp-col.wrong {
  animation: lsFromLeft  0.38s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}
.ls-section.ls-visible .slide-cmp-col.right {
  animation: lsFromRight 0.38s cubic-bezier(0.22,1,0.36,1) 0.18s both;
}
.ls-section.ls-visible .slide-cmp-note {
  animation: lsSlideUp 0.32s ease 0.3s both;
}

/* ── pitfall animations ── */
.ls-section.ls-visible .slide-pitfall-top {
  animation: lsSlideDown 0.38s cubic-bezier(0.22,1,0.36,1) 0.05s both;
}
.ls-section.ls-visible .slide-pitfall-tip {
  animation: lsScaleIn 0.42s cubic-bezier(0.34,1.25,0.64,1) 0.2s both;
}

/* Progress bar spring easing */
.lesson-progress-fill {
  transition: width 0.55s cubic-bezier(0.22,1,0.36,1) !important;
}

/* ── Slide: rule_card ── */
.slide-rule { display: flex; flex-direction: column; }
.slide-rule-top {
  background: linear-gradient(135deg, #1a2f5e 0%, #1a6080 100%);
  padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 8px;
}
.slide-rule-badge {
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.55);
}
.slide-rule-headline {
  font-size: 1.15rem; font-weight: 800; color: white; letter-spacing: -0.02em;
}
.slide-rule-formula {
  margin-top: 8px; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px; padding: 18px 16px;
  text-align: center; overflow-x: auto;
}
.slide-rule-formula .katex { font-size: 1.3em; color: white; }
.slide-rule-formula .katex-display { margin: 0; }
.slide-rule-bottom { padding: 20px 28px; display: flex; flex-direction: column; gap: 8px; }
.slide-rule-bullet {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 0.88rem; line-height: 1.55; color: var(--text-primary);
}
.slide-rule-bullet::before {
  content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-top: 6px;
}

/* ── Slide: formula_breakdown ── */
.slide-breakdown {
  padding: 24px 28px; display: flex; flex-direction: column; gap: 18px;
}
.slide-breakdown-badge {
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}
.slide-breakdown-formula {
  background: var(--pill-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px 16px;
  text-align: center; overflow-x: auto;
}
.slide-breakdown-formula .katex { font-size: 1.4em; }
.slide-breakdown-formula .katex-display { margin: 0; overflow-x: auto; }
.slide-breakdown-legend { display: flex; flex-direction: column; gap: 7px; }
.slide-breakdown-legend-item {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.85rem; color: var(--text-primary);
}
.slide-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.slide-breakdown-explanation {
  font-size: 0.88rem; line-height: 1.7; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 14px;
}

/* ── Slide: comparison ── */
.slide-comparison {
  padding: 24px 28px; display: flex; flex-direction: column; gap: 16px;
}
.slide-comparison-badge {
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}
.slide-cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slide-cmp-col {
  border-radius: 12px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.slide-cmp-col.wrong { background: rgba(220,38,38,0.05); border: 1.5px solid rgba(220,38,38,0.18); }
.slide-cmp-col.right { background: rgba(5,150,105,0.05); border: 1.5px solid rgba(5,150,105,0.2); }
.slide-cmp-verdict {
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.slide-cmp-col.wrong .slide-cmp-verdict { color: #dc2626; }
.slide-cmp-col.right .slide-cmp-verdict { color: #059669; }
.slide-cmp-formula {
  border-radius: 8px; padding: 12px 8px; text-align: center; overflow-x: auto;
}
.slide-cmp-col.wrong .slide-cmp-formula { background: rgba(220,38,38,0.06); }
.slide-cmp-col.right .slide-cmp-formula { background: rgba(5,150,105,0.06); }
.slide-cmp-formula .katex { font-size: 1em; }
.slide-cmp-formula .katex-display { margin: 0; overflow-x: auto; }
.slide-cmp-label { font-size: 0.75rem; line-height: 1.45; color: var(--text-muted); }
.slide-cmp-note {
  font-size: 0.85rem; line-height: 1.65; color: var(--text-primary);
  background: var(--pill-bg); border-radius: 10px; padding: 10px 14px;
}

/* ── Slide: pitfall ── */
.slide-pitfall {
  display: flex; flex-direction: column;
}
.slide-pitfall-top {
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  padding: 22px 28px 20px; display: flex; flex-direction: column; gap: 6px;
}
.slide-pitfall-badge {
  font-size: 0.65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.55);
}
.slide-pitfall-mistake {
  font-size: 1.05rem; font-weight: 800; color: white; letter-spacing: -0.01em;
}
.slide-pitfall-why {
  font-size: 0.85rem; color: rgba(255,255,255,0.78); line-height: 1.6; margin-top: 4px;
}
.slide-pitfall-bottom { padding: 20px 28px; }
.slide-pitfall-tip {
  background: #f0fdf4; border: 1.5px solid #bbf7d0;
  border-radius: 12px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 5px;
}
.slide-pitfall-tip-label {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: #059669;
}
.slide-pitfall-tip-text {
  font-size: 0.9rem; font-weight: 600; color: #065f46; line-height: 1.55;
}

