:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #475569;
  --text-faint: #94a3b8;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --green-line: #bbf7d0;
  --red: #b91c1c;
  --red-bright: #dc2626;
  --red-soft: #fef2f2;
  --red-line: #fecaca;
  --amber: #b45309;
  --accent: #0ea5e9;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 12px 30px -12px rgba(15, 23, 42, 0.25);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020617;
  --surface: #0f172a;
  --surface-soft: #1e293b;
  --border: #334155;
  --border-strong: #475569;
  --text: #f8fafc;
  --text-soft: #cbd5e1;
  --text-faint: #94a3b8;
  --green: #4ade80;
  --green-soft: rgba(34, 197, 94, 0.1);
  --green-line: rgba(34, 197, 94, 0.3);
  --red: #fca5a5;
  --red-bright: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.1);
  --red-line: rgba(239, 68, 68, 0.3);
  --amber: #fbbf24;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap;
}
.ni { margin: 14px 0; }
.ni-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.ni-readout { color: var(--text); font-size: 14px; }
.ni-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.ni-slider { flex: 1; accent-color: var(--green); height: 28px; cursor: pointer; }
.ni-number { width: 96px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; }
.quiz { margin-top: 18px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.quiz-q { margin-bottom: 16px; }
.quiz-prompt { font-weight: 600; margin: 0 0 8px; }
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.quiz-choice { text-align: left; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.quiz-choice:hover { border-color: var(--accent); }
.quiz-choice[data-state="right"] { border-color: var(--green); background: var(--green-soft); }
.quiz-choice[data-state="wrong"] { border-color: var(--red-bright); background: var(--red-soft); }
.quiz-fb { font-size: 13px; min-height: 1em; margin: 8px 0 0; }
.quiz-fb.is-right { color: var(--green); }
.quiz-fb.is-wrong { color: var(--red); }
.quiz-status { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.quiz-status.is-pass { color: var(--green); }
.tone-red .ni-slider { accent-color: var(--red-bright); }
.jar-corner { position: fixed; top: 12px; right: 16px; z-index: 40; }
.jar-btn { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: 30px; background: var(--surface); cursor: pointer; box-shadow: var(--shadow); }
.jar-count { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.jar-mini { display: flex; gap: 2px; width: 40px; height: 30px; align-items: flex-end; padding: 3px; background: linear-gradient(180deg, transparent, var(--surface-soft)); border: 1px solid var(--border); border-radius: 5px 5px 9px 9px; }
.marble-img, .marble-fallback { border-radius: 50%; display: inline-block; }
.marble-fallback { box-shadow: inset -2px -2px 4px rgba(0,0,0,.2); }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); max-width: 440px; width: 100%; padding: 24px; }
.modal-x { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 18px; color: var(--text-soft); cursor: pointer; }
.jar-stage { position: relative; height: 280px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px 8px 18px 18px; overflow: hidden; margin: 12px 0; }
.jar-static { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; align-content: flex-end; height: 100%; }
.marble-enlarged { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(2px); cursor: pointer; z-index: 2; }
.marble-enlarged[hidden] { display: none; }
.marble-cap { font-size: 12px; color: var(--text-soft); margin-top: 8px; }
.jar-actions { display: flex; gap: 10px; justify-content: space-between; margin-top: 12px; }
.btn-ghost { background: none; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; color: var(--text-soft); cursor: pointer; font: inherit; font-size: 13px; }
.btn-ghost.danger { color: var(--red-bright); border-color: var(--red-line); background: var(--red-soft); font-weight: 600; }
.btn-ghost.danger:hover { border-color: var(--red-bright); }

.home { padding: 28px 20px 80px; }
.home-hero h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0 0 12px; }
.accent-green { color: var(--green); }
.lede { color: var(--text-soft); font-size: 16px; max-width: 36ch; }
.btn-primary { background: var(--green); color: #fff; border: none; border-radius: 10px; padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.module-map { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 10px; }
.map-btn { width: 100%; display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; gap: 0 12px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; }
.map-num { grid-row: 1 / 3; align-self: center; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-soft); color: var(--text-soft); }
.is-done .map-num { background: var(--green); color: #fff; }
.map-title { font-weight: 700; }
.map-kicker { font-size: 12px; color: var(--text-faint); }
.map-item.is-locked .map-btn { opacity: .5; cursor: not-allowed; }
.module { padding: 24px 20px 80px; }
.rail { display: flex; gap: 6px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.rail-dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); cursor: pointer; font-size: 12px; }
.rail-dot.is-active { box-shadow: 0 0 0 3px var(--green-line); border-color: var(--green); }
.rail-dot.is-done { background: var(--green); color: #fff; border-color: var(--green); }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700; color: var(--green); margin: 0; }
.tone-red .kicker { color: var(--red-bright); }
.module-title { font-size: clamp(26px, 5vw, 36px); font-weight: 800; letter-spacing: -.02em; margin: 4px 0 14px; }
.lesson-p { font-size: 16px; color: var(--text-soft); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 18px 0; }
.demo-big { font-size: 34px; font-weight: 800; font-family: var(--mono); line-height: 1; }
.demo-big.green { color: var(--green); } .demo-big.red { color: var(--red); }
.demo-sub { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.demo-bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin: 14px 0; }
.bar { flex: 1; border-radius: 2px; min-height: 4px; }
.bar.green { background: var(--green); }
.bar-split { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.seg.interest { background: var(--red-bright); border-radius: 2px 2px 0 0; }
.seg.principal { background: var(--red-line); }
.demo-legend { font-size: 11px; color: var(--text-faint); }
.budget-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.budget-row.green b { color: var(--green); }
.takeaway { background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; font-weight: 500; }
.btn-wayout { display: inline-block; background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); border-radius: 10px; padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer; margin: 4px 0 18px; }
.lesson-done { color: var(--green); font-weight: 600; }
.module-nav { display: flex; justify-content: space-between; margin-top: 28px; }
.quiz-h { font-size: 18px; margin: 24px 0 0; }
.persona-card { text-align: center; max-width: 380px; }
.persona-orb { font-size: 30px; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 16px 0; }
.persona-opt { padding: 14px 6px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.persona-opt[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); }
.persona-emoji { font-size: 26px; }
.theme-toggle { margin-top: 40px; background: none; border: 1px solid var(--border-strong); border-radius: 20px; padding: 6px 14px; font-size: 12px; color: var(--text-soft); cursor: pointer; }
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 800; background: rgba(240,253,244,.92); z-index: 60; text-align: center; padding: 20px; }
@media (max-width: 420px) {
  .persona-grid { grid-template-columns: 1fr 1fr 1fr; }
  .jar-corner { top: 8px; right: 8px; }
  .module-nav { gap: 8px; }
  .home-hero h1 { font-size: clamp(26px, 9vw, 40px); }
  .module-title { font-size: clamp(22px, 7vw, 32px); }
  .modal-card { padding: 18px; }
  .jar-stage { height: 240px; }
}
.home, .module { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.jar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.persona-opt:focus-visible, .map-btn:focus-visible, .quiz-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Static SEO / overview footer ---------- */
.site-overview {
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 44px 0 60px;
  margin-top: 24px;
  color: var(--text-soft);
}
.site-overview h2 { font-size: 20px; color: var(--text); margin: 0 0 10px; letter-spacing: -.01em; }
.site-overview h3 { font-size: 15px; color: var(--text); margin: 26px 0 8px; }
.site-overview p { font-size: 14px; line-height: 1.7; margin: 0 0 12px; }
.overview-modules { padding-left: 20px; margin: 0; display: grid; gap: 7px; font-size: 14px; line-height: 1.6; }
.overview-modules li strong { color: var(--text); }
.overview-faq { margin: 0; }
.overview-faq dt { font-weight: 600; color: var(--text); margin-top: 14px; font-size: 14px; }
.overview-faq dd { margin: 4px 0 0; font-size: 14px; line-height: 1.65; }
.overview-trust {
  font-size: 12.5px; color: var(--text-faint); margin-top: 26px;
  border-top: 1px dashed var(--border); padding-top: 16px;
}

/* ---------- Multi-page: header + anchors styled as controls ---------- */
.site-header { display: flex; align-items: center; padding: 14px 20px; max-width: 680px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; background: var(--green-soft); border: 1px solid var(--green-line); border-radius: 8px; color: var(--green); font-weight: 700; font-family: var(--mono); }
.brand-name { font-size: 15px; font-weight: 700; }
.brand-name span { color: var(--text-faint); font-weight: 600; }
a.btn-primary, a.btn-ghost, a.btn-wayout { text-decoration: none; display: inline-block; }
a.map-btn { text-decoration: none; color: inherit; }
a.rail-dot { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.lesson-complete-mount:empty { display: none; }

/* ============================================================
   Bold & playful refresh (logo-cued: leaf + $ green gradient)
   ============================================================ */
:root {
  --grad-green: linear-gradient(135deg, #34d058 0%, #15803d 100%);
  --grad-green-bright: linear-gradient(135deg, #4ade80 0%, #16a34a 100%);
  --grad-red: linear-gradient(135deg, #f87171 0%, #b91c1c 100%);
  --lift: 0 18px 40px -18px rgba(21, 128, 61, .35);
  --lift-soft: 0 10px 24px -14px rgba(15, 23, 42, .25);
}
html[data-theme="dark"] {
  --grad-green: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

/* --- Header with real logo --- */
.site-header { gap: 10px; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-name { font-size: 16px; letter-spacing: -.01em; }

/* --- Buttons: gradient + lift --- */
.btn-primary {
  background: var(--grad-green); box-shadow: var(--lift);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: 0 22px 46px -16px rgba(21,128,61,.5); }
.btn-primary:disabled { background: var(--green); box-shadow: none; }
.btn-hero { font-size: 16px; padding: 15px 26px; border-radius: 14px; }

/* --- Landing hero --- */
.hero {
  position: relative; overflow: hidden;
  padding: 36px 20px 56px;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(52, 208, 88, .18), transparent 60%),
    radial-gradient(700px 360px at 0% 0%, rgba(239, 68, 68, .10), transparent 55%);
}
.hero-inner { max-width: 660px; margin: 0 auto; text-align: center; }
.hero-logo { width: 76px; height: 76px; object-fit: contain; margin: 0 auto 14px; display: block; filter: drop-shadow(0 8px 16px rgba(21,128,61,.28)); }
.hero-title {
  font-size: clamp(38px, 8vw, 66px); font-weight: 800; line-height: 1.02;
  letter-spacing: -.03em; margin: 0 0 14px;
}
.hero-em-red { color: var(--red-bright); }
.hero-em-green { background: var(--grad-green); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: clamp(15px, 2.4vw, 18px); color: var(--text-soft); max-width: 34em; margin: 0 auto 26px; }

.hero-split { display: flex; align-items: stretch; justify-content: center; gap: 12px; margin: 0 auto 28px; max-width: 560px; }
.hero-card { flex: 1; border-radius: 18px; padding: 18px 16px; text-align: left; box-shadow: var(--lift-soft); border: 1.5px solid; }
.hero-card.hero-red { background: linear-gradient(165deg, #fff, #fef2f2); border-color: var(--red-line); }
.hero-card.hero-green { background: linear-gradient(165deg, #fff, #f0fdf4); border-color: var(--green-line); }
html[data-theme="dark"] .hero-card.hero-red { background: linear-gradient(165deg, var(--surface), rgba(239,68,68,.12)); }
html[data-theme="dark"] .hero-card.hero-green { background: linear-gradient(165deg, var(--surface), rgba(34,197,94,.12)); }
.hero-card-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.hero-red .hero-card-label { color: var(--red-bright); }
.hero-green .hero-card-label { color: var(--green); }
.hero-stat { font-family: var(--mono); font-weight: 700; font-size: clamp(26px, 6vw, 38px); line-height: 1; letter-spacing: -.02em; }
.hero-red .hero-stat { color: var(--red); }
.hero-green .hero-stat { color: var(--green); }
.hero-card-sub { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.hero-vs { align-self: center; font-weight: 800; color: var(--text-faint); font-size: 13px; }
.hero-meta { font-size: 13px; color: var(--text-faint); margin-top: 14px; }

@media (max-width: 540px) {
  .hero-split { flex-direction: column; gap: 10px; }
  .hero-vs { transform: rotate(90deg); }
}

/* --- Course section + revamped module cards --- */
.course { max-width: 660px; margin: 0 auto; padding: 8px 20px 90px; }
.course-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 14px; }
.course-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.course-progress { font-size: 13px; color: var(--text-faint); font-weight: 600; }
.module-map { margin: 0; }
.map-btn {
  grid-template-columns: 46px 1fr auto; align-items: center;
  box-shadow: var(--lift-soft); transition: transform 130ms ease, box-shadow 130ms ease, border-color 130ms ease;
  position: relative; overflow: hidden;
}
.map-btn:hover { transform: translateY(-2px); border-color: var(--green-line); box-shadow: var(--lift); }
.map-btn::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--border-strong); }
.tone-green .map-btn::before { background: var(--grad-green); }
.tone-red .map-btn::before { background: var(--grad-red); }
.map-icon {
  grid-row: 1 / 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--border);
}
.tone-green .map-icon { background: var(--green-soft); }
.tone-red .map-icon { background: var(--red-soft); }
.map-text { display: flex; flex-direction: column; gap: 2px; }
.map-arrow { color: var(--text-faint); font-size: 18px; transition: transform 130ms ease; }
.map-btn:hover .map-arrow { transform: translateX(3px); color: var(--green); }
.map-item.is-done .map-icon { background: var(--grad-green); color: #fff; box-shadow: var(--lift-soft); }
.map-item.is-done .map-arrow { color: var(--green); }
.map-done-badge { display: none; }
