:root {
  --ink: #152225;
  --muted: #667477;
  --canvas: #edf2ee;
  --paper: #fbfcf8;
  --panel: #f2f6f2;
  --line: #d7dfd9;
  --teal: #087d72;
  --teal-dark: #075d56;
  --aqua: #d9f1ea;
  --amber: #e2a343;
  --amber-soft: #fff1d8;
  --danger: #ae4737;
  --mono: "DM Mono", monospace;
  --sans: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: var(--canvas); font-family: var(--sans); font-size: 15px; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

.app-shell { height: 100dvh; display: grid; grid-template-columns: 278px minmax(0, 1fr); overflow: hidden; }
.sidebar { background: #102427; color: #eff9f5; padding: 26px 19px 20px; display: flex; flex-direction: column; border-right: 1px solid #254247; min-height: 0; }
.brand { display: flex; align-items: flex-start; gap: 11px; padding: 0 4px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; background: var(--teal); color: #fff; font-family: var(--mono); font-size: 13px; font-weight: 500; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.eyebrow { margin: 0 0 5px; font: 500 10px/1.1 var(--mono); letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.brand .eyebrow { color: #9eb6b3; }
h1 { font-size: 18px; line-height: 1.13; letter-spacing: -.04em; margin: 0; }
.course-meta { display: flex; gap: 8px; align-items: center; margin: 24px 4px 16px; color: #abc1bf; font-size: 12px; }
.pill { background: rgba(217, 241, 234, .12); border: 1px solid rgba(217, 241, 234, .18); color: #d4f6ec; border-radius: 999px; padding: 4px 8px; font: 500 10px var(--mono); }
.muted { color: inherit; }
.lesson-nav { display: flex; flex-direction: column; gap: 3px; padding: 3px 0; }
.lesson-nav::-webkit-scrollbar { width: 0; }
.lesson-button { display: grid; grid-template-columns: 25px 1fr 16px; gap: 8px; align-items: center; width: 100%; text-align: left; color: #b9ccc8; border: 1px solid transparent; background: transparent; border-radius: 9px; padding: 9px 8px; transition: .18s ease; }
.lesson-button:hover { color: #fff; background: rgba(255,255,255,.06); }
.lesson-button.active { color: #fff; border-color: rgba(154,235,215,.25); background: rgba(9, 125, 114, .38); }
.lesson-button.done .lesson-index { background: #80dac5; color: #09312d; }
.lesson-index { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; border: 1px solid #476366; color: #9eb6b3; font: 11px var(--mono); }
.lesson-button strong { font-size: 12px; font-weight: 600; line-height: 1.2; }
.lesson-arrow { opacity: .55; }
.review-button { margin: 14px 4px 0; padding: 10px; color: #ccdfdc; border: 1px solid #416063; background: rgba(255,255,255,.04); border-radius: 8px; text-align: left; font-size: 12px; }
.review-button span { float: right; }
.sidebar-footer { margin-top: auto; padding: 17px 4px 0; border-top: 1px solid #2d494c; }
.progress-label { display: flex; justify-content: space-between; color: #b4c8c5; font-size: 11px; margin-bottom: 8px; }
.progress-label strong { color: #eff9f5; font-family: var(--mono); font-weight: 400; }
.progress-track { height: 4px; background: #2d494c; border-radius: 999px; overflow: hidden; }
.progress-fill { width: 0; height: 100%; background: #86ddc9; transition: width .3s ease; }
.sidebar-footer p { margin: 12px 0 0; color: #8ca5a2; font-size: 11px; line-height: 1.5; }

.workspace { min-width: 0; min-height: 0; display: grid; grid-template-rows: 70px minmax(0, 1fr); }
.topbar { display: flex; align-items: center; justify-content: space-between; background: rgba(251,252,248,.9); border-bottom: 1px solid var(--line); padding: 0 32px; }
.breadcrumb { color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.primary-button { border: 0; background: var(--teal); color: white; border-radius: 8px; padding: 10px 14px; font-size: 12px; font-weight: 700; box-shadow: 0 5px 12px rgba(8, 125, 114, .17); transition: transform .15s, background .15s; }
.primary-button:hover { transform: translateY(-1px); background: var(--teal-dark); }
.primary-button span { margin-left: 12px; }
.primary-button.large { padding: 13px 18px; font-size: 13px; }
.mobile-menu { display: none; }

.overview-view { min-height: 0; overflow-y: auto; padding: clamp(26px, 5vw, 70px); display: grid; grid-template-columns: minmax(0, 760px) minmax(250px, 330px); gap: clamp(26px, 5vw, 76px); align-content: center; }
.overview-main { max-width: 770px; }
.teal { color: var(--teal); }
h2 { margin: 0; font-size: clamp(29px, 4.1vw, 54px); line-height: 1.05; letter-spacing: -.06em; max-width: 13ch; }
.lead { max-width: 690px; margin: 20px 0 27px; color: #536265; font-size: 16px; line-height: 1.7; }
.overview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 29px; }
.overview-card { background: rgba(251,252,248,.7); border: 1px solid var(--line); border-radius: 10px; padding: 15px; min-height: 145px; }
.card-number { color: var(--teal); font: 10px var(--mono); }
h3 { margin: 12px 0 6px; font-size: 14px; letter-spacing: -.025em; }
.overview-card p, .setup-card li { color: var(--muted); font-size: 12px; line-height: 1.55; }
.setup-card { align-self: center; background: #dce8e1; border: 1px solid #cad8d0; border-radius: 11px; padding: 23px; }
.setup-card h3 { font-size: 18px; margin: 8px 0 13px; }
.setup-card ul { padding-left: 18px; margin: 0; }
.setup-card li { margin: 8px 0; }
.outcome { border-top: 1px solid #bfd0c5; padding-top: 15px; margin-top: 18px; }
.outcome span { color: var(--teal-dark); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.outcome p { margin: 5px 0 0; font-size: 12px; line-height: 1.5; }

.lesson-view { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 326px; background: var(--paper); }
.hidden { display: none !important; }
.lesson-reader { min-height: 0; overflow-y: auto; padding: 40px clamp(25px, 5vw, 74px) 50px; }
.reader-wrap { max-width: 800px; }
.lesson-kicker { display: flex; align-items: center; gap: 11px; color: var(--teal); font: 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.kicker-dot { width: 6px; height: 6px; background: var(--amber); border-radius: 50%; }
.lesson-title { margin: 12px 0 12px; font-size: clamp(28px, 3.6vw, 43px); line-height: 1.08; letter-spacing: -.055em; }
.lesson-summary { margin: 0 0 26px; color: #526164; font-size: 15px; line-height: 1.65; max-width: 690px; }
.section-label { color: var(--teal); font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.objectives { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0 0 28px; }
.objective { background: var(--panel); border: 1px solid #dce5de; border-radius: 8px; padding: 12px; color: #405053; font-size: 12px; line-height: 1.45; }
.objective::before { content: "↳"; display: block; color: var(--teal); margin-bottom: 5px; font-family: var(--mono); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(240px, .95fr); gap: 18px; align-items: start; }
.explanation { font-size: 14px; color: #354447; line-height: 1.7; }
.explanation p { margin: 0 0 13px; }
.explanation strong { color: var(--ink); }
.callout { background: var(--amber-soft); border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; padding: 13px 14px; color: #654b24; font-size: 12px; line-height: 1.5; }
.callout b { color: #47300d; }
.code-card { overflow: hidden; background: #102427; border: 1px solid #244146; border-radius: 10px; box-shadow: 0 10px 25px rgba(15,35,37,.1); }
.code-label { display: flex; justify-content: space-between; padding: 9px 12px; color: #a5c6bf; background: #183236; border-bottom: 1px solid #28484b; font: 10px var(--mono); }
pre { margin: 0; padding: 14px; overflow-x: auto; color: #d9f5eb; font: 11px/1.62 var(--mono); }
.inline-note { display: flex; gap: 9px; align-items: flex-start; margin-top: 17px; color: #516165; font-size: 12px; line-height: 1.55; }
.inline-note span { color: var(--teal); font-family: var(--mono); }

.practice-rail { min-height: 0; border-left: 1px solid var(--line); background: #f5f8f4; padding: 26px 18px; }
.rail-heading { margin: 0 0 14px; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .09em; }
.flashcard { min-height: 155px; perspective: 900px; margin-bottom: 16px; }
.flash-inner { position: relative; width: 100%; height: 155px; transform-style: preserve-3d; transition: transform .45s; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px; padding: 15px; border: 1px solid #bfd8d0; background: var(--aqua); display: flex; flex-direction: column; justify-content: space-between; }
.flash-face.back { background: #173337; border-color: #173337; color: #edf9f5; transform: rotateY(180deg); }
.flash-tag { color: var(--teal-dark); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.back .flash-tag { color: #9cdccb; }
.flash-text { margin: 7px 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
.flash-hint { color: #52736d; font-size: 10px; }
.back .flash-hint { color: #b9d4cd; }
.quiz-card, .sources-card { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.quiz-prompt { font-size: 12px; font-weight: 700; line-height: 1.5; margin: 0 0 10px; }
.option { display: block; width: 100%; padding: 9px 10px; text-align: left; color: #405154; background: #fff; border: 1px solid #d6e0d9; border-radius: 7px; font-size: 11px; line-height: 1.35; margin: 6px 0; transition: .15s; }
.option:hover { border-color: var(--teal); }
.option.correct { background: #daf1e8; border-color: #5cb59c; color: #124a3f; }
.option.incorrect { background: #ffebe6; border-color: #db8d7d; color: #7c2f24; }
.feedback { min-height: 22px; margin: 7px 1px 0; color: #496064; font-size: 11px; line-height: 1.45; }
.source-link { display: block; padding: 10px 0; border-bottom: 1px solid #dce4dd; color: #285d57; text-decoration: none; font-size: 11px; line-height: 1.4; }
.source-link:hover { color: var(--teal); }
.source-link small { display: block; margin-top: 2px; color: var(--muted); font: 9px var(--mono); text-transform: uppercase; }
.complete-button { width: 100%; padding: 10px; margin-top: 17px; border: 1px solid var(--teal); color: var(--teal-dark); border-radius: 7px; background: transparent; font-size: 12px; font-weight: 700; }
.complete-button.complete { color: #fff; background: var(--teal); }

.review-wrap { max-width: 850px; }
.review-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; margin-top: 23px; }
.review-item { padding: 16px; background: var(--panel); border: 1px solid #dce5de; border-radius: 9px; }
.review-item h3 { margin: 0 0 6px; font-size: 13px; }
.review-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.final-question { margin-top: 23px; border: 1px solid #bfd8d0; border-radius: 10px; padding: 19px; background: #e5f3ed; }
.final-question h3 { margin: 0 0 9px; font-size: 15px; }
.final-question p { color: #405154; font-size: 12px; line-height: 1.55; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: 128px minmax(0, 1fr); }
  .sidebar { padding: 14px 16px 0; border-right: 0; border-bottom: 1px solid #254247; }
  .brand { position: absolute; top: 14px; left: 16px; }
  .brand h1 { font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; }
  .course-meta, .review-button, .sidebar-footer { display: none; }
  .lesson-nav { margin-top: 60px; flex-direction: row; overflow-x: auto; gap: 6px; }
  .lesson-button { display: flex; flex: 0 0 auto; width: auto; padding: 8px 10px; background: rgba(255,255,255,.04); border-color: #2c494c; }
  .lesson-button strong { white-space: nowrap; }
  .lesson-arrow { display: none; }
  .workspace { grid-template-rows: 57px minmax(0, 1fr); }
  .topbar { padding: 0 16px; }
  .mobile-menu { display: inline-block; background: transparent; border: 0; color: var(--teal-dark); font: 11px var(--mono); text-transform: uppercase; }
  .overview-view { grid-template-columns: 1fr; padding: 28px 20px; align-content: start; }
  .setup-card { display: none; }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-card { min-height: auto; }
  .lesson-view { grid-template-columns: 1fr; }
  .practice-rail { border-left: 0; border-top: 1px solid var(--line); min-height: auto; overflow: visible; padding: 20px; }
  .lesson-reader { padding: 28px 20px; }
  .content-grid { grid-template-columns: 1fr; }
  .objectives { grid-template-columns: 1fr; }
  .flashcard { max-width: 360px; }
}

@media (max-width: 480px) {
  .topbar-actions { display: none; }
  .lesson-title { font-size: 31px; }
  h2 { font-size: 36px; }
  .review-grid { grid-template-columns: 1fr; }
}
