/* ============================================================
   Learning AI: design system
   Editorial, warm, practical. For 9th grade and up.
   ============================================================ */

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --border: #dbe3ea;
  --text: #121826;
  --text-dim: #4b5870;
  --text-faint: #7a869a;
  --accent: #2563eb;
  --accent-dim: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --good: #0f8a66;
  --bad: #c2414b;
  --blue: #182235;
  --on-accent: #ffffff;
  --max-w: 720px;
  --wide-w: 1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body[data-font-scale="large"] { font-size: 19px; }
body[data-font-scale="xl"] { font-size: 21px; }
body[data-font-family="serif"] { font-family: Georgia, "Times New Roman", serif; }
body[data-font-family="mono"] { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* ---------- typography ---------- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 500; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-top: 3rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-top: 2rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.05rem; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--text-dim); }
p { margin-bottom: 1.1rem; color: var(--text); }
p.lead { font-size: 1.2rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 1.5rem; }
small, .small { font-size: 0.9rem; color: var(--text-dim); }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--accent); }
strong { color: var(--text); font-weight: 600; }
em { color: var(--text); font-style: italic; }

ul, ol { margin: 0 0 1.2rem 1.4rem; }
li { margin-bottom: 0.5rem; }
li::marker { color: var(--accent); }

code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; background: var(--surface-2); padding: 0.15em 0.4em; border-radius: 4px; color: var(--text); }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.2rem; overflow-x: auto; margin: 1.2rem 0; }
pre code { background: none; padding: 0; font-size: 0.92rem; line-height: 1.55; }

blockquote { border-left: 3px solid var(--accent); padding: 0.2rem 0 0.2rem 1.2rem; margin: 1.5rem 0; color: var(--text-dim); font-style: italic; }

hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

/* ---------- layout ---------- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }
.wide { max-width: var(--wide-w); margin: 0 auto; padding: 0 1.25rem; }

.section { padding: 4rem 0; }
.section-tight { padding: 2rem 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 249, 252, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: var(--wide-w); margin: 0 auto; padding: 0.9rem 1.25rem; display: flex; align-items: center; gap: 2rem; }
.nav-logo { font-weight: 600; font-size: 1.05rem; color: var(--text); letter-spacing: -0.02em; border: none; }
.nav-logo span { color: var(--accent); }
.nav-logo:hover { border: none; }
.nav-links { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: var(--text-dim); font-size: 0.95rem; border: none; }
.nav-links a:hover { color: var(--text); border: none; }
.nav-links a.active { color: var(--text); }
.nav-cta { background: var(--accent); color: var(--on-accent) !important; padding: 0.45rem 0.9rem; border-radius: 6px; font-weight: 500; }
.nav-cta:hover { background: var(--accent-dim); border: none; }
.assessment-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.assessment-nav span {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.assessment-nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.45rem 0.85rem;
}
.assessment-nav button:hover { border-color: var(--accent); }
@media (max-width: 760px) {
  .nav-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 0.9rem;
  }

  .nav-logo {
    font-size: 1.15rem;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
    margin-left: 0;
    width: 100%;
  }

  .nav-links a {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.1;
    min-height: 36px;
    padding: 0.55rem 0.35rem;
    text-align: center;
  }

  .nav-cta {
    display: none;
  }
  .assessment-nav {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}

/* ---------- hero ---------- */
.hero { padding: 6rem 0 4rem; }
.hero h1 { margin-bottom: 1.5rem; }
.hero .tagline { font-size: 0.9rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.5rem; font-weight: 500; }
.hero-meta { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 2rem; flex-wrap: wrap; color: var(--text-dim); font-size: 0.95rem; }
.hero-meta span strong { color: var(--text); display: block; font-weight: 500; }

/* ---------- buttons ---------- */
.btn { display: inline-block; padding: 0.85rem 1.6rem; border-radius: 8px; font-weight: 500; font-size: 1rem; cursor: pointer; border: 1px solid transparent; transition: all 0.15s; text-decoration: none; line-height: 1.2; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text-dim); background: var(--surface); }
.btn + .btn { margin-left: 0.5rem; }
.btn-row { margin: 1.5rem 0; }

