/* ============================================================
   EdMe — your personal educator
   A careful, warm, opinionated design system.
   ============================================================ */

[hidden] { display: none !important; }

/* ============ TOKENS ============ */
:root {
  /* Colors — Light */
  --bg: #faf8f3;
  --bg-elev: #ffffff;
  --bg-sunk: #f0ece1;
  --bg-tint: #f7f3e9;
  --ink: #1a1d1c;
  --ink-soft: #4a4f4e;
  --ink-mute: #7a7e7c;
  --ink-faint: #a8aca9;
  --line: #e5dfce;
  --line-soft: #eee8d7;
  --accent: #2f6b4f;
  --accent-2: #478f6d;
  --accent-ink: #143524;
  --accent-soft: #d6eadc;
  --accent-tint: #ecf5ef;
  --warm: #c47830;
  --warm-soft: #fce9ce;
  --warn: #c64a2a;
  --warn-soft: #fbdccf;
  --good: #2f6b4f;
  --depth-1: #e4a24d;
  --depth-2: #b8c46f;
  --depth-3: #6fb48e;
  --depth-4: #3e8a6a;
  --depth-5: #1f5a45;

  --shadow-xs: 0 1px 2px rgba(20, 30, 25, 0.04);
  --shadow-sm: 0 1px 2px rgba(20, 30, 25, 0.05), 0 2px 8px rgba(20, 30, 25, 0.04);
  --shadow-md: 0 2px 8px rgba(20, 30, 25, 0.06), 0 12px 32px rgba(20, 30, 25, 0.07);
  --shadow-lg: 0 6px 18px rgba(20, 30, 25, 0.09), 0 28px 60px rgba(20, 30, 25, 0.10);
  --shadow-ring: 0 0 0 3px rgba(47, 107, 79, 0.14);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-serif: "Iowan Old Style", "Source Serif Pro", "Charter", Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, monospace;

  --max-w: 1200px;
  --tx: 16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark mode */
body[data-theme="dark"] {
  --bg: #151614;
  --bg-elev: #1e201d;
  --bg-sunk: #23261f;
  --bg-tint: #1a1c19;
  --ink: #ece9df;
  --ink-soft: #c1c0b6;
  --ink-mute: #898a82;
  --ink-faint: #5a5b54;
  --line: #2e302a;
  --line-soft: #363830;
  --accent: #6dbe93;
  --accent-2: #8fd4ae;
  --accent-ink: #e6f5ec;
  --accent-soft: #2b3e33;
  --accent-tint: #212922;
  --warm: #e09652;
  --warm-soft: #3d2e1b;
  --warn: #e06b4a;
  --warn-soft: #3d221a;
  --good: #6dbe93;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 6px 18px rgba(0, 0, 0, 0.45), 0 28px 60px rgba(0, 0, 0, 0.5);
  --shadow-ring: 0 0 0 3px rgba(109, 190, 147, 0.22);
}

/* High contrast */
body.high-contrast {
  --bg: #ffffff; --bg-elev: #ffffff; --bg-sunk: #f0f0f0;
  --ink: #000; --ink-soft: #111; --ink-mute: #333;
  --line: #000; --accent: #00533a; --accent-ink: #00261a;
}
body[data-theme="dark"].high-contrast {
  --bg: #000; --bg-elev: #0a0a0a; --bg-sunk: #121212;
  --ink: #fff; --ink-soft: #e6e6e6; --ink-mute: #aaa;
  --line: #fff; --accent: #9be2b5;
}

body.dyslexic { --font-sans: "OpenDyslexic", "Comic Sans MS", "Lexend", sans-serif; }
body.serif .lesson-content,
body.serif .note-item p,
body.serif .hero-sub,
body.serif .live-demo-body { font-family: var(--font-serif); }

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--tx);
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s var(--ease), color .3s var(--ease);
  overflow-x: hidden;
}
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 0.5em; line-height: 1.2; letter-spacing: -0.015em; }
p { margin: 0 0 0.8em; color: var(--ink-soft); }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink-soft);
  text-align: center;
}
::selection { background: var(--accent-soft); color: var(--accent-ink); }

