:root {
  --ink: #243264;
  --ink-2: #344581;
  --cream: #fff8e9;
  --paper: #fffefa;
  --coral: #f06b4f;
  --coral-dark: #d64e36;
  --mint: #cdeeda;
  --gold: #ffd15c;
  --muted: #6f7770;
  --line: #dedfd6;
  --shadow: 0 18px 55px rgba(23,60,59,.10);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "DM Sans", sans-serif; color: var(--ink); background: var(--cream); }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-columns: 310px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 30px 24px; background: var(--ink); color: white; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 6px 30px; }
.brand-mark { display: grid; place-items: center; width: 42px; aspect-ratio: 1; border: 2px solid var(--gold); border-radius: 50% 50% 45% 55%; background: var(--coral); font: 700 24px/1 "Fraunces", serif; transform: rotate(-4deg); }
.brand span { display: block; font: 700 21px/1.15 "Fraunces", serif; }
.brand small { display: block; margin-top: 4px; color: #a9c3bd; font-size: 11px; }
.progress-card { padding: 18px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.06); }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; }
.progress-label strong { color: var(--gold); }
.progress-track { height: 7px; margin: 11px 0; overflow: hidden; border-radius: 8px; background: rgba(255,255,255,.12); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--gold); transition: width .45s ease; }
.progress-card p { margin: 0; color: #b9cdc8; font-size: 11px; line-height: 1.45; }
.lesson-nav { display: grid; gap: 5px; margin-top: 25px; }
.nav-item { position: relative; display: grid; grid-template-columns: 34px 1fr 18px; gap: 10px; align-items: center; width: 100%; padding: 13px 11px; border: 0; border-radius: 13px; color: #b5cbc6; background: transparent; text-align: left; cursor: pointer; transition: .2s ease; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { color: white; background: rgba(255,255,255,.10); }
.nav-item.active::before { content: ""; position: absolute; left: -24px; height: 27px; width: 4px; border-radius: 0 5px 5px 0; background: var(--coral); }
.nav-number { font-size: 11px; color: #779b94; letter-spacing: .08em; }
.nav-item b { display: block; font-size: 13px; font-weight: 600; }
.nav-item small { display: block; margin-top: 3px; color: #789b95; font-size: 10px; }
.nav-item i { display: none; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: var(--ink); font-size: 10px; font-style: normal; }
.nav-item.completed i { display: grid; }
.sidebar-note { display: flex; gap: 11px; margin: 27px 5px 0; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); color: #8eaaa4; font-size: 10px; line-height: 1.5; }
.sidebar-note span { color: var(--gold); }
.sidebar-note p { margin: 0; }

.main-content { display: flex; min-width: 0; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 78px; padding: 0 clamp(24px, 5vw, 76px); border-bottom: 1px solid var(--line); }
.eyebrow { color: #78847d; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.course-links { display:flex; align-items:center; gap:6px; }
.course-switch { padding: 8px 11px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: rgba(255,255,255,.5); font-size: 10px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.course-switch:hover { border-color: var(--coral); color: var(--coral-dark); }
.streak { color: var(--coral); font-size: 11px; }.streak b { color: var(--ink); }
.avatar { width: 36px; height: 36px; border: 0; border-radius: 50%; color: white; background: var(--ink); font-size: 10px; font-weight: 700; }
.menu-button { display: none; border: 0; background: none; font-size: 22px; }

.lesson-content { width: min(900px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 38px; outline: none; }
.lesson-kicker { display: flex; align-items: center; gap: 10px; color: var(--coral); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.lesson-kicker::before { content:""; width: 25px; height: 2px; background: var(--coral); }
h1 { max-width: 730px; margin: 14px 0 16px; font: 700 clamp(41px,6vw,68px)/.98 "Fraunces", serif; letter-spacing: -.035em; }
.lede { max-width: 650px; margin: 0; color: #65716b; font-size: 17px; line-height: 1.65; }
.lesson-hero { position: relative; margin-bottom: 48px; }
.hero-scribble { position: absolute; right: 2%; top: 24%; width: 130px; color: var(--coral); opacity: .7; transform: rotate(-6deg); }
.concept-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 15px; margin: 30px 0; }
.concept-card { min-height: 180px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 8px 30px rgba(23,60,59,.04); }
.concept-card.featured { border-color: var(--ink); color: white; background: var(--ink); }
.concept-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 20px; border-radius: 12px; color: var(--ink); background: var(--mint); font-size: 19px; }
.concept-card.featured .concept-icon { background: var(--gold); }
.concept-card h3 { margin: 0 0 7px; font: 700 20px/1.1 "Fraunces", serif; }
.concept-card p { margin: 0; color: #748079; font-size: 12px; line-height: 1.55; }
.concept-card.featured p { color: #bed1cd; }

.mission-banner { display: grid; grid-template-columns: 56px 1fr; gap: 18px; align-items: center; margin: 28px 0; padding: 21px 24px; border: 2px dashed #eb9b45; border-radius: 18px; background: #fff0c8; transform: rotate(-.3deg); }
.mission-banner > span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: white; font-size: 28px; box-shadow: 0 5px 0 #f3cf73; }
.mission-banner b { display: block; margin-bottom: 4px; font: 700 18px "Fraunces",serif; }
.mission-banner p { margin: 0; color: #70654e; font-size: 12px; line-height: 1.5; }

.learn-block { display: grid; grid-template-columns: 48px 1fr; gap: 20px; margin: 34px 0; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.62); }
.learn-number { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: white; background: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.learn-block h2 { margin: 2px 0 10px; font: 700 27px/1.15 "Fraunces",serif; }
.learn-block p { margin: 0 0 11px; color: #5f6a65; font-size: 14px; line-height: 1.7; }
.learn-block p:last-child { margin-bottom: 0; }
.story-card { display: grid; grid-template-columns: 58px 1fr; gap: 20px; margin: 30px 0; padding: 27px; border-left: 5px solid var(--coral); border-radius: 8px 18px 18px 8px; background: #fff0e6; }
.story-card > span { font-size: 34px; }
.story-card small { color: var(--coral-dark); font-size: 9px; font-weight: 700; letter-spacing: .13em; }
.story-card h3 { margin: 5px 0 7px; font: 700 21px/1.2 "Fraunces",serif; }
.story-card p { margin: 0; color: #6f625c; font-size: 13px; line-height: 1.65; }
.vocab-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 28px 0; }
.vocab-grid > div { padding: 15px 17px; border: 1px dashed #bcc6bf; border-radius: 12px; background: #fffefa; }
.vocab-grid b { display: block; margin-bottom: 3px; font-size: 12px; }
.vocab-grid span { display: block; color: var(--muted); font-size: 10px; line-height: 1.4; }
.talk-prompt { margin: 30px 0; padding: 20px 23px; border-radius: 15px; background: #e7eefb; }
.talk-prompt b { display: block; margin-bottom: 5px; font: 700 17px "Fraunces",serif; }
.talk-prompt p { margin: 0; color: #5c6680; font-size: 12px; line-height: 1.55; }

.callout { display: grid; grid-template-columns: 50px 1fr; gap: 16px; align-items: center; margin: 28px 0; padding: 21px 24px; border-radius: 16px; background: #f0e6cd; }
.callout-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; color: #865e1c; background: var(--gold); font-size: 20px; }
.callout b { display: block; margin-bottom: 3px; font-family: "Fraunces", serif; }
.callout p { margin: 0; color: #726b5d; font-size: 12px; line-height: 1.45; }
.section-title { margin: 42px 0 7px; font: 700 30px/1.1 "Fraunces",serif; }
.section-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.activity { margin: 30px 0; padding: clamp(24px,4vw,40px); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.activity-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.activity-tag { padding: 7px 10px; align-self: flex-start; border-radius: 20px; color: var(--coral-dark); background: #fae1db; font-size: 9px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.activity h2 { margin: 0 0 5px; font: 700 27px/1.15 "Fraunces",serif; }
.activity-head p { margin: 0; color: var(--muted); font-size: 12px; }
.slider-row { display: grid; grid-template-columns: 160px 1fr 78px; gap: 15px; align-items: center; margin: 18px 0; }
.slider-row label { font-size: 12px; font-weight: 600; }
.slider-row output { text-align: right; font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--coral); }
.budget-result { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; overflow: hidden; margin-top: 28px; border-radius: 15px; background: var(--line); }
.budget-result div { padding: 20px; background: #f7f5ed; }
.budget-result small { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.budget-result strong { font: 700 22px/1 "Fraunces",serif; }
.budget-result .good strong { color: #31806c; }.budget-result .bad strong { color: var(--coral); }

.input-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.field label { display: block; margin-bottom: 7px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.money-input { display: flex; align-items: center; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.money-input span { color: var(--muted); }.money-input input { width: 100%; padding: 13px 5px; border: 0; outline: none; background: transparent; }
.result-banner { margin-top: 23px; padding: 26px; border-radius: 16px; color: white; background: var(--ink); text-align: center; }
.result-banner small { display: block; color: #a9c2bc; font-size: 10px; text-transform: uppercase; letter-spacing: .11em; }
.result-banner strong { display: block; margin: 5px 0; color: var(--gold); font: 700 37px/1 "Fraunces",serif; }
.result-banner p { margin: 0; color: #bad0cb; font-size: 11px; }

.strategy-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.strategy-button { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: white; cursor: pointer; text-align: left; }
.strategy-button.active { border-color: var(--coral); box-shadow: inset 0 0 0 1px var(--coral); background: #fff8f5; }
.strategy-button b { display:block; margin-bottom:3px; }.strategy-button small { color:var(--muted); }
.strategy-result { min-height: 110px; margin-top: 18px; padding: 22px; border-radius: 14px; background: #eef4ef; }
.strategy-result h3 { margin: 0 0 6px; font: 700 20px "Fraunces",serif; }.strategy-result p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.choice-game { display: grid; grid-template-columns: repeat(2,1fr); gap: 13px; }
.choice-card { padding: 20px; border: 2px solid var(--line); border-radius: 16px; background: white; text-align: center; transition: .2s ease; }
.choice-card > span { display: block; margin-bottom: 7px; font-size: 32px; }
.choice-card > b { display: block; min-height: 38px; font-size: 13px; }
.choice-card > div { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.choice-card button { padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #f8f7f2; cursor: pointer; font-size: 11px; font-weight: 700; }
.choice-card button:hover,.choice-card button.selected { border-color: var(--ink); background: #eef0fa; }
.choice-card.solved { border-color: #52a17e; background: #f0fbf5; box-shadow: 0 5px 0 #bfe6d2; }
.choice-card.retry { animation: wiggle .25s ease; }
.game-score { margin: 18px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; text-align: center; }
@keyframes wiggle { 25% { transform:translateX(-3px); } 75% { transform:translateX(3px); } }

.compound-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; }
.bar-chart { display: flex; align-items: end; gap: 10px; height: 210px; padding-top: 20px; border-bottom: 1px solid var(--line); }
.bar-wrap { display:flex; flex:1; height:100%; flex-direction:column; justify-content:flex-end; align-items:center; gap:7px; }
.bar { width: 80%; min-height: 5px; border-radius: 7px 7px 0 0; background: var(--mint); transition: height .5s ease; }.bar:last-child { background:var(--coral); }
.bar-wrap small { font-size:9px; color:var(--muted); }
.big-number { margin: 12px 0 4px; font: 700 43px/1 "Fraunces",serif; color:var(--coral); }

.quiz { margin: 45px 0 8px; padding: clamp(24px,4vw,38px); border: 1px solid var(--line); border-radius: 22px; background: #edf2ec; }
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.quiz-head h2 { margin: 7px 0 0; font: 700 30px/1.15 "Fraunces",serif; }
.quiz-head > strong { display: grid; place-items: center; min-width: 58px; height: 40px; padding: 0 12px; border-radius: 20px; color: white; background: var(--ink); font-size: 12px; }
.quiz-card { margin-top: 13px; padding: 23px; border: 1px solid #d6ddd5; border-radius: 16px; background: rgba(255,255,255,.7); }
.quiz-card.answered { border-color: #9ecdb9; background: #f1faf5; }
.question-count { color: #7a8a82; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.quiz-label { color: #688078; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.quiz-card h2 { margin: 8px 0 17px; font: 700 21px/1.3 "Fraunces",serif; }
.answers { display: grid; gap: 9px; }
.answer { padding: 14px 16px; border: 1px solid #d6ddd5; border-radius: 11px; background: white; cursor: pointer; text-align: left; transition:.2s; }
.answer:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); }
.answer:disabled { cursor: default; }
.answer.correct { border-color: #3b8a72; color: #23614f; background: #dcf0e6; }
.answer.wrong { border-color: var(--coral); color: #a33d2b; background: #fbe2dc; }
.quiz-feedback { min-height: 20px; margin: 13px 0 0; font-size: 12px; font-weight: 600; }

.lesson-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: auto; padding: 23px clamp(24px,5vw,76px); border-top: 1px solid var(--line); background: rgba(247,243,232,.92); }
.lesson-footer > span { color: var(--muted); font-size: 10px; }
.button { padding: 12px 18px; border-radius: 10px; border: 0; cursor: pointer; font-size: 11px; font-weight: 700; }
.button.primary { color: white; background: var(--coral); box-shadow: 0 8px 20px rgba(233,101,75,.22); }.button.primary:hover { background:var(--coral-dark); }
.button.primary.completed { background:#357561; }.button.ghost { background:transparent; }.button:disabled { opacity:.35; cursor:not-allowed; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index:20; padding: 13px 18px; border-radius: 10px; color:white; background:var(--ink); box-shadow:var(--shadow); font-size:12px; opacity:0; transform:translateY(12px); pointer-events:none; transition:.25s; }.toast.show { opacity:1; transform:none; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 10; width: min(310px,88vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform:none; }
  .menu-button { display:block; }
  .topbar { padding: 0 22px; }.eyebrow { display:none; }
  .concept-grid { grid-template-columns:1fr; }.concept-card { min-height:0; }
}
@media (max-width: 620px) {
  .lesson-content { width:min(100% - 30px,900px); padding-top:38px; }
  h1 { font-size:42px; }.hero-scribble { display:none; }
  .slider-row { grid-template-columns: 1fr 65px; }.slider-row input { grid-column:1/-1; grid-row:2; }
  .budget-result,.input-grid,.compound-demo,.choice-game,.vocab-grid { grid-template-columns:1fr; }
  .learn-block,.story-card { grid-template-columns:1fr; }
  .lesson-footer { padding:16px; }.lesson-footer > span { display:none; }
  .button { padding:12px 13px; }
  .course-links { display:none; }
}
