/* Brainsnacc — matches the approved screen designs (course map look). */
:root {
  --ground: #F4F6FB;
  --surface: #FFFFFF;
  --line: #E3E6EB;
  --line-strong: #C9D1DC;
  --ink: #141A22;
  --muted: #5B6573;
  --nav: #14213D;
  --nav-active: rgba(255, 255, 255, .12);
  --nav-text: #D4DCEC;
  --chem: #2F6BEA;
  --chem-tint: #E8F0FE;
  --chem-dark: #1E4FC2;
  --bio: #E07A12;
  --bio-tint: #FFF1E3;
  --brand-blue: #2F6BEA;
  --brand-orange: #F08A24;
  --brand-purple: #7B5CF0;
  --brand-teal: #14B8A6;
  --brand-pink: #EC4899;
  --good: #1F7A4D;
  --good-tint: #E7F4EC;
  --bad: #B42318;
  --bad-tint: #FCEBEA;
  --radius: 16px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, sans-serif; color: var(--ink); background: var(--ground); line-height: 1.5; }
a { color: var(--chem); }
a:hover { color: var(--chem-dark); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 600; font-size: 32px; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }

/* Layout */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 200px; max-width: 240px; background: var(--nav); color: #fff; padding: 28px 16px; display: flex; flex-direction: column; gap: 4px; }
.nav .brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; padding: 0 12px 24px; }
.nav a { display: block; padding: 12px; border-radius: 8px; color: var(--nav-text); text-decoration: none; }
.nav a.active { background: var(--nav-active); color: #fff; font-weight: 600; }
.nav a:hover { background: var(--nav-active); color: #fff; }
.nav .who { margin-top: auto; padding: 12px; font-size: 13px; color: #9AA4B2; }
.nav form button { background: none; border: 0; color: #9AA4B2; font: inherit; font-size: 13px; padding: 12px; cursor: pointer; text-decoration: underline; }
.main { flex: 999 1 480px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; max-width: 1120px; }
@media (max-width: 760px) { .nav { max-width: none; } .main { padding: 24px 16px; } }

/* Building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.pill { display: inline-block; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--chem-tint); color: var(--chem-dark); }
.pill.bio { background: var(--bio-tint); color: #8A3F06; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.big-number { font-family: 'Space Grotesk', sans-serif; font-size: 32px; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 22px; border-radius: 10px; border: 0; background: var(--chem); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--chem-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn.secondary:hover { background: var(--ground); color: var(--ink); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid var(--bad); }

.bar { height: 8px; background: var(--chem-tint); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--chem); border-radius: 999px; }

.flash { background: var(--good-tint); border: 1px solid var(--good); border-radius: 12px; padding: 12px 16px; }
.errors { background: var(--bad-tint); border: 1px solid var(--bad); border-radius: 12px; padding: 12px 16px; }

/* Segmented controls and tabs */
.segmented { display: inline-flex; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.segmented a { padding: 10px 18px; border-radius: 8px; text-decoration: none; color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }
.segmented a.on { background: var(--chem); color: #fff; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { border: 1px solid var(--line); background: #fff; padding: 10px 16px; border-radius: 999px; text-decoration: none; color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }
.chips a.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* Course map */
.lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lesson-list li { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 10px; }
.lesson-list li.done { background: var(--ground); }
.lesson-list li.current { background: var(--chem-tint); border: 1px solid var(--chem); }
.lesson-list a { flex: 1; color: var(--ink); font-weight: 500; text-decoration: none; }
.lesson-list a:hover { text-decoration: underline; }
.dot { width: 28px; height: 28px; border-radius: 999px; border: 2px solid var(--line-strong); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.dot.done { background: var(--good); border-color: var(--good); color: #fff; }
.dot.current { border-color: var(--chem); }

/* Lesson */
.lesson-body { font-size: 17px; line-height: 1.65; max-width: 720px; }
.lesson-body h2 { font-size: 20px; margin: 24px 0 8px; }
.lesson-body code { font-family: ui-monospace, Menlo, monospace; background: var(--ground); padding: 2px 6px; border-radius: 6px; }
.lesson-body p { margin: 0 0 14px; }
.option { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; min-height: 56px; }
.option input { width: 20px; height: 20px; flex: none; accent-color: var(--chem); }
.option.correct { border: 2px solid var(--good); background: var(--good-tint); }
.option.wrong { border: 2px solid var(--bad); background: var(--bad-tint); }
.feedback { border-radius: 12px; padding: 16px; }
.feedback.right { background: var(--good-tint); border: 1px solid var(--good); }
.feedback.wrong { background: var(--bad-tint); border: 1px solid var(--bad); }

/* Forms */
label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; min-height: 44px; background: #fff;
}
textarea { min-height: 220px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.field { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 420px; }

/* Lessons not written yet */
.lesson-list li.soon { color: var(--muted); }
.lesson-list li.soon .lesson-title { flex: 1; }
.lesson-list li.soon .dot { border-style: dashed; }

/* Mistakes box: topic stands out; the wrong question is highlighted when you land on it */
.mistake-topic { font-weight: 600; background: #FDECEC; color: #A3261F; padding: 4px 10px; border-radius: 8px; text-decoration: none; display: inline-block; margin: 3px 0; }
.mistake-topic:hover { background: #F9D6D4; }
.card:target { outline: 3px solid #E0483E; outline-offset: 2px; background: #FFF6F5; scroll-margin-top: 80px; }

/* Help page steps */
.help-step { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 8px 0 0; }
.help-step span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--chem); color: #fff; font-size: 15px; flex: none; }
.help-question { border: 2px solid #E0483E; background: #FFF6F5; }
details.card summary { list-style-position: inside; }

/* Side panel: each year with its subjects underneath */
.nav .nav-section { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #9AA4B2; padding: 18px 12px 6px; }
.nav .nav-level { font-size: 13px; font-weight: 600; color: #fff; padding: 10px 12px 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nav .nav-level.open { color: #fff; }
.nav .nav-mine { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.15); border-radius: 999px; padding: 2px 8px; }
.nav a.nav-sub { padding: 8px 12px 8px 22px; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.nav-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; vertical-align: middle; }

/* Lesson explainer video */
.lesson-video { margin: 0 0 24px; }
.lesson-video video { width: 100%; max-width: 860px; aspect-ratio: 16 / 9; border-radius: 12px; background: #111827; display: block; }
.lesson-video figcaption { margin-top: 8px; }

/* Lesson slide show */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.deck { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.deck-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 28px 14px; border-bottom: 1px solid var(--line); }
.deck-title { margin: 0; font-size: 26px; }
.deck-jump select { font: inherit; font-size: 15px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; max-width: min(420px, 100%); }
.deck-progress { height: 5px; background: var(--ground); }
.deck-progress span { display: block; height: 100%; width: 0; background: var(--accent, #2456C7); transition: width .25s ease; }
.deck-stage { padding: 24px 28px; outline: none; }
.deck-stage .slide { display: flex; flex-direction: column; gap: 14px; }
.deck-stage .slide + .slide { margin-top: 32px; padding-top: 24px; border-top: 1px dashed var(--line); }
.deck-stage .slide > h2 { margin: 0; font-size: 22px; }
.deck-stage .slide.lesson-body { max-width: 760px; }
.deck-stage .slide.lesson-body h3 { font-size: 18px; margin: 12px 0 0; }
.deck-stage .slide .card { box-shadow: none; }
.deck-bar { display: none; }
/* With JavaScript: one slide at a time in a fixed-height window, buttons always in view */
.deck.is-deck .deck-stage { height: calc(100vh - 260px); min-height: 360px; overflow-y: auto; }
.deck.is-deck .deck-stage .slide + .slide { margin-top: 0; padding-top: 0; border-top: 0; }
.deck.is-deck .slide[hidden] { display: none; }
.deck.is-deck .deck-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.deck-bar .btn[disabled] { opacity: .4; cursor: default; }
@media (max-width: 760px) {
  .deck-top, .deck-stage, .deck.is-deck .deck-bar { padding-left: 16px; padding-right: 16px; }
  .deck.is-deck .deck-stage { height: calc(100vh - 220px); }
}

/* Past exams */
.pp-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pp-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(200px, 1fr) auto; align-items: center; gap: 10px 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pp-row:first-child { border-top: 0; }
.pp-row.is-done { background: var(--good-tint); }
.pp-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.pp-form { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pp-form input[type=number] { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; }
.btn.small { padding: 6px 12px; min-height: 0; font-size: 14px; }
.linklike { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
@media (max-width: 760px) { .pp-row { grid-template-columns: 1fr; } .pp-form { justify-content: flex-start; } }

/* Practice exams */
.mx-facts { display: flex; flex-wrap: wrap; gap: 12px; }
.mx-facts > div { background: var(--ground); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; min-width: 120px; }
.mx-facts strong { font-size: 20px; }
.mx-facts span { font-size: 13px; color: var(--muted); }
.mx-timer { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(17, 24, 39, .06); }
.mx-timer [data-clock] { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; }
.mx-timer [data-clock].bad { color: var(--bad, #B42318); }
.mx-timer [data-handin] { margin-left: auto; }
.mx-section { font-size: 22px; margin: 24px 0 8px; }
.mx-q { margin-bottom: 14px; }
fieldset.mx-q { border: 1px solid var(--line); }
.mx-q summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mx-part { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.mx-part textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; resize: vertical; }
.mx-part textarea:disabled { background: var(--ground); }
.mx-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mx-mine { white-space: pre-wrap; background: var(--ground); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.mx-model { background: var(--good-tint); border-radius: 10px; padding: 10px 12px; }
@media (max-width: 760px) { .mx-compare { grid-template-columns: 1fr; } }

/* Side panel stays in view while the page scrolls (no long empty column next to long pages) */
@media (min-width: 761px) {
  .nav { position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; box-sizing: border-box; }
}

/* Sign-up: choose parent / teacher / student */
.role-pick { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.role-pick legend { font-weight: 600; margin-bottom: 6px; }
.role-pick label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; font-weight: 400; }
.role-pick label:has(input:checked) { border: 2px solid var(--chem); background: var(--chem-tint); }
.role-pick label > span { display: flex; flex-direction: column; }
.role-pick input { margin-top: 3px; accent-color: var(--chem); }

/* Parent / teacher progress */
.table-scroll { overflow-x: auto; }
.progress-table { width: 100%; border-collapse: collapse; }
.progress-table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 12px 16px; background: var(--ground); border-bottom: 1px solid var(--line); white-space: nowrap; }
.progress-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.progress-table tr:last-child td { border-bottom: 0; }
.progress-table tbody tr:hover { background: #FAFBFD; }
.score-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.score-pill.good { background: var(--good-tint); color: var(--good); }
.score-pill.ok { background: #FFF4DB; color: #8A5A00; }
.score-pill.low { background: #FDECEC; color: #A3261F; }
.score-big { display: flex; flex-direction: column; align-items: flex-end; }
.score-big strong { font-size: 32px; line-height: 1.1; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; max-width: 520px; }
.heat-cell { aspect-ratio: 1; border-radius: 4px; background: var(--ground); border: 1px solid var(--line); }
.heat-cell.lvl-1 { background: #C9DBFA; border-color: #C9DBFA; }
.heat-cell.lvl-2 { background: #7FA7EE; border-color: #7FA7EE; }
.heat-cell.lvl-3 { background: #2456C7; border-color: #2456C7; }

/* ---------- Brainsnacc colours (matches the logo) ---------- */
.nav { background: linear-gradient(180deg, #1B2C6B 0%, #14213D 55%, #111827 100%); }
.nav .brand { display: block; padding: 0 8px 22px; }
.nav .brand img { display: block; width: 100%; max-width: 190px; height: auto; }
.nav a.active { background: var(--nav-active); box-shadow: inset 3px 0 0 var(--brand-orange); }
.nav .nav-mine { background: var(--brand-orange); color: #fff; }
h1 { color: #14213D; }
.card { box-shadow: 0 1px 2px rgba(20, 33, 61, .04), 0 6px 18px rgba(20, 33, 61, .05); }
.btn { background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple)); box-shadow: 0 4px 12px rgba(47, 107, 234, .25); transition: transform .08s ease, box-shadow .15s ease; }
.btn:hover { color: #fff; box-shadow: 0 6px 16px rgba(91, 75, 224, .35); transform: translateY(-1px); }
.btn.secondary { box-shadow: none; transform: none; }
.flash { background: linear-gradient(90deg, #E7F7F1, #EAF2FF); border-color: var(--brand-teal); }
.pill { background: var(--chem-tint); color: var(--chem-dark); }
.pill.bio { background: var(--bio-tint); color: #9A4E05; }
.bar { background: #E8EDF7; }
.bar > span { background: linear-gradient(90deg, var(--brand-blue), var(--brand-purple)); }
.deck-progress span { background: linear-gradient(90deg, var(--brand-blue), var(--brand-orange)); }
.help-step span { background: linear-gradient(135deg, var(--brand-orange), var(--brand-pink)); }
.mistake-topic { background: #FFF1E3; color: #9A4E05; }
.mistake-topic:hover { background: #FFE2C4; }
/* Log-in and sign-up pages: colourful background */
.login { background:
    radial-gradient(circle at 15% 20%, rgba(47, 107, 234, .22), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(240, 138, 36, .25), transparent 38%),
    radial-gradient(circle at 70% 85%, rgba(123, 92, 240, .18), transparent 42%),
    radial-gradient(circle at 20% 90%, rgba(20, 184, 166, .16), transparent 40%),
    #F4F6FB; }
.login .card { border: 0; box-shadow: 0 20px 50px rgba(20, 33, 61, .14); }
.auth-logo { display: block; width: 240px; max-width: 100%; height: auto; margin: 0 0 4px; }