/* Ambient gradient on the body */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: -1;
  background:
    radial-gradient(800px 400px at 10% -10%, var(--accent-tint) 0%, transparent 60%),
    radial-gradient(600px 300px at 90% 10%, var(--bg-tint) 0%, transparent 50%);
  opacity: 0.7;
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg-elev) 85%, transparent);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.brand:hover { background: var(--bg-sunk); }
.brand-logo { color: var(--accent); display: inline-flex; }
.brand-text {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand-mark { color: var(--accent); }
.brand-tail { color: var(--ink); }

.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 14px;
  transition: background .12s, color .12s;
}
.nav button .nav-glyph { font-size: 14px; opacity: 0.65; }
.nav button:hover { background: var(--bg-sunk); color: var(--ink); }
.nav button.active {
  background: var(--accent-tint);
  color: var(--accent);
}
.nav button.active .nav-glyph { opacity: 1; }

.topbar-right { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-mute);
  font-size: 12px;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--ink); }
.icon-btn .kbd-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  padding-left: 2px;
}
.theme-toggle .icon-moon { display: none; }
body[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
body[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.status-pill:hover { border-color: var(--ink-mute); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-off { background: var(--ink-faint); }
.dot-on { background: var(--good); box-shadow: 0 0 0 3px rgba(47,107,79,0.18); animation: pulse 2s infinite; }
.dot-warn { background: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ============ APP / SCREENS ============ */
#app { max-width: var(--max-w); margin: 0 auto; padding: 44px 28px 100px; }
.screen { display: none; }
.screen.active { display: block; animation: screen-in .35s var(--ease-out); }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform .08s, background .14s, border-color .14s, box-shadow .14s, color .14s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-sunk); color: var(--ink); border-color: var(--ink-faint); }
.btn-text { background: transparent; color: var(--ink-mute); }
.btn-text:hover { color: var(--ink); }
.btn-danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn-danger:hover { background: var(--warn); color: #fff; }
.btn-danger-soft { background: var(--warn-soft); color: var(--warn); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--warn); color: #fff; }
.btn-success-soft { background: var(--accent-soft); color: var(--accent); border: 1px solid transparent; }
.btn-success-soft:hover { background: var(--accent); color: #fff; }
.btn-glyph { font-size: 13px; opacity: 0.8; }
.arrow { transition: transform .15s var(--ease-out); display: inline-block; }
.btn:hover .arrow { transform: translateX(3px); }

/* ============ WELCOME ============ */
.hero {
  text-align: center;
  padding: 56px 12px 24px;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 24px;
  box-shadow: var(--shadow-xs);
}
.hero-eyebrow a { color: var(--accent); font-weight: 600; }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(47, 107, 79, 0.5);
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(47, 107, 79, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(47, 107, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 107, 79, 0); }
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(42px, 6.4vw, 72px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 20px;
}
.hero-title em {
  color: var(--accent);
  font-style: italic;
  position: relative;
}
.hero-title em::after {
  content: ''; position: absolute;
  left: 0; right: 0; bottom: 4px; height: 6px;
  background: var(--accent-soft);
  z-index: -1;
  border-radius: 2px;
}
.hero-sub {
  font-size: 19px;
  max-width: 640px;
  margin: 0 auto 32px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-keyhint {
  margin-top: 28px;
  font-size: 12.5px;
  color: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 8px;
}
.hero-keyhint kbd { font-size: 11px; }

/* ============ LIVE DEMO ============ */
.live-demo {
  margin: 80px auto 0;
  max-width: 880px;
}
.live-demo-header { text-align: center; margin-bottom: 28px; }
.live-demo-header h2 { font-family: var(--font-serif); font-size: 30px; font-weight: 600; }
.live-demo-header h2 em { color: var(--accent); font-style: italic; }
.live-demo-header .caption { color: var(--ink-mute); margin: 0; }

.live-demo-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}
.live-demo-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--depth-1), var(--depth-2), var(--depth-3), var(--depth-4), var(--depth-5));
}
.live-demo-topic {
  padding: 20px 28px 0;
  display: flex; align-items: center; gap: 12px;
}
.live-demo-topic::before {
  content: "Topic:";
  font-size: 12px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#liveDemoSelect {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
#liveDemoSelect:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-ring); }

.live-demo-body {
  padding: 28px;
  min-height: 170px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  position: relative;
}
.live-demo-body .demo-label {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.live-demo-body.d-1 .demo-label { background: rgba(228, 162, 77, 0.18); color: var(--depth-1); }
.live-demo-body.d-2 .demo-label { background: rgba(184, 196, 111, 0.22); color: #708425; }
.live-demo-body.d-3 .demo-label { background: rgba(111, 180, 142, 0.22); color: var(--accent); }
.live-demo-body.d-4 .demo-label { background: rgba(62, 138, 106, 0.2); color: #1f5a45; }
.live-demo-body.d-5 .demo-label { background: rgba(31, 90, 69, 0.25); color: #0d3d2b; }
body[data-theme="dark"] .live-demo-body.d-2 .demo-label { color: #c8d68a; }
body[data-theme="dark"] .live-demo-body.d-4 .demo-label { color: #9ad3b0; }
body[data-theme="dark"] .live-demo-body.d-5 .demo-label { color: #aee0be; }

.live-demo-body-text {
  animation: fade-swap .35s var(--ease-out);
}
@keyframes fade-swap {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.live-demo-slider {
  padding: 24px 28px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
}
.live-depth-badge {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background .2s;
}
.live-demo-caption {
  margin-top: 20px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 14px;
}
.live-demo-caption strong { color: var(--accent); }

/* ============ MANIFESTO ============ */
.manifesto { margin-top: 80px; }
.manifesto h2 {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 28px;
}
.manifesto-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.m-card {
  padding: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform .15s var(--ease-out), border-color .15s, box-shadow .15s;
  position: relative;
}
.m-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.m-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin-bottom: 10px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 18px;
}
.m-card h4 { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.m-card p { font-size: 14px; margin: 0; color: var(--ink-soft); line-height: 1.45; }

/* ============ COMPARE ============ */
.compare { margin-top: 72px; }
.compare h2 {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 24px;
}
.compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.compare-table th, .compare-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.compare-table th { font-weight: 600; color: var(--ink-mute); background: var(--bg-tint); font-size: 13px; }
.compare-table th.own, .compare-table td.own { background: var(--accent-tint); color: var(--accent-ink); font-weight: 600; }
.compare-table .no { color: var(--ink-mute); }
.compare-table .yes::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.compare-table tbody tr:last-child td { border-bottom: none; }

/* ============ ONBOARD ============ */
.onboard-frame {
  max-width: 760px;
  margin: 40px auto;
  padding: 40px 44px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.onboard-progress { margin-bottom: 32px; }
.onboard-progress .bar {
  height: 3px;
  width: 25%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width .4s var(--ease-out);
  margin-bottom: 12px;
}
.onboard-steps {
  display: flex; gap: 8px; justify-content: center;
}
.onboard-steps span {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-sunk);
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 600;
  transition: all .2s;
}
.onboard-steps span.active {
  background: var(--accent);
  color: #fff;
}
.onboard-steps span.done {
  background: var(--accent-soft);
  color: var(--accent);
}

.onboard-icon {
  font-size: 32px;
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: var(--accent-tint);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.onboard-step h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 600; }
.onboard-step .hint { color: var(--ink-mute); margin-bottom: 24px; }
.onboard-controls {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.onboard-controls #onboardBack { margin-right: auto; }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--ink-soft);
  transition: all .15s var(--ease-out);
}
.chip:hover {
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
}
.chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-ring);
}
.chip-emoji { font-size: 15px; }

/* Depth slider */
.depth-slider-wrap { margin-top: 8px; }
.depth-slider {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 8px;
  background: linear-gradient(90deg,
    var(--depth-1) 0%, var(--depth-2) 25%, var(--depth-3) 50%, var(--depth-4) 75%, var(--depth-5) 100%);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}
.depth-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition: transform .12s;
}
.depth-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.depth-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: grab;
}
.depth-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-mute);
}
.depth-ticks span { cursor: pointer; transition: color .12s; }
.depth-ticks span:hover { color: var(--accent); }
.depth-preview {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--bg-sunk);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.depth-preview strong { color: var(--accent); font-weight: 600; }

/* ============ EXPLORE ============ */
.explore-header { text-align: center; padding: 20px 0 40px; }
.explore-header h2 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 20px;
}
.search-wrap {
  display: flex;
  align-items: center;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-ring);
}
.search-glyph { color: var(--ink-mute); flex-shrink: 0; }
.search-wrap input {
  flex: 1;
  border: none; outline: none;
  padding: 10px 14px;
  background: transparent;
  font-size: 15px;
}
.search-wrap input::placeholder { color: var(--ink-mute); }
.search-kbd {
  margin-right: 10px;
  font-size: 11px;
  opacity: 0.6;
}
.search-wrap .btn { border-radius: var(--radius-full); padding: 10px 22px; }

.suggestion-chips {
  display: flex; flex-wrap: wrap;
  gap: 6px; justify-content: center;
  margin-top: 20px; max-width: 720px; margin-left: auto; margin-right: auto;
}
.suggestion-chips .chip {
  padding: 6px 14px;
  font-size: 13px;
  background: var(--bg-elev);
}

.explore-sections { display: flex; flex-direction: column; gap: 40px; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.section-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin: 0;
  font-weight: 700;
}
.section-sub { font-size: 13px; color: var(--ink-faint); }

.continue-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.continue-card {
  padding: 20px;
  background: linear-gradient(135deg, var(--accent-tint), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.continue-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.continue-card .cc-title { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.continue-card .cc-meta { font-size: 12px; color: var(--ink-mute); margin-bottom: 10px; }
.continue-card .cc-progress {
  height: 3px; background: rgba(47, 107, 79, 0.15);
  border-radius: 2px; overflow: hidden;
}
.continue-card .cc-progress > div { height: 100%; background: var(--accent); transition: width .4s var(--ease-out); }
.continue-card .cc-resume {
  font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 8px;
  display: inline-flex; align-items: center; gap: 4px;
}
.continue-empty {
  padding: 20px; color: var(--ink-mute);
  background: var(--bg-sunk); border-radius: var(--radius-lg);
  text-align: center; font-size: 14px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.subject-tile {
  display: flex; flex-direction: column;
  align-items: flex-start; text-align: left;
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: transform .15s var(--ease-out), border-color .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.subject-tile::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, var(--accent-tint) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .25s;
}
.subject-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.subject-tile:hover::after { opacity: 1; }
.subject-tile .tile-glyph {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--accent);
}
.subject-tile strong { font-size: 16px; margin-bottom: 2px; color: var(--ink); }
.subject-tile span { font-size: 13px; color: var(--ink-mute); }

/* ============ PATH ============ */
.path-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.path-meta { flex: 1; }
.path-meta h2 { font-family: var(--font-serif); font-size: 32px; font-weight: 600; }
.path-meta p { color: var(--ink-mute); margin: 0; }

.progress-ring { position: relative; width: 64px; height: 64px; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .ring-bg { fill: none; stroke: var(--line); stroke-width: 4; }
.progress-ring .ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 106.8; stroke-dashoffset: 106.8;
  transition: stroke-dashoffset .6s var(--ease-out);
}
.progress-ring span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ink);
}

.lesson-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.lesson-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.lesson-row:hover {
  border-color: var(--accent);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm);
}
.lesson-row .lesson-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sunk);
  color: var(--ink-mute);
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
  transition: all .2s;
}
.lesson-row.done .lesson-num {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-ring);
}
.lesson-row .lesson-meta { flex: 1; }
.lesson-row .lesson-meta h4 { margin: 0 0 2px; font-size: 16px; }
.lesson-row .lesson-meta p { margin: 0; font-size: 13px; color: var(--ink-mute); }
.lesson-row .lesson-time {
  font-size: 12px; color: var(--ink-mute);
  padding: 4px 10px; background: var(--bg-sunk); border-radius: var(--radius-full);
}
.lesson-row .lesson-arrow { color: var(--ink-faint); transition: transform .15s, color .15s; }
.lesson-row:hover .lesson-arrow { transform: translateX(4px); color: var(--accent); }