/* ---------- cards / chapter list ---------- */
.chapter-list { display: grid; gap: 1rem; margin: 2rem 0; }
.chapter-card { display: block; padding: 1.5rem 1.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); border-bottom: 1px solid var(--border); transition: border-color 0.2s, background 0.2s; }
.chapter-card:hover { border-color: var(--accent); background: var(--surface-2); }
.chapter-card .num { display: inline-block; color: var(--accent); font-family: ui-monospace, monospace; font-size: 0.85rem; margin-bottom: 0.3rem; letter-spacing: 0.05em; }
.chapter-card h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.chapter-card p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.chapter-card .meta { margin-top: 0.6rem; color: var(--text-faint); font-size: 0.85rem; font-family: ui-monospace, monospace; }
.lesson-path-head {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.lesson-path-head h2 {
  margin: 0.35rem 0 0.4rem;
}
.lesson-path-head p {
  margin: 0;
}
.personalized-lessons {
  counter-reset: lesson-path;
}
.personalized-lesson-card {
  border-left: 4px solid var(--accent);
}
.personalized-lesson-card:first-child {
  background: var(--surface-2);
}

/* ---------- pull-out boxes ---------- */
.callout { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 6px; padding: 1.1rem 1.3rem; margin: 1.5rem 0; }
.callout h4 { margin-top: 0; color: var(--accent); letter-spacing: 0.08em; font-size: 0.8rem; text-transform: uppercase; }
.callout p:last-child { margin-bottom: 0; }
.callout-good { border-left-color: var(--good); }
.callout-good h4 { color: var(--good); }
.callout-bad { border-left-color: var(--bad); }
.callout-bad h4 { color: var(--bad); }

/* ---------- side-by-side comparison ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0; }
.compare > div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.1rem 1.2rem; }
.compare .bad { border-top: 3px solid var(--bad); }
.compare .good { border-top: 3px solid var(--good); }
.compare h4 { margin-top: 0; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
.compare .bad h4 { color: var(--bad); }
.compare .good h4 { color: var(--good); }
.compare pre { margin: 0.5rem 0; background: var(--bg); font-size: 0.85rem; }
.compare p { font-size: 0.93rem; color: var(--text-dim); margin: 0.6rem 0 0; }
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }

/* ---------- prev/next nav ---------- */
.lesson-nav { display: flex; justify-content: space-between; margin: 4rem 0 2rem; gap: 1rem; flex-wrap: wrap; }
.lesson-nav a { flex: 1; min-width: 200px; padding: 1rem 1.3rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); }
.lesson-nav a:hover { border-color: var(--accent); }
.lesson-nav .label { display: block; font-size: 0.78rem; color: var(--text-faint); margin-bottom: 0.2rem; letter-spacing: 0.05em; text-transform: uppercase; }
.lesson-nav .next { text-align: right; }

/* ---------- playground chat ---------- */
.chat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; margin: 1.5rem 0; max-width: 100%; }
.chat-window { height: 360px; overflow-y: auto; padding: 0.5rem; margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.msg { padding: 0.65rem 0.95rem; border-radius: 10px; max-width: 85%; font-size: 0.95rem; line-height: 1.5; white-space: pre-wrap; }
.msg-user { background: var(--accent); color: var(--on-accent); align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-ai { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); align-self: flex-start; border-bottom-left-radius: 2px; }
.msg-system { color: var(--text-faint); font-size: 0.85rem; font-style: italic; align-self: center; text-align: center; max-width: 100%; padding: 0.3rem; }
.chat-input { display: flex; gap: 0.5rem; }
.chat-input textarea { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 0.7rem 0.9rem; font: inherit; font-size: 0.95rem; resize: none; min-height: 44px; max-height: 120px; font-family: inherit; }
.chat-input textarea:focus { outline: none; border-color: var(--accent); }
.chat-input button { background: var(--accent); color: var(--on-accent); border: none; border-radius: 8px; padding: 0 1.1rem; font-weight: 500; cursor: pointer; font-size: 0.95rem; }
.chat-input button:hover { background: var(--accent-dim); }
.chat-hint { font-size: 0.83rem; color: var(--text-faint); margin-top: 0.6rem; }
.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.8rem 0 0; }
.chip { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); padding: 0.35rem 0.7rem; border-radius: 16px; font-size: 0.85rem; cursor: pointer; transition: all 0.15s; }
.chip:hover { color: var(--text); border-color: var(--accent); }

