:root {
  --ink: #172033;
  --muted: #657084;
  --paper: #f5f7fb;
  --card: #ffffff;
  --line: #dce2ec;
  --navy: #132a46;
  --accent: #2563eb;
  --accent-soft: #eaf0ff;
  --teal: #0f766e;
  --teal-soft: #e8f5f1;
  --gold: #d97706;
  --gold-soft: #fff5df;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(19, 42, 70, 0.1);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.58; }
button, input { font: inherit; }
button { cursor: pointer; }
.skip { position: fixed; left: 12px; top: -80px; background: var(--navy); color: white; padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 12px; }

.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; padding: 10px max(22px, calc((100vw - 1180px)/2)); display: flex; align-items: center; gap: 28px; background: rgba(245,247,251,.88); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(220,226,236,.86); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--navy); font-weight: 800; letter-spacing: -2px; }
.brand-mark span { color: #7dd3fc; }
.brand b, .brand small { display: block; line-height: 1.1; }
.brand small { color: var(--muted); margin-top: 4px; font-size: 11px; }
nav { display: flex; gap: 4px; }
.nav-button, .ghost, .filter { border: 0; background: transparent; color: var(--muted); border-radius: 12px; padding: 9px 13px; font-weight: 650; }
.pdf-link { text-decoration: none; white-space: nowrap; }
.nav-button:hover, .nav-button.active, .filter:hover, .filter.active { background: white; color: var(--ink); box-shadow: 0 4px 18px rgba(19,42,70,.08); }
.small-button { font-size: 13px; border: 1px solid var(--line); }

main { max-width: 1180px; margin: 0 auto; padding: 42px 22px 80px; min-height: calc(100vh - 150px); }
.view { display: none; animation: enter .25s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.55fr .65fr; gap: 48px; align-items: center; min-height: 430px; padding: 54px; border-radius: 34px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -100px; top: -160px; width: 420px; height: 420px; border-radius: 50%; border: 70px solid rgba(125,211,252,.12); }
.eyebrow { margin: 0 0 10px; color: #60a5fa; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero h1, .section-head h1 { margin: 0; letter-spacing: -.035em; line-height: 1.08; }
.hero h1 { max-width: 720px; font-size: clamp(38px, 5vw, 66px); }
.lead { max-width: 680px; margin: 18px 0 0; color: #c8d5e6; font-size: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary, .secondary { border-radius: 13px; padding: 12px 18px; border: 1px solid transparent; font-weight: 750; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: #1d4ed8; }
.secondary { background: transparent; color: inherit; border-color: currentColor; opacity: .88; }
.progress-card { position: relative; z-index: 1; padding: 28px; text-align: center; border: 1px solid rgba(255,255,255,.14); border-radius: 25px; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.progress-card p { color: #c8d5e6; font-size: 13px; }
.progress-ring { --progress: 0deg; width: 128px; height: 128px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: conic-gradient(#60a5fa var(--progress), rgba(255,255,255,.12) 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 10px; background: var(--navy); border-radius: 50%; }
.progress-ring span { position: relative; font-size: 25px; font-weight: 800; }
.source-note { margin: 24px 0; padding: 18px 22px; border-left: 4px solid var(--accent); border-radius: 0 15px 15px 0; background: white; color: var(--muted); box-shadow: 0 6px 18px rgba(19,42,70,.05); }
.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.grade-card { display: flex; gap: 20px; padding: 28px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.grade-card h2 { margin: 0 0 10px; font-size: 20px; }
.grade-card ul { margin: 0; padding-left: 18px; }
.grade-card li { margin: 6px 0; color: var(--muted); }
.grade-number { flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; font-size: 25px; font-weight: 850; }
.grade-five .grade-number { background: var(--teal-soft); color: var(--teal); }
.grade-six .grade-number { background: var(--gold-soft); color: var(--gold); }
.how-to { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 24px; }
.how-to > div { padding: 24px; border-radius: var(--radius); background: white; border: 1px solid var(--line); }
.how-to span { color: var(--accent); font-weight: 850; }
.how-to h3 { margin: 5px 0; }
.how-to p { margin: 0; color: var(--muted); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.section-head h1 { font-size: clamp(36px, 5vw, 54px); color: var(--navy); }
.section-head p:not(.eyebrow) { color: var(--muted); max-width: 680px; }
.filters { display: flex; padding: 4px; background: #e9edf4; border-radius: 14px; }
.filter { white-space: nowrap; font-size: 13px; }
.module-list { display: grid; gap: 14px; }
.module-card { display: grid; grid-template-columns: 72px 1fr auto; gap: 20px; align-items: center; padding: 21px; background: white; border: 1px solid var(--line); border-radius: 20px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.module-card:hover { transform: translateY(-2px); border-color: #b8c6da; box-shadow: 0 12px 30px rgba(19,42,70,.08); }
.week-badge { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: var(--accent-soft); color: var(--accent); font-size: 18px; font-weight: 850; }
.module-card h2 { margin: 0; font-size: 20px; }
.module-card p { margin: 4px 0 0; color: var(--muted); }
.module-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.tag { padding: 4px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); font-size: 11px; font-weight: 700; }
.tag.grade-6 { background: var(--gold-soft); color: var(--gold); }
.module-action { display: flex; align-items: center; gap: 12px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.module-card.done .status-dot { background: #10b981; box-shadow: 0 0 0 5px #d1fae5; }
.open-module { border: 0; border-radius: 12px; background: var(--navy); color: white; padding: 10px 14px; font-weight: 700; }
.hidden { display: none !important; }

dialog { width: min(900px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 28px; box-shadow: 0 25px 80px rgba(15,23,42,.3); }
dialog::backdrop { background: rgba(15,23,42,.62); backdrop-filter: blur(4px); }
.dialog-close { position: sticky; float: right; top: 16px; right: 16px; z-index: 2; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 26px; }
#dialog-content { padding: 42px; }
.lesson-heading { padding-right: 42px; }
.lesson-heading h1 { margin: 0; color: var(--navy); font-size: 34px; line-height: 1.15; }
.lesson-heading p { color: var(--muted); }
.goal-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 0; list-style: none; }
.goal-list li { padding: 12px; border-radius: 12px; background: var(--accent-soft); color: #27456f; font-size: 13px; }
.lesson-copy h2 { margin-top: 28px; color: var(--navy); }
.lesson-copy p { color: #344054; }
pre { overflow-x: auto; margin: 18px 0; padding: 20px; border-radius: 16px; background: #10243d; color: #dce7f7; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.task-box { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.task-box.challenge { border-color: #f0c46d; background: var(--gold-soft); }
.task-box h3 { margin: 0 0 6px; }
.task-box p { margin: 0; }
.reveal { margin-top: 12px; padding: 8px 12px; border: 1px solid var(--teal); border-radius: 10px; color: var(--teal); background: white; font-weight: 700; }
.answer { display: none; margin-top: 12px !important; padding: 13px; border-radius: 12px; background: var(--teal-soft); color: #145b55; }
.answer.visible { display: block; }
.quiz-box { padding: 20px; border-radius: 18px; background: var(--paper); }
.quiz-options { display: grid; gap: 8px; margin: 12px 0; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.quiz-feedback { min-height: 24px; font-weight: 700; }
.quiz-feedback.ok { color: var(--teal); }
.quiz-feedback.bad { color: var(--danger); }
.complete-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.complete-button { border: 0; border-radius: 13px; background: var(--teal); color: white; padding: 11px 15px; font-weight: 750; }

.test-list { display: grid; gap: 14px; }
.test-question { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.test-question h2 { margin: 0 0 12px; font-size: 17px; }
.test-question label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; color: #344054; }
.test-question.correct { border-color: #62b7a9; background: #f5fffc; }
.test-question.wrong { border-color: #f3a7a1; background: #fff9f8; }
.test-explanation { display: none; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.test-question.graded .test-explanation { display: block; }
.test-actions { display: flex; gap: 12px; margin-top: 22px; }
.test-result { display: none; margin-top: 20px; padding: 20px; border-radius: 16px; background: var(--navy); color: white; font-size: 18px; font-weight: 750; }
.test-result.visible { display: block; }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.project-card { display: flex; flex-direction: column; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.project-card .project-no { color: var(--accent); font-weight: 850; }
.project-card h2 { margin: 8px 0 10px; }
.project-card p { color: var(--muted); }
.project-card .reveal { margin-top: auto; align-self: flex-start; }
.rubric { margin-top: 24px; padding: 28px; border-radius: var(--radius); background: var(--navy); color: white; }
.rubric h2 { margin-top: 0; }
.rubric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rubric-grid div { padding: 18px; border-radius: 16px; background: rgba(255,255,255,.08); }
.rubric-grid p { color: #c8d5e6; }
footer { max-width: 1180px; margin: 0 auto; padding: 28px 22px 40px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 20px; font-size: 12px; }

@media (max-width: 850px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .brand { width: calc(100% - 130px); }
  nav { order: 3; width: 100%; overflow-x: auto; }
  .hero { grid-template-columns: 1fr; padding: 34px 26px; }
  .progress-card { max-width: 340px; }
  .grade-grid, .project-grid, .rubric-grid { grid-template-columns: 1fr; }
  .how-to { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .module-card { grid-template-columns: 58px 1fr; }
  .module-action { grid-column: 2; justify-content: flex-start; }
  .goal-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  main { padding-inline: 14px; }
  .topbar { padding-inline: 14px; }
  .small-button { font-size: 11px; padding: 7px 9px; }
  .hero { min-height: 0; }
  .hero h1 { font-size: 38px; }
  .grade-card { flex-direction: column; }
  .filters { width: 100%; overflow-x: auto; }
  .module-card { grid-template-columns: 1fr; }
  .week-badge { width: 48px; height: 48px; }
  .module-action { grid-column: 1; }
  #dialog-content { padding: 28px 20px; }
  footer { flex-direction: column; }
}

@media print {
  .topbar, .hero-actions, .filters, footer { display: none !important; }
  body { background: white; }
  main { max-width: none; padding: 0; }
  .view { display: block !important; page-break-after: always; }
  .hero { min-height: auto; background: white; color: var(--ink); box-shadow: none; padding: 20px 0; }
  .lead { color: var(--muted); }
}
