/* ============================================================
   course.css — warm cream background, green accents, dark
   readable text, spacious layout. Colours are tokens so the
   whole course can be re-themed in one place.
   Contrast (text on background) is at least 4.5:1 throughout.
   ============================================================ */
:root {
  --bg: #fbf5ea;          /* warm cream */
  --surface: #fffdf8;
  --soft: #f3ecdd;
  --line: #e3dccd;
  --ink: #1f2a44;         /* dark navy text, 13.9:1 on --bg */
  --ink-2: #4a5468;       /* secondary text, 7:1 on --bg */
  --green: #3f6b33;       /* primary accent, 6.1:1 with white */
  --green-dark: #2f5226;
  --green-soft: #e3ecd5;
  --green-mid: #86a05a;
  --orange: #a3510b;      /* secondary accent, 5.3:1 on --bg */
  --orange-soft: #fbe9d6;
  --red: #a4262c;
  --red-soft: #fbe4e4;
  --focus: #c76b12;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 6px 20px rgba(31, 42, 68, .06);
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-h: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side-w: 300px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h, 70px) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 1.0625rem; line-height: 1.65; }
img { max-width: 100%; height: auto; }
a { color: var(--green-dark); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--font-h); line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); margin: 1.6em 0 .5em; }
h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }
p, li { max-width: 72ch; }
code { background: var(--soft); padding: .05em .35em; border-radius: 5px; font-size: .92em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; color: #fff; }
.muted { color: var(--ink-2); }
.small { font-size: .92rem; }
.hint { color: var(--ink-2); font-size: .95rem; }
.error { color: var(--red); font-weight: 700; }
.note { font-size: .95rem; color: var(--ink-2); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-logo { width: 44px; height: 44px; flex: none; border-radius: 12px; background: #ecfaf2; display: grid; place-items: center; }
.brand-logo svg { width: 40px; height: 40px; display: block; animation: logo-spin 12s linear infinite; }
.brand:hover .brand-logo svg, .brand:focus-visible .brand-logo svg, .no-logo-motion .brand-logo svg { animation-play-state: paused; }
.no-logo-motion .brand-logo svg { animation: none; }
@keyframes logo-spin { to { transform: rotate(360deg); } }   /* positive = clockwise */
.brand-t { font-family: var(--font-h); font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.brand-t span { display: block; font-weight: 500; font-size: .85rem; color: var(--ink-2); }
.top-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.top-nav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem; }
.top-nav a:hover { background: var(--green-soft); }
.top-nav a[aria-current] { background: var(--green); color: #fff; }
.top .menu-btn { display: none; }

/* ---------- layout ---------- */
.layout { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 32px; padding: 24px 20px 40px; }
.is-home .layout { grid-template-columns: minmax(0, 1fr); }
.is-home .side { display: none; }
main { min-width: 0; max-width: 880px; width: 100%; }
.is-home main { max-width: 1240px; margin: 0 auto; }
main:focus { outline: none; }
.side { position: sticky; top: calc(var(--head-h, 70px) + 12px); align-self: start; max-height: calc(100vh - var(--head-h, 70px) - 24px); overflow: auto; padding-right: 6px; }
.side-h { font-size: 1rem; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.side-prog { margin-bottom: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2; padding: 10px 18px; min-height: 44px; border-radius: 999px; border: 2px solid var(--green); background: var(--surface); color: var(--green-dark); cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--green-soft); color: var(--green-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-quiet { border-color: var(--line); color: var(--ink); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-small { padding: 6px 14px; min-height: 38px; font-size: .92rem; }
.btn-big { padding: 14px 26px; font-size: 1.1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; align-items: center; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; margin: 10px 0 40px; }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.5rem); line-height: 1.08; margin: .1em 0 .35em; }
.h1-sub { display: block; font-size: .5em; font-weight: 600; color: var(--green-dark); margin-top: .35em; line-height: 1.25; }
.kicker { font-weight: 700; color: var(--green-dark); font-size: .95rem; margin: 0; }
.lead { font-size: 1.2rem; color: var(--ink); }
.hero-photo { margin: 0; position: relative; }
.hero-photo::before { content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: var(--green-mid); top: -26px; left: -26px; z-index: 0; opacity: .85; }
.hero-photo .photo-frame { position: relative; z-index: 1; border-radius: 120px 24px 24px 24px; overflow: hidden; aspect-ratio: 4 / 3.2; box-shadow: var(--shadow); background: var(--soft); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo figcaption { position: relative; z-index: 1; }
.resume-note { color: var(--ink-2); }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.home-grid h2 { margin-top: 0; font-size: 1.3rem; }
.addie-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0 10px; }
.addie-chip { display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; }
.addie-chip span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #fff; font-family: var(--font-h); }

/* ---------- cards, bars ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; box-shadow: var(--shadow); margin: 0 0 20px; }
.card h2 { margin-top: 0; }
.bar { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }
.bar-label { margin: 4px 0 0; font-size: .9rem; color: var(--ink-2); }
.flash { background: var(--green-soft); border-left: 6px solid var(--green); padding: 14px 18px; border-radius: 10px; margin: 0 0 20px; font-weight: 700; }
.dash-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
.section-h { margin-top: 1em; }
.mod-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.mod-card { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--green); border-radius: var(--radius); padding: 16px 18px; }
.mod-card h3 { margin: 4px 0 10px; font-size: 1.08rem; }
.mod-card h3 a { text-decoration: none; color: var(--ink); }
.mod-card h3 a:hover { text-decoration: underline; }
.mod-stage { margin: 0; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.stage-analyse { --stage: #2f6b7a; } .stage-design { --stage: #3f6b33; } .stage-develop { --stage: #8a4b0b; } .stage-implement { --stage: #6b3f7a; } .stage-evaluate { --stage: #a4262c; } .stage-all { --stage: #1f2a44; }
.mod-card { border-top-color: var(--stage, var(--green)); }

/* ---------- contents ---------- */
.toc { list-style: none; padding: 0; margin: 0; }
.toc ol { list-style: none; padding: 0 0 6px 8px; margin: 0; }
.toc-mod summary { cursor: pointer; font-weight: 700; padding: 8px 6px; border-radius: 8px; display: flex; gap: 8px; align-items: baseline; list-style: none; }
.toc-mod summary::-webkit-details-marker { display: none; }
.toc-mod summary::before { content: "▸"; color: var(--ink-2); }
.toc-mod details[open] > summary::before { content: "▾"; }
.toc-mod summary:hover { background: var(--soft); }
.toc-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); font-size: .85rem; }
.toc a { display: flex; gap: 8px; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; line-height: 1.35; }
.toc a:hover { background: var(--soft); }
.toc a.here { background: var(--green-soft); font-weight: 700; }
.st { flex: none; width: 1.2em; text-align: center; }
.st-done { color: var(--green); font-weight: 700; }
.st-lock { font-size: .8em; opacity: .7; }
.st-open { color: var(--ink-2); }
.toc-full { max-width: 760px; }
.toc-full .toc-mod { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 4px 8px; }

/* ---------- page ---------- */
.crumbs { font-size: .92rem; color: var(--ink-2); margin-bottom: 8px; }
.page-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.page-head h1 { margin: .15em 0 .4em; }
.stage-badge { display: inline-block; background: var(--stage, var(--green)); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; margin-right: 6px; }
.ls { margin: 0 0 8px; }
.ls > h2 { display: flex; align-items: center; gap: 10px; }
.ls > h2::before { content: ""; width: 10px; height: 26px; border-radius: 4px; background: var(--stage, var(--green)); }
.objective { font-size: 1.15rem; background: var(--green-soft); border-radius: var(--radius); padding: 14px 18px; font-weight: 700; }
.ls-why { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 22px 10px; margin-top: 24px; }
.ls-example { }
.ls-activity { background: #f6f9f0; border: 2px solid var(--green-soft); border-radius: var(--radius); padding: 2px 22px 12px; margin-top: 24px; }
.topic-note { background: var(--orange-soft); padding: 10px 14px; border-radius: 10px; }
.list { padding-left: 1.3em; }
.list li { margin: .3em 0; }
.list.check { list-style: none; padding-left: 0; }
.list.check li { padding-left: 1.8em; position: relative; }
.list.check li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 1.3em; height: 1.3em; border-radius: 50%; background: var(--green-mid); color: #fff; font-size: .8em; display: grid; place-items: center; margin-top: .25em; }
.mistakes { list-style: none; padding: 0; }
.mistakes li { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--orange); border-radius: 10px; padding: 10px 16px; margin-bottom: 10px; }
.mistakes p { margin: .3em 0; }
.steps { counter-reset: s; list-style: none; padding: 0; }
.steps > li { counter-increment: s; position: relative; padding: 4px 0 4px 52px; margin-bottom: 12px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; font-family: var(--font-h); font-weight: 700; display: grid; place-items: center; }
.step-t { font-weight: 700; margin: 4px 0; }
.callout { border-radius: var(--radius); padding: 6px 20px; margin: 18px 0; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--green); }
.callout-warn { border-left-color: var(--orange); background: #fffaf3; }
.callout-example { border-left-color: #2f6b7a; }
.callout-title { font-weight: 700; font-family: var(--font-h); font-size: 1.05rem; margin-bottom: 0; }
blockquote { margin: 18px 0; padding: 10px 20px; border-left: 5px solid var(--green-mid); background: var(--surface); border-radius: 0 12px 12px 0; font-style: italic; }
blockquote footer { font-style: normal; color: var(--ink-2); font-size: .95rem; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.compare-side { border-radius: var(--radius); padding: 10px 18px; border: 2px solid; }
.compare-bad { border-color: #e7c7a8; background: #fffaf3; }
.compare-good { border-color: #b9d1a3; background: #f6f9f0; }
.compare-label { font-weight: 700; font-family: var(--font-h); margin-bottom: 0; }
.compare ul { padding-left: 1.2em; }

/* tables */
.table-wrap { overflow-x: auto; margin: 18px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .97rem; }
caption { text-align: left; font-weight: 700; padding: 10px 14px; font-family: var(--font-h); }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
thead th { background: var(--soft); border-top: 0; }
.thumb { width: 90px; border-radius: 6px; }
.work-table { background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }

/* figures */
figure { margin: 22px 0; }
.photo .photo-frame { border-radius: var(--radius); overflow: hidden; background: var(--soft); aspect-ratio: 16 / 9; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-small { max-width: 520px; }
figcaption { font-size: .92rem; color: var(--ink-2); margin-top: 8px; }
figcaption .cap { display: block; color: var(--ink); margin-bottom: 2px; }
.credit { display: block; font-size: .85rem; }
.credit a { color: var(--ink-2); }
.photo-missing { display: grid; place-items: center; border: 2px dashed var(--line); }
.photo-missing-box { padding: 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; max-width: 46ch; }
.intro-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.diagram { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.diagram-art svg { width: 100%; height: auto; display: block; }
details.desc { margin-top: 6px; }
details.desc summary, details.reveal summary, .f-example summary, .example-box > summary, .transcript summary { cursor: pointer; color: var(--green-dark); font-weight: 700; }
.reveal { background: var(--surface); border: 1px dashed var(--green-mid); border-radius: 12px; padding: 10px 16px; margin: 14px 0; }
.example-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; }
.figure-note { font-size: .9rem; }
pre { background: #1f2a44; color: #f4efe4; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: .9rem; line-height: 1.5; }
pre code { background: none; padding: 0; color: inherit; }
.code figcaption { margin: 0 0 4px; font-weight: 700; }

/* diagrams (SVG classes) */
.d-box { fill: var(--surface); stroke: #cfc6b3; stroke-width: 1.5; }
.d-soft { fill: #f3ecdd; stroke: #ddd3bf; stroke-width: 1.5; }
.d-accent { fill: var(--green); }
.d-accent2 { fill: #2f6b7a; }
.d-warn { fill: var(--orange-soft); stroke: var(--orange); stroke-width: 2; }
.d-good { fill: var(--green-soft); stroke: var(--green); stroke-width: 2; }
.d-paper { fill: #fff; stroke: #cfc6b3; }
.d-busy { fill: #d8cfc0; stroke: #b9ad97; }
.d-faint { fill: #b9ad97; }
.d-bar { fill: #d5ccba; }
.d-ink { fill: var(--ink); }
.d-ring { fill: none; stroke: var(--ink-2); stroke-width: 2; }
.d-accent-fill { fill: var(--green); }
.d-meter { fill: #e9e1d0; }
.d-meter-warn { fill: var(--orange); }
.d-meter-good { fill: var(--green); }
.d-tri { fill: var(--green-soft); stroke: var(--green-mid); stroke-width: 2; }
.d-line { stroke: var(--ink-2); stroke-width: 2.2; }
.d-dash { stroke: var(--ink-2); stroke-width: 1.8; stroke-dasharray: 6 5; }
.d-arrowhead { fill: var(--ink-2); }
.d-pin { fill: var(--orange); }
.d-pin-t { fill: #fff; font: 700 14px var(--font-h); }
.d-t { fill: var(--ink); font: 400 15px var(--font); }
.d-t-strong { fill: var(--ink); font: 700 16px var(--font-h); }
.d-t-small { fill: var(--ink); font: 400 13.5px var(--font); }
.d-t-tiny { fill: var(--ink); font: 400 11.5px var(--font); }
.d-t-muted { fill: var(--ink-2); font: italic 400 14px var(--font); }
.d-t-good { fill: var(--green-dark); font: 700 15px var(--font); }
.d-t-warn { fill: var(--orange); font: 700 15px var(--font); }
.d-on-accent { fill: #fff; }

/* ---------- glossary term button ---------- */
.term { font: inherit; color: inherit; background: none; border: 0; padding: 0; border-bottom: 2px dotted var(--green); cursor: help; text-align: inherit; }
.term:hover { background: var(--green-soft); }
.term:disabled { cursor: default; }
dialog { border: 0; border-radius: var(--radius); padding: 22px 26px; max-width: min(520px, 92vw); box-shadow: 0 20px 60px rgba(31, 42, 68, .3); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(31, 42, 68, .45); }
.td-title { margin-top: 0; }
.glossary { margin: 20px 0; }
.gl-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin-bottom: 10px; }
.gl-item dt { font-weight: 700; font-family: var(--font-h); font-size: 1.08rem; }
.gl-item dd { margin: 4px 0 0; }
.gl-item:target { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- forms and worksheets ---------- */
label, .f-label { font-weight: 700; display: block; margin: 0 0 4px; }
input[type=text], input[type=search], textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 2px solid #cfc6b3; border-radius: 10px; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 3.2em; }
input:focus, textarea:focus, select:focus { border-color: var(--green); outline: 3px solid var(--focus); outline-offset: 1px; }
select { width: auto; max-width: 100%; }
.field { margin: 16px 0; }
.field-sm { margin: 10px 0; }
.f-hint { color: var(--ink-2); font-size: .95rem; margin: 0 0 6px; }
.worksheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px 8px; margin: 16px 0; }
.ws-head h3 { margin-top: 14px; }
.ws-save { font-size: .9rem; color: var(--ink-2); margin: 0; }
.ws-topic { font-size: .95rem; }
.ws-status { color: var(--green-dark); font-weight: 700; min-height: 1.4em; margin: 4px 0; }
.f-example { margin-top: 6px; font-size: .97rem; background: #f6f9f0; border-radius: 8px; padding: 6px 12px; }
.row-card { border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 6px; margin: 10px 0; background: #fff; }
.row-card legend { font-weight: 700; padding: 0 6px; font-family: var(--font-h); }
.checklist { border: 0; padding: 0; }
.chk { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 6px 0; cursor: pointer; }
.chk input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--green); }
.chk-count { color: var(--ink-2); font-size: .92rem; }
.auto-fb { font-size: .95rem; }
.auto-label { display: inline-block; background: #e8eef5; color: #23415e; border-radius: 6px; padding: 2px 8px; font-size: .82rem; font-weight: 700; margin: 8px 0 4px; }
.ok { color: var(--green-dark); }
.preview-box { border: 2px dashed var(--green-mid); border-radius: var(--radius); padding: 8px 18px; margin: 14px 0; background: #fff; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.results { padding-left: 1.2em; }
.results li { margin-bottom: 12px; }
.bm-list { list-style: none; padding: 0; }
.bm-list li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- interactions ---------- */
.ix, .email-ix { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 20px 12px; margin: 20px 0; }
.ix-title { font-family: var(--font-h); font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.mcq { border: 0; padding: 0; margin: 10px 0; }
.mcq legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.opt { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px; margin: 8px 0; cursor: pointer; background: #fff; }
.opt:hover { border-color: var(--green-mid); }
.opt input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--green); }
.opt.is-right { border-color: var(--green); background: var(--green-soft); }
.opt.is-wrong { border-color: var(--orange); background: var(--orange-soft); }
.mcq-fb { border-radius: 10px; }
.mcq-fb.ok, .scn-fb.ok { background: var(--green-soft); border-left: 6px solid var(--green); padding: 4px 16px; color: var(--ink); }
.mcq-fb.no, .scn-fb.no { background: var(--orange-soft); border-left: 6px solid var(--orange); padding: 4px 16px; color: var(--ink); }
.scn-fb { border-radius: 10px; margin: 10px 0; }
.scn-text { font-size: 1.08rem; }
.scn-choices { display: grid; gap: 10px; }
.scn-choice { justify-content: flex-start; text-align: left; border-radius: 12px; }
.addie-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.addie-tabs button { font: inherit; font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; min-height: 44px; }
.addie-tabs button[aria-selected=true] { border-color: var(--green); background: var(--green-soft); }
.addie-letter { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-family: var(--font-h); }
.addie-panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; }
.addie-panel h4 { font-size: 1.15rem; margin: 12px 0 4px; }
.sorter { padding-left: 1.3em; }
.sorter li { margin: 12px 0; }
.sorter label { font-weight: 400; }
.sorter-fb { display: block; font-size: .95rem; margin-top: 4px; }
.sorter-fb.ok { color: var(--green-dark); }
.sorter-fb.no { color: var(--orange); }
.sorter-sum { font-weight: 700; }
.pg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.code-in { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88rem; line-height: 1.45; }
.pg-out { width: 100%; min-height: 220px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.accordion details { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; }
.accordion summary { cursor: pointer; padding: 12px 16px; font-weight: 700; }
.accordion summary:hover { background: var(--soft); }
.acc-body { padding: 0 18px 8px; }
.email { background: #fff; border: 1px solid #cfc6b3; border-radius: 10px; overflow: hidden; font-size: .98rem; }
.email-head { background: #f4f1ea; padding: 10px 16px; border-bottom: 1px solid #ddd3bf; }
.email-head > div { margin: 3px 0; }
.email-k { display: inline-block; min-width: 88px; color: var(--ink-2); font-size: .9rem; }
.email-body { padding: 6px 16px; }
.hotspot { font: 700 .85rem var(--font-h); width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--orange); color: #fff; cursor: pointer; vertical-align: middle; margin: 0 4px; box-shadow: 0 0 0 2px var(--orange); }
.hotspot.seen { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.hotspot.active { transform: scale(1.15); }
.spot-panel { margin-top: 10px; background: #fff; border-radius: 10px; border: 1px solid var(--line); padding: 4px 16px; min-height: 60px; }
.spot-count { color: var(--ink-2); font-size: .95rem; }

/* ---------- portfolio ---------- */
.pf-list { list-style: none; padding: 0; counter-reset: pf; }
.pf-item { counter-increment: pf; }
.pf-item h3 { margin-top: 0; }
.pf-item h3::before { content: counter(pf) ". "; color: var(--green-dark); }
.pf-pre { white-space: pre-wrap; background: #fff; color: var(--ink); border: 1px solid var(--line); font-family: var(--font); font-size: .9rem; max-height: 320px; overflow: auto; }
.pf-checks { list-style: none; padding: 0; }
.pf-checks li { padding: 6px 12px; border-radius: 8px; margin: 4px 0; }
.pf-checks li.ok { background: var(--green-soft); }
.pf-checks li.no { background: var(--orange-soft); }
.pf-crit { border: 1px solid var(--line); }
.pf-crit legend { padding: 0 6px; }
.pf-sum { font-weight: 700; }

/* ---------- quiz ---------- */
.quiz-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 20px; margin: 16px 0; }
.qn { display: block; font-size: .85rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.quiz-warn { color: var(--orange); font-weight: 700; }
.score { display: flex; gap: 20px; align-items: center; border-radius: var(--radius); padding: 14px 22px; margin: 10px 0 20px; border: 2px solid; }
.score:focus { outline: 3px solid var(--focus); }
.score-big { font-family: var(--font-h); font-size: 2.4rem; font-weight: 700; margin: 0; white-space: nowrap; }
.score p { margin: .2em 0; }
.score-good { background: var(--green-soft); border-color: var(--green); }
.score-ok { background: #fff8e8; border-color: #d1a84a; }
.score-low { background: var(--orange-soft); border-color: var(--orange); }
.review { padding-left: 1.4em; }
.rv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; margin: 14px 0; }
.rv.ok { border-left: 6px solid var(--green); }
.rv.no { border-left: 6px solid var(--orange); }
.rv-q { font-weight: 700; }
.rv-opts { list-style: none; padding: 0; }
.rv-opts li { padding: 6px 12px; border-radius: 8px; margin: 4px 0; border: 1px solid var(--line); }
.rv-opts li.is-right { background: var(--green-soft); border-color: var(--green); }
.rv-opts li.is-wrong { background: var(--orange-soft); border-color: var(--orange); }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.tag-good { background: var(--green); color: #fff; }
.tag-bad { background: var(--orange); color: #fff; }
.tag-you { background: var(--ink); color: #fff; }
.rv-status { font-weight: 700; }

/* ---------- audio ---------- */
.audio { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin: 0 0 18px; }
/* Docked in the sticky header: top right, always visible, content scrolls beneath the header. */
.audio-dock { max-width: 1400px; margin: 0 auto; padding: 0 20px 10px; display: flex; justify-content: flex-end; }
.audio-dock:empty { display: none; }
.audio-dock .audio { margin: 0; max-width: 100%; box-shadow: var(--shadow); }
.audio-dock .audio-rate { margin-left: 16px; }
.audio-dock .transcript-body { max-height: min(320px, 40vh); }
.audio-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audio-rate { display: flex; align-items: center; gap: 6px; margin: 0 0 0 auto; font-weight: 700; font-size: .92rem; }
.audio-rate select { padding: 6px 8px; }
.audio-status { margin: 6px 0 0; font-size: .92rem; color: var(--ink-2); min-height: 1.2em; }
.audio-off { color: var(--ink-2); }
.transcript { margin-top: 6px; font-size: .95rem; }
.transcript-body { max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; margin-top: 6px; }
.is-reading { background: #fff4d6; box-shadow: 0 0 0 6px #fff4d6; border-radius: 6px; }
::highlight(narration-word) { background-color: #f2c14e; color: #1f2a44; }

/* ---------- pager ---------- */
.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin: 40px 0 6px; padding-top: 20px; border-top: 2px solid var(--line); }
.pager-prev { justify-self: start; flex-direction: column; align-items: flex-start; border-radius: 16px; }
.pager-next { justify-self: end; flex-direction: column; align-items: flex-end; border-radius: 16px; }
.pager-t { display: block; font-weight: 400; font-size: .85rem; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.pager-save { align-self: center; }
.pager-msg { color: var(--orange); font-weight: 700; min-height: 1.2em; text-align: right; }
.mini-toc { padding-left: 1.3em; }

/* ---------- footer, toast ---------- */
.foot { border-top: 1px solid var(--line); background: var(--soft); margin-top: 40px; }
.foot-inner { max-width: 1400px; margin: 0 auto; padding: 20px; font-size: .92rem; color: var(--ink-2); }
.foot-inner p { margin: .3em 0; max-width: none; }
.powered { background: #05633a; color: #fff; text-align: center; padding: 16px 20px 18px; }   /* white on #05633a: 7.4:1 */
.powered p { margin: 0 auto; max-width: none; }
.powered-by { font-size: 1.15rem; }
.powered-author { font-size: 1rem; margin-top: 6px !important; opacity: .95; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 140%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; transition: transform .25s; z-index: 50; font-weight: 700; }
.toast.show { transform: translate(-50%, 0); }
.toast:empty { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  main { margin: 0 auto; }
}
@media (max-width: 900px) {
  .top .menu-btn { display: inline-flex; }
  .top-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 16px 16px; flex-direction: column; box-shadow: var(--shadow); }
  .menu-open .top-nav { display: flex; }
  .top-nav a { padding: 12px 14px; border-radius: 10px; }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo::before { width: 90px; height: 90px; top: -14px; left: -10px; }
  .home-grid, .dash-top { grid-template-columns: 1fr; }
  .pg-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .top-inner { padding: 8px 16px; }
  .brand-t span { display: none; }
  .layout { padding: 16px 16px 32px; }
  .compare { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager-save { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .pager-t { max-width: 14ch; }
  .card, .ls-activity, .ls-why, .worksheet, .ix, .email-ix { padding-left: 14px; padding-right: 14px; }
  .audio-rate, .audio-dock .audio-rate { margin-left: 0; }
  .audio-dock { padding: 0 16px 8px; }
  /* Compact on phones: buttons on one row; speed and transcript on the next; status only when set. */
  .audio-dock .audio { width: 100%; padding: 8px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .audio-dock .audio-row { display: contents; }
  .audio-dock .btn-small { padding: 4px 9px; min-height: 36px; font-size: .8rem; gap: 4px; }
  .audio-dock .audio-rate { font-size: .8rem; }
  .audio-dock .audio-rate select { padding: 4px 6px; font-size: .85rem; }
  .audio-dock .transcript { margin: 0; font-size: .85rem; }
  .audio-dock .transcript[open] { flex-basis: 100%; }
  .audio-dock .audio-status { order: 10; flex-basis: 100%; margin: 0; font-size: .82rem; min-height: 0; }
  .audio-dock .audio-status:empty { display: none; }
  .score { flex-direction: column; align-items: flex-start; gap: 4px; }
  .email-k { min-width: 0; display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .top, .side, .foot-inner, .audio, .pager, .pager-msg, .bm-btn, .btn-row, .skip { display: none !important; }
  body { background: #fff; }
  .layout { display: block; padding: 0; }
}