/* ---------- "try it" external button ---------- */
.try-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.try-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 0.55rem 1rem; border-radius: 6px; font-size: 0.9rem; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.try-btn:hover { border-color: var(--accent); }
.try-btn .icon { color: var(--accent); margin-right: 0.4rem; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 3rem 0 4rem; margin-top: 5rem; color: var(--text-dim); }
.footer p { font-size: 0.92rem; margin-bottom: 0.5rem; }
.footer a { color: var(--text); }

/* ---------- utility ---------- */
.tag { display: inline-block; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.scaffold-notice { background: var(--accent-soft); border: 1px dashed var(--accent-dim); border-radius: 8px; padding: 1rem 1.2rem; margin: 1.5rem 0; color: var(--text-dim); font-size: 0.93rem; }
.scaffold-notice strong { color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.stat .num { font-size: 1.6rem; font-weight: 500; color: var(--accent); letter-spacing: -0.02em; }
.stat .label { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.2rem; }

/* ---------- TL;DR box at top of chapters ---------- */
.tldr {
  background: linear-gradient(180deg, rgba(79,111,82,0.13) 0%, rgba(79,111,82,0.05) 100%);
  border: 1px solid rgba(79,111,82,0.28);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  margin: 2rem 0 3rem;
}
.tldr h4 { margin: 0 0 0.7rem; color: var(--accent); font-size: 0.78rem; letter-spacing: 0.15em; text-transform: uppercase; }
.tldr ul { margin: 0; list-style: none; padding-left: 0; }
.tldr li { margin: 0.4rem 0; padding-left: 1.4rem; position: relative; font-size: 0.97rem; }
.tldr li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }

/* ---------- Scroll progress bar ---------- */
.progress-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: transparent; z-index: 100; pointer-events: none; }
.progress-bar > div { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s; }

/* ---------- SVG diagram containers ---------- */
.diagram {
  background: var(--blue);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}
.diagram svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.diagram .caption { color: var(--text-dim); font-size: 0.88rem; margin-top: 1rem; }

/* ---------- The inline mini-lesson card on home ---------- */
.mini-lesson {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  margin: 2.5rem 0;
}
.mini-lesson .tag { margin-bottom: 0.5rem; display: block; }
.mini-lesson h3 { margin-top: 0; font-size: 1.5rem; letter-spacing: -0.02em; }
.mini-lesson p:last-child { margin-bottom: 0; }

/* ---------- Four-ingredient grid ---------- */
.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.ingredient {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  position: relative;
}
.ingredient .num {
  position: absolute;
  top: 0.7rem;
  right: 0.9rem;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  opacity: 0.7;
}
.ingredient h4 { margin: 0.2rem 0 0.4rem; font-size: 1.05rem; color: var(--text); }
.ingredient p { font-size: 0.88rem; color: var(--text-dim); margin: 0; line-height: 1.5; }

