/* OpenPrep UK - site styles. System fonts only; the one external request is KaTeX on maths pages. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #17213b;
  --muted: #566075;
  --line: #e4e0d6;
  --brand: #26358a;
  --brand-ink: #ffffff;
  --accent: #f5b83d;
  --cream: #fbefd9;
  --ok: #176b3a;
  --ok-bg: #e6f4ec;
  --note-bg: #f3f1ea;
  --focus: #1d4ed8;
  --lv: var(--brand);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(23, 33, 59, .06), 0 8px 24px rgba(23, 33, 59, .07);
  --shadow-lg: 0 14px 40px rgba(23, 33, 59, .16);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1424;
    --surface: #171e33;
    --ink: #e8ebf5;
    --muted: #a3acc4;
    --line: #2a3350;
    --brand: #8fa2ff;
    --brand-ink: #0f1424;
    --ok: #6fd69a;
    --ok-bg: #12301f;
    --note-bg: #1a2138;
    --focus: #9db0ff;
    --shadow: none;
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow { max-width: 780px; }
.center { text-align: center; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.18; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.5rem, 3.2vw, 2.05rem); }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.meta { color: var(--muted); font-size: .92rem; }
.fine { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.print-only { display: none; }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- header ---------- */
.site-header { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.bar { display: flex; align-items: center; gap: 22px; min-height: 68px; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.18rem; letter-spacing: -.01em; }
.logo { width: 38px; height: 38px; flex: none; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 9px 13px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.nav a:hover { background: var(--note-bg); }
.nav a[aria-current="page"] { background: var(--note-bg); box-shadow: inset 0 -3px 0 var(--accent); }
.search-form { position: relative; display: flex; align-items: center; }
.search-form .ic { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search-form input { font: inherit; font-size: .95rem; padding: 9px 16px 9px 38px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); width: 200px; }
.search-form input:focus, .hero-search input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }

/* ---------- buttons, chips ---------- */
.btn, .hero-search button {
  font: inherit; font-weight: 700; padding: 11px 22px; border-radius: 999px; border: 2px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; line-height: 1.3; transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover, .hero-search button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn.small { padding: 7px 16px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--brand); }
.chip { display: inline-block; background: var(--lv); color: #fff; font-weight: 700; font-size: .78rem; padding: 3px 11px; border-radius: 999px; letter-spacing: .01em; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(36px, 6vw, 72px) 0 clamp(36px, 6vw, 64px); background:
  radial-gradient(700px 360px at 92% 8%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
  radial-gradient(520px 320px at 4% 100%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 70%),
  var(--bg); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.eyebrow { font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .09em; font-size: .78rem; margin-bottom: 12px; }
.hl { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 75%, transparent) 62%); padding-inline: 2px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.hero-search { position: relative; display: flex; gap: 8px; max-width: 560px; margin-top: 24px; }
.hero-search .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.hero-search input { flex: 1; min-width: 0; font: inherit; padding: 15px 20px 15px 46px; font-size: 1rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.quick { list-style: none; padding: 0; margin: 18px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }
.quick a { display: inline-block; padding: 6px 15px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; border-left: 5px solid var(--lv); }
.quick a:hover { border-color: var(--lv); }
.hero-art { position: relative; }
.art-card { background: var(--cream); border-radius: 30px; padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); transform: rotate(1.4deg); aspect-ratio: 1200 / 896; }
.art-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.sticker { position: absolute; display: inline-flex; align-items: center; gap: 7px; background: var(--surface); color: var(--ink); font-weight: 800; font-size: .88rem; padding: 9px 15px; border-radius: 999px; box-shadow: var(--shadow-lg); border: 1.5px solid var(--line); }
.sticker .ic { color: var(--ok); }
.sticker.s1 { left: -14px; top: 9%; transform: rotate(-4deg); }
.sticker.s2 { right: -10px; bottom: 7%; transform: rotate(3deg); }

/* ---------- stats ---------- */
.stats { background: var(--brand); color: var(--brand-ink); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 8px; padding-block: 22px; text-align: center; }
.stats strong { display: block; font-family: var(--serif); font-size: clamp(1.6rem, 3.4vw, 2.3rem); line-height: 1.1; }
.stats span { font-size: .86rem; opacity: .9; }

/* ---------- sections ---------- */
.block { padding-block: clamp(30px, 5vw, 54px); }
.sec-head { max-width: 62ch; margin-bottom: 24px; }
.sec-head p { color: var(--muted); margin: 0; }
.band { background: var(--note-bg); border-block: 1px solid var(--line); padding-block: clamp(34px, 5vw, 58px); }
.band.alt { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.grid { display: grid; gap: 20px; }
.levels { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.subjects { grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); }
.topics { grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); }
.boards { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; position: relative; }
.card h3 { margin-bottom: .3em; }
.card p { color: var(--muted); font-size: .96rem; }
.more { font-weight: 700; }

/* level cards */
.level-card { border-top: 6px solid var(--lv); padding-top: 14px; transition: transform .16s ease, box-shadow .16s ease; display: flex; flex-direction: column; gap: 6px; }
.level-card:hover, .subject-card:hover, .topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.level-card .art { display: grid; place-items: center; height: 138px; margin: 0 -6px 4px; border-radius: 12px; background: color-mix(in srgb, var(--lv) 9%, var(--surface)); }
.art-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; mix-blend-mode: normal; }
.level-card .art-img { height: 124px; width: auto; }
.art-fallback { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 26px; background: var(--lv); color: #fff; }
.art-fallback .ic { width: 42px; height: 42px; }
.level-card h3 { font-size: 1.35rem; margin: 6px 0 0; }
.level-card p { flex: 1; margin: 0; }
.level-card .go { position: absolute; right: 16px; bottom: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--lv); color: #fff; display: grid; place-items: center; transition: transform .16s ease; }
.level-card:hover .go { transform: translateX(3px); }
.level-card .meta { padding-right: 44px; }

/* subject icons */
.sico { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: color-mix(in srgb, var(--lv) 14%, var(--surface)); color: var(--lv); flex: none; }
.sico .ic { width: 22px; height: 22px; }
.sico.lg { width: 50px; height: 50px; border-radius: 15px; margin-bottom: 12px; background: var(--lv); color: #fff; }
.sico.lg .ic { width: 28px; height: 28px; }
.sico.xl { width: 104px; height: 104px; border-radius: 30px; background: var(--lv); color: #fff; box-shadow: var(--shadow-lg); transform: rotate(-4deg); }
.sico.xl .ic { width: 58px; height: 58px; }
.subject-card { border-top: 6px solid var(--lv); transition: transform .16s ease, box-shadow .16s ease; }
.progress { height: 8px; border-radius: 999px; background: var(--note-bg); overflow: hidden; margin: 10px 0 8px; }
.progress span { display: block; height: 100%; background: var(--lv); min-width: 3px; border-radius: 999px; }

/* topic cards and feature tags */
.topic-card { transition: transform .16s ease, box-shadow .16s ease; display: flex; flex-direction: column; gap: 4px; }
.tc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.topic-card h3 { margin: 0 0 .15em; }
.topic-card p { margin: 0 0 .7em; flex: 1; }
.ftags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ft { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 999px; background: var(--note-bg); color: var(--muted); }
.ft .ic { width: 14px; height: 14px; }
.ft.vid { background: color-mix(in srgb, #e11d48 12%, var(--surface)); color: #be123c; }
@media (prefers-color-scheme: dark) { .ft.vid { color: #fda4af; } }
.done-mark { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 800; color: var(--ok); background: var(--ok-bg); padding: 3px 10px; border-radius: 999px; }
.done-mark[hidden] { display: none; }

/* steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 28px; counter-reset: s; }
.steps li { text-align: left; }
.step-art { display: grid; place-items: center; height: 150px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin-bottom: 14px; }
.step-art .art-img { height: 128px; width: auto; }
.steps h3 { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; }
.steps .n { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #17213b; font-weight: 800; display: grid; place-items: center; font-size: .95rem; }
.steps p { color: var(--muted); margin: 0; }

/* split + boards */
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(24px, 5vw, 56px); align-items: center; }
.split-art { display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-radius: 28px; min-height: 240px; padding: 24px; }
.split-art .art-img { max-height: 260px; width: auto; }
.board-chips { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.board-chips a { display: inline-block; padding: 7px 16px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; }
.board-chips a:hover { border-color: var(--brand); color: var(--brand); }

/* faq */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--brand); transition: transform .15s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding-bottom: 6px; }

/* page heads */
.page-head { padding: 30px 0 28px; background:
  radial-gradient(520px 220px at 94% 0%, color-mix(in srgb, var(--lv) 16%, transparent), transparent 70%),
  linear-gradient(180deg, color-mix(in srgb, var(--lv) 9%, var(--bg)), var(--bg)); border-bottom: 1px solid var(--line); }
.page-head h1 { margin-top: 10px; font-size: clamp(1.9rem, 4.4vw, 2.9rem); }
.head-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.head-art { display: grid; place-items: center; }
.head-art .art-img.big { max-height: 190px; width: auto; }
.head-art .art-fallback { width: 110px; height: 110px; border-radius: 32px; }
.head-art .art-fallback .ic { width: 56px; height: 56px; }
.head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0 0; }
.progress-pill { font-weight: 700; font-size: .9rem; color: var(--ok); background: var(--ok-bg); padding: 6px 14px; border-radius: 999px; }
.progress-pill[hidden] { display: none; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 4px; }
.facts { list-style: none; padding: 0; margin: 14px 0 10px; display: flex; gap: 8px 22px; flex-wrap: wrap; color: var(--muted); font-size: .92rem; }
.facts strong { color: var(--ink); margin-right: 4px; }
.note-box { background: var(--note-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 26px; margin-block: 8px; }
.note-box h2 { font-size: 1.35rem; }
.note-box ol, .note-box ul { padding-left: 1.3em; }
.pill-list { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.pill-list a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border: 1.5px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--surface); font-weight: 600; font-size: .95rem; color: var(--ink); }
.pill-list a:hover { border-color: var(--brand); }
.unit-h { font-family: var(--sans); margin-top: 34px; padding-bottom: 8px; border-bottom: 2px solid var(--line); font-size: 1.2rem; border-left: 6px solid var(--lv); padding-left: 12px; }

/* empty and 404 */
.empty, .notfound { text-align: center; max-width: 560px; margin: 20px auto; }
.empty-art { display: grid; place-items: center; margin: 0 auto 16px; }
.empty-art .art-img { height: 170px; width: auto; }
.empty-art.lg .art-img { height: 230px; }
.empty-art .art-fallback { width: 90px; height: 90px; }
.notfound .hero-search { margin-inline: auto; margin-bottom: 20px; text-align: left; }

/* topic list */
.topic-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.topic-list li > a, .topic-list li > .row { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; min-height: 62px; }
.topic-list li > .row { flex-direction: row; align-items: center; justify-content: space-between; }
.topic-list li.live > a:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.topic-list li.planned > .row { background: transparent; color: var(--muted); font-weight: 500; border-style: dashed; }
.tl-title { display: flex; align-items: center; gap: 9px; }
.tick { display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; place-items: center; flex: none; }
.tick .ic { width: 13px; height: 13px; }
a.is-done .tick { display: grid; }
.tag { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--note-bg); color: var(--muted); white-space: nowrap; }

/* ---------- topic page ---------- */
.topic-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 44px; padding-block: 36px; align-items: start; }
.side { position: sticky; top: 90px; font-size: .92rem; }
.side ul { list-style: none; padding-left: 0; margin: 8px 0 0; }
.side ul ul { padding-left: 14px; border-left: 2px solid var(--line); margin: 4px 0 6px 2px; }
.side a { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; }
.side a:hover, .side a.on { color: var(--brand); }
.side a.on { font-weight: 700; }
.done-btn { margin-top: 16px; width: 100%; justify-content: center; }
.done-btn[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.3em; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose blockquote { margin: 1.2em 0; padding: 15px 20px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border-left: 5px solid var(--accent); border-radius: 0 14px 14px 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; display: block; overflow-x: auto; max-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose th { background: var(--note-bg); }
.prose code { background: var(--note-bg); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.sect { padding-bottom: 12px; margin-bottom: 30px; scroll-margin-top: 90px; }
.sect > .sect-h, .sect-bar .sect-h { font-size: 1.7rem; padding-bottom: 8px; border-bottom: 3px solid var(--accent); display: inline-block; margin-top: 0; }
.sect-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.worksheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 28px 10px; box-shadow: var(--shadow); }
.worksheet > ol { padding-left: 1.4em; }
.worksheet > ol > li { margin-bottom: 1.1em; padding-left: .3em; }
.worksheet li > ul, .answers li > ul { list-style: none; padding-left: 0; margin: .4em 0 0; }
.worksheet li > ul li, .answers li > ul li { margin: .35em 0; }
.answers { margin-top: 20px; background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); border-radius: var(--radius); padding: 6px 28px 14px; }
.answers[hidden] { display: none; }
.answers h3 { margin-top: .8em; }
.answers > ol { padding-left: 1.4em; }
.answers > ol > li { margin-bottom: .9em; }

/* video + downloads */
.video { margin: 0 0 22px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-el { width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); background: #000; box-shadow: var(--shadow-lg); display: block; }
.video figcaption { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.dl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.dl { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 700; }
.dl:hover { border-color: var(--brand); }
.dl .ic { color: var(--brand); width: 22px; height: 22px; }
.dl span { flex: 1; }
.dl em { font-style: normal; font-size: .75rem; padding: 3px 9px; border-radius: 999px; background: var(--note-bg); color: var(--muted); }

/* quiz */
.quiz-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.quiz-q fieldset { border: 0; padding: 0; margin: 0; }
.quiz-q legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.quiz-opt { display: block; width: 100%; text-align: left; font: inherit; padding: 11px 15px; margin: 7px 0; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.quiz-opt:hover:not(:disabled) { border-color: var(--brand); }
.quiz-opt.right { border-color: var(--ok); background: var(--ok-bg); }
.quiz-opt.wrong { border-color: #b3261e; background: color-mix(in srgb, #b3261e 12%, var(--bg)); }
.quiz-opt:disabled { cursor: default; }
.quiz-why { margin-top: 10px; padding: 11px 15px; border-radius: 12px; background: var(--note-bg); font-size: .96rem; }
.quiz-score { font-weight: 800; font-size: 1.15rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 32px; }
.pager a { padding: 15px 20px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; background: var(--surface); color: var(--ink); display: block; }
.pager a:hover { border-color: var(--brand); }
.pager a.next { text-align: right; }
.pager small { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
.pager span { font-weight: 700; }

/* search results */
.results { list-style: none; padding: 0; display: grid; gap: 10px; }
.results a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); }
.results a:hover { border-color: var(--brand); }
.results small { color: var(--muted); display: block; }
.results .soon { opacity: .65; }

/* footer */
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 28px; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; gap: 26px; margin-bottom: 24px; }
.foot-grid ul { list-style: none; padding: 0; margin: 8px 0 0; }
.foot-grid li { margin: 5px 0; }
.foot-grid a { color: var(--muted); text-decoration: none; }
.foot-grid a:hover { color: var(--brand); text-decoration: underline; }
.foot-brand .logo { width: 34px; height: 34px; }
.foot-tag { color: var(--muted); margin-top: 10px; max-width: 34ch; font-size: .95rem; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 540px; }
  .head-grid { grid-template-columns: minmax(0, 1fr); }
  .head-art { display: none; }
  .sticker.s1 { left: 6px; }
  .sticker.s2 { right: 6px; }
}
@media (max-width: 860px) {
  .topic-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side { position: static; margin-bottom: 18px; padding: 14px 16px; background: var(--note-bg); border-radius: 14px; }
  .side ul ul { display: none; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .nav { order: 3; flex-basis: 100%; }
  .pager { grid-template-columns: 1fr; }
  .site-header { position: static; }
  .bar { flex-wrap: wrap; gap: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .nav::-webkit-scrollbar { display: none; }
  .search-form { margin-left: auto; }
  .topic-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .worksheet, .answers { padding-inline: 16px; }
  .hero-search { flex-direction: column; }
  .hero-search .ic { top: 26px; }
  .hero-search button { justify-content: center; }
  .search-form input { width: 150px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
  .art-card { transform: none; }
  .sticker { font-size: .8rem; padding: 7px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .level-card, .subject-card, .topic-card, .btn { transition: none; }
}

/* ---------- print: worksheet only ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --line: #bbb; --muted: #333; }
  body { font-size: 12pt; background: #fff; color: #000; }
  .site-header, .site-footer, .side, .no-print, .pager, .crumbs, .facts, .page-head .lead, .ftags, .head-art { display: none !important; }
  .print-only { display: block; }
  .page-head { background: none; border: 0; padding: 0; }
  .topic-layout { display: block; padding: 0; }
  .wrap { width: 100%; }
  .worksheet { border: 0; padding: 0; box-shadow: none; }
  .answers { display: none !important; }
  a { color: #000; text-decoration: none; }
  body.print-worksheet #notes, body.print-worksheet #past-papers, body.print-worksheet #video, body.print-worksheet .page-head { display: none !important; }
  .ws-head { border-bottom: 2px solid #000; margin-bottom: 14px; padding-bottom: 6px; }
  .ws-head p { margin: 0 0 6px; }
}


/* ---------- merged site: header actions, textbook, tutors ---------- */
.hdr-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }
.hdr-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink); text-decoration: none; }
.hdr-icon:hover { background: var(--note-bg); }
.hdr-icon .ic { width: 20px; height: 20px; }
.hdr-link { padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem; white-space: nowrap; }
.hdr-link:hover { background: var(--note-bg); }
.hero-tutor { margin: 16px 0 0; color: var(--muted); font-size: .98rem; }
.hero-tutor a { font-weight: 700; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; }
.book-band { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 9%, var(--bg)), color-mix(in srgb, var(--accent) 14%, var(--bg))); }
.book-facts { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); }
.book-facts strong { color: var(--ink); font-family: var(--serif); font-size: 1.5rem; margin-right: 4px; }
.book-callout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--lv); border-radius: var(--radius); padding: 22px 26px; box-shadow: var(--shadow); }
.bc-art { display: grid; place-items: center; background: color-mix(in srgb, var(--lv) 8%, var(--surface)); border-radius: 18px; min-height: 150px; }
.bc-art .art-img { max-height: 150px; width: auto; }
.bc-body h2 { margin-bottom: .3em; }
.bc-body p { color: var(--muted); }
.tutor-band { background: color-mix(in srgb, #7c3aed 7%, var(--bg)); }
.tutor-cards { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.tutor-card { display: flex; flex-direction: column; gap: 6px; transition: transform .16s ease, box-shadow .16s ease; border-top: 6px solid #7c3aed; }
.tutor-card.alt { border-top-color: var(--accent); }
.tutor-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tc-art { display: grid; place-items: center; height: 150px; border-radius: 14px; background: color-mix(in srgb, #7c3aed 8%, var(--surface)); margin-bottom: 6px; }
.tutor-card.alt .tc-art { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.tc-art .art-img { height: 130px; width: auto; }
.tc-cta { margin-top: auto; font-weight: 800; color: var(--brand); display: inline-flex; align-items: center; gap: 6px; }
.tutor-links { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tutor-links a { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; }
.tutor-links a:hover { border-color: var(--brand); }
.tutor-note { margin-top: 16px; }
.topic-list li.book { display: flex; flex-direction: column; gap: 8px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.topic-list li.book:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.topic-list li.book .tl-main { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); font-weight: 600; padding: 0; border: 0; background: none; min-height: 0; }
.topic-list li.book .no { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; background: var(--note-bg); color: var(--muted); font-size: .82rem; font-weight: 800; }
.tl-tiers { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-tiers a { font-size: .82rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; border: 1.5px solid var(--brand); color: var(--brand); text-decoration: none; }
.tl-tiers a:hover { background: var(--brand); color: var(--brand-ink); }
.tl-tiers a.quick-link { border-color: var(--line); color: var(--muted); }
.chapter-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 18px; margin-bottom: 8px; }
.chapter-cols h2 { font-size: 1.15rem; font-family: var(--sans); }
.chapter-cols .h-gap { margin-top: 18px; }
.toc-list { columns: 2 320px; column-gap: 32px; padding-left: 1.4em; margin: 12px 0 28px; }
.toc-list li { margin: 0 0 6px; break-inside: avoid; }
.done-btn-inline { margin-left: 4px; }
.done-btn-inline[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 860px) {
  .book-callout { grid-template-columns: minmax(0, 1fr); }
  .bc-art { display: none; }
  .hdr-actions { order: 2; }
  .hdr-link { display: none; }
  .bar .brand { order: 1; }
}
@media (max-width: 560px) {
  .hdr-actions .btn { padding: 6px 12px; font-size: .85rem; }
}

.year-chips { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.year-chips a { display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; min-width: 120px; background: var(--surface); border: 1.5px solid var(--line); border-top: 5px solid var(--lv); border-radius: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.year-chips a:hover, .year-chips a[aria-current="page"] { border-color: var(--lv); }
.year-chips strong { font-family: var(--serif); font-size: 1.2rem; }
.year-chips span { font-size: .82rem; color: var(--muted); }
.year-chips.small a { padding: 6px 14px; min-width: 0; box-shadow: none; flex-direction: row; }
.year-chips.small strong { font-size: .95rem; font-family: var(--sans); }

.nav .nav-tutor { display: none; color: #7c3aed; }
@media (max-width: 860px) { .nav .nav-tutor { display: inline-block; } }

.find-band .type-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.type-chips a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem; }
.type-chips a:hover { border-color: var(--brand); color: var(--brand); }
.type-chips a em { font-style: normal; color: var(--muted); font-size: .8rem; font-weight: 600; }
.book-chips { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.book-chips a { display: inline-block; padding: 7px 15px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .92rem; }
.book-chips a:hover { border-color: var(--brand); }
.book-chips span { color: var(--muted); font-weight: 600; font-size: .8rem; margin-left: 6px; }

/* ---------- header dropdowns ---------- */
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item .nav-top { padding-right: 4px; }
.dd-btn { display: grid; place-items: center; width: 22px; height: 30px; margin-left: -2px; margin-right: 4px; border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer; padding: 0; }
.dd-btn .ic { width: 14px; height: 14px; transition: transform .15s ease; }
.dd-btn:hover, .nav-item.open .dd-btn { background: var(--note-bg); color: var(--ink); }
.nav-item.open .dd-btn .ic { transform: rotate(180deg); }
.dd { display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: min(620px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--lv); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px 18px 16px; }
.dd::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; } /* hover bridge */
.nav-item.open .dd { display: block; }
@media (hover: hover) and (min-width: 861px) { .nav-item:hover .dd, .nav-item:focus-within .dd { display: block; } }
.nav .dd-head { display: flex; white-space: normal; font-size: 1rem; font-weight: 400; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 -6px 10px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.nav .dd-head:hover { background: var(--note-bg); }
.dd-head strong { font-family: var(--serif); font-size: 1.25rem; }
.dd-head span { color: var(--muted); font-size: .88rem; flex: 1; }
.dd-head .ic { color: var(--lv); }
.dd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 20px; }
.dd h4 { margin: 0 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dd ul { list-style: none; padding: 0; margin: 0; }
.dd li a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .93rem; white-space: nowrap; }
.dd li a:hover { background: var(--note-bg); color: var(--brand); }
.dd li a em { font-style: normal; margin-left: auto; font-size: .76rem; font-weight: 700; color: var(--ok); background: var(--ok-bg); padding: 1px 8px; border-radius: 999px; }
.dd li a .ic { width: 16px; height: 16px; color: var(--lv); }
.dd-subjects { max-height: 300px; overflow-y: auto; overflow-x: hidden; }
.dd-subjects li a { white-space: normal; line-height: 1.3; }
@media (min-width: 861px) {
  .nav { overflow: visible; }
  .nav a { padding: 9px 10px; font-size: .93rem; }
}
@media (max-width: 860px) {
  .site-header { backdrop-filter: none; } /* a backdrop-filter ancestor would trap the fixed panel */
  .dd { position: fixed; left: 12px; right: 12px; width: auto; max-height: 72vh; overflow: auto; top: var(--dd-top, 120px); }
  .dd-subjects { max-height: none; }
}
