:root {
  --bg: #f4f2ed;
  --card: #ffffff;
  --ink: #1b1b1f;
  --muted: #5a5a66;
  --line: #e2ddd3;
  --band: #2b2f66;
  --band-ink: #ffffff;
  --brand: #2b2f66;
  --brand-soft: #e8e9f5;
  --tint: #f7f4ed;
  --good: #246b45;
  --good-soft: #e3f3e9;
  --mid: #9a6a12;
  --mid-soft: #fdf1dc;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --mark: #fdf0c9;
  /* Guide block colours, as in the Study Guide format. */
  --points: #246b45; --points-bg: #eaf5ee;
  --picture: #0f6f78; --picture-bg: #e4f3f4;
  --develop: #1f5f9e; --develop-bg: #e8f1fb;
  --terms: #9a6a12; --terms-bg: #fdf4e2;
  --quiz: #6a3d94; --quiz-bg: #f1eafb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30, 30, 50, .06), 0 2px 10px rgba(30, 30, 50, .05);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121320;
    --card: #1b1d2c;
    --ink: #e9e9f0;
    --muted: #a3a4b5;
    --line: #2e3145;
    --band: #23264f;
    --brand: #a9b0ff;
    --brand-soft: #262a4d;
    --tint: #202336;
    --good: #6fd19a;
    --good-soft: #17301f;
    --mid: #f0b45a;
    --mid-soft: #3a2d15;
    --bad: #f2867d;
    --bad-soft: #3d1d1a;
    --mark: #5a4a12;
    --points: #6fd19a; --points-bg: #17301f;
    --picture: #5cc8d2; --picture-bg: #132e31;
    --develop: #8ab4f0; --develop-bg: #172a44;
    --terms: #f0b45a; --terms-bg: #3a2d15;
    --quiz: #c6a2f0; --quiz-bg: #2c2140;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
h1, h2 { font-family: var(--serif); letter-spacing: -.01em; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 .3rem; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }
kbd { font: 600 .7rem ui-monospace, monospace; border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em; opacity: .6; margin-left: .3em; }
mark { background: var(--mark); color: inherit; padding: 0 .12em; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.good { color: var(--good); }
.grow { flex: 1; min-width: 0; }

/* Header */
.top { background: var(--band); color: var(--band-ink); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 20px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.brand img { border-radius: 8px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.82); text-decoration: none; padding: 7px 11px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav a.on { color: #fff; background: rgba(255,255,255,.16); }
.nav-end { margin-left: auto; align-items: center; }
.top-search input { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 999px; padding: 7px 14px; width: 230px; font: inherit; font-size: .9rem; }
.top-search input::placeholder { color: rgba(255,255,255,.6); }
.top-search input:focus { outline: 2px solid rgba(255,255,255,.5); background: rgba(255,255,255,.18); }
.top-search + .nav-end { margin-left: 0; }
.top-search { margin-left: auto; }

.main { padding: 32px 24px 48px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1; }
.foot { color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding: 14px 0; }
.narrow { max-width: 460px; margin: 4vh auto 0; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p.muted { max-width: 70ch; margin: .2rem 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .88rem; color: var(--muted); margin: 0 0 .35rem; }
.crumbs a { color: inherit; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
section { margin-bottom: 28px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > :last-child { margin-bottom: 0; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .93rem; padding: 9px 16px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--band); border-color: var(--band); color: #fff; }
.btn-primary:hover { filter: brightness(1.15); border-color: var(--band); }
@media (prefers-color-scheme: dark) { .btn-primary { background: #4a52b8; border-color: #4a52b8; } }
.btn-good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.btn-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 4px 6px; font-weight: 500; }
.btn-sm { padding: 6px 11px; font-size: .84rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.top .btn { color: var(--band); background: #fff; border-color: #fff; }
.icon-btn { border: none; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; line-height: 1; }
.icon-btn:hover { color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea, .inline-form > input, .inline-form > select, textarea {
  font: inherit; font-weight: 400; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px 18px; }
.form .wide { grid-column: 1 / -1; }
.form h2 { margin-bottom: 0; }
.form-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > input, .inline-form > select { width: auto; flex: 1; min-width: 160px; }
fieldset { border: none; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.radio { display: block; font-weight: 400; margin: 4px 0; }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-family: ui-monospace, Consolas, monospace !important; }
.segmented { display: flex; flex-wrap: wrap; gap: 0; }
.segmented legend { width: 100%; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 10px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; }
.segmented label:first-of-type span { border-radius: 9px 0 0 9px; }
.segmented label:last-of-type span { border-radius: 0 9px 9px 0; }
.segmented label + label span { border-left: none; }
.segmented input:checked + span { background: var(--band); color: #fff; border-color: var(--band); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; flex-direction: row; }
.swatches legend { width: 100%; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 32px; height: 32px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.dropzone { display: flex; align-items: center; gap: 16px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; cursor: pointer; background: var(--tint); }
.dropzone:hover { border-color: var(--brand); }
.dropzone input { max-width: 260px; }
.danger-zone { border-color: var(--bad-soft); }

.flash, .note { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--good-soft); color: var(--good); font-weight: 500; }
.flash-bad, .note-bad { background: var(--bad-soft); color: var(--bad); }

.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--tint); border: 1px solid var(--line); color: var(--muted); }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .12em; background: var(--tint); padding: 2px 8px; border-radius: 6px; }
.code-lg { display: block; font-size: 1.8rem; padding: 4px 14px; margin-top: 4px; }
.count { font-size: .78em; font-weight: 600; opacity: .7; }
.bar { display: inline-block; vertical-align: middle; width: 100%; max-width: 140px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--good)); border-radius: 99px; }
.bar-lg { max-width: 360px; height: 10px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table form { margin: 0; }
.table select { font: inherit; font-size: .88rem; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.score { font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.score-good { background: var(--good-soft); color: var(--good); }
.score-mid { background: var(--mid-soft); color: var(--mid); }
.score-low { background: var(--bad-soft); color: var(--bad); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: none; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--band); }
@media (prefers-color-scheme: dark) { .tabs a.on { border-bottom-color: var(--brand); } }
.tabs-sm { margin: 0; border: none; }
.tabs-sm a { padding: 4px 10px; font-size: .85rem; border: 1px solid var(--line); border-radius: 99px; margin: 0; }
.tabs-sm a.on { background: var(--band); color: #fff; border-color: var(--band); }

/* Landing */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; padding: 32px 0 48px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); margin-bottom: 1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; font-size: .8rem; color: var(--brand); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.hero-card { background: var(--card); border-radius: 16px; box-shadow: 0 20px 50px rgba(43,47,102,.18); padding: 22px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); transform: rotate(1.5deg); }
.demo-head { background: var(--band); color: #fff; border-radius: 10px; padding: 12px 16px; font-family: var(--serif); font-weight: 700; }
.demo-block { border: 1.5px solid var(--points); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.demo-block b { color: var(--points); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.demo-block span { height: 8px; border-radius: 4px; background: var(--points-bg); }
.demo-block span.short { width: 60%; }
.demo-flip { border-radius: 10px; background: var(--terms-bg); border: 1.5px solid var(--terms); padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.demo-term { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; color: var(--terms); }
.demo-score { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: .9rem; color: var(--quiz); }
.demo-score .bar { --c: var(--quiz); flex: 1; max-width: none; }
.audiences { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.audiences h2 { font-size: 1.2rem; }
.steps { margin: 0; padding-left: 1.3rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 32px; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.stat b { font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .86rem; }
.continue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.continue { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.continue:hover { box-shadow: var(--shadow); border-color: var(--c); }
.join p { max-width: 60ch; }
.join .inline-form { max-width: 420px; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 20px; }
.subject-card { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .12s; }
.subject-card:hover { transform: translateY(-2px); border-color: var(--c); }
.subject-band { width: 8px; background: var(--c); flex: none; }
.subject-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; flex: 1; min-width: 0; }
.subject-body strong { font-family: var(--serif); font-size: 1.2rem; }
.subject-meta { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.subject-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 6px; }
.subject-foot .bar { --c: inherit; max-width: 110px; }

/* Subject page */
.progress-line { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.topic-list { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 8px; }
.topic { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.topic-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--tint); color: var(--c); border: 2px solid var(--c); }
.topic.is-done .topic-num { background: var(--c); color: #fff; }
.topic-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topic-title { font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.topic-title:hover { color: var(--brand); text-decoration: underline; }
.topic-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 8px; width: 250px; display: flex; flex-direction: column; gap: 2px; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: .9rem; background: none; border: none; color: var(--ink); cursor: pointer; text-decoration: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--tint); }
.menu-pop .danger { color: var(--bad); }
.menu-pop .small { padding: 6px 10px 2px; }
.pill-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.pill-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-left: 4px solid var(--c); background: var(--tint); border-radius: 6px; }
.pill-list form { margin-left: auto; }
.invite { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.copy-row { display: flex; gap: 8px; margin-top: 4px; }
.copy-row input { flex: 1; font: inherit; font-size: .9rem; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--tint); color: var(--ink); min-width: 0; }
.term-results dt { font-weight: 700; margin-top: 12px; }
.term-results dt a { font-weight: 400; margin-left: 8px; }
.term-results dd { margin: 2px 0 0; color: var(--muted); }

/* Topic page */
.guide-head { background: var(--c); color: #fff; border-radius: 14px; padding: 22px 26px 0; margin-bottom: 24px; }
.guide-head .crumbs, .guide-head .crumbs a { color: rgba(255,255,255,.85); }
.guide-head h1 { color: #fff; }
.tabs-light { border: none; margin: 14px 0 0; }
.tabs-light a { color: rgba(255,255,255,.75); border-bottom-width: 4px; }
.tabs-light a.on, .tabs-light a:hover { color: #fff; border-bottom-color: #fff; }
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 28px; align-items: start; }
.guide-side { position: sticky; top: 80px; }
.guide-side h2 { font-size: 1.05rem; }
.side-stat { display: flex; justify-content: space-between; margin: 10px 0 4px; font-size: .9rem; }
.guide-side .bar { max-width: none; margin-bottom: 8px; }
.guide-side form { margin-top: 14px; }
.topic-nav { display: flex; flex-direction: column; gap: 4px; }
.topic-nav a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.topic-nav a:hover { background: var(--tint); }
.topic-nav .btn { margin-top: 8px; align-self: flex-start; }

/* Imported guide content: the Study Guide look, inside the site. */
.guide-body { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px; line-height: 1.65; }
.guide-body .chapter-title { display: flex; align-items: baseline; gap: 10px; background: var(--band); color: #fff; border-radius: 10px; padding: 10px 16px; margin: 2rem 0 1rem; font-size: 1.35rem; }
.guide-body .chapter-title:first-child { margin-top: 0; }
.guide-body .chapter-title .num { background: rgba(255,255,255,.2); border-radius: 6px; padding: 0 .5rem; font-size: 1rem; font-family: Inter, sans-serif; }
.guide-body .overview { background: var(--tint); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin: 0 0 1.4rem; font-size: 1.04rem; }
.guide-body .block { border: 1.5px solid var(--hue, var(--line)); border-radius: 10px; margin: 1.2rem 0; background: var(--hue-bg, var(--tint)); }
.guide-body .block > h3 { margin: 0; background: var(--hue, var(--band)); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; padding: .5rem 1rem; border-radius: 7px 7px 0 0; }
@media (prefers-color-scheme: dark) { .guide-body .block > h3 { color: #111; } }
.guide-body .block > .body { padding: .95rem 1.2rem; background: var(--card); border-radius: 0 0 8px 8px; }
.guide-body .block > .body > :last-child { margin-bottom: 0; }
.guide-body .points { --hue: var(--points); --hue-bg: var(--points-bg); }
.guide-body .picture { --hue: var(--picture); --hue-bg: var(--picture-bg); }
.guide-body .develop { --hue: var(--develop); --hue-bg: var(--develop-bg); }
.guide-body .glossary { --hue: var(--terms); --hue-bg: var(--terms-bg); }
.guide-body .selftest { --hue: var(--quiz); --hue-bg: var(--quiz-bg); }
.guide-body .block.content { border: none; background: none; }
.guide-body .block.content > .body { padding: 0; }
.guide-body ul, .guide-body ol { padding-left: 1.3rem; margin: 0 0 .5rem; }
.guide-body li { margin: .3rem 0; }
.guide-body .block li::marker { color: var(--hue); font-weight: 700; }
.guide-body .outline > li > strong { color: var(--develop); }
.guide-body .outline ul { margin: .25rem 0 .7rem; }
.guide-body img { max-width: 100%; height: auto; }
.guide-body table { border-collapse: collapse; width: 100%; }
.guide-body td, .guide-body th { border-bottom: 1px solid var(--line); padding: .45rem .8rem .45rem 0; vertical-align: top; text-align: left; }
.guide-body table.terms td:first-child { font-weight: 700; color: var(--terms); width: 31%; }
.guide-body tr:last-child td { border-bottom: none; }
.guide-body .diagram { display: block; max-width: 100%; height: auto; margin: .3rem auto; background: #fff; border-radius: 8px; }
.guide-body .diagram-title { font-weight: 600; color: var(--picture); margin: .4rem 0; }
.guide-body .caption { color: var(--muted); font-size: .86rem; margin: .4rem 0 1rem; text-align: center; }
.guide-body .quiz li { margin-bottom: .7rem; }
.guide-body .quiz summary { color: var(--quiz); cursor: pointer; font-size: .88rem; font-weight: 600; margin-top: .2rem; }
.guide-body .answer { background: var(--quiz-bg); border-radius: 6px; padding: .5rem .8rem; margin-top: .35rem; }
.guide-body .answer p:last-child { margin: 0; }
.guide-body .caveat { background: var(--mid-soft); border-left: 4px solid var(--mid); padding: .7rem 1rem; font-size: .9rem; margin-top: 1.4rem; border-radius: 0 6px 6px 0; }

/* Specification */
.guide-body .fromspec { --hue: #2b2f66; --hue-bg: var(--brand-soft); }
.guide-body .spec { --hue: #5d6963; --hue-bg: var(--tint); }
@media (prefers-color-scheme: dark) { .guide-body .fromspec { --hue: var(--brand); } .guide-body .spec { --hue: var(--muted); } }
.guide-body .extra + .extra { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .9rem; }
.guide-body .extra h4 { margin: 0 0 .35rem; font-size: 1rem; }
.guide-body .extra p:last-child { margin-bottom: 0; }
.spec-ref { font-size: .7rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35em; vertical-align: middle; white-space: nowrap; }
.spec-req { border-bottom: 1px solid var(--line); padding: .45rem 0; }
.spec-req:last-of-type { border-bottom: none; }
.spec-req summary { cursor: pointer; font-weight: 600; }
.spec-req .chip { margin-left: .4rem; }
.spec-code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; color: var(--muted); font-weight: 600; }
.spec-body { font-size: .93rem; padding: .4rem 0 0 .2rem; }
.spec-body ul { margin: 0 0 .6rem; }
.spec-body p { margin-bottom: .5rem; }
.chip.cov-covered { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.cov-partial { background: var(--mid-soft); color: var(--mid); border-color: transparent; }
.chip.cov-missing { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
a.chip { text-decoration: none; }
.spec-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 20px; margin-bottom: 12px; }
.spec-point { border-bottom: 1px solid var(--line); padding: 8px 0; }
.spec-point:last-child { border-bottom: none; }
.spec-point summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.spec-point.depth-3 summary .spec-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.spec-point.depth-4 { padding-left: 16px; } .spec-point.depth-4 .spec-title { font-weight: 600; }
.spec-point.depth-5 { padding-left: 32px; }
.spec-point .spec-body { padding-left: 4px; color: var(--muted); }
.spec-links { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.spec-picks { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.spec-picks label { font-size: .92rem; }
.spec-picks .depth-4 { padding-left: 18px; } .spec-picks .depth-5 { padding-left: 36px; }
.cov-list { list-style: none; padding: 0; margin: 0 0 12px; }
.cov-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.cov-list .chip { margin-right: 6px; }
.extra-edit { display: flex; flex-direction: column; gap: 12px; border-left: 5px solid var(--brand); }
.extra-edit.kind-tip { border-left-color: var(--mid); }
.extra-edit.kind-term { border-left-color: var(--terms); }
.extra-edit.kind-question { border-left-color: var(--quiz); }
.extra-meta { margin: 0; }
.btn[disabled] { opacity: .65; cursor: progress; }

/* Key-term definitions on highlighted words */
mark.has-def { cursor: help; text-decoration: underline dotted; text-decoration-color: var(--mid); text-underline-offset: 3px; }
mark.has-def:hover, mark.has-def:focus-visible { background: #fbe39a; outline: none; }
@media (prefers-color-scheme: dark) { mark.has-def:hover, mark.has-def:focus-visible { background: #7a6418; } }
mark.auto { background: rgba(247, 201, 72, .28); }
.term-tip { position: absolute; z-index: 50; max-width: min(340px, calc(100vw - 16px)); background: var(--ink); color: var(--bg);
  font-size: .88rem; line-height: 1.45; padding: 9px 12px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); pointer-events: none; }
.term-tip strong { display: block; color: #f7c948; margin-bottom: 2px; }
.term-tip[hidden] { display: none; }
@media print { mark.has-def { text-decoration: none; } .term-tip { display: none; } }

/* Practice: quiz, quick-fire and the Practice page */
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 10px; }
.quiz-progress { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; }
.quiz-progress .bar { max-width: 320px; height: 9px; --c: var(--quiz); }
.quiz-progress .bar i { transition: width .3s; }
.quiz-dots { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.quiz-dots button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: var(--muted); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; }
.quiz-dots button:hover { border-color: var(--quiz); }
.quiz-dots button.current { border-color: var(--quiz); color: var(--quiz); box-shadow: 0 0 0 3px var(--quiz-bg); }
.quiz-dots button.r-got { background: var(--good); border-color: var(--good); color: #fff; }
.quiz-dots button.r-partly { background: var(--mid); border-color: var(--mid); color: #fff; }
.quiz-dots button.r-missed { background: var(--bad); border-color: var(--bad); color: #fff; }
.quiz-topic { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; font-size: .75rem; }
.points-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.points-list label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; line-height: 1.5; }
.points-list label:hover { border-color: var(--quiz); }
.points-list input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--good); }
.points-list label:has(input:checked) { background: var(--good-soft); border-color: var(--good); }
.score-line { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; padding: 10px 14px; border-radius: 10px; }
.score-line.r-got { background: var(--good-soft); color: var(--good); }
.score-line.r-partly { background: var(--mid-soft); color: var(--mid); }
.score-line.r-missed { background: var(--bad-soft); color: var(--bad); }
.revise { background: var(--tint); border-radius: 10px; padding: 10px 16px; margin-bottom: 12px; }
.revise ul { margin: 0 0 .4rem; padding-left: 1.2rem; }
.revise li { margin: .3rem 0; }
.model-full { margin-top: 10px; }
.model-full summary { cursor: pointer; color: var(--quiz); font-weight: 600; font-size: .9rem; }
.model-full .model-answer { margin-top: 8px; }
.quiz-summary h2 { margin-bottom: .3rem; }
.summary-list { padding-left: 0; list-style: none; margin: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.summary-list li { display: flex; gap: 10px; align-items: baseline; }
.summary-list .chip { flex: none; min-width: 54px; text-align: center; }
.chip.r-got { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.r-partly { background: var(--mid-soft); color: var(--mid); border-color: transparent; }
.chip.r-missed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.summary-q { background: none; border: none; padding: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.summary-q:hover { color: var(--brand); text-decoration: underline; }
.summary-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qf-stats { display: flex; gap: 16px; font-size: .9rem; }
.qf-stats b { font-size: 1.1rem; }
.qf-card { border-top: 5px solid var(--terms); }
.qf-label { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; font-size: .75rem; }
.qf-q { font-size: 1.15rem; line-height: 1.55; margin-bottom: 16px; }
.qf-q.qf-term { font-family: var(--serif); font-size: 1.8rem; font-weight: 700; color: var(--terms); }
.qf-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qf-options.qf-long { grid-template-columns: 1fr; }
.qf-option { text-align: left; font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); cursor: pointer; line-height: 1.45; }
.qf-option:hover:not(:disabled) { border-color: var(--terms); background: var(--terms-bg); }
.qf-option:disabled { cursor: default; opacity: .7; }
.qf-option.right { border-color: var(--good); background: var(--good-soft); opacity: 1; }
.qf-option.wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.qf-option kbd { margin: 0 6px 0 0; }
.qf-feedback { min-height: 1.5em; margin: 14px 0 6px; font-weight: 600; }
.qf-feedback.good { color: var(--good); }
.qf-feedback.bad { color: var(--bad); font-weight: 500; }
.practice-cta { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--quiz-bg); border: 1.5px solid var(--quiz); border-radius: 12px; padding: 16px 20px; margin: 1.4rem 0; }
.practice-cta h3 { margin: 0 0 .2rem; color: var(--quiz); font-size: 1.1rem; }
.practice-cta p { margin: 0; }
.practice-cta-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.practice-filters { display: flex; gap: 10px 20px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.practice-filters select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
@media (max-width: 600px) { .qf-options { grid-template-columns: 1fr; } }

/* Group page: key-point scores */
.table tr.row-on td { background: var(--brand-soft); }
.answers-table .topic-row td { background: var(--tint); font-weight: 600; font-size: .85rem; }
.answers-table tr.muted td { color: var(--muted); }
.missed-points summary { color: var(--bad); cursor: pointer; margin-top: 4px; }
.missed-points ul { margin: 4px 0 0; padding-left: 1.2rem; color: var(--muted); }
.hard-list > li { padding: 12px 0; }
.hard-head { display: flex; gap: 12px; align-items: flex-start; }
.hard-head .score { flex: none; margin-top: 2px; }
.hard-missed-label { margin: 8px 0 2px 58px; color: var(--muted); }
.hard-missed { margin: 0 0 0 58px; padding-left: 1.1rem; }
.hard-missed li { margin: 3px 0; }
@media (max-width: 600px) { .hard-missed-label, .hard-missed { margin-left: 0; } }

/* Chapters on the subject page */
.chapter-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.chapter-head-row:first-of-type { margin-top: 8px; }
.chapter-name { font-size: 1.25rem; margin: 0; }
.chapter-empty { margin: 4px 0 12px; }
.chapter-head-row + .topic-list, .chapter-empty + .topic-list { margin-bottom: 8px; }

/* Rearrange page */
.arrange-status { min-height: 1.4em; margin: 0 0 6px; text-align: right; }
.arr-section { padding: 14px 16px; }
.arr-section.dragging { opacity: .5; }
.arr-section.drop-target { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.arr-none { background: var(--tint); }
.arr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.arr-title { flex: 1; font: 700 1.1rem var(--serif); border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; background: transparent; color: var(--ink); min-width: 0; }
.arr-title:hover { border-color: var(--line); }
.arr-title:focus { background: var(--card); }
.arr-title-static { flex: 1; font-size: 1.1rem; margin: 0; padding: 6px 8px; }
.arr-count { white-space: nowrap; }
.arr-del { margin: 0; }
.arr-handle { cursor: grab; color: var(--muted); font-size: 1.1rem; padding: 0 4px; user-select: none; }
.arr-list { list-style: none; margin: 0; padding: 0; min-height: 44px; display: flex; flex-direction: column; gap: 6px; border-radius: 8px; }
.arr-list.is-empty { border: 2px dashed var(--line); }
.arr-list.is-empty::before { content: attr(data-empty); color: var(--muted); font-size: .88rem; padding: 10px 14px; }
.arr-topic { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: grab; }
.arr-topic:hover { border-color: var(--muted); }
.arr-topic.dragging { opacity: .45; border-style: dashed; }
.arr-topic-title { flex: 1; font-weight: 600; min-width: 0; }
.arr-topic select { font: inherit; font-size: .85rem; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 200px; }
.arr-topic .icon-btn:hover, .arr-head .icon-btn:hover { color: var(--brand); }
@media (max-width: 600px) { .arr-topic { flex-wrap: wrap; } .arr-topic-title { flex-basis: calc(100% - 30px); } }

/* Narrated slideshow player */
.player { background: #11131f; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 34px rgba(0,0,0,.25); }
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #fff; overflow: hidden; }
.stage { position: absolute; inset: 0; cursor: pointer; container-type: inline-size; }
.slide { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 5.5cqw 6cqw 9cqw; background: linear-gradient(135deg, #fff 60%, #f6f4ee); color: #1b1b1f; border-top: 1.4cqw solid var(--c); }
.slide-count { position: absolute; top: 2.4cqw; right: 3cqw; font-size: 1.5cqw; color: #8a8a96; font-weight: 600; }
.slide-title { font-family: var(--serif); font-size: 4.4cqw; line-height: 1.15; margin: 0 0 3cqw; color: #1b1b1f; letter-spacing: -.01em; }
.slide-body { flex: 1; display: flex; gap: 4cqw; align-items: center; min-height: 0; }
.slide-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.8cqw; flex: 1; }
.slide-points li { font-size: 2.9cqw; line-height: 1.35; padding-left: 3.4cqw; position: relative; opacity: 0; transform: translateY(1cqw); transition: opacity .5s, transform .5s; }
.slide-points li::before { content: ''; position: absolute; left: 0; top: .6em; width: 1.4cqw; height: 1.4cqw; border-radius: 50%; background: var(--c); }
.slide-points li.shown { opacity: 1; transform: none; }
.slide-points mark { font-size: inherit; }
.slide-diagram { flex: 1.25; margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; }
.slide-diagram svg { width: 100%; max-height: 100%; height: auto; }
.slide-diagram figcaption { font-size: 1.6cqw; color: #6b6b76; margin-top: 1cqw; text-align: center; }
.layout-diagram .slide-points li { font-size: 2.4cqw; }
.layout-title .slide { justify-content: center; background: var(--c); color: #fff; border-top: none; padding-bottom: 12cqw; }
.layout-title .slide-title { color: #fff; font-size: 6.2cqw; margin-bottom: 2cqw; }
.layout-title .slide-body { flex: none; }
.layout-title .slide-points li { font-size: 2.8cqw; padding-left: 0; color: rgba(255,255,255,.9); }
.layout-title .slide-points li::before { display: none; }
.layout-title .slide-count { color: rgba(255,255,255,.7); }
.layout-summary .slide { background: linear-gradient(135deg, #fff 55%, var(--good-soft)); }
.layout-summary .slide-points li::before { content: '✓'; background: none; color: var(--good); font-weight: 700; width: auto; height: auto; top: 0; font-size: 1em; }
.captions { position: absolute; left: 50%; bottom: 3.2%; transform: translateX(-50%); width: max-content; max-width: 88%; margin: 0; text-align: center;
  background: rgba(17, 19, 31, .82); color: #fff; font-size: clamp(.8rem, 1.9vw, 1.25rem); line-height: 1.4; padding: .35em .8em; border-radius: 8px; pointer-events: none; }
.captions.empty { display: none; }
.captions .now { color: #f7c948; }
.player-start { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; display: flex; align-items: center; gap: 12px;
  padding: 16px 28px 16px 22px; border-radius: 999px; border: none; background: rgba(17, 19, 31, .85); color: #fff; font: 600 1.15rem Inter, sans-serif; cursor: pointer; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.player-start:hover { background: var(--c); }
.play-icon { width: 0; height: 0; border-left: 18px solid currentColor; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.player-end { position: absolute; inset: 0; background: rgba(255,255,255,.96); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: #1b1b1f; }
.player-end h2 { font-size: clamp(1.3rem, 3.5vw, 2.2rem); }
.player-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; color: #fff; }
.pbtn { background: none; border: none; color: #fff; font: inherit; font-size: 1.05rem; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; flex: none; }
.pbtn:hover { background: rgba(255,255,255,.12); }
.pbtn-main { background: var(--c); }
.pbtn-main:hover { background: var(--c); filter: brightness(1.15); }
.pbtn-text { width: auto; padding: 0 8px; font-size: .82rem; font-weight: 700; color: rgba(255,255,255,.6); }
.pbtn-text.on { color: #fff; }
.player-track { flex: 1; display: flex; gap: 3px; min-width: 60px; }
.player-track .seg { height: 8px; padding: 0; border: none; border-radius: 3px; background: rgba(255,255,255,.22); cursor: pointer; overflow: hidden; flex-basis: 0; }
.player-track .seg i { display: block; height: 100%; width: 0; background: #f7c948; }
.player-track .seg.current { background: rgba(255,255,255,.35); }
.player-time { color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; white-space: nowrap; }
.player:fullscreen { display: flex; flex-direction: column; justify-content: center; border-radius: 0; }
.player:fullscreen .player-frame { max-height: calc(100vh - 56px); width: min(100vw, calc((100vh - 56px) * 16 / 9)); margin: 0 auto; }
@media (max-width: 600px) { .player-time, .js-full { display: none; } .pbtn { width: 32px; } }

/* Presentation editor */
.pres-status { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.slide-edit { display: flex; flex-direction: column; gap: 12px; border-left: 5px solid var(--good); }
.slide-edit.needs-voice { border-left-color: var(--mid); }
.slide-num { width: 30px; height: 30px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; font-weight: 700; margin-bottom: 6px; flex: none; }
.slide-edit-body { display: grid; grid-template-columns: 1fr 1.5fr; gap: 14px; }
.slide-audio { display: flex; align-items: center; gap: 10px; }
.slide-audio audio { height: 34px; }
@media (max-width: 900px) { .slide-edit-body { grid-template-columns: 1fr; } }

/* Parents and carers */
.narrow-card { max-width: 620px; }
.link-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.link-row form { margin: 0; }
.note .code-lg { margin: 10px 0; display: table; }
.activity { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 140px; align-items: end; margin: 8px 0 4px; }
.activity-day { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.activity-bar { width: 100%; max-width: 34px; background: var(--good); border-radius: 5px 5px 2px 2px; min-height: 0; }
.activity-day::before { content: ''; flex: 1; }
.activity-day { position: relative; }
.activity-label { font-size: .72rem; color: var(--muted); font-weight: 600; }
.activity-day.today .activity-label { color: var(--ink); text-decoration: underline; }
.parent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.parent-grid .card { margin-bottom: 0; }
.parent-grid + .card { margin-top: 16px; }
.parent-subjects li { border-left: 4px solid var(--c); padding-left: 12px; margin: 6px 0; }
.parent-subject-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.parent-subject-row .bar { --c: inherit; max-width: 160px; }
.help-card ul { margin: 0; padding-left: 1.2rem; }
.help-card li { margin: .35rem 0; }
@media (max-width: 900px) { .parent-grid { grid-template-columns: 1fr; } }

/* Import: topics that are already there */
.pending-form { border-left: 5px solid var(--mid); }
.pending-item { border-top: 1px solid var(--line); padding-top: 12px; }
.pending-item legend { float: left; width: 100%; margin-bottom: 2px; }
.pending-item p { clear: both; margin-bottom: 6px; }

/* Topic editor */
.block-edit { display: flex; flex-direction: column; gap: 12px; }
.block-edit-head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.block-edit-head .field.order { width: 90px; }
.del { font-size: .88rem; color: var(--bad); white-space: nowrap; padding-bottom: 10px; }
.block-edit-body { min-width: 0; }
.block-edit-body textarea { font-size: .82rem; line-height: 1.45; min-height: 160px; }
.preview { max-height: 420px; overflow: auto; padding: 14px 16px; font-size: .9rem; position: relative; }
.preview-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.rows-edit { display: flex; flex-direction: column; gap: 8px; }
.row-edit { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.row-edit.row-q { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; }
.row-edit input, .row-edit textarea { font: inherit; font-size: .92rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); width: 100%; }
.row-edit textarea.mono { font-size: .82rem; }
.row-new input, .row-new textarea { border-style: dashed; }
.save-bar { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px; box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.rich { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.rich:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }
.rich-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; background: var(--tint); border-bottom: 1px solid var(--line); }
.rich-bar button { font: inherit; font-size: .84rem; padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; min-width: 32px; }
.rich-bar button:hover { background: var(--card); border-color: var(--line); }
.rich-bar button.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.rich-bar button mark { padding: 0 3px; }
.rich-bar .rich-mode { margin-left: auto; font-family: ui-monospace, Consolas, monospace; font-size: .78rem; color: var(--muted); }
.rich-bar.code-mode button[data-cmd] { opacity: .35; pointer-events: none; }
.rich-area.guide-body { border: none; border-radius: 0; padding: 12px 16px; max-height: 560px; overflow-y: auto; font-size: .95rem; }
.rich-area:focus { outline: none; }
.rich-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-area h4 { font-size: 1.05rem; margin: .8rem 0 .3rem; }
.rich textarea { border: none; border-radius: 0; display: block; }
.rich textarea[hidden] { display: none; }
.rich-area svg { cursor: default; outline: 1px dashed var(--line); }
.row-q .rich-area.guide-body { min-height: 6em; padding: 8px 12px; font-size: .9rem; }
.side-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
@media (max-width: 900px) {
  .row-edit, .row-edit.row-q { grid-template-columns: 1fr; }
}

/* Flashcards and self-test */
.cards-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cards-opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.flashcard { position: relative; display: block; width: 100%; min-height: 300px; border: none; padding: 0; background: none; cursor: pointer; perspective: 1400px; font: inherit; color: var(--ink); }
.flashcard .face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 36px 40px 48px; border-radius: 16px;
  backface-visibility: hidden; transition: transform .45s; border: 1.5px solid var(--terms); box-shadow: var(--shadow); }
.flashcard .front { background: var(--card); font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; color: var(--terms); }
.flashcard .back { background: var(--terms-bg); transform: rotateY(180deg); font-size: 1.15rem; line-height: 1.6; }
.flashcard.flipped .front { transform: rotateY(-180deg); }
.flashcard.flipped .back { transform: rotateY(0); }
.flashcard.long .front { font-size: 1.15rem; font-family: Inter, sans-serif; font-weight: 400; line-height: 1.6; color: var(--ink); }
.flashcard .hint { position: absolute; bottom: 14px; left: 0; right: 0; color: var(--muted); z-index: 1; pointer-events: none; }
.cards-actions, .mark-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.cards-actions .btn { flex: 1; max-width: 240px; }
.cards-done { text-align: center; padding: 36px; }
.quiz-card { border-top: 5px solid var(--quiz); }
.quiz-q { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.4; }
.model-answer { background: var(--quiz-bg); border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; }
.model-answer p:last-child { margin: 0; }
.mark-row { justify-content: flex-start; }

@media (max-width: 900px) {
  .hero, .audiences { grid-template-columns: 1fr; }
  .hero-card { display: none; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-side { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .top-search { order: 5; width: 100%; margin: 0 0 10px; }
  .top-search input { width: 100%; }
  .nav-end { margin-left: auto; }
}
@media (max-width: 600px) {
  .top-in, .main { padding-left: 16px; padding-right: 16px; }
  .top-in { gap: 8px 12px; padding-top: 8px; }
  .nav a { padding: 6px 8px; font-size: .9rem; }
  .steps { grid-template-columns: 1fr; }
  .guide-body { padding: 18px 16px; }
  .guide-head { padding: 18px 18px 0; }
  .topic { flex-wrap: wrap; }
  .topic-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  h1 { font-size: 1.6rem; }
}
@media print {
  .top, .foot, .guide-side, .tabs, .js-all-answers, .glossary .btn { display: none !important; }
  body { background: #fff; }
  .guide-layout { display: block; }
  .guide-body { border: none; padding: 0; }
  .guide-head { background: none; color: #000; padding: 0; }
  .guide-head h1, .guide-head .crumbs, .guide-head .crumbs a { color: #000; }
  .guide-body .block, .guide-body tr { break-inside: avoid; }
  details > summary { display: none; }
  details > * { display: block !important; }
}

/* Private mode */
.coming-soon { max-width: 620px; margin: 12vh auto 0; text-align: center; }
.coming-soon img { border-radius: 16px; margin-bottom: 18px; }
.coming-soon h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }

/* Import: chapter picker */
.chapter-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; }
.chapter-pick p { grid-column: 1 / -1; margin: 0; }
.chapter-meta { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }

/* Videos and further reading */
.guide-body .resources { --hue: #b3261e; --hue-bg: #fbe9e7; }
@media (prefers-color-scheme: dark) { .guide-body .resources { --hue: #f2867d; --hue-bg: #3d1d1a; } }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-bottom: 18px; }
.video { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.video figcaption { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.video figcaption a { font-weight: 600; color: var(--ink); }
.video-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: none; border-radius: 10px; overflow: hidden; cursor: pointer; background: #000; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.video-thumb:hover img { transform: scale(1.03); }
.video-play { position: absolute; inset: 0; margin: auto; width: 58px; height: 40px; border-radius: 12px; background: rgba(204, 0, 0, .92); }
.video-play::after { content: ''; position: absolute; left: 23px; top: 11px; border-left: 16px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.video-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: #000; }
.link-list { list-style: none; padding: 0 !important; margin: 0 0 12px !important; display: flex; flex-direction: column; gap: 8px; }
.link-list li { margin: 0 !important; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; }
.link-list li::marker { content: ''; }
.link-list a { color: var(--ink); }
.resource-edit { display: flex; flex-direction: column; gap: 10px; border-left: 5px solid var(--good); }
.resource-edit.is-draft { border-left-color: var(--mid); }
.resource-edit-main { display: flex; gap: 14px; align-items: flex-start; }
.resource-thumb { border-radius: 8px; flex: none; }
.resource-icon { font-size: 1.8rem; width: 56px; text-align: center; flex: none; }
.resource-meta { margin: 0 0 6px; }
.resource-edit .field { margin-bottom: 8px; }
@media (max-width: 600px) { .resource-edit-main { flex-direction: column; } }