/* ============ LESSON ============ */
.screen-lesson { padding-bottom: 0; }
.read-progress {
  position: fixed;
  top: 60px; left: 0; right: 0;
  height: 2px; background: transparent;
  z-index: 40;
  pointer-events: none;
}
.read-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .1s linear;
}
.lesson-topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.lesson-title-wrap { flex: 1; min-width: 0; }
.lesson-title-wrap h2 { font-family: var(--font-serif); font-size: 28px; font-weight: 600; margin: 0 0 2px; }
.lesson-topic {
  font-size: 12px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.lesson-depth {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 320px;
  padding: 8px 14px;
  background: var(--bg-sunk);
  border-radius: var(--radius-full);
}
.lesson-depth label {
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600;
}
.lesson-depth .depth-slider { flex: 1; height: 5px; }
.lesson-depth .depth-slider::-webkit-slider-thumb { width: 16px; height: 16px; border-width: 2px; }
.depth-label {
  font-size: 12.5px; color: var(--accent); font-weight: 700;
  min-width: 92px; text-align: right;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 28px;
  align-items: start;
}
.lesson-content {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 44px 52px;
  min-height: 420px;
  font-size: 16.5px;
  line-height: 1.75;
  box-shadow: var(--shadow-sm);
}
.lesson-content h1 {
  font-family: var(--font-serif);
  font-size: 34px;
  margin-top: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.lesson-content h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  margin-top: 32px;
  font-weight: 600;
}
.lesson-content h3 {
  font-size: 12.5px;
  color: var(--accent);
  margin-top: 24px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.lesson-content p { color: var(--ink); }
.lesson-content ul, .lesson-content ol { padding-left: 24px; }
.lesson-content li { margin-bottom: 8px; color: var(--ink); }
.lesson-content blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  background: var(--bg-sunk);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-style: italic;
}
.lesson-content code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-sunk);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--accent-ink);
}
body[data-theme="dark"] .lesson-content code { color: var(--accent); }
.lesson-content .key-term {
  background: linear-gradient(180deg, transparent 68%, var(--accent-soft) 68%);
  padding: 0 3px;
  cursor: help;
  transition: background .15s;
}
.lesson-content .key-term:hover {
  background: var(--accent-soft);
}
.lesson-content .callout {
  margin: 22px 0;
  padding: 18px 22px;
  background: var(--warm-soft);
  border: 1px solid color-mix(in srgb, var(--warm) 30%, transparent);
  border-radius: var(--radius);
  color: #6e3f10;
  position: relative;
  padding-left: 48px;
}
body[data-theme="dark"] .lesson-content .callout { color: #e8c188; }
.lesson-content .callout::before {
  content: "✎";
  position: absolute;
  left: 18px; top: 18px;
  font-size: 16px;
  color: var(--warm);
}

/* Lesson skeleton */
.lesson-skeleton { animation: skel-pulse 1.2s ease-in-out infinite; }
.lesson-skeleton .sk-line {
  height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-sunk), var(--line-soft), var(--bg-sunk));
  background-size: 200% 100%;
  animation: skel-shimmer 1.5s linear infinite;
  margin-bottom: 10px;
}
.lesson-skeleton .sk-h { height: 28px; width: 50%; margin-bottom: 18px; }
.lesson-skeleton .sk-line.short { width: 78%; }
.lesson-skeleton .sk-line.shorter { width: 60%; }
@keyframes skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes skel-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.75; } }

