:root {
  /* surfaces and text (contrast against --bg: ink 17:1, muted 7.5:1) */
  --bg: #0e1116;
  --panel: #171c26;
  --line: #262d3b;
  --rule: #5f6a80;          /* marks that must stay visible: empty ticks, meter tracks (3.5:1) */
  --ink: #f2f4f8;
  --muted: #9aa3b5;
  /* the one brand color, kept for primary actions and the selected tab */
  --gold: #f5c542;
  --green: #3ddc97;
  /* each subject wears the color its videos are drawn in */
  --math: #4da3ff;
  --chemistry: #3ddc97;
  --physics: #ff9f43;
  --biology: #ff7eb6;
  --chemical-engineering: #ffd23f;
  --mechanical-engineering: #b49cff;
  --electrical-engineering: #ff5a5a;
  --accent: var(--gold);
  /* the reels are 9:16; on wider screens everything sits in a column that shape */
  --column: min(100vw, calc(100dvh * 9 / 16));
}
.subj-math { --accent: var(--math); }
.subj-chemistry { --accent: var(--chemistry); }
.subj-physics { --accent: var(--physics); }
.subj-biology { --accent: var(--biology); }
.subj-chemical-engineering { --accent: var(--chemical-engineering); }
.subj-mechanical-engineering { --accent: var(--mechanical-engineering); }
.subj-electrical-engineering { --accent: var(--electrical-engineering); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
/* rem sizes everywhere below, so text follows the reader's own text-size setting */
body { font: 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

/* ---- home ---- */

#home {
  max-width: 560px;
  margin: 0 auto;
  /* room at the bottom for the tab bar */
  padding: max(20px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
}

/* the tab bar along the bottom */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: rgba(14, 17, 22, .94); border-top: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tabs button {
  flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0; border-radius: 12px; font-size: 0.75rem; font-weight: 700; color: var(--muted);
}
.tabs button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--gold); }
.tabs button.on svg { fill: currentColor; fill-opacity: .18; }
.tabs button:hover, .tabs button:focus-visible { background: var(--panel); outline: none; }