/* ---------- Lose/gain split visual ---------- */
.lose-gain {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 2rem 0;
}
.lose-gain > div { padding: 1.4rem 1.6rem; }
.lose-gain .lose { border-right: 1px solid var(--border); }
.lose-gain h4 { margin: 0 0 0.8rem; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.lose-gain .lose h4 { color: var(--bad); }
.lose-gain .gain h4 { color: var(--good); }
.lose-gain ul { margin: 0; padding-left: 1.2rem; }
.lose-gain li { font-size: 0.93rem; margin: 0.4rem 0; }
@media (max-width: 600px) {
  .lose-gain { grid-template-columns: 1fr; }
  .lose-gain .lose { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ---------- Probability bar for token prediction visual ---------- */
.token-bars { display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; margin: 1rem auto; }
.token-bar { display: flex; align-items: center; gap: 0.7rem; }
.token-bar .word { font-family: ui-monospace, monospace; min-width: 90px; text-align: right; color: var(--text); font-size: 0.92rem; }
.token-bar .bar { flex: 1; height: 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.token-bar .fill { height: 100%; background: var(--accent); }
.token-bar .pct { font-family: ui-monospace, monospace; min-width: 40px; color: var(--text-dim); font-size: 0.85rem; text-align: right; }

/* ---------- AI knowledge gauge ---------- */
.assessment-page .nav-inner {
  max-width: 960px;
}
.assessment-page {
  --bg: #0f1726;
  --surface: #1b2637;
  --surface-2: #243247;
  --border: #33445c;
  --text: #f4f7fb;
  --text-dim: #a7b1c2;
  --text-faint: #778397;
  --accent: #1597e5;
  --accent-dim: #0f77bf;
  --accent-soft: rgba(21, 151, 229, 0.14);
  --good: #11b88a;
  --bad: #ff5f75;
  --on-accent: #ffffff;
  background:
    radial-gradient(circle at 50% 0%, rgba(21, 151, 229, 0.12), transparent 34rem),
    var(--bg);
}
.assessment-page .nav {
  background: rgba(15, 23, 38, 0.86);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.assessment-page .nav-logo,
.assessment-page .assessment-nav button {
  color: var(--text);
}
.assessment-page .assessment-nav button {
  background: rgba(27, 38, 55, 0.86);
  border-color: rgba(255, 255, 255, 0.12);
}
.assessment-hero {
  padding: 4rem 0 2rem;
  text-align: center;
}
.assessment-hero .container,
.assessment-page .container {
  max-width: 860px;
}
.assessment-hero .tagline {
  color: var(--good);
}
.assessment-hero h1 {
  color: var(--text);
  text-shadow: 0 2px 0 rgba(0,0,0,0.22);
}
.assessment-hero .lead {
  color: var(--text-dim);
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}
.level-preview,
.profile-panel {
  background: rgba(27, 38, 55, 0.9);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  margin: 0 auto 1.2rem;
  max-width: 780px;
  padding: clamp(1.2rem, 3vw, 2rem);
}
.level-preview {
  display: grid;
  gap: 1.2rem;
}
.level-preview h2 {
  margin: 0.2rem 0 0.5rem;
}
.level-preview p {
  color: var(--text-dim);
  margin: 0;
}
.level-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.level-card {
  background: #111b2b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 1rem;
}
.level-card span {
  color: var(--good);
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}
.level-card h3 {
  color: var(--text);
  margin: 0 0 0.35rem;
}
.profile-panel {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
}
.profile-panel h2 { margin-top: 0.2rem; }
.profile-panel p,
.profile-form label,
.profile-form .small { color: var(--text-dim); }
.profile-form {
  display: grid;
  gap: 0.75rem;
}
.profile-form label {
  color: var(--text-dim);
  display: grid;
  font-size: 0.9rem;
  gap: 0.3rem;
}
.profile-form input {
  background: #111b2b;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 0.75rem 0.85rem;
}
.profile-form input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 760px) {
  .level-grid { grid-template-columns: 1fr; }
  .profile-panel { grid-template-columns: 1fr; }
}
.gauge {
  display: grid;
  gap: 1rem;
  margin: 0 auto;
  max-width: 780px;
}
.gauge-progress {
  background: rgba(27, 38, 55, 0.82);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.2);
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
}
.gauge-progress span {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gauge-progress div {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.gauge-progress div span {
  background: var(--accent);
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}
.gauge-card {
  background: rgba(27, 38, 55, 0.92);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 18px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
  display: none;
  padding: clamp(1.2rem, 3vw, 2rem);
}
.gauge-card.active { display: block; }
.gauge-card h2 {
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
.gauge-card p { color: var(--text-dim); }
.gauge-kicker {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gauge-card label {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0.65rem;
  align-items: start;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px;
  background: #1d2a3b;
  color: var(--text);
  cursor: pointer;
  font-size: 0.96rem;
  line-height: 1.45;
  margin: 0.65rem 0;
  padding: 1.05rem 1.15rem;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.gauge-card label:hover {
  border-color: rgba(21, 151, 229, 0.75);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}
.gauge-card label:has(input:checked) {
  border-color: var(--good);
  background: rgba(17, 184, 138, 0.1);
  box-shadow: 0 0 0 2px rgba(17, 184, 138, 0.45);
}
.gauge-card input[type="radio"] {
  accent-color: var(--accent);
  margin-top: 0.2rem;
}
.gauge-card textarea {
  width: 100%;
  min-height: 72px;
  margin-top: 0.8rem;
  padding: 0.85rem 0.95rem;
  background: #111b2b;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  font: inherit;
  resize: vertical;
}
.gauge-card textarea:focus { outline: none; border-color: var(--accent); }
.gauge-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 1rem 0 0;
}
.assessment-page .btn-primary {
  background: linear-gradient(180deg, #1597e5, #0b7fc9);
  box-shadow: 0 12px 26px rgba(21, 151, 229, 0.28);
  min-width: 170px;
}
.assessment-page .btn-ghost {
  background: rgba(27, 38, 55, 0.7);
  border-color: rgba(255,255,255,0.14);
  color: var(--text);
}
.gauge-result {
  background: rgba(27, 38, 55, 0.94);
  border: 1px solid rgba(255,255,255,0.11);
  border-left: 4px solid var(--good);
  border-radius: 18px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
  margin: 2rem 0 0;
  padding: 1.5rem;
}
.gauge-score {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
  padding-bottom: 1rem;
}
.gauge-score span {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.gauge-score strong {
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
}
.gauge-result .chapter-list { margin-bottom: 1.2rem; }
.known-profile {
  background: #111b2b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
}
.known-profile h3 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
}
.known-profile ul {
  margin-bottom: 0;
}
.known-profile textarea {
  background: #0f1726;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  min-height: 150px;
  padding: 0.85rem 0.95rem;
  resize: vertical;
  width: 100%;
}
.tool-hub {
  margin: 1.2rem 0;
}
.tool-hub h3 {
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
}
.tool-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.9rem;
}
.tool-card {
  background: linear-gradient(180deg, #1d2a3b 0%, #172234 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  color: var(--text);
  display: block;
  min-height: 150px;
  padding: 1rem;
}
.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(18, 24, 38, 0.08);
}
.tool-card .tool-icon {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 12px;
  color: var(--accent);
  display: inline-flex;
  font-weight: 700;
  height: 38px;
  justify-content: center;
  margin-bottom: 0.75rem;
  width: 38px;
}
.tool-card h4 {
  color: var(--text);
  font-size: 1rem;
  margin: 0 0 0.35rem;
}
.tool-card p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
}
@media (max-width: 680px) {
  .tool-grid { grid-template-columns: 1fr; }
}
.gauge-warning {
  color: var(--bad);
  font-size: 0.95rem;
  margin-top: 0.6rem;
}

/* ---------- My Path dashboard ---------- */
.path-page {
  --bg: #0f1726;
  --surface: #1b2637;
  --surface-2: #243247;
  --border: #33445c;
  --text: #f4f7fb;
  --text-dim: #a7b1c2;
  --text-faint: #778397;
  --accent: #1597e5;
  --accent-dim: #0f77bf;
  --accent-soft: rgba(21, 151, 229, 0.14);
  --good: #11b88a;
  --bad: #ff5f75;
  --on-accent: #ffffff;
  background:
    radial-gradient(circle at 10% 0%, rgba(17, 184, 138, 0.11), transparent 30rem),
    radial-gradient(circle at 80% 0%, rgba(21, 151, 229, 0.13), transparent 34rem),
    var(--bg);
}
.path-page .nav {
  background: rgba(15, 23, 38, 0.86);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.path-page .nav-logo,
.path-page .nav-links a {
  color: var(--text);
}
body[data-theme="light"].assessment-page,
body[data-theme="light"].path-page {
  background: var(--bg);
}
body[data-theme="dark"].assessment-page,
body[data-theme="dark"].path-page {
  background: var(--bg);
}
body[data-theme] .nav,
body[data-theme].assessment-page .nav,
body[data-theme].path-page .nav {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom-color: var(--border);
}
body[data-theme] .nav-logo,
body[data-theme].assessment-page .nav-logo,
body[data-theme].path-page .nav-logo,
body[data-theme].path-page .nav-links a {
  color: var(--text);
}
body[data-theme].assessment-page .assessment-nav span {
  color: var(--text-dim);
}
body[data-theme].assessment-page .assessment-nav button {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: none;
}
body[data-theme].assessment-page .assessment-nav button:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.path-hero {
  padding: 4rem 0 2rem;
}
.path-hero-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: stretch;
}
.path-hero h1 {
  color: var(--text);
  margin-bottom: 1rem;
}
.path-score-card,
.path-panel,
.path-empty {
  background: rgba(27, 38, 55, 0.92);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  padding: clamp(1.2rem, 3vw, 1.7rem);
}
.path-score-card span {
  color: var(--good);
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.path-score-card strong {
  color: var(--text);
  display: block;
  font-size: 3rem;
  line-height: 1;
  margin: 1rem 0;
}
.path-score-card p {
  color: var(--text-dim);
  margin: 0;
}
.path-score-card p + p {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.9rem;
  padding-top: 0.9rem;
}
.path-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  margin: 1rem 0;
}
.path-panel h2,
.path-empty h2 {
  color: var(--text);
  margin-top: 0;
}
.next-step-panel {
  border-left: 4px solid var(--good);
}
.skill-map {
  display: grid;
  gap: 0.6rem;
}
.skill-item {
  align-items: center;
  background: #111b2b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
}
.skill-item span { color: var(--text); }
.skill-item strong {
  color: var(--good);
  font-size: 0.8rem;
}
.path-panel textarea {
  background: #0f1726;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  min-height: 220px;
  padding: 0.85rem 0.95rem;
  resize: vertical;
  width: 100%;
}
.settings-panel {
  display: grid;
  gap: 1rem;
}
.settings-choice-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.settings-choice-grid label {
  align-items: center;
  background: #111b2b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
}
.settings-choice-grid label:has(input:checked) {
  border-color: var(--good);
  box-shadow: 0 0 0 1px rgba(17, 184, 138, 0.18);
}
.settings-color-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}
.settings-color-grid label {
  color: var(--text-dim);
  display: grid;
  gap: 0.35rem;
}
.settings-color-grid input,
.settings-color-grid select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  min-height: 42px;
  padding: 0.45rem 0.65rem;
}
.settings-color-grid input[type="color"] {
  padding: 0.25rem;
}
.settings-panel textarea {
  background: #0f1726;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  min-height: 140px;
  padding: 0.85rem 0.95rem;
  resize: vertical;
  width: 100%;
}
.formatted-copy {
  white-space: pre-line;
}
.manage-panel {
  margin-top: 1rem;
}
@media (max-width: 820px) {
  .path-hero-grid,
  .path-grid {
    grid-template-columns: 1fr;
  }
  .settings-choice-grid,
  .settings-color-grid {
    grid-template-columns: 1fr;
  }
}

body[data-theme] .level-preview,
body[data-theme] .profile-panel,
body[data-theme] .gauge-progress,
body[data-theme] .gauge-card,
body[data-theme] .gauge-result,
body[data-theme] .path-score-card,
body[data-theme] .path-panel,
body[data-theme] .path-empty {
  background: var(--surface);
  border-color: var(--border);
}
body[data-theme] .level-card,
body[data-theme] .gauge-progress div,
body[data-theme] .gauge-card label,
body[data-theme] .skill-item,
body[data-theme] .settings-choice-grid label {
  background: var(--surface-2);
  border-color: var(--border);
}
body[data-theme] .profile-form input,
body[data-theme] .gauge-card textarea,
body[data-theme] .path-panel textarea,
body[data-theme] .settings-panel textarea {
  background: var(--surface-2);
  border-color: var(--border);
}
body[data-theme] .assessment-page .btn-primary,
body[data-theme].assessment-page .btn-primary {
  background: var(--accent);
  box-shadow: none;
}
body[data-theme] .btn-ghost,
body[data-theme].assessment-page .btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
body[data-theme] .btn-ghost:hover,
body[data-theme].assessment-page .btn-ghost:hover {
  background: var(--surface-2);
}
body[data-theme] .gauge-card h2 {
  text-shadow: none;
}

/* ---------- Section heading on home ---------- */
.section-heading {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.7rem;
  display: block;
}

/* ============================================================
   PERSISTENT CHAT WIDGET (Llama in your browser via WebLLM)
   ============================================================ */
.widget-fab {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(36, 35, 31, 0.22), 0 0 0 1px rgba(79,111,82,0.25);
  z-index: 200;
  transition: transform 0.2s, box-shadow 0.2s;
}
.widget-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(36, 35, 31, 0.26), 0 0 0 1px rgba(79,111,82,0.35); }
.widget-fab svg { width: 24px; height: 24px; }
.widget-fab .pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: widget-pulse 2.5s ease-out infinite;
}
@keyframes widget-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}
.widget-fab.open .pulse { display: none; }

.widget-panel {
  position: fixed;
  right: 1.2rem;
  bottom: 5.5rem;
  width: 380px;
  height: min(600px, calc(100vh - 8rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(36, 35, 31, 0.24);
  z-index: 199;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.widget-panel.open { display: flex; }
@media (max-width: 600px) {
  .widget-panel { right: 0.6rem; left: 0.6rem; width: auto; bottom: 5rem; height: calc(100vh - 7rem); }
}

.widget-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
}
.widget-header .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.widget-header.ready .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.widget-header.error .dot { background: var(--bad); }
.widget-header .title { font-weight: 600; font-size: 0.95rem; flex: 1; }
.widget-header .subtitle { font-size: 0.78rem; color: var(--text-dim); font-weight: 400; display: block; margin-top: 1px; }
.widget-header button.x { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 0 0.3rem; }
.widget-header button.x:hover { color: var(--text); }

.widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.widget-body .msg {
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  max-width: 90%;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.widget-body .msg-user { background: var(--accent); color: var(--on-accent); align-self: flex-end; border-bottom-right-radius: 3px; }
.widget-body .msg-ai { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 3px; }
.widget-body .msg-system { color: var(--text-dim); font-size: 0.85rem; align-self: center; text-align: center; padding: 0.4rem 0.8rem; line-height: 1.5; }
.widget-body .msg-tip {
  align-self: stretch;
  background: var(--accent-soft);
  border: 1px solid rgba(79,111,82,0.35);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 0.55rem 0.8rem 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}
.widget-body .msg-tip .tip-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.widget-progress {
  align-self: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin: 0.3rem 0;
}
.widget-progress .label { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.widget-progress .label strong { color: var(--text); }
.widget-progress .bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.widget-progress .fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.2s; }

.widget-startbox {
  padding: 1.2rem 1.1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin: 0.3rem 0;
}
.widget-startbox h4 { color: var(--text); font-size: 1rem; margin-bottom: 0.5rem; }
.widget-startbox p { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.9rem; line-height: 1.5; }
.widget-startbox button.start {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 7px;
  padding: 0.6rem 1.1rem;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.92rem;
}
.widget-startbox button.start:hover { background: var(--accent-dim); }
.widget-startbox .fine { font-size: 0.78rem; color: var(--text-faint); margin: 0.7rem 0 0; }

.widget-input {
  padding: 0.7rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.widget-input textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-size: 0.92rem;
  resize: none;
  min-height: 38px;
  max-height: 120px;
  font-family: inherit;
}
.widget-input textarea:focus { outline: none; border-color: var(--accent); }
.widget-input textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.widget-input button {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 8px;
  padding: 0 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-size: 0.92rem;
}
.widget-input button:hover:not(:disabled) { background: var(--accent-dim); }
.widget-input button:disabled { opacity: 0.5; cursor: not-allowed; }

.widget-footer-actions {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.widget-footer-actions button {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
}
.widget-footer-actions button:hover { color: var(--text); border-color: var(--text-dim); }
