/* Editorial Campus foundations plus site-wide ambient glass.
   Chrome uses 75% material; reading surfaces use 55%. Study originals stay opaque. */
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/FrauncesVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter Variable";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter Variable";
  src: url("/static/fonts/InterVariable-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}
:root,
html[data-theme] {
  color-scheme: light;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --ink: #172b29;
  --muted: #51645e;
  --line: #dbe3dc;
  --green: #146b5f;
  --on-green: #ffffff;
  --soft: #e0eee4;
  --chip: #edf3f0;
  --course-mint: #e0eee4; --course-mint-ink: #224e43;
  --course-coral: #f4bea3; --course-coral-ink: #603c2f;
  --course-lilac: #ded6f4; --course-lilac-ink: #443956;
  --course-blue: #dcebf8; --course-blue-ink: #294b65;
  --accent-coral: #f28473;
  --campus-navy: #173c33; --on-campus-navy: #f4faf9;
  --amber: #88511b;
  --red: #a23232;
  --shadow: 0 8px 28px #172b3a0b;
  --radius: 24px;
  /* 1ch is the advance of "0", .63em in Inter, but German running text averages
     .48em per character. A cap written as 65ch therefore seats about 86
     characters. This token is one average character, so a reading measure can be
     written as calc(66 * var(--lv-char)) and mean 66 characters. */
  --lv-char: .76ch;
  --reading-alpha: .65;
  --shell-alpha: .75;
  --glass-reading: rgb(255 254 250 / var(--reading-alpha));
  --glass-shell: rgb(255 254 250 / var(--shell-alpha));
  --glass-inset: rgb(243 245 237 / calc(var(--reading-alpha) - .02));
  --glass-surface: var(--glass-shell);
  --glass-border: rgb(255 255 255 / .72);
  --glass-highlight: rgb(255 255 255 / .58);
  --glass-shadow: 0 18px 48px rgb(23 43 41 / .16);
  --glass-rim: #172b3a10;
  --glass-muted: #354842;
  --focus: #064f47;
  --hero-start: #172b3a;
  --hero-end: #1d5260;
  --glow-teal: #ddf3ea48;
  --glow-iris: #e7e0ff30;
  --glow-peach: #f8d9cb20;
  --sans: "Inter Variable", "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --reading-font: var(--sans);
  --serif: var(--sans);
  --display: "Fraunces", "Source Serif 4", Georgia, serif;
  font-family: var(--sans);
  line-height: 1.6;
}
html[data-reading-font="atkinson"] { --reading-font: "Atkinson Hyperlegible", var(--sans); }
.prose, .prep-prose, .help-reading { font-family: var(--reading-font); }
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #172522; --surface: #233530; --ink: #f1f4ed;
  --muted: #b7c8c0; --line: #40584e; --green: #94d7c0;
  --on-green: #122c24; --soft: #29483b; --chip: #2b4540;
  --course-mint: #284e49; --course-mint-ink: #cceee2;
  --course-coral: #654638; --course-coral-ink: #ffe1d2;
  --course-lilac: #443b61; --course-lilac-ink: #e6dcff;
  --course-blue: #2f485e; --course-blue-ink: #d4eaff;
  --campus-navy: #122c24;
  --amber: #efbf7e; --red: #ffb2ab;
  --shadow: 0 8px 24px #00000020;
  --glass-reading: rgb(35 53 48 / var(--reading-alpha));
  --glass-shell: rgb(35 53 48 / var(--shell-alpha));
  --glass-inset: rgb(41 61 54 / calc(var(--reading-alpha) - .02));
  --glass-surface: var(--glass-shell);
  --glass-border: #c1eeee38;
  --glass-highlight: #d7ffff1c;
  --glass-shadow: 0 10px 28px #00000045;
  --glass-rim: #00000050;
  --glass-muted: #c9d8d0;
  --glow-teal: #1d76632b; --glow-iris: #6d58991f; --glow-peach: #79553514;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --paper: #172522; --surface: #233530; --ink: #f1f4ed;
    --muted: #b7c8c0; --line: #40584e; --green: #94d7c0;
    --on-green: #122c24; --soft: #29483b; --chip: #2b4540;
    --course-mint: #284e49; --course-mint-ink: #cceee2;
    --course-coral: #654638; --course-coral-ink: #ffe1d2;
    --course-lilac: #443b61; --course-lilac-ink: #e6dcff;
    --course-blue: #2f485e; --course-blue-ink: #d4eaff;
    --campus-navy: #122c24;
    --amber: #efbf7e; --red: #ffb2ab;
    --shadow: 0 8px 24px #00000020;
    --glass-reading: rgb(35 53 48 / var(--reading-alpha));
    --glass-shell: rgb(35 53 48 / var(--shell-alpha));
    --glass-inset: rgb(41 61 54 / calc(var(--reading-alpha) - .02));
    --glass-surface: var(--glass-shell);
    --glass-border: #c1eeee38;
    --glass-highlight: #d7ffff1c;
    --glass-shadow: 0 10px 28px #00000045;
    --glass-rim: #00000050;
    --glass-muted: #c9d8d0;
    --glow-teal: #1d76632b; --glow-iris: #6d58991f; --glow-peach: #79553514;
  }
}
body {
  position: relative;
  isolation: isolate;
  background: radial-gradient(ellipse at 4% 0%, var(--glow-teal), transparent 44rem),
    radial-gradient(ellipse at 95% 5%, var(--glow-iris), transparent 40rem),
    radial-gradient(ellipse at 70% 100%, var(--glow-peach), transparent 34rem), var(--paper);
  background-repeat: no-repeat;
}
.site-header, .shell, main, .tabs, footer.site-footer { position: relative; z-index: 1; }
.site-header, .shell { max-width: 1260px; }
.site-header { padding-top: calc(1.3rem + env(safe-area-inset-top)); padding-bottom: 1.25rem; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.brand strong { font-size: 1.06rem; font-weight: 650; letter-spacing: -.035em; }
.brand span:not(.brand-mark) { font-size: .78rem; }
.brand-mark { border: 1px solid var(--glass-border); box-shadow: inset 0 1px 1px var(--glass-highlight), 0 4px 12px #254b4921; border-radius: 15px; }
h1 { font-size: clamp(1.9rem, 3.8vw, 2.8rem); letter-spacing: -.045em; font-weight: 650; }
h2 { letter-spacing: -.025em; font-weight: 620; }
h3, legend { font-weight: 620; }
.eyebrow { color: var(--green); font-size: .74rem; letter-spacing: .09em; }
.section-heading { margin: .8rem 0 1.5rem; }
.section-heading p { max-width: calc(66 * var(--lv-char)); }
.tabs {
  width: fit-content; max-width: 100%; margin: 0 0 1.65rem; padding: .35rem;
  border: 1px solid var(--glass-border); border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 1px 1px var(--glass-highlight), inset 0 -1px 1px var(--glass-rim), var(--glass-shadow);
  gap: .2rem;
}
.tabs button {
  flex: 0 1 auto; min-width: 5.8rem; min-height: 48px; display: flex;
  align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.05rem; color: var(--muted); border-radius: 999px;
  font-size: .86rem; font-weight: 600; box-shadow: none; border-color: transparent;
}
.tabs .tab-secondary { display: none; }
.tabs button[aria-selected="true"] {
  color: var(--on-green); background: var(--green);
  border-color: transparent; box-shadow: 0 3px 9px #172b3a14;
}
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.menu-toggle { min-height: 46px; border-radius: 999px; padding: .6rem 1rem; background: var(--surface); color: var(--green); border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow); }
button { min-height: 46px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; border-radius: 14px; font-weight: 600; padding: .7rem 1.1rem; box-shadow: 0 3px 8px #173f470c; }
button:hover:not(:disabled) { filter: none; }
button.secondary { background: linear-gradient(145deg, var(--glass-highlight), transparent), var(--surface); border-color: var(--line); box-shadow: inset 0 1px 0 var(--glass-highlight), 0 2px 6px #173f4708; }
button.quiet { box-shadow: none; }
input, select, textarea { background: var(--surface); border-radius: 15px; border-color: var(--line); min-height: 48px; font-size: 1rem; box-shadow: inset 0 1px 3px #173f4708; }
input[type="checkbox"], input[type="radio"] { min-height: 20px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
:focus-visible { outline: 3px solid var(--focus, var(--green)); outline-offset: 4px; }
button:disabled { opacity: .58; box-shadow: none; }
.card, .empty-state, .viewer-card, .bridge .card {
  border-color: var(--glass-border); border-radius: var(--radius);
  background: var(--glass-reading); box-shadow: var(--glass-shadow);
  padding: 1.45rem;
}
.card.accent, .ticket { background: var(--soft); }
.badge, .local-badge { color: var(--green); background: var(--soft); font-weight: 550; }
.card.flash-card { border-left: 4px solid var(--family, var(--green)); }
.family-grid, .topic-grid { gap: .75rem; }
.actions > *, .match-col { min-width: 0; }
.match-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.family-card, .topic-card { border-radius: 20px; box-shadow: inset 0 1px 0 var(--glass-highlight), 0 3px 10px #183f4708; }
.family-card[aria-pressed="true"], .topic-card[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--green), 0 3px 12px #183f4714; }
.pill, .chip { min-height: 44px; font-weight: 550; }
.choice-label { background: var(--paper); padding: 1rem; border-radius: 17px; }
.choice-label:has(input:checked) { background: var(--soft); border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.choice-label input { margin-top: .15rem; }
.question-card > h2 { font-size: clamp(1.15rem, 2.3vw, 1.5rem); line-height: 1.5; margin-bottom: 1.2rem; }
.question-card { scroll-margin-top: 1.25rem; }
.question-top .badge { max-width: 100%; white-space: normal; }
.question-card .actions { gap: .5rem .8rem; }
.prose, .prep-prose { max-width: calc(70 * var(--lv-char)); }
summary { min-height: 44px; padding-block: .25rem; }
.citations, .document-meta { font-size: .84rem; }
.citation button { min-height: 44px; }
.feedback, .hint, .notice { border-radius: 16px; }
.feedback { border-left: 4px solid var(--green); }
.session-context { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; padding: 1rem 1.25rem; margin-bottom: 1rem; background: var(--soft); border: 1px solid var(--line); border-radius: 20px; }
.session-context p { margin: 0; font-size: .9rem; }
.session-context button { font-size: .85rem; }
#panel-practice.is-studying > .section-heading, #panel-practice.is-studying > #family-grid, #panel-practice.is-studying > #session-form { display: none; }
#panel-practice.is-studying #session { max-width: 880px; margin-inline: auto; }
#panel-practice.is-studying .session-context { max-width: 880px; margin-inline: auto; }
.study-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.3rem; }
.study-shortcuts a { display: inline-flex; align-items: center; padding: .45rem .9rem; min-height: 44px; color: var(--green); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .84rem; }
.study-shortcuts a:hover { background: var(--soft); }
#panel-practice.is-studying > .study-shortcuts { display: none; }
/* The daily bridge keeps its subject stations, with the shared visual language. */
.bridge {
  --bridge-ink: var(--ink); --bridge-muted: var(--muted); --bridge-panel: var(--paper);
  --bridge-panel-2: var(--surface); --bridge-amber: var(--amber); --bridge-cyan: var(--green);
  --bridge-ok: var(--green); --bridge-line: var(--line);
  background: transparent; padding: 0; box-shadow: none;
}
.bridge-mast { grid-template-columns: minmax(0, 1fr) auto; margin: .8rem 0 1.3rem; gap: 1rem; }
.bridge-cap { display: none; }
.bridge-mast h1 { max-width: 28ch; }
.bridge-stardate { font-size: .78rem; font-weight: 550; letter-spacing: .025em; color: var(--muted); }
.bridge-light { background: var(--surface); border: 1px solid var(--line); font-weight: 500; }
.bridge .bridge-hero {
  position: relative; isolation: isolate; overflow: hidden;
  background: radial-gradient(ellipse at 110% -35%, #b8fff34d, transparent 65%), linear-gradient(125deg, var(--hero-start), var(--hero-end));
  border: 1px solid #c5fff080; color: #f4fffc; padding: clamp(1.4rem, 3vw, 2.2rem);
  box-shadow: inset 0 1px 2px #ffffff73, inset 0 -2px 3px #00373535, 0 14px 28px #0e555d20;
}
.bridge-hero::after { content: ""; position: absolute; z-index: -1; width: 75%; height: 5rem; left: 45%; top: -2.8rem; transform: rotate(-12deg); border-radius: 50%; background: #ffffff12; border-bottom: 1px solid #ffffff40; pointer-events: none; }
.bridge .bridge-hero :is(h1,h2,h3,h4,.eyebrow,.muted,.learner-hint,.document-meta,small) { color: #f4fffc; }
.bridge .bridge-hero h2 { font-size: clamp(1.55rem, 3vw, 2.15rem); }
.bridge .bridge-hero button { background: linear-gradient(#ffffff, #e1f5f0); color: #075552; border-color: #ffffffd9; box-shadow: inset 0 1px 0 #ffffff, 0 4px 10px #003d4938; }
.bridge .bridge-hero button.secondary { background: #ffffff12; color: #f4fffc; border-color: #ffffff70; box-shadow: inset 0 1px 0 #ffffff26; }
.bridge .bridge-hero button.quiet { background: transparent; color: #f4fffc; border-color: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
.bridge .hero-more { border-color: #ffffff40; margin: .8rem 0; padding: .5rem 0; }
.bridge .hero-more summary { color: #f4fffc; font-size: .9rem; font-weight: 550; }
.bridge .hero-more .actions { margin-bottom: .3rem; }
.bridge .bridge-hero a { color: #ffffff; }
.bridge .bridge-hero :focus-visible { outline-color: #ffffff; }
.bridge .card:not(.bridge-hero) { color: var(--ink); }
.bridge button.secondary, .bridge button.quiet, .bridge a.plan-link { background: var(--surface); color: var(--green); border-color: var(--line); border-radius: 999px; }
.bridge-lane-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1rem; }
.bridge-lane { border-radius: 22px; border: 1px solid var(--glass-border); border-top: 4px solid var(--family); padding: 1.2rem; box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow); }
.bridge-rail-item, .bridge-later-item, .bridge-log-row { border-radius: 18px; padding: 1rem; }
.bridge-rail-item.is-past { opacity: .85; }
.bridge-rail-item.is-next { outline-width: 1px; }
.quest-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.quest-step { border-radius: 17px; min-height: 54px; padding: .8rem; }
.quest-step.is-done { background: var(--green); color: var(--on-green); }
.bridge .quest-step.is-done { background: var(--green); color: var(--on-green); border-color: var(--green); }
.week-day { border-radius: 17px; }
.plan-class, .agenda-card { border-radius: 16px; }
/* Share material quality with the independently loaded feature panels. */
.exams .ex-card, .exams .ex-hero, .exams .ex-board, .uni-platform, .uni-card,
.prep-inbox, .prep-packages, .prep-builder, .prep-source-card, .prep-content,
.prep-review, .prep-generation, .prep-versions, .prep-home-strip {
  border-color: var(--glass-border); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}
.exams .ex-primary, .prep-primary, .uni-open-platform { border-radius: 999px; font-weight: 600; box-shadow: inset 0 1px 0 #ffffff38, 0 3px 8px #173f4712; }
.exams .ex-primary:hover:not(:disabled) { transform: none; box-shadow: inset 0 1px 0 #ffffff38, 0 5px 12px #173f4720; }
.prep-pill, .uni-badge, .uni-capability-heading .uni-badge { font-size: .76rem; }
.uni-card-footer small { font-size: .75rem; }
.prep-chemistry { background: linear-gradient(125deg, var(--hero-start), var(--hero-end)); color: #f4fffc; border: 1px solid #ffffff66; box-shadow: inset 0 1px 0 #ffffff77, var(--shadow); border-radius: var(--radius); }
.prep-chemistry .prep-primary { color: #075552; background: #f4fffc; border-color: #ffffff; }
.prep-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.uni-heading h1 { font-size: clamp(2rem, 4vw, 3rem); }
.menu-backdrop { background: #0b273f66; }
.app-menu { top: max(.6rem, env(safe-area-inset-top)); right: max(.6rem, env(safe-area-inset-right)); bottom: max(.6rem, env(safe-area-inset-bottom)); height: auto; width: min(28rem, calc(100% - 1.2rem)); border: 1px solid var(--glass-border); border-radius: 28px; box-shadow: inset 0 1px 0 var(--glass-highlight), 0 22px 60px #061c3b45; overscroll-behavior: contain; padding: 1.3rem; }
.menu-head { position: sticky; top: -1.3rem; margin: -1.3rem -1.3rem .6rem; padding: 1.1rem 1.3rem .75rem; background: var(--surface); z-index: 1; border-bottom: 1px solid var(--line); }
.menu-head .eyebrow { margin: 0; }
.menu-label { font-size: .76rem; margin-top: 1.4rem; }
.menu-link { border-radius: 12px; font-size: .93rem; font-weight: 550; padding: .65rem .75rem; }
.menu-link:hover, .menu-link[aria-current="page"] { background: var(--soft); color: var(--green); }
.coach, .badge-pop { border-radius: 22px; box-shadow: var(--glass-shadow); border-color: var(--glass-border); }
.skip-link { z-index: 30; border-radius: 16px; }
.ambient-art {
  --art-image: url("/static/assets/learning-studio/lesson-molecular-960.webp");
  --art-position: 58% 48%;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #ead8c9;
}
.ambient-art::before {
  content: "";
  position: absolute;
  inset: -4%;
  background: linear-gradient(115deg, rgb(247 245 239 / .34), transparent 48%, rgb(20 107 95 / .08)),
    linear-gradient(180deg, rgb(247 245 239 / .12), rgb(247 245 239 / .26)), var(--art-image);
  background-position: center, center, var(--art-position);
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(.88) contrast(.96);
  transform: scale(1.035);
  transform-origin: var(--art-position);
}
.ambient-art-layer {
  position: absolute;
  inset: -4%;
  opacity: 0;
  background: linear-gradient(115deg, rgb(247 245 239 / .34), transparent 48%, rgb(20 107 95 / .08)),
    linear-gradient(180deg, rgb(247 245 239 / .12), rgb(247 245 239 / .26)), var(--art-next-image);
  background-position: center, center, var(--art-position);
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(.88) contrast(.96);
  transform: scale(1.045);
  transform-origin: var(--art-position);
  transition: opacity 1400ms ease;
}
.ambient-art::before { transition: opacity 1400ms ease; }
.ambient-art.is-next-visible::before { opacity: 0; }
.ambient-art.is-next-visible .ambient-art-layer { opacity: 1; }
.ambient-art.is-committing::before, .ambient-art.is-committing .ambient-art-layer { transition: none; }
.ambient-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(247 245 239 / .78) 0%, rgb(247 245 239 / .46) 38%, rgb(247 245 239 / .12) 62%, transparent 78%);
}
html[data-theme="dark"] .ambient-art { background-color: #1a2420; }
html[data-theme="dark"] .ambient-art::before, html[data-theme="dark"] .ambient-art-layer { filter: saturate(.7) contrast(.9) brightness(.72); }
html[data-theme="dark"] .ambient-art::after {
  background: linear-gradient(90deg, rgb(23 37 34 / .82) 0%, rgb(23 37 34 / .5) 38%, rgb(23 37 34 / .18) 62%, transparent 78%);
}
body.learning-studio:has(#panel-home:not([hidden])) .ambient-art {
  --art-image: url("/static/assets/home-v2/hero-960.webp");
  --art-position: 72% 46%;
}
body.learning-studio:has(#panel-exams:not([hidden])) .ambient-art,
body.learning-studio:has(#panel-practice:not([hidden])) .ambient-art {
  --art-image: url("/static/assets/learning-studio/lesson-molecular-960.webp");
  --art-position: 56% 50%;
}
.landing-page .ambient-art {
  --art-image: url("/static/assets/landing-v2/hero-960.webp");
  --art-position: 70% 58%;
}
body.quiet-art .ambient-art {
  --art-image: none;
  background: radial-gradient(ellipse at 12% 0%, var(--glow-teal), transparent 42rem),
    radial-gradient(ellipse at 90% 8%, var(--glow-iris), transparent 38rem), var(--paper);
}
body.quiet-art .ambient-art::before { display: none; }
body.quiet-art .ambient-art-layer { display: none; }
body.quiet-art .ambient-art::after {
  background: linear-gradient(90deg, rgb(247 245 239 / .55) 0%, transparent 55%);
}
html[data-theme="dark"] body.quiet-art .ambient-art::after {
  background: linear-gradient(90deg, rgb(23 37 34 / .35) 0%, transparent 55%);
}
#viewer-content, .reader-display, .workspace-board, iframe[src*="etherpad"], iframe[src*="jitsi"],
.meeting-host iframe {
  background: var(--surface);
}
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  background: var(--surface);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tabs, .menu-toggle, .site-header, .app-menu {
    background: linear-gradient(145deg, var(--glass-highlight), transparent), var(--glass-shell);
    -webkit-backdrop-filter: blur(10px) saturate(112%);
    backdrop-filter: blur(10px) saturate(112%);
  }
  .card, .empty-state, .viewer-card, .bridge .card, .access-card {
    -webkit-backdrop-filter: blur(11px) saturate(116%);
    backdrop-filter: blur(11px) saturate(116%);
  }
  .menu-backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.quiet-art) .ambient-art::before { animation: ambient-drift 26s ease-in-out infinite alternate; }
  body:not(.quiet-art):focus-within .ambient-art::before { animation-play-state: paused; }
}
@keyframes ambient-drift {
  from { transform: scale(1.035) translate(0, 0); }
  to { transform: scale(1.06) translate(-1.2%, 0.8%); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  button:not(:disabled):not(.quiet):not(.quest-step):hover { transform: translateY(-1px); }
  .family-card:hover, .topic-card:hover { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: no-preference) {
  button, .tabs button, .family-card, .topic-card { transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease; }
  button:not(:disabled):active { transform: scale(.98); }
}
@media (max-width: 900px) {
  body { padding-bottom: calc(6.8rem + env(safe-area-inset-bottom)); }
  html { scroll-padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
  .site-header { padding-inline: 1.1rem; gap: .75rem; }
  .header-actions { gap: .4rem; }
  .brand { gap: .65rem; }
  .brand strong { font-size: 1rem; }
  .brand span:not(.brand-mark) { font-size: .74rem; }
  .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .shell { padding-inline: 1.05rem; }
  .tabs { position: fixed; z-index: 15; top: auto; left: max(.65rem, env(safe-area-inset-left)); right: max(.65rem, env(safe-area-inset-right)); bottom: max(.7rem, env(safe-area-inset-bottom)); width: auto; max-width: 560px; margin: 0 auto; padding: .35rem; gap: .12rem; border: 1px solid var(--glass-border); border-radius: 30px; overflow: visible; }
  .tabs button { flex: 1 1 0; min-width: 0; min-height: 59px; flex-direction: column; gap: .25rem; padding: .45rem .15rem; font-size: .74rem; line-height: 1.25; border-radius: 24px; }
  .tabs .nav-icon { width: 21px; height: 21px; flex-basis: 21px; }
  .card, .bridge .card { padding: 1.2rem; }
  .bridge-mast { grid-template-columns: minmax(0, 1fr); }
  .bridge-status { grid-column: auto; justify-items: start; }
  .bridge-lane-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
  .bridge .bridge-hero { padding: 1.5rem; }
  .session-navigation { gap: .5rem; }
  .session-navigation button:last-child { margin-left: 0; }
  #answer-form { scroll-margin-bottom: 7rem; }
  #check-answer { min-height: 50px; }
  .source-image { border-radius: 10px; }
  footer { padding-bottom: 1rem; }
}
@media (max-width: 540px) {
  .quest-steps { grid-template-columns: minmax(0, 1fr); }
  .quest-step { text-align: left; }
  .question-card .actions { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  #check-answer { grid-column: 1 / -1; }
  .question-card .actions button { padding-inline: .6rem; font-size: .86rem; }
  #session .flash-card > details { font-size: .94rem; }
  .session-context { padding: .85rem 1rem; }
  .prep-home-strip { border-left-width: 1px; }
}
@media (max-width: 370px) {
  .site-header { padding-inline: .8rem; }
  .brand strong { font-size: .9rem; }
  .brand span:not(.brand-mark) { font-size: .7rem; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 12px; }
  .menu-toggle { min-width: 44px; padding: .6rem; }
  .menu-toggle > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .shell { padding-inline: .8rem; }
  .tabs { left: .4rem; right: .4rem; padding: .25rem; }
  .tabs button { font-size: .74rem; }
  .card, .bridge .card { padding: 1.05rem; }
  .bridge .bridge-hero { padding: 1.2rem; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .ambient-art { opacity: .12; filter: saturate(.55); }
  .ambient-art::after { display: none; }
  .tabs, .menu-toggle, .app-menu, .site-header, .card, .empty-state, .viewer-card, .bridge .card, .access-card {
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--line);
  }
  .menu-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  button:hover, button:active, .tabs button[aria-selected="true"] { transform: none !important; }
  .ambient-art::before, .ambient-art::after, .ambient-art-layer { animation: none !important; transform: none; transition: none !important; }
}
@media (forced-colors: active) {
  .ambient-art { display: none; }
  .tabs, .card, .bridge-lane, .app-menu, .site-header, .access-card {
    background: Canvas; color: CanvasText; border: 1px solid CanvasText; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs button[aria-selected="true"], .choice-label:has(input:checked) { outline: 2px solid Highlight; }
}
@media print {
  body { padding-bottom: 0; background: white; }
  .study-shortcuts, .session-context { display: none !important; }
  .bridge .bridge-hero { background: white; color: black; box-shadow: none; }
  .bridge .bridge-hero :is(h1,h2,h3,h4,.eyebrow,.muted,.learner-hint,.document-meta,small) { color: black; }
}
