:root {
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #eef2f7; --fg: #172033; --muted: #4a5466; --border: #d3dae4;
  --accent: #0e6b61; --accent-fg: #ffffff; --accent-soft: #e2f3f0; --focus: #c2410c; --mark: #fff1a6;
  --lecture: #4338ca; --seminar: #0e6b61; --lab: #a14a06;
  --ok: #136b2f; --bad: #b3261e; --caption-bg: rgba(10, 14, 22, .86); --caption-fg: #fff;
  --hero: linear-gradient(135deg, #0e6b61 0%, #1f4f8f 55%, #3a2f9e 100%); --hero-fg: #ffffff;
  --slide-bg: radial-gradient(120% 120% at 0% 0%, #ffffff 0%, #eef4f8 100%);
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 20px rgba(16, 24, 40, .07);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1116; --surface: #151b23; --surface-2: #1d252f; --fg: #e8ecf1; --muted: #adb6c2; --border: #2e3844;
    --accent: #5fd3c3; --accent-fg: #04241f; --accent-soft: #12302c; --focus: #ffb366; --mark: #4b4100;
    --lecture: #a9b6ff; --seminar: #5fd3c3; --lab: #f5b54a;
    --ok: #7fe0a0; --bad: #ffb4ab;
    --hero: linear-gradient(135deg, #0a4d46 0%, #173a69 55%, #2a2276 100%);
    --slide-bg: radial-gradient(120% 120% at 0% 0%, #1b2430 0%, #121820 100%);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1116; --surface: #151b23; --surface-2: #1d252f; --fg: #e8ecf1; --muted: #adb6c2; --border: #2e3844;
  --accent: #5fd3c3; --accent-fg: #04241f; --accent-soft: #12302c; --focus: #ffb366; --mark: #4b4100;
  --lecture: #a9b6ff; --seminar: #5fd3c3; --lab: #f5b54a;
  --ok: #7fe0a0; --bad: #ffb4ab;
  --hero: linear-gradient(135deg, #0a4d46 0%, #173a69 55%, #2a2276 100%);
  --slide-bg: radial-gradient(120% 120% at 0% 0%, #1b2430 0%, #121820 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
:root[data-theme="contrast"] {
  --bg: #000; --surface: #000; --surface-2: #000; --fg: #fff; --muted: #fff; --border: #fff;
  --accent: #ffff00; --accent-fg: #000; --accent-soft: #000; --focus: #00ffff; --mark: #003a8c;
  --lecture: #ffff00; --seminar: #ffff00; --lab: #ffff00;
  --ok: #00ff66; --bad: #ff8080; --caption-bg: #000; --caption-fg: #fff;
  --hero: #000; --hero-fg: #fff; --slide-bg: #000; --shadow: none;
  color-scheme: dark;
}
:root[data-theme="contrast"] .hero, :root[data-theme="contrast"] .caption { border: 2px solid #fff; }

* { box-sizing: border-box; }
html { scroll-padding-bottom: 9rem; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-wrap: break-word;
}
.spacing body { letter-spacing: .12em; word-spacing: .16em; line-height: 1.9; }
.spacing p, .spacing li { margin-bottom: 1.2em; }

a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .18em; }
.underline a, .underline summary { text-decoration: underline; text-decoration-thickness: .15em; }
.underline button { outline: 2px solid var(--fg); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1:focus, h2:focus, h3:focus, main:focus { outline: none; }
.ico { width: 1.2em; height: 1.2em; flex-shrink: 0; vertical-align: -.22em; }

.skip { position: absolute; left: 1rem; top: -100rem; z-index: 50; background: var(--accent); color: var(--accent-fg); padding: .75rem 1rem; font-weight: 700; border-radius: 8px; }
.skip:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button, input, select, textarea { font: inherit; color: inherit; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 2.75rem; min-width: 2.75rem; padding: .4rem .9rem; cursor: pointer;
  background: var(--surface); color: var(--fg); border: 2px solid var(--border); border-radius: 10px;
  font-weight: 600; text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
select { min-height: 2.5rem; padding: .25rem .5rem; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); }

/* ---------- header ---------- */
header.site { background: var(--surface); border-bottom: 1px solid var(--border); }
.bar, .panel, main, footer.site { max-width: 78rem; margin: 0 auto; padding-inline: 1rem; }
.bar { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding-block: .6rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--fg); text-decoration: none; font-size: 1.25rem; font-weight: 800; line-height: 1.15; }
.brand small { display: block; font-size: .78rem; font-weight: 500; color: var(--muted); }
.logo { width: 2.4rem; height: 2.4rem; fill: var(--accent); stroke: var(--accent); stroke-width: 2.5; }
header.site nav { flex: 1 1 auto; }
header.site nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; }
header.site nav a { display: inline-block; padding: .45rem .8rem; border-radius: 999px; font-weight: 600; color: var(--fg); text-decoration: none; }
header.site nav a:hover { background: var(--surface-2); }
header.site nav a[aria-current] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

.panel { padding-block: .5rem 1rem; border-top: 1px solid var(--border); }
.panel h2 { font-size: 1.1rem; margin: .5rem 0; }
.panel-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
fieldset { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 .75rem; padding: .5rem .75rem .75rem; }
legend { font-weight: 700; padding-inline: .25rem; }
.panel fieldset { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; margin: 0; }
label { display: inline-flex; gap: .5rem; align-items: center; min-height: 2.75rem; cursor: pointer; }
input[type="radio"], input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.hint { color: var(--muted); font-size: .95rem; }

/* ---------- page ---------- */
main { padding-block: 1.25rem 3rem; }
main:has(.player) { padding-bottom: 10rem; }
main h1 { font-size: clamp(1.7rem, 3vw + 1rem, 2.4rem); line-height: 1.2; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
main h2 { font-size: 1.4rem; line-height: 1.3; margin: 2rem 0 .6rem; }
main h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
.lead { font-size: 1.12rem; color: var(--muted); margin-top: 0; max-width: 52rem; }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .75rem 0 0; color: var(--muted); font-weight: 600; font-size: .95rem; }
.page-head { margin-bottom: 1.25rem; }
.prose, .doc { max-width: 48rem; }

.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; font-size: .92rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .3rem; }

.card, .side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-block: 1rem; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; display: flex; gap: .5rem; align-items: center; font-size: 1.2rem; }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; border: 1.5px solid currentColor; white-space: nowrap; }
.chip-lecture { color: var(--lecture); } .chip-seminar { color: var(--seminar); } .chip-lab { color: var(--lab); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 .45rem; border-radius: 6px; background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); white-space: nowrap; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: .05rem .55rem; margin-left: .5rem; vertical-align: .15em; }

/* ---------- home ---------- */
.hero { background: var(--hero); color: var(--hero-fg); border-radius: 20px; padding: clamp(1.25rem, 4vw, 2.5rem); box-shadow: var(--shadow); }
.hero .eyebrow, .hero .lead { color: inherit; opacity: .92; }
.hero h1 { font-size: clamp(2rem, 4vw + 1rem, 3.2rem); margin-top: .25rem; }
.hero a.btn { border-color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .12); color: inherit; }
.hero a.btn.primary { background: #fff; color: #0b3d38; border-color: #fff; }
:root[data-theme="contrast"] .hero a.btn.primary { background: #ffff00; color: #000; border-color: #ffff00; }
.cta { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0 0; }
.progress-wrap { max-width: 26rem; font-weight: 600; }
.meter { height: .6rem; border-radius: 999px; background: rgba(255, 255, 255, .25); overflow: hidden; margin-top: .35rem; }
.meter span { display: block; height: 100%; background: #fff; border-radius: inherit; }
:root[data-theme="contrast"] .meter { border: 1px solid #fff; }
.home-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.features li { display: flex; gap: .6rem; align-items: flex-start; }
.features .ico { color: var(--accent); width: 1.5em; height: 1.5em; margin-top: .05em; }
.due-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }

.weeks { list-style: none; padding: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); }
.weeks > li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.weeks > li.now { border: 3px solid var(--accent); }
.weeks h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.week-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.wl { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; color: var(--fg); }
a.wl:hover { background: var(--surface-2); }
a.wl .wl-title { text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: .2em; }
.wl.current { background: var(--accent-soft); font-weight: 700; }
.due { display: flex; gap: .4rem; color: var(--muted); font-size: .92rem; margin: .5rem 0 0; }

.item-grid { list-style: none; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.item-grid a { display: grid; grid-template-columns: auto 1fr; gap: .1rem .8rem; padding: .9rem 1rem; height: 100%; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--fg); text-decoration: none; }
.item-grid a:hover { border-color: var(--accent); }
.num { grid-row: span 2; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.it-title { font-weight: 700; }
.it-meta { display: flex; flex-wrap: wrap; gap: .4rem; color: var(--muted); font-size: .9rem; }

/* ---------- lesson layout ---------- */
.layout { display: grid; gap: 1.5rem; }
@media (min-width: 64rem) {
  .layout { grid-template-columns: minmax(0, 1fr) 18rem; grid-template-areas: "content side"; align-items: start; }
  .layout .content { grid-area: content; }
  .layout .side { grid-area: side; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
}
.side .side-card { margin-top: 0; padding: .75rem; }
.side-h { margin: 0 0 .4rem; font-weight: 800; }
.toc summary { font-weight: 800; color: var(--fg); }
.toc ol { margin: .25rem 0 0; padding-left: 1.3rem; display: grid; gap: .3rem; font-size: .95rem; }

.feature { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-radius: var(--radius); background: var(--hero); color: var(--hero-fg); text-decoration: none; box-shadow: var(--shadow); }
.feature .ico { width: 2.6rem; height: 2.6rem; }
.feature strong { display: block; font-size: 1.15rem; }
.feature span span { opacity: .92; }
.feature:hover { filter: brightness(1.08); }

.doc > h2 { padding-top: .25rem; border-top: 1px solid var(--border); }
.doc p, .doc li { max-width: 46rem; }
.reading { background: var(--mark); outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.listening .doc [data-a] { cursor: pointer; }
.listening .doc [data-a]:hover { outline: 1px dashed var(--accent); outline-offset: 2px; }

.table-wrap { overflow-x: auto; margin-block: 1rem; border-radius: 10px; }
table { border-collapse: collapse; min-width: 100%; background: var(--surface); }
th, td { border: 1px solid var(--border); padding: .45rem .65rem; text-align: left; vertical-align: top; }
thead th, th[scope="row"] { background: var(--surface-2); }
td:empty::after { content: "\00a0"; }

details { margin-block: .75rem; }
summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: list-item; padding-block: .45rem; color: var(--accent); }
.answers { border: 1px dashed var(--border); border-radius: 10px; padding: 0 1rem; }

.quiz fieldset { margin-bottom: 1rem; background: var(--surface); }
.quiz legend { font-weight: 600; }
.quiz label { display: flex; }
.fb { margin: .25rem 0 0; font-weight: 700; }
.fb.ok { color: var(--ok); } .fb.bad { color: var(--bad); }
.result { font-size: 1.15rem; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-block: 1rem; }

.calc textarea, .calc input { width: 100%; max-width: 32rem; padding: .5rem; border: 2px solid var(--border); border-radius: 8px; background: var(--bg); }
.calc .field { margin-bottom: .75rem; }
.calc .field label { display: block; min-height: 0; font-weight: 600; margin-bottom: .25rem; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
dl.facts { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: .4rem 1rem; }
dl.facts dt { font-weight: 700; } dl.facts dd { margin: 0; }
@media (max-width: 40rem) { dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: .5rem; } }

/* ---------- floating player ---------- */
.player {
  position: fixed; z-index: 30; bottom: .75rem; left: 50%; transform: translateX(-50%);
  width: min(44rem, calc(100% - 1rem)); padding: .5rem .75rem; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0, 0, 0, .22);
}
.player-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.player .play { min-width: 9rem; }
.rate { min-height: 0; font-size: .9rem; color: var(--muted); }
.pos { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.player-hint { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- 3D ---------- */
.viz-fig { margin: 1.5rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.viz-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.viz-pick button { min-height: 2.4rem; padding: .25rem .7rem; border-radius: 999px; font-weight: 600; }
.viz-stage { position: relative; }
.viz-stage canvas { display: block; width: 100%; height: 22rem; border-radius: 12px; background: var(--slide-bg); border: 1px solid var(--border); touch-action: pan-y; cursor: grab; }
.viz-stage canvas:active { cursor: grabbing; }
.viz-badge { position: absolute; top: .6rem; right: .6rem; font-size: .75rem; font-weight: 800; padding: .1rem .5rem; border-radius: 6px; background: var(--accent); color: var(--accent-fg); }
.viz-ctrl { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.viz-ctrl button { min-width: 2.6rem; min-height: 2.6rem; padding: .2rem .55rem; font-size: 1.05rem; }
.viz-cap { margin: .6rem 0 .2rem; }
.viz-legend { margin: 0; font-size: .9rem; color: var(--muted); }
.viz-key { white-space: nowrap; margin-right: .6rem; }
.viz-key i { display: inline-block; width: .85em; height: .85em; border-radius: 50%; margin-right: .3em; vertical-align: -.05em; border: 1px solid var(--muted); }
.viz-fig .hint { margin: .3rem 0 0; font-size: .85rem; }

/* ---------- presentation ---------- */
.deck { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(.5rem, 2vw, 1.25rem); box-shadow: var(--shadow); }
.deck:fullscreen { overflow: auto; background: var(--bg); padding: 2rem; }
.stage-row { display: grid; gap: .75rem; }
.deck.signing .stage-row { grid-template-columns: minmax(0, 1fr) minmax(12rem, 30%); align-items: start; }
@media (max-width: 48rem) { .deck.signing .stage-row { grid-template-columns: 1fr; } }
.sign-panel { margin: 0; padding: .5rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; position: sticky; top: .5rem; }
.sign-video { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #000; border-radius: 12px; }
.sign-video[hidden] { display: none; }
.sign-panel figcaption { margin: .4rem 0 0; text-align: center; }
.stage-wrap { background: var(--slide-bg); border: 1px solid var(--border); border-radius: 16px; aspect-ratio: 16 / 9; overflow-x: clip; } /* clip, not hidden: a tall slide (big text, 3D) must grow, not be cut */
.slide { min-height: 100%; padding: clamp(1rem, 3vw, 2.5rem); font-size: clamp(1rem, .6vw + .8rem, 1.3rem); }
.slide.enter { animation: slide-in .45s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.slide h2 { margin: 0 0 1rem; font-size: 1.7em; line-height: 1.2; border: 0; }
.slide .s-title { font-size: 2.3em; }
.slide .kicker { color: var(--muted); font-weight: 600; margin: 0 0 .5rem; }
.slide [data-hl] { border-radius: 10px; transition: background .3s, box-shadow .3s, transform .3s; }
.slide .hl { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent), 0 8px 28px rgba(14, 107, 97, .25); transform: scale(1.015); }
.plan { counter-reset: p; list-style: none; padding: 0; display: grid; gap: .5rem; }
.plan li { counter-increment: p; display: flex; gap: .8rem; align-items: center; padding: .45rem .7rem; }
.plan li::before { content: counter(p); display: grid; place-items: center; flex: 0 0 2em; height: 2em; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 800; }
.chips { display: flex; gap: .5rem; padding: .3rem .5rem; width: fit-content; }
.chips span { padding: .1rem .7rem; border-radius: 999px; border: 2px solid var(--accent); color: var(--accent); font-weight: 700; }
.box { padding: .8rem 1rem; border-left: 6px solid var(--accent); background: var(--surface); margin-bottom: 1rem; }
.timeline { list-style: none; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.timeline li { padding: .8rem 1rem; background: var(--surface); border: 1px solid var(--border); }
.timeline b { display: block; color: var(--accent); font-size: 1.1em; }
.cards { list-style: none; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); counter-reset: c; }
.cards li { counter-increment: c; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--border); }
ol.cards li::before { content: counter(c) ". "; font-weight: 800; color: var(--accent); }
.split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); align-items: start; }
.slide .viz-slot .viz-stage canvas { height: 15rem; }
.slide .viz-slot .viz-cap, .slide .viz-slot .viz-legend { font-size: .8em; }
.slide .viz-slot .hint { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* still read via aria-describedby */
.slide .viz-slot { padding: .4rem; }
.defs { margin: 0; display: grid; gap: .4rem; }
.defs div { padding: .45rem .7rem; }
.defs dt { font-weight: 800; color: var(--accent); }
.defs dd { margin: 0; }
.pairs { padding-left: 1.2rem; display: grid; gap: .4rem; }
.pairs li { padding: .3rem .5rem; }
table.laws { font-size: .92em; }
.formulas { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.formulas div { display: grid; gap: .3rem; padding: 1rem; background: var(--surface); border: 1px solid var(--border); }
.formulas .f, .big-f { font-size: 1.35em; font-weight: 800; color: var(--accent); }
.big-f { padding: .4rem .7rem; width: fit-content; }
.example, .task { padding: .8rem 1rem; background: var(--surface); border: 1px dashed var(--accent); }
.steps { display: grid; gap: .5rem; padding-left: 1.4rem; }
.steps li { padding: .45rem .6rem; }
.next { font-weight: 700; padding: .6rem .8rem; }
.progress { height: 5px; border-radius: 999px; background: var(--surface-2); margin: .6rem 0; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.caption { margin: .4rem auto; max-width: 60rem; min-height: 3.4em; padding: .6rem 1rem; border-radius: 10px; background: var(--caption-bg); color: var(--caption-fg); font-size: 1.12rem; text-align: center; }
.deck-bar { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; justify-content: center; }
.deck-bar .play { min-width: 9rem; }
.counter { font-variant-numeric: tabular-nums; font-weight: 700; padding-inline: .4rem; }
.deck .hint { text-align: center; margin: .5rem 0 0; }
.transcript h2 { font-size: 1.1rem; }

footer.site { border-top: 1px solid var(--border); color: var(--muted); font-size: .95rem; padding-block: 1rem 2rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .slide .hl { transform: none; }
}
@media print {
  header.site, footer.site, .player, .deck-bar, .skip, .pager, .calc, .quiz button, .viz-ctrl, .viz-pick, .side { display: none !important; }
  main:has(.player) { padding-bottom: 0; }
  details > * { display: block; }
}

/* ---------- digital lab ---------- */
.vlab-progress { max-width: 26rem; margin-top: .5rem; }
.meter.dark { background: var(--surface-2); border: 1px solid var(--border); }
.meter.dark span { background: var(--accent); }
.safety ul { padding-left: 1.3rem; }
.vlab-exps[inert] { opacity: .55; }
.exp-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; justify-content: space-between; }
.exp-head h3 { margin: 0; font-size: 1.15rem; }
.status { font-weight: 700; font-size: .9rem; color: var(--muted); }
.status.ok { color: var(--ok); }
.exp-steps { padding-left: 1.3rem; color: var(--muted); }
.note { display: block; margin-top: 1rem; font-weight: 600; }
.note textarea, .ask input, .field select { width: 100%; max-width: 46rem; margin-top: .3rem; padding: .5rem; border: 2px solid var(--border); border-radius: 8px; background: var(--bg); font-weight: 400; }
.bench { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .bench { grid-template-columns: minmax(12rem, auto) minmax(0, 1fr); align-items: start; } }
.rack { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); justify-content: center; }
.tube { flex-direction: column; min-width: 4.2rem; padding: .3rem .2rem; background: transparent; color: var(--fg); }
.tube[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.tube-svg { width: 4.2rem; height: 15rem; display: block; }
.tube-n { font-weight: 800; font-size: .9rem; }
.bub { fill: #fff; stroke: #0003; animation: rise 1.6s linear infinite; }
@keyframes rise { from { transform: translateY(0); opacity: .9; } to { transform: translateY(var(--h)); opacity: .1; } }
.shelf-h { margin: .2rem 0 .4rem; font-weight: 700; }
.reagents, .actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.reagents button { flex-direction: column; align-items: flex-start; gap: 0; text-align: left; min-width: 7.5rem; padding: .35rem .6rem; }
.reagents small { font-weight: 400; font-size: .75rem; color: var(--muted); }
.actions button { font-weight: 600; }
.log-h { margin: 1rem 0 .3rem; font-size: 1rem; }
.obs-log { max-height: 16rem; overflow: auto; margin: 0; padding: .5rem .5rem .5rem 1.8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.obs-log li { margin-block: .35rem; }
.eq { display: block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; color: var(--accent); }
.eq.ion { color: var(--muted); }
.sim-steps { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.readout { margin: .5rem 0; padding: .6rem .8rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; }
.readout:empty { display: none; }
.ask { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: .75rem 0; }
.ask label { display: block; min-height: 0; font-weight: 600; flex: 1 1 16rem; }
.ask .fb { flex-basis: 100%; margin: 0; }
.chart { width: 100%; max-width: 28rem; height: auto; color: var(--muted); display: block; margin: .5rem 0; }
.burette { float: right; width: 1.6rem; height: 8rem; margin: 0 0 .5rem 1rem; border: 2px solid var(--fg); border-top: 0; border-radius: 0 0 6px 6px; background: #7fb8ff55; position: relative; }
.burette div { background: var(--surface); width: 100%; transition: height .8s; }
.turb { position: relative; width: 11rem; height: 8rem; margin: .5rem 0; border-radius: 0 0 40px 40px; border: 3px solid var(--fg); border-top: 0; background: #fff; overflow: hidden; display: grid; place-items: center; }
.cross { font-size: 4rem; color: #000; font-weight: 900; }
.cloud { position: absolute; inset: 0; background: #f2efd8; opacity: 0; }
.watch { position: absolute; top: .3rem; right: .4rem; font: 700 .95rem ui-monospace, monospace; color: #000; background: #fffc; padding: 0 .3rem; border-radius: 4px; }
.cond { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.lamp svg { width: 5rem; color: var(--fg); }
.glow { fill: rgba(255, 210, 60, 0); transition: fill .4s, opacity .4s; }
.cond-list { display: grid; gap: .35rem; flex: 1 1 22rem; }
.cond-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cond-row button { flex: 1 1 14rem; justify-content: flex-start; }
.cond-row select.good { border-color: var(--ok); }
.cond-row select.bad { border-color: var(--bad); box-shadow: 0 0 0 2px var(--bad); }
.utube { display: flex; gap: 2.5rem; margin: .75rem 0; }
.arm { display: grid; justify-items: center; gap: .3rem; font-size: .85rem; font-weight: 700; }
.arm i { display: block; width: 3rem; height: 8rem; border: 3px solid var(--fg); border-top: 0; border-radius: 0 0 1.5rem 1.5rem; transition: background .8s; position: relative; }
.arm i.gas::after { content: "∘ ° ∘ °"; position: absolute; top: .4rem; left: 0; right: 0; text-align: center; color: #fff; letter-spacing: .1rem; }
.arm.cat.cu i { box-shadow: inset 0 -12px 0 #b5562e; }
.cell-mini { display: flex; gap: .4rem; align-items: flex-end; height: 5rem; margin: .5rem 0; }
.cell-mini .cath { width: 1rem; height: 4.5rem; background: #b5562e; opacity: 0; transition: opacity .6s; }
.cell-mini .sol { width: 8rem; height: 3.5rem; background: #3d9be0; border: 2px solid var(--fg); border-top: 0; transition: opacity .6s; }
.choose { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.match { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.match-item { padding: .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.match-item label { display: block; min-height: 0; }
.match-item select { width: 100%; margin-top: .3rem; }
.match .primary, .match .result { grid-column: 1 / -1; justify-self: start; }
.glass { width: 5rem; height: 7rem; color: var(--fg); }
.meniscus { width: 9rem; height: auto; color: var(--fg); }
.journal .j-exp { border-top: 1px solid var(--border); padding-top: .5rem; }
.journal h3 { font-size: 1.05rem; margin: .5rem 0; }
@media print {
  body.print-journal main > :not(.vlab-page), body.print-journal .vlab-page > :not(.journal) { display: none !important; }
  body.print-journal .journal .toolbar, body.print-journal .journal .hint { display: none !important; }
  body.print-journal .journal { box-shadow: none; border: 0; }
}

/* ---------- 3D lab ---------- */
.lab3d { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 64rem) { .lab3d { grid-template-columns: minmax(0, 1fr) 22rem; } }
.stage3d { position: relative; height: min(72vh, 46rem); min-height: 22rem; border-radius: var(--radius); overflow: hidden; background: #dfe6ec; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stage3d canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.loading3d { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-weight: 700; color: #1f2937; text-align: center; padding: 1rem; }
.toast3d { position: absolute; left: 0; top: 0; max-width: 18rem; padding: .45rem .7rem; border-radius: 10px; background: rgba(10, 14, 22, .86); color: #fff; font-size: .9rem; pointer-events: none; opacity: 0; transition: opacity .25s; }
.toast3d.on { opacity: 1; }
.cam3d { position: absolute; right: .6rem; bottom: .6rem; display: flex; gap: .4rem; }
.cam3d button { background: rgba(255, 255, 255, .9); color: #111; border-color: #fff; min-height: 2.4rem; }
.panel3d { display: flex; flex-direction: column; gap: .4rem; padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); max-height: min(72vh, 46rem); overflow: auto; }
@media (max-width: 63.99rem) { .panel3d { max-height: none; } }
.panel3d .field select { width: 100%; }
.steps3d { margin: 0; padding-left: 1.2rem; color: var(--muted); font-size: .92rem; }
.next3d { margin: 0; padding: .45rem .6rem; border-radius: 8px; background: var(--accent-soft); color: var(--fg); font-weight: 700; }
.sel3d { margin: 0; font-size: .9rem; color: var(--muted); }
.tubes3d, .reag3d, .act3d { display: flex; flex-wrap: wrap; gap: .3rem; }
.tubes3d button { min-width: 2.6rem; }
.reag3d button { flex-direction: column; align-items: flex-start; gap: 0; padding: .3rem .55rem; min-width: 6.5rem; }
.reag3d small { font-weight: 400; font-size: .72rem; color: var(--muted); }
.log3d { max-height: 14rem; }
.lab3d.busy .panel3d button { cursor: progress; }
/* 3D lab: test-tube mode vs instrument mode (the digital lab's simulator runs inside the panel) */
.lab3d.app-mode .tubeui, .lab3d:not(.app-mode) .sim3d { display: none; }
.sim3d { display: grid; gap: .5rem; font-size: .95rem; }
.sim3d .utube, .sim3d .cond .lamp, .sim3d .turb, .sim3d .cell-mini, .sim3d .burette, .sim3d svg.meniscus, .sim3d svg.glass { display: none; }
.sim3d .cond-row button { flex: 1 1 9rem; }
.sim3d dl.facts { grid-template-columns: 1fr auto; }
.sim3d .match { grid-template-columns: 1fr; }
.sim3d .sim-steps { flex-direction: column; align-items: stretch; }
.sim3d .sim-steps button { justify-content: flex-start; text-align: left; }
.panel3d .hint-on { outline: 3px solid var(--accent); outline-offset: 2px; animation: hint3d 1.4s ease-in-out infinite; }
@keyframes hint3d { 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .panel3d .hint-on { animation: none; } }
/* sign-language studio: the camera frame (portrait 3:4, as shown next to the slide) and a teleprompter */
.studio { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .studio { grid-template-columns: minmax(16rem, 26rem) minmax(0, 1fr); align-items: start; } }
.studio-cam { position: relative; aspect-ratio: 3 / 4; background: #111; border-radius: var(--radius); overflow: hidden; }
.studio-cam canvas { display: block; width: 100%; height: 100%; transform: scaleX(-1); } /* mirror only on screen, like a mirror */
.studio-off { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #ddd; font-weight: 700; }
.studio-off[hidden] { display: none; }
.studio-count { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 800 6rem/1 system-ui, sans-serif; text-shadow: 0 2px 12px #000; pointer-events: none; }
.studio-rec { position: absolute; top: .6rem; left: .6rem; padding: .2rem .55rem; border-radius: 8px; background: #c81e1e; color: #fff; font-weight: 800; }
.studio-preview { position: absolute; inset: auto .6rem .6rem auto; width: 38%; aspect-ratio: 3 / 4; object-fit: cover; border: 3px solid #fff; border-radius: 10px; background: #000; }
.studio-side { display: grid; gap: .6rem; align-content: start; }
.studio-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.studio-chips button { min-width: 3.2rem; }
.studio-title { margin: .3rem 0 0; }
.prompter { margin: 0; padding: .8rem 1rem .8rem 2.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; font-size: 1.25rem; line-height: 1.6; max-height: 22rem; overflow: auto; }
.prompter li { padding: .15rem .3rem; border-radius: 6px; }
.prompter li.now { background: var(--mark); outline: 2px solid var(--accent); }
.studio-status:empty { display: none; }
.studio-status { margin: 0; padding: .5rem .7rem; border-radius: 8px; background: var(--accent-soft); font-weight: 600; }
.studio [hidden] { display: none !important; } /* buttons are inline-flex site-wide, which would beat the hidden attribute */