/* Home tab */
.brand { font-size: 1.5rem; font-weight: 800; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-bottom: 6px; }
h1 { margin: 4px 0 8px; font-size: 1.875rem; line-height: 1.12; letter-spacing: -.01em; }
.lede { margin: 0 0 24px; font-size: 1.0625rem; color: var(--muted); }
.lede b { color: var(--ink); font-weight: 600; }
.home-head { margin-bottom: 18px; }
.home-art { display: block; width: 100%; height: auto; margin: 0 0 22px; border-radius: 18px; }
/* a subject on the Courses tab: a header that opens and closes its list of courses */
.group { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 56px; margin: 10px 0 0; padding: 12px 14px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.group:hover, .group:focus-visible { border-color: var(--accent); outline: none; }
.group h2 { margin: 0; font-size: 1.125rem; line-height: 1.2; }
.group .counts { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: .875rem; line-height: 1.25; color: var(--muted); text-align: right; white-space: nowrap; }
.group svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.group[aria-expanded="true"] svg { transform: rotate(180deg); }
.group + .course-list { margin-top: 10px; }
.home-head + .resume { margin-bottom: 14px; }
.how { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 14px; }
.how li { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: .9375rem; }
.how b { display: block; color: var(--ink); font-size: 1rem; font-weight: 600; }
.how svg { width: 24px; height: 24px; flex: none; margin-top: 1px; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* thumbnails: the poster zoomed onto its diagram, which sits in the upper middle of every frame */
.thumb { position: relative; display: block; flex: none; overflow: hidden; background: var(--bg); }
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; transform: scale(1.55); transform-origin: 50% 30%; }

/* a course: its opening diagram, its name, and how far along you are */
.course-list { display: grid; gap: 10px; }
.course-card {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 44px; text-align: left;
  padding: 12px 14px 12px 12px; border-radius: 16px; background: var(--panel);
  border-left: 4px solid var(--accent);
}
.course-card:hover, .course-card:focus-visible { background: var(--line); outline: none; }
.course-card:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.course-card > div { flex: 1; min-width: 0; }
.course-card b { display: block; font-size: 1.125rem; line-height: 1.25; }
.course-card small { color: var(--muted); font-size: .875rem; }
.peek { display: flex; flex: none; }
.peek .thumb { width: 60px; height: 60px; border-radius: 12px; }
.lab-thumb { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 12px; background: #f6f7f9; flex: none; }
.lab-thumb .lab-icon { width: 32px; height: 32px; fill: none; stroke: #2c5fae; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lab-intro { color: var(--muted); margin: 16px 0 12px; }
.lab-intro.soon { font-size: .875rem; margin-top: 14px; }
.lab-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; background: var(--panel); color: var(--ink); text-decoration: none; border-left: 4px solid var(--accent); }
.lab-row:hover, .lab-row:focus-visible { background: var(--line); outline: none; }
.lab-row > div { flex: 1; min-width: 0; }
.lab-row b { display: block; font-size: 1.0625rem; }
.lab-row small { display: block; color: var(--muted); font-size: .875rem; }
.lab-row i { display: block; font-style: normal; color: var(--accent); font-size: .8125rem; margin-top: 2px; }
.lab-row > svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.course-card svg, .to-courses svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Courses tab: one course */
.to-courses { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: 0 0 4px -8px; padding: 0 12px 0 4px; border-radius: 999px; font-size: .9375rem; font-weight: 600; color: var(--muted); }
.to-courses:hover, .to-courses:focus-visible { background: var(--panel); outline: none; }
.eyebrow { font-size: .8125rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.eyebrow.also { margin-top: 2px; }  /* a cross-listed course: the other subjects it is listed under, each in its own colour */
.course-meta { margin: -2px 0 20px; font-size: .9375rem; color: var(--muted); }
.total-views:empty { display: none; }
.total-views { margin: -14px 0 20px; font-size: .875rem; color: var(--muted); }
.total-views b { color: var(--ink); font-size: 1rem; }

.resume {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 44px; text-align: left;
  padding: 10px 16px 10px 10px; border-radius: 18px; background: var(--gold); color: #1a1400;
}
.resume .thumb { width: 72px; height: 72px; border-radius: 12px; }
.resume small { display: block; font-weight: 700; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.resume b { display: block; font-size: 1.125rem; line-height: 1.2; margin-top: 2px; }
.resume i { display: block; font-style: normal; font-size: .875rem; opacity: .75; margin-top: 2px; }
.resume svg { margin-left: auto; width: 28px; height: 28px; fill: currentColor; flex: none; }
.resume:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.unit { margin-top: 30px; }
.unit-head { display: flex; align-items: baseline; gap: 10px; }
.unit-head small { font-size: .75rem; font-weight: 700; letter-spacing: .1em; color: var(--accent); text-transform: uppercase; }
.unit-head span { margin-left: auto; font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.unit h2 { margin: 2px 0 0; font-size: 1.25rem; line-height: 1.25; }
.meter { height: 4px; margin-top: 10px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.unit.soon > :not(.lab-row):not(.section) { opacity: .5; }
.unit.soon h2 { font-size: 1.0625rem; }

.section { margin: 20px 0 4px; font-size: .8125rem; font-weight: 700; color: var(--muted); }
.reel {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; text-align: left;
  padding: 6px; border-radius: 14px;
}
.reel:hover, .reel:focus-visible { background: var(--panel); outline: none; }
.reel .thumb { width: 52px; height: 52px; border-radius: 10px; }
.reel b { display: block; font-weight: 600; font-size: 1rem; line-height: 1.25; }
.reel small { color: var(--muted); font-size: .8125rem; }
.reel .tick { margin-left: auto; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--rule); }
.reel.seen .tick { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e1116' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 16px no-repeat; }

/* ---- the optional end-of-course quiz ---- */

/* the card at the bottom of a course page */
.quiz-card {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; margin-top: 36px; text-align: left;
  padding: 16px 14px 16px 18px; border-radius: 18px; border: 2px solid var(--accent); background: var(--panel);
}
.quiz-card small { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.quiz-card b { display: block; font-size: 1.125rem; margin-top: 2px; }
.quiz-card i { display: block; font-style: normal; font-size: .875rem; color: var(--muted); margin-top: 2px; }
.quiz-card svg { margin-left: auto; width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.quiz-card:hover, .quiz-card:focus-visible { outline: none; background: var(--line); }
.quiz-card.checkpoint { margin-top: 18px; padding: 12px 14px 12px 16px; border-width: 2px; border-style: dashed; }
.quiz-card.checkpoint b { font-size: 1rem; }
.final-unit .unit-head small { color: var(--gold); }
.final-note { margin: 6px 0 0; font-size: .9375rem; color: var(--muted); }
.quiz-startover {
  display: block; min-height: 44px; margin: 4px 0 0 auto; padding: 0 12px;
  font-size: .9375rem; font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.quiz-startover:hover, .quiz-startover:focus-visible { color: var(--ink); outline: none; }

/* the app's own "start over?" dialog */
#qconfirm {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: rgba(14, 17, 22, .7);
}
.qconfirm-card {
  width: min(340px, 100%); padding: 24px 22px 18px; border-radius: 24px; text-align: center;
  background: var(--panel); border: 2px solid var(--line); box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
  animation: qburstin .3s cubic-bezier(.2, 1.4, .4, 1);
}
.qconfirm-card h2 { margin: 0 0 8px; font-size: 1.375rem; }
.qconfirm-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.45; }
.qconfirm-card button { display: block; width: 100%; min-height: 50px; border-radius: 16px; font-weight: 800; font-size: 1rem; }
.qconfirm-yes { background: #ff6b6b; color: #2b0606; border-bottom: 5px solid #c94848; }
.qconfirm-yes:active { transform: translateY(2px); border-bottom-width: 3px; }
.qconfirm-no { margin-top: 10px; background: var(--bg); border: 2px solid var(--line); }
.qconfirm-card button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .qconfirm-card { animation: none; } }
/* "open in your browser", shown inside Instagram, TikTok and other apps' built-in browsers; it reuses the confirm card */
#openout { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(14, 17, 22, .7); }
#openout[hidden] { display: none; }
.openout-how { color: var(--ink) !important; font-weight: 600; }
.openout-go { background: var(--gold) !important; color: #0e1116 !important; border-bottom-color: #c79a1e !important; }
.openout-go[hidden] { display: none; }
.qskipped {
  width: 100%; min-height: 48px; margin-top: 14px; border-radius: 14px; font-weight: 700;
  border: 2px dashed var(--rule); color: var(--ink);
}
.qskipped:hover, .qskipped:focus-visible { border-color: var(--accent); outline: none; }

/* the quiz itself: one question per screen, snapping like the reels */
#qfeed {
  position: fixed; inset: 0;
  overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
#qfeed::-webkit-scrollbar { display: none; }
.qslide {
  height: 100dvh; width: var(--column); margin: 0 auto;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column;
  padding: calc(64px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
}
/* centred with auto margins rather than justify-content, so a tall question scrolls instead of losing its top */
.qcard { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.qcard > :first-child { margin-top: auto; }
.qcard > :last-child { margin-bottom: auto; }
.qcard > small { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.qcard > h2 { margin: 8px 0 22px; font-size: 1.375rem; line-height: 1.3; }

.qchoices { display: grid; gap: 10px; }
.qchoices button {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; text-align: left; line-height: 1.3;
  border-radius: 16px; background: var(--panel); border: 2px solid var(--line); border-bottom-width: 5px;
  font-size: 1.0625rem; font-weight: 600; transition: transform .06s;
}
.qchoices button:not(:disabled):active { transform: translateY(2px); border-bottom-width: 3px; }
.qchoices button:not(:disabled):hover, .qchoices button:focus-visible { border-color: var(--rule); outline: none; }
.qchoices .key {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
  border: 2px solid var(--line); font-size: .875rem; color: var(--muted);
}
.qchoices button.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.qchoices button.picked .key { border-color: var(--accent); color: var(--accent); }
.qchoices button:disabled { cursor: default; color: var(--muted); }
.qchoices button.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--panel)); color: var(--ink); }
.qchoices button.correct .key { border-color: var(--green); color: var(--green); }
.qchoices button.missed { border-color: #ff6b6b; background: color-mix(in srgb, #ff6b6b 14%, var(--panel)); color: var(--ink); }
.qchoices button.missed .key { border-color: #ff6b6b; color: #ff6b6b; }
/* once checked, the choices that don't matter step back; on short screens they go, to make room for the explanation */
.qchoices button.other { opacity: .45; }
@media (max-height: 760px) {
  .qslide { padding-top: calc(58px + env(safe-area-inset-top)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .qcard > h2 { font-size: 1.1875rem; margin: 6px 0 14px; }
  .qchoices { gap: 8px; }
  .qchoices button { min-height: 48px; padding: 8px 12px; font-size: 1rem; }
  .qchoices button.other { display: none; }
  .qfoot { padding-top: 10px; }
  .qslide.checked .qfoot { margin-bottom: calc(-10px - env(safe-area-inset-bottom)); padding: 12px 18px calc(8px + env(safe-area-inset-bottom)); }
  .qfeedback { margin-bottom: 10px; }
  .qfeedback > b { font-size: 1.1875rem; }
  .qfeedback .mark { width: 26px; height: 26px; font-size: 1rem; }
  .qfeedback p { margin-top: 4px; font-size: .875rem; }
  .qrewatch { margin-top: 4px; min-height: 40px; }
  .qcheck, .qnext { min-height: 48px; }
  .qswipe { margin-top: 4px; }
  .qbig { font-size: 3.5rem; }
  .qresults h3 { margin-top: 14px; }
  .qactions { margin-top: 16px; }
}

.qfoot { flex: none; padding-top: 14px; }
.qcheck, .qnext {
  width: 100%; min-height: 54px; border-radius: 16px; font-size: 1.0625rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: var(--green); color: #06281a; border-bottom: 5px solid #23a36d;
}
.qcheck:disabled { background: var(--line); color: var(--muted); border-bottom-color: var(--panel); cursor: default; }
.qcheck:not(:disabled):active, .qnext:active { transform: translateY(2px); border-bottom-width: 3px; }
.qcheck:focus-visible, .qnext:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* once checked, the foot becomes a coloured panel across the whole screen with the verdict, the reason and Continue */
.qslide.checked .qfoot {
  margin: 0 -18px calc(-18px - env(safe-area-inset-bottom));
  padding: 16px 18px calc(12px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  animation: qrise .22s ease-out;
}
@keyframes qrise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.qslide.right .qfoot { background: color-mix(in srgb, var(--green) 18%, var(--bg)); }
.qslide.wrong .qfoot { background: color-mix(in srgb, #ff6b6b 18%, var(--bg)); }
.qfeedback:empty { display: none; }
.qfeedback { margin-bottom: 14px; }
.qfeedback > b { display: flex; align-items: center; gap: 10px; font-size: 1.375rem; }
.qfeedback .mark {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; flex: none;
  font-size: 1.125rem; color: var(--bg);
}
.right .qfeedback > b { color: var(--green); }
.right .qfeedback .mark { background: var(--green); }
.wrong .qfeedback > b { color: #ff8a8a; }
.wrong .qfeedback .mark { background: #ff6b6b; }
.qfeedback p { margin: 8px 0 0; font-size: .9375rem; line-height: 1.4; color: var(--ink); }
.qfeedback p.answer { font-weight: 700; color: #ffb3b3; }
.qrewatch {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 8px; padding: 0 14px 0 10px;
  border-radius: 999px; background: var(--bg); font-size: .9375rem; font-weight: 600;
}
.qrewatch svg { width: 18px; height: 18px; fill: var(--accent); }
.qrewatch:hover, .qrewatch:focus-visible { outline: 2px solid var(--accent); }
.qnext { display: flex; align-items: center; justify-content: center; gap: 8px; }
.qslide.wrong .qnext { background: #ff6b6b; color: #2b0606; border-bottom-color: #c94848; }
.qnext svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; animation: qnudge 1.4s ease-in-out infinite; }
@keyframes qnudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.qswipe { display: block; margin-top: 6px; text-align: center; font-size: .8125rem; color: var(--muted); }

/* a little bounce for a right answer, a shake for a wrong one */
.qchoices button.correct { animation: qpop .3s ease-out; }
.qchoices button.missed { animation: qshake .35s ease-in-out; }
@keyframes qpop { 40% { transform: scale(1.04); } }
@keyframes qshake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) {
  .qnext svg, .qslide.checked .qfoot, .qchoices button.correct, .qchoices button.missed, .qresults.celebrate .qbig { animation: none; }
}

/* the last screen can grow past one screen height when many units need review; the feed just scrolls on */
.qresults { height: auto; min-height: 100dvh; }
.qresults .qcard { text-align: center; overflow: visible; }
.qbig { margin-top: 10px; font-size: 4.5rem; font-weight: 800; line-height: 1; color: var(--accent); }
.qbig span { font-size: 2rem; color: var(--muted); }
.qresults h2 { margin: 6px 0 4px; }
.qbest { margin: 4px 0 0; color: var(--muted); }
.qstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.qstats div { padding: 10px 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); }
.qstats b { display: block; font-size: 1.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.qstats small { display: block; margin-top: 2px; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.qresults.celebrate .qbig { animation: qcheer .6s ease-out; }
@keyframes qcheer { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.qresults h3 { margin: 22px 0 8px; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.qreview { display: grid; gap: 8px; text-align: left; }
.qreview button {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px;
  border-radius: 14px; background: var(--panel); border: 2px solid var(--line); font-weight: 600;
}
.qreview button i { margin-left: auto; font-style: normal; font-weight: 700; color: #ff8a8a; white-space: nowrap; }
.qreview button:hover, .qreview button:focus-visible { border-color: var(--accent); outline: none; }
.qactions { display: grid; gap: 10px; margin-top: 24px; }
.qagain, .qdone { min-height: 52px; border-radius: 16px; font-weight: 800; background: var(--panel); border: 2px solid var(--line); }
.qactions .primary { background: var(--gold); color: #1a1400; border: 0; border-bottom: 5px solid #b8901c; }
.qagain:focus-visible, .qdone:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* the top bar: close, and a progress bar that fills as questions are checked */
.qbar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: var(--column);
  display: flex; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px 6px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.qbar button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.qbar button:hover, .qbar button:focus-visible { background: var(--panel); outline: none; }
.qbar svg { width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* one segment per question; a tall invisible strip around it so a thumb can tap or drag to any question */
.qprogress {
  flex: 1; display: flex; align-items: center; gap: 3px; height: 44px; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.qprogress i { flex: 1; height: 12px; border-radius: 3px; background: var(--line); transition: background .2s, height .15s; }
.qprogress i:first-child { border-radius: 999px 3px 3px 999px; }
.qprogress i:last-child { border-radius: 3px 999px 999px 3px; }
.qprogress.many { gap: 2px; }
.qprogress i.right { background: var(--green); }
.qprogress i.wrong { background: #ff6b6b; }
.qprogress i.here { height: 18px; box-shadow: inset 0 0 0 2px var(--ink); }
#qcount { font-size: .875rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; white-space: nowrap; }

/* ---- celebrations: confetti over everything, and a badge that pops up in the middle ---- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
#qburst {
  position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s .25s;
}
#qburst.show { opacity: 1; visibility: visible; transition: opacity .15s; }
#qburst.perfect.show { pointer-events: auto; background: rgba(14, 17, 22, .55); }
.burst-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 22px 34px; border-radius: 28px; background: var(--panel); border: 3px solid var(--accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); text-align: center;
}
#qburst.show .burst-card { animation: qburstin .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes qburstin { from { transform: scale(.3) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.streak .burst-card { border-color: var(--gold); }
.burst-num { font-size: 4.5rem; line-height: 1; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.burst-card b { font-size: 1.5rem; font-weight: 800; }
.perfect .burst-card { padding: 28px 40px 26px; border-color: var(--gold); background: linear-gradient(160deg, #2a2410, var(--panel) 60%); }
.perfect .burst-card svg { width: 96px; height: 96px; fill: var(--gold); filter: drop-shadow(0 0 18px rgba(245, 197, 66, .55)); animation: qspin 1.1s ease-out; }
@keyframes qspin { from { transform: scale(0) rotate(-180deg); } 70% { transform: scale(1.15) rotate(10deg); } to { transform: none; } }
.perfect .burst-card b { font-size: 2.25rem; color: var(--gold); margin-top: 6px; }
.perfect .burst-card span { font-size: 1.0625rem; color: var(--ink); }

/* the score screen after a perfect quiz */
.qperfect {
  display: inline-flex; align-items: center; gap: 8px; align-self: center; margin-top: 12px; padding: 6px 14px;
  border-radius: 999px; background: color-mix(in srgb, var(--gold) 18%, var(--bg)); color: var(--gold);
  font-weight: 800; font-size: .875rem; letter-spacing: .08em; text-transform: uppercase;
}
.qperfect svg { width: 16px; height: 16px; fill: var(--gold); }
.qresults.perfect .qbig { color: var(--gold); text-shadow: 0 0 24px rgba(245, 197, 66, .45); }
@media (prefers-reduced-motion: reduce) {
  #qburst.show .burst-card, .perfect .burst-card svg { animation: none; }
}

/* ---- watching ---- */

#feed {
  position: fixed; inset: 0;
  overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
#feed::-webkit-scrollbar { display: none; }
.slide {
  position: relative; height: 100dvh;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: grid; place-items: center;
}
.slide video { width: var(--column); height: 100%; object-fit: contain; background: var(--bg); }
/* a clear layer over the video: a long press lands on it, not the video, so phones offer no "Download video" menu */
.slide .shield { position: absolute; inset: 0; }
.slide video, .slide .shield { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.slide .caption {
  position: absolute; left: 50%; transform: translateX(-50%); width: var(--column);
  bottom: 0; padding: 0 124px calc(44px + env(safe-area-inset-bottom)) 18px;
  pointer-events: none;
}
.caption small { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.caption b { display: block; font-size: 0.9375rem; line-height: 1.25; }
.slide .paused {
  position: absolute; width: 84px; height: 84px; border-radius: 50%;
  background: rgba(14, 17, 22, .7); display: grid; place-items: center; pointer-events: none;
  opacity: 0; transition: opacity .15s;
}
/* shown when paused, then faded away after 3 seconds (the video stays paused) */
.slide.is-paused .paused { animation: paused-hint 3.25s forwards; }
@keyframes paused-hint { 0%, 92% { opacity: 1; } 100% { opacity: 0; } }
.paused svg { width: 36px; height: 36px; fill: var(--ink); margin-left: 5px; }

.slide.end { text-align: center; padding: 24px; }
.end div { width: min(var(--column), 100%); padding: 0 24px; }
.end h2 { font-size: 1.625rem; margin: 0 0 8px; }
.end p { color: var(--muted); margin: 0 0 24px; }
.end button { padding: 12px 22px; border-radius: 999px; background: var(--gold); color: #1a1400; font-weight: 700; }

/* a quiz offered in the feed after a few units: take it or skip it */
.slide.gate { text-align: center; padding: 24px; }
.gate > div { width: min(var(--column), 100%); padding: 0 24px; display: flex; flex-direction: column; align-items: center; }
.gate small { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.gate h2 { font-size: 2rem; margin: 10px 0 8px; }
.gate p { color: var(--muted); margin: 0 0 28px; line-height: 1.45; }
.gate button { width: min(320px, 100%); min-height: 54px; border-radius: 16px; font-weight: 800; font-size: 1.0625rem; }
.gate .gate-take { background: var(--gold); color: #1a1400; border-bottom: 5px solid #b8901c; text-transform: uppercase; letter-spacing: .04em; }
.gate .gate-take:active { transform: translateY(2px); border-bottom-width: 3px; }
.gate .gate-skip { margin-top: 10px; color: var(--muted); }
.gate a.gate-take { display: flex; align-items: center; justify-content: center; width: min(320px, 100%); min-height: 54px; border-radius: 16px;
  font-weight: 800; font-size: 1.0625rem; text-decoration: none; }
.lab-gate .lab-thumb { width: 84px; height: 84px; border-radius: 20px; margin-bottom: 16px; }
.lab-gate .lab-thumb .lab-icon { width: 46px; height: 46px; }
.gate .gate-skip:hover, .gate button:focus-visible { color: var(--ink); outline: none; text-decoration: underline; }
/* the 5-second countdown before an unanswered offer skips itself */
.gate-timer, .gate-stayed { margin-top: 22px; font-size: .875rem; color: var(--muted); display: none; }
.gate.counting .gate-timer { display: block; }
.gate.stayed .gate-stayed { display: block; }
.gate-timer i { display: block; width: 160px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--rule); position: relative; overflow: hidden; }
.gate-timer i::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(var(--left, 1)); transition: transform .1s linear; }
.gate-timer b { color: var(--ink); font-variant-numeric: tabular-nums; }

.bar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: var(--column);
  display: flex; align-items: center; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 8px 8px;
  background: linear-gradient(var(--bg), transparent);
}
.bar button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.bar button:hover, .bar button:focus-visible { background: var(--panel); outline: none; }
.bar svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.where { flex: 1; min-width: 0; }
#where-views { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
#where-views:empty { display: none; }
#where-course { font-size: 0.875rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#where-course:empty { display: none; }
#where-unit { font-size: 0.8125rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar button.off svg { stroke: var(--muted); }
.bar #speed { font-size: 0.875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar #speed.changed { color: var(--gold); }

/* back and forward five seconds, just above the right-hand end of the progress bar */
#skip {
  position: fixed; left: 50%; transform: translateX(-50%); width: var(--column);
  bottom: calc(38px + env(safe-area-inset-bottom)); padding: 0 10px;
  display: flex; justify-content: flex-end; gap: 10px; pointer-events: none;
}
#skip button {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(14, 17, 22, .6); pointer-events: auto;
}
#skip button:hover, #skip button:focus-visible { background: var(--panel); outline: none; }
#skip button:active { background: var(--line); }
#skip svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#skip text { fill: var(--ink); stroke: none; font: 700 8px system-ui, sans-serif; text-anchor: middle; }

/* the progress bar: a thin line with a tall invisible strip around it, so a thumb can grab it */
#scrub {
  position: fixed; left: 50%; transform: translateX(-50%); width: var(--column);
  bottom: env(safe-area-inset-bottom); height: 36px; padding: 0 14px;
  display: flex; align-items: center; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#scrub:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; border-radius: 8px; }
.track { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .28); overflow: hidden; transition: height .12s; }
#scrub:hover .track, #scrub.dragging .track { height: 9px; }
#track-fill { height: 100%; width: 0; background: var(--ink); }
#scrub.dragging #track-fill { background: var(--gold); }

#toast {
  position: fixed; left: 50%; top: calc(max(8px, env(safe-area-inset-top)) + 60px); transform: translateX(-50%);
  padding: 8px 16px; border-radius: 999px; background: rgba(14, 17, 22, .85); border: 1px solid var(--line);
  font-size: 0.875rem; font-weight: 700; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
#toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #feed { scroll-behavior: auto; }
}

/* Search tab */
.search-box {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; margin-bottom: 8px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.search-box:focus-within { border-color: var(--gold); }
.search-box svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; flex: none; }
.search-box input { flex: 1; min-width: 0; padding: 14px 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1.0625rem; outline: none; }
.hint { color: var(--muted); margin: 18px 4px; }
.hit { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; }
.hit:hover, .hit:focus-visible { background: var(--panel); outline: none; }
.hit b { display: block; font-weight: 600; }
.hit small, .hit-video small { display: block; color: var(--muted); font-size: 0.8125rem; }
.hit-video { align-items: flex-start; }
.hit-video .teaches { display: block; margin-top: 2px; font-size: 0.8125rem; color: var(--muted); line-height: 1.35; }
.ideas { margin: 4px 4px 0; }
.ideas .section { margin: 0 0 8px; }
.chip { display: inline-flex; align-items: center; min-height: 44px; margin: 0 6px 8px 0; padding: 0 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .9375rem; font-weight: 600; }
.chip:hover, .chip:focus-visible { border-color: var(--gold); outline: none; }

/* difficulty: five pips in the subject's colour, then the level's name */
.level { display: flex; align-items: center; gap: 8px; margin: 4px 0 2px; font-size: .8125rem; font-weight: 600; color: var(--ink); }
.pips { display: inline-flex; gap: 3px; flex: none; }
.pips i { width: 12px; height: 6px; border-radius: 3px; background: var(--rule); }
.pips i.on { background: var(--accent); }
.course-card small.after { display: block; margin-bottom: 2px; }
.course-level { margin: 8px 0 16px; }
.course-level small { color: var(--muted); font-size: .875rem; }
.list-rule { width: 64px; margin: 22px auto 18px; border: 0; border-top: 2px solid var(--line); }
.sort-note { margin: 4px 0 0; font-size: .875rem; color: var(--muted); }
.course-level small { display: block; }
.equiv { display: block; margin: 0 0 2px; font-size: .75rem; color: var(--muted); }
.course-level small.equiv { font-size: .8125rem; }

/* Install tab */
.install-card { margin: 14px 0 0; padding: 16px 18px 6px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.install-card.mine { border-color: var(--gold); }
.install-card h2 { margin: 0 0 6px; font-size: 1.125rem; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.install-card h2 small { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.install-card.mine h2 small { color: var(--gold); }
.install-card ol { margin: 0; padding-left: 22px; color: var(--muted); font-size: .9375rem; }
.install-card li { margin: 0 0 10px; padding-left: 4px; }
.install-card b { color: var(--ink); font-weight: 600; }
.install-card svg.inline { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-card svg.inline circle { fill: var(--ink); stroke: none; }
.install-now { margin-bottom: 4px; }
.install-done { display: flex; align-items: center; gap: 10px; color: var(--green); font-weight: 600; }
.install-done svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Home tab: the difficulty levels and their school-system equivalents */
.levels { margin: 30px 0 0; }
.levels h2 { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.2; }
.levels > p { margin: 0 0 12px; color: var(--muted); font-size: .9375rem; }
.level-card { margin: 0 0 10px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.level-card .level { font-size: .9375rem; margin: 0 0 8px; }
.level-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.level-card dt { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.level-card dd { margin: 1px 0 0; font-size: .8125rem; color: var(--ink); }
.level-card dl .wide { grid-column: 1 / -1; }

/* ---- the raised, 3D look of the quiz buttons, everywhere ----
   A 2px edge with a thicker 5px bottom makes a box look like a key you can press; tappable ones sink when pressed.
   (Written last so it adds to each box's own colours and shapes above.) */
.course-card, .group, .quiz-card, .chip, .qreview button, .qskipped, .qdone, .qagain:not(.primary), .qrewatch, .gate .gate-skip,
.install-card, .level-card, .qstats div, .search-box {
  border: 2px solid var(--line); border-bottom-width: 5px;
}
.course-card { border-left: 4px solid var(--accent); }
.quiz-card { border-color: var(--accent); border-bottom-color: color-mix(in srgb, var(--accent) 55%, #000); }
.quiz-card.checkpoint { border-style: dashed; border-bottom-style: solid; border-bottom-width: 5px; }
.install-card.mine { border-color: var(--gold); border-bottom-color: #b8901c; }
.resume, .end button { border-bottom: 5px solid #b8901c; }
.gate .gate-skip { background: var(--panel); }
.qrewatch { border-color: color-mix(in srgb, var(--ink) 18%, transparent); }

/* pressing sinks the key: it drops 2px while its bottom edge shrinks by the same amount */
.course-card, .group, .quiz-card, .chip, .qreview button, .qskipped, .qdone, .qagain, .qrewatch, .gate button,
.resume, .end button, .quiz-startover { transition: transform .06s, border-bottom-width .06s; }
.course-card:active, .group:active, .quiz-card:active, .chip:active, .qreview button:active, .qskipped:active,
.qdone:active, .qagain:active, .qrewatch:active, .gate .gate-skip:active, .resume:active, .end button:active {
  transform: translateY(2px); border-bottom-width: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .course-card:active, .group:active, .quiz-card:active, .chip:active, .qreview button:active, .qskipped:active,
  .qdone:active, .qagain:active, .qrewatch:active, .gate .gate-skip:active, .resume:active, .end button:active { transform: none; }
}

/* ---- Home tab: the picture of the quizzes, two phones drawn in the quiz's own style ---- */
.quiz-show { margin: 30px 0 0; }
.quiz-show h2 { margin: 0 0 12px; font-size: 1.25rem; line-height: 1.2; }
.quiz-note { margin: 12px 0 0; color: var(--muted); font-size: .9375rem; line-height: 1.45; }
.qd { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 12px; border-radius: 18px;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--green) 14%, var(--panel)), var(--panel) 70%);
  border: 2px solid var(--line); border-bottom-width: 5px; }
.qd-phone {
  position: relative; display: flex; flex-direction: column; aspect-ratio: 9 / 17; overflow: hidden;
  border-radius: 22px; border: 5px solid #2b3242; background: var(--bg); box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  font-size: 9px; line-height: 1.25; color: var(--ink); pointer-events: none; user-select: none;
}
.qd-bar { display: flex; align-items: center; gap: 5px; padding: 8px 7px 4px; color: var(--muted); font-weight: 700; font-size: 8px; }
.qd-segs { flex: 1; display: flex; gap: 2px; }
.qd-segs i { flex: 1; height: 5px; border-radius: 2px; background: var(--line); }
.qd-segs i.r { background: var(--green); }
.qd-segs i.w { background: #ff6b6b; }
.qd-segs i.here { box-shadow: inset 0 0 0 1px var(--ink); height: 7px; }
.qd-body { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; }
.qd-body.center { align-items: center; justify-content: center; text-align: center; gap: 3px; }
.qd-body small { font-size: 6.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--chemistry); }
.qd-q { font-size: 10.5px; line-height: 1.25; margin: 2px 0 4px; }
.qd-choice { display: flex; align-items: center; gap: 5px; padding: 4px 5px; border-radius: 7px; font-weight: 600;
  background: var(--panel); border: 1.5px solid var(--line); border-bottom-width: 3px; }
.qd-choice em { font-style: normal; width: 13px; height: 13px; display: grid; place-items: center; border-radius: 4px;
  border: 1.5px solid var(--line); font-size: 7px; color: var(--muted); flex: none; }
.qd-choice.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--panel)); }
.qd-choice.correct em { border-color: var(--green); color: var(--green); }
.qd-choice.other { opacity: .45; }
.qd-sheet { padding: 7px 8px 8px; border-radius: 12px 12px 0 0; background: color-mix(in srgb, var(--green) 18%, var(--bg)); }
.qd-sheet b { display: flex; align-items: center; gap: 4px; color: var(--green); font-size: 11px; }
.qd-sheet b span { width: 13px; height: 13px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: var(--bg); font-size: 8px; }
.qd-sheet p { margin: 3px 0 6px; font-size: 7.5px; color: var(--ink); }
.qd-next { padding: 5px 0; border-radius: 7px; text-align: center; font-weight: 800; font-size: 8px; letter-spacing: .04em;
  text-transform: uppercase; background: var(--green); color: #06281a; border-bottom: 3px solid #23a36d; }
.qd-burst {
  position: absolute; left: 66%; top: 59%; transform: translate(-50%, -50%) rotate(-6deg);
  display: flex; flex-direction: column; align-items: center; padding: 6px 12px; border-radius: 12px;
  background: var(--panel); border: 2px solid var(--gold); box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  font-size: 24px; font-weight: 900; line-height: 1; color: var(--gold);
}
.qd-burst small { font-size: 8px; color: var(--ink); font-weight: 800; margin-top: 2px; white-space: nowrap; }
.qd-big { font-size: 34px; font-weight: 800; line-height: 1; color: var(--gold); margin-top: 4px; }
.qd-big span { font-size: 15px; color: var(--muted); }
.qd-body.center > b { font-size: 11px; }
.qd-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 100%; margin-top: 6px; }
.qd-stats div { padding: 4px 1px; border-radius: 6px; border: 1.5px solid var(--line); border-bottom-width: 3px; background: var(--panel); }
.qd-stats b { display: block; font-size: 9px; }
.qd-stats small { display: block; font-size: 5px; color: var(--muted); letter-spacing: .04em; }
.qd-keep { width: 100%; margin-top: 8px; padding: 6px 0; border-radius: 8px; font-weight: 800; font-size: 8px;
  background: var(--gold); color: #1a1400; border-bottom: 3px solid #b8901c; }
.qd-confetti { position: absolute; inset: 0; pointer-events: none; }
.qd-confetti i { position: absolute; left: var(--x); top: var(--y); width: 5px; height: 3px; border-radius: 1px;
  background: var(--c); transform: rotate(var(--r)); }

/* ---- Home tab: three clearly separated parts (videos, quizzes, levels), each with a coloured label ---- */
.home-section { margin: 40px 0 0; padding: 30px 0 0; border-top: 2px solid var(--line); }
.home-head + .home-section { margin-top: 8px; }
.home-section > h2 { margin: 8px 0 16px; font-size: 1.5rem; line-height: 1.2; letter-spacing: -.01em; }
.home-section.levels > h2 { margin-bottom: 4px; }
.home-label {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 999px;
  font-size: 1.0625rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.home-label.videos { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); }
.home-label.quizzes { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.home-label.levels-label { color: var(--math); background: color-mix(in srgb, var(--math) 15%, transparent); }
.home-section .home-art { margin-bottom: 20px; }
.quiz-show .how { margin-top: 20px; }
.quiz-show .how svg { stroke: var(--green); }

/* ---- Home tab: the labs picture (two phones in the virtual labs' own look) ---- */
.home-label.labs-label { color: #b49cff; background: color-mix(in srgb, #b49cff 15%, transparent); }
.lab-show .how svg { stroke: #b49cff; }
.lab-show .how { margin-top: 20px; }
.qd.ld { background: radial-gradient(circle at 70% 20%, color-mix(in srgb, #b49cff 16%, var(--panel)), var(--panel) 70%); }
.ld-phone { padding: 0 0 6px; }
.ld-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 2px; font-size: 6.5px; color: var(--muted); }
.ld-top b { color: var(--green); font-size: 6px; letter-spacing: .08em; text-transform: uppercase; }
.ld-title { padding: 2px 8px 5px; font-size: 11px; font-weight: 800; }
.ld-bench { margin: 0 6px; border-radius: 9px; overflow: hidden; line-height: 0; }
.ld-bench svg { width: 100%; height: auto; display: block; }
.ld-drop { animation: ld-drip 1.4s ease-in infinite; }
@keyframes ld-drip { 0% { transform: translateY(-3px); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(9px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ld-drop { animation: none; } }
.ld-step { margin: 6px 6px 0; padding: 5px 6px; border-radius: 8px; background: var(--panel); border: 1.5px solid var(--line); }
.ld-step small { display: block; font-size: 5.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ld-step b { font-size: 8px; line-height: 1.2; }
.ld-hold { margin: 5px 6px 0; padding: 6px 0; border-radius: 8px; text-align: center; font-weight: 800; font-size: 8px;
  background: var(--green); color: #06281a; border-bottom: 3px solid #23a36d; }
.ld-q { display: flex; align-items: center; gap: 5px; margin: 6px 8px 3px; font-size: 8px; font-weight: 700; }
.ld-q em { font-style: normal; width: 13px; height: 13px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: #b49cff; color: #1a1033; font-size: 7px; font-weight: 900; }
.ld-in { display: flex; justify-content: space-between; align-items: center; margin: 0 8px; padding: 4px 4px 4px 7px; border-radius: 7px;
  background: var(--bg); border: 1.5px solid var(--green); font-size: 9px; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.ld-in i { font-style: normal; font-family: inherit; font-size: 6.5px; font-weight: 800; padding: 3px 5px; border-radius: 5px; background: var(--panel); color: var(--ink); }
.ld-ok { margin: 3px 8px 0; padding: 3px 5px; border-radius: 6px; font-size: 6.5px; font-weight: 700; color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--bg)); }
.ld-unknown { margin: auto 8px 4px; padding: 4px 5px; border-radius: 6px; font-size: 6.5px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); }
.ld-burst { left: 50%; top: 66%; font-size: 15px; white-space: nowrap; transform: translate(-50%, -50%) rotate(-4deg); border-color: #b49cff; color: #b49cff; }

/* bullets slide up into place as they scroll into view (only when the script has marked them, so nothing hides without it) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease-out, transform .5s ease-out; }
.reveal.shown { opacity: 1; transform: none; }

/* the levels section wears the same blue as its label: the pips and the school-system names */
.home-section.levels { --accent: var(--math); }
.home-section.levels .level-card dt { color: var(--math); }
.home-section.levels .level-card { border-bottom-color: color-mix(in srgb, var(--math) 35%, var(--line)); }

/* Profile tab, and the sign-in wall over a reel past the free videos */
/* the Settings tab: groups of rows on cards */
.set-group { margin: 0 0 22px; }
.set-group h2 { margin: 0 0 8px 4px; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.set-card { border-radius: 16px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.set-card > * + * { border-top: 1px solid var(--line); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 18px; }
.set-row.stack { flex-direction: column; align-items: stretch; }
.set-label span { display: block; }
.set-label small { display: block; margin-top: 2px; font-size: .8125rem; color: var(--muted); }
.set-note { margin: 0; padding: 14px 18px; color: var(--muted); line-height: 1.45; }
.set-person { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.set-person b { display: block; font-size: 1.0625rem; }
.set-person small { display: block; margin-top: 2px; color: var(--muted); font-size: .9375rem; overflow-wrap: anywhere; }
.profile-pic { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--line); flex: none; }
.set-action { display: block; width: 100%; min-height: 52px; padding: 0 18px; text-align: left; font-size: 1rem; font-weight: 600; color: var(--ink); }
.set-action:hover, .set-action:focus-visible { background: color-mix(in srgb, var(--ink) 6%, var(--panel)); outline: none; }
.set-action.main { color: var(--gold); font-weight: 800; }
a.set-action { display: flex; align-items: center; text-decoration: none; }
/* the last thing on the Settings tab: deleting the account */
.delete-account {
  display: block; width: 100%; min-height: 54px; margin: 8px 0 0; border-radius: 16px;
  background: #ff6b6b; color: #2b0606; font-size: 1.0625rem; font-weight: 800; border-bottom: 5px solid #c94848;
}
.delete-account:active { transform: translateY(2px); border-bottom-width: 3px; }
.delete-account:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.wall { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px 16px; background: rgba(14, 17, 22, .92); }
.wall-card { width: min(100%, 360px); padding: 26px 22px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.wall-card h2 { margin: 0 0 8px; font-size: 1.5rem; }
.wall-card p { margin: 0 0 22px; color: var(--muted); line-height: 1.45; }
.wall-card button { display: block; width: 100%; min-height: 50px; border-radius: 16px; font-weight: 800; font-size: 1rem; }
.wall-up { background: var(--gold); color: #0e1116; border-bottom: 5px solid #c79a1e; }
.wall-up:active { transform: translateY(2px); border-bottom-width: 3px; }
.wall-in { margin-top: 10px; background: var(--bg); border: 2px solid var(--line); color: var(--ink); }
.wall-card button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.slide.walled .paused { display: none; }

/* Home tab: the last section, a big button to the Courses tab */
.home-label.start-label { color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, transparent); }
.start-courses { min-height: 76px; padding: 14px 20px; }
.start-courses b { font-size: 1.375rem; }

/* Privacy policy link at the foot of the Home and Profile tabs */
.legal { margin: 28px 0 0; text-align: center; font-size: .875rem; color: var(--muted); }
.legal a { display: inline-block; padding: 10px 8px; color: var(--muted); }
.legal a:hover, .legal a:focus-visible { color: var(--ink); }

/* Course page: the "All courses" button floats at the top once the page has scrolled past the real one */
.course-float {
  position: fixed; z-index: 6; top: 0; left: 50%; width: 100%; max-width: 560px;
  display: flex; align-items: center; gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) 16px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0; transform: translate(-50%, -8px); pointer-events: none; transition: opacity .18s, transform .18s;
}
.course-float.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.course-float .to-courses {
  margin: 0; width: 40px; height: 40px; padding: 0; flex: none; justify-content: center;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
}
.course-float .to-courses svg { stroke: var(--ink); }
.course-float b { min-width: 0; font-size: 1.0625rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .course-float { transition: none; } }
.unit .lab-row { margin-top: 6px; }
/* Settings: "Have a code?" for unlimited videos */
.set-code > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.set-code > summary::-webkit-details-marker { display: none; }
.set-code > summary::after { content: "▾"; color: var(--muted); font-size: .9rem; transition: transform .2s; }
.set-code[open] > summary::after { transform: rotate(180deg); }
.set-code-body { padding: 0 18px 16px; }
.set-code-body p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; }
.set-code-row { display: flex; gap: 8px; }
.set-code-row input { flex: 1; min-width: 0; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg, #0f141c); color: var(--ink); font: inherit; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase; }
.set-code-row button, .set-code-signin { min-height: 46px; padding: 0 18px; border-radius: 12px; background: var(--gold); color: #1d1600; font-weight: 800; }
.set-code-row button:disabled { opacity: .55; }
.set-code-msg { margin: 10px 0 0 !important; min-height: 1.2em; }
.set-code-msg.ok { color: var(--accent, #3ddc97) !important; }
.set-code-msg.no { color: var(--gold) !important; }
.wall-code { margin-top: 6px; background: var(--gold); color: #0e1116; border-bottom: 5px solid #c79a1e; }