/* Tutor panel */
.tutor-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: width .3s var(--ease);
}
.tutor-panel.collapsed > :not(.tutor-header) { display: none; }
.tutor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-tint);
}
.tutor-header h3 {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.tutor-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
}
.tutor-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  max-height: 52vh;
  scroll-behavior: smooth;
}
.tutor-chat:empty::before {
  content: "Ask anything about this lesson — I know what you're reading.";
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
  padding: 40px 24px;
  display: block;
  line-height: 1.5;
}
.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
  max-width: 92%;
  word-wrap: break-word;
  animation: msg-in .25s var(--ease-out);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.chat-msg.user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  background: var(--bg-sunk);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.assistant.thinking { color: var(--ink-mute); font-style: italic; }
.chat-cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.tutor-input {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.tutor-input input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  transition: border-color .12s;
}
.tutor-input input:focus { outline: none; border-color: var(--accent); }
.tutor-input .btn { padding: 8px 14px; }

.tutor-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 10px 12px;
  background: var(--bg);
}
.tutor-quick button {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  transition: all .12s;
}
.tutor-quick button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-tint);
}

.lesson-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.lesson-quiz {
  margin-top: 28px;
  padding: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.lesson-quiz h3 { font-family: var(--font-serif); font-size: 22px; }
.quiz-q { margin-bottom: 28px; }
.quiz-q h4 { font-size: 16px; margin-bottom: 12px; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options button {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  transition: all .15s;
}
.quiz-options button:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.quiz-options button.correct { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.quiz-options button.wrong { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.quiz-explain {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--bg-tint);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ============ LIBRARY ============ */
.library-header { margin-bottom: 24px; }
.library-header h2 { font-family: var(--font-serif); font-size: 30px; font-weight: 600; }
.library-header .hint { color: var(--ink-mute); margin: 0; }

.library-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.tab .tab-glyph { opacity: 0.65; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active .tab-glyph { opacity: 1; }
.tab-count {
  font-size: 11px;
  padding: 2px 7px;
  background: var(--bg-sunk);
  border-radius: var(--radius-full);
  color: var(--ink-mute);
  font-weight: 600;
}
.tab.active .tab-count { background: var(--accent-tint); color: var(--accent); }
.tab-panel { animation: fade-swap .25s var(--ease-out); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.lib-card {
  padding: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.lib-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.lib-card h4 { font-size: 16px; margin-bottom: 4px; }
.lib-card .meta { font-size: 12px; color: var(--ink-mute); margin-bottom: 14px; }
.lib-card .progress-bar {
  height: 6px; background: var(--bg-sunk); border-radius: 3px;
  overflow: hidden;
}
.lib-card .progress-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease-out); }

.note-list { display: grid; gap: 12px; }
.note-item {
  padding: 18px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.note-item .note-meta {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.note-item p { margin: 0; }

.flashcard-stage {
  min-height: 280px;
  display: flex; align-items: center; justify-content: center;
  perspective: 1400px;
  margin-bottom: 16px;
}
.empty-state { color: var(--ink-mute); font-style: italic; text-align: center; padding: 40px; }
.flashcard {
  width: min(480px, 92%);
  height: 240px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.5,.1,.2,1);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard .face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  text-align: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  font-size: 19px;
  line-height: 1.5;
}
.flashcard .face.front::after {
  content: "click or Flip to reveal";
  position: absolute; bottom: 14px; left: 0; right: 0;
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.flashcard .back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-tint));
  color: var(--accent-ink);
  border-color: var(--accent);
}
.flashcard-meta {
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  margin-bottom: 16px;
}
.flashcard-meta strong { color: var(--ink); }
.flashcard-controls {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

.graph-canvas {
  width: 100%;
  height: 60vh;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.graph-canvas svg { width: 100%; height: 100%; }
.graph-node {
  fill: var(--bg-sunk);
  stroke: var(--accent);
  stroke-width: 1.8;
  cursor: pointer;
  transition: all .2s;
}
.graph-node.done { fill: var(--accent); }
.graph-node:hover { fill: var(--accent-soft); transform: scale(1.2); }
.graph-edge { stroke: var(--line); stroke-width: 1.5; }
.graph-label { font-size: 12px; fill: var(--ink); pointer-events: none; font-weight: 600; }
.graph-legend {
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  margin-top: 12px;
}

/* ============ PROFILE ============ */
.profile-header { margin-bottom: 24px; }
.profile-header h2 { font-family: var(--font-serif); font-size: 30px; font-weight: 600; }
.profile-header .hint { color: var(--ink-mute); margin: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}
.settings-card {
  padding: 28px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.settings-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.settings-head h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; margin: 0;
}
.settings-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.settings-card > p { color: var(--ink-mute); margin-bottom: 18px; font-size: 14px; }

.key-form { display: grid; gap: 6px; }
.key-form label {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.key-form input, .key-form select {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color .12s, box-shadow .12s;
}
.key-form select { font-family: var(--font-sans); font-size: 14px; }
.key-form input:focus, .key-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-ring);
}
.key-input-wrap { position: relative; }
.key-input-wrap input { width: 100%; padding-right: 44px; }
.key-reveal {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-mute);
  font-size: 16px;
}
.key-reveal:hover { background: var(--bg-sunk); color: var(--ink); }
.key-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.warning {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--warm-soft);
  border-left: 3px solid var(--warm);
  border-radius: var(--radius-sm);
  color: #6e3f10;
  font-size: 13px;
  display: flex; gap: 10px;
  line-height: 1.45;
}
body[data-theme="dark"] .warning { color: #e8c188; }
.warn-glyph { color: var(--warm); font-size: 16px; flex-shrink: 0; }

.toggle-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row label {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  flex-wrap: wrap;
}
.toggle-row label small {
  color: var(--ink-mute);
  font-size: 12px;
  width: 100%;
  padding-left: 30px;
  margin-top: 2px;
}
.toggle-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.range-with-val {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.range-with-val input[type="range"] {
  flex: 1;
  max-width: 220px;
  accent-color: var(--accent);
}

.profile-summary {
  padding: 18px;
  background: var(--bg-sunk);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
}
.profile-summary dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.profile-summary dt { color: var(--ink-mute); font-size: 13px; }
.profile-summary dd { margin: 0; color: var(--ink); font-weight: 500; }

.data-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ TOASTS ============ */
.toast-stack {
  position: fixed;
  bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: toast-in .28s var(--ease-out);
  pointer-events: auto;
  max-width: 360px;
  transition: opacity .35s, transform .35s;
}
.toast.success { background: var(--accent); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ============ COMMAND PALETTE ============ */
.cmd-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 12, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  animation: overlay-in .18s var(--ease-out);
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.cmd-palette {
  width: min(640px, 92%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: palette-in .22s var(--ease-out);
}
@keyframes palette-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.cmd-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-mute);
}
.cmd-input-wrap input {
  flex: 1;
  border: none; outline: none;
  font-size: 16px;
  background: transparent;
}
.cmd-input-wrap input::placeholder { color: var(--ink-mute); }
.cmd-results {
  list-style: none;
  margin: 0; padding: 8px;
  max-height: 50vh;
  overflow-y: auto;
}
.cmd-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .08s;
  font-size: 14px;
}
.cmd-result:hover, .cmd-result.active { background: var(--accent-tint); }
.cmd-result.active { color: var(--accent); }
.cmd-result-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: var(--bg-sunk);
  border-radius: var(--radius-sm);
  color: var(--ink-mute);
  font-size: 14px;
  flex-shrink: 0;
}
.cmd-result.active .cmd-result-icon { background: var(--accent); color: #fff; }
.cmd-result-label { flex: 1; color: var(--ink); font-weight: 500; }
.cmd-result-hint { color: var(--ink-mute); font-size: 12px; }
.cmd-footer {
  display: flex; gap: 18px; justify-content: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
  font-size: 12px;
  color: var(--ink-mute);
}
.cmd-footer kbd { margin-right: 3px; font-size: 10px; }

/* ============ GLOSSARY TOOLTIP ============ */
.glossary-tip {
  position: absolute;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  max-width: 280px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  z-index: 60;
  animation: tip-in .15s var(--ease-out);
}
.glossary-tip::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 20px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
  border-bottom: none;
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ============ KEYBOARD HELP ============ */
.kbd-help-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 15, 12, 0.48);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  animation: overlay-in .18s var(--ease-out);
}
.kbd-help {
  width: min(440px, 92%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  animation: palette-in .22s var(--ease-out);
}
.kbd-help h3 { font-family: var(--font-serif); font-size: 20px; margin-bottom: 16px; }
.kbd-help dl {
  display: grid; grid-template-columns: auto 1fr;
  gap: 10px 18px; align-items: center;
  margin-bottom: 20px;
}
.kbd-help dt { display: flex; gap: 4px; align-items: center; }
.kbd-help dd { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* ============ KID MODE ============ */
body.kid-mode {
  --tx: 18px;
  --font-sans: "Comic Sans MS", "Quicksand", system-ui, sans-serif;
  --accent: #d8730a;
  --accent-2: #e68d2b;
  --accent-soft: #ffe5b8;
  --accent-tint: #fff4e0;
  --accent-ink: #6b3a04;
}
body.kid-mode .lesson-content { line-height: 1.85; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .tutor-panel { position: static; max-height: none; }
  .tutor-chat { max-height: 320px; }
  .lesson-topbar { flex-wrap: wrap; }
  .lesson-depth { width: 100%; min-width: 0; }
  .lesson-content { padding: 32px 28px; }
}
@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .nav { margin-left: 0; }
  .nav button span.nav-glyph { display: none; }
  .status-pill .status-text { display: none; }
  .kbd-hint { display: none; }
  #app { padding: 24px 16px 80px; }
  .hero { padding: 32px 8px 16px; }
  .hero-title { font-size: 40px; }
  .live-demo-body { padding: 20px; font-size: 15px; }
  .live-demo-slider { padding: 18px 20px; }
  .onboard-frame { padding: 24px; }
  .lesson-content { padding: 24px 20px; }
  .compare-table th, .compare-table td { padding: 10px 8px; font-size: 12px; }
}
