@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(assets/dm-sans.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 500 700;
  font-display: swap;
  src: url(assets/playfair-italic.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(assets/playfair-regular.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #faf6f3;
  --white: #fffdfa;
  --ink: #301e25;
  --muted: #705e64;
  --wine: #842d4b;
  --line: #eadbdc;
  --pink: #f9e5eb;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.55 var(--sans); }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #963e5c; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
h1, h2 { font-family: var(--serif); font-weight: 600; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 2; top: .5rem; left: .5rem; transform: translateY(-180%); background: var(--white); padding: .7rem 1rem; }
.skip-link:focus { transform: none; }
.topbar { background: #fffbf9; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 74px; display: flex; gap: 22px; align-items: center; justify-content: space-between; }
.wordmark { display: inline-flex; gap: .63rem; align-items: center; white-space: nowrap; font: 600 1.25rem/1 var(--serif); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 11px; background: var(--wine); color: #fff3f5; font: 1rem/1 var(--sans); }
.nav { display: flex; align-items: center; gap: .35rem; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: .52rem .84rem; border-radius: .6rem; text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 700; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--wine); background: var(--pink); }
.nav-short { display: none; }
.study-upload { white-space: nowrap; }
.header-course { color: var(--muted); font-size: .73rem; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; white-space: nowrap; }
.header-course span { margin-inline: .22rem; color: #a96d81; }
.main { min-height: 71vh; padding-block: 42px 56px; }
.main:focus { outline: none; }
.noscript { margin-top: 2rem; }
.footer { padding-block: 24px 30px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .85rem; }
.footer .wordmark { color: var(--ink); font-size: 1.04rem; }
.footer .brand-mark { width: 24px; height: 24px; border-radius: 8px; font-size: .72rem; }

.hero { display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; min-height: 350px; border-radius: 27px; background: #f7e2e0; border: 1px solid #efd3d5; }
.hero-copy { padding: 45px 0 43px 50px; z-index: 1; position: relative; align-self: center; }
.eyebrow { color: var(--wine); font-size: .72rem; text-transform: uppercase; letter-spacing: .125em; font-weight: 800; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: .36rem .64rem; background: #fff7f3a8; border: 1px solid #eecad0; border-radius: 100px; }
.hero h1 { margin-block: .78rem .86rem; font-size: clamp(3.3rem, 5.65vw, 5.12rem); letter-spacing: -.058em; line-height: .98; }
.hero h1 em { color: var(--wine); font-weight: 550; }
.hero p { max-width: 35ch; color: #5b4148; font-size: 1.04rem; }
.hero-actions, .actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.hero-actions { margin-top: 1.55rem; }
.hero-art { position: relative; margin-left: -12%; min-width: 0; background: #f7e2e0; }
.hero-art img { display: block; position: absolute; height: 100%; width: 100%; object-fit: cover; object-position: 52% 56%; }
.hero-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #f7e2e0, transparent 29%); }
.btn { display: inline-flex; gap: .48rem; justify-content: center; align-items: center; min-height: 44px; border: 1px solid var(--wine); border-radius: .63rem; padding: .56rem .95rem; background: var(--wine); color: white; text-decoration: none; font-size: .88rem; font-weight: 760; }
.btn:hover { background: #6d223c; }
.btn.secondary { color: var(--wine); background: var(--white); border-color: #dec2c8; }
.btn.secondary:hover { background: #f9e9ed; }
.btn.text { background: transparent; color: var(--wine); border-color: transparent; padding-inline: .25rem; }
.btn.text:hover { text-decoration: underline; }
.btn:disabled { opacity: .45; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-block: 21px 42px; padding: 14px 0; background: var(--white); border: 1px solid var(--line); border-radius: 15px; }
.stat { display: flex; gap: .64rem; align-items: baseline; justify-content: center; padding: .22rem .6rem; color: var(--muted); font-size: .84rem; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { white-space: nowrap; color: var(--wine); font-size: 1.12rem; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 0 0 18px; }
.section-head h2 { font-size: clamp(1.95rem, 4vw, 2.53rem); letter-spacing: -.035em; }
.section-head p, .page-head p { color: var(--muted); margin-top: .4rem; }
.chapter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.rose { --tone: #f7e1e8; --tone-ink: #8a3453; }
.peach { --tone: #f9e6d9; --tone-ink: #873f30; }
.lilac { --tone: #eee4f5; --tone-ink: #624686; }
.mint { --tone: #e4eee5; --tone-ink: #365b46; }
.honey { --tone: #f5ead2; --tone-ink: #75521d; }
.sky { --tone: #e3edf6; --tone-ink: #375a76; }
.chapter-tile { text-decoration: none; display: flex; align-items: flex-start; gap: .87rem; padding: 18px 15px; min-height: 102px; border: 1px solid var(--line); border-radius: 15px; background: var(--white); }
.chapter-tile:hover { border-color: #bf8297; background: #fff; box-shadow: 0 4px 13px #632b4810; }
.icon { background: var(--tone, var(--pink)); color: var(--tone-ink, var(--wine)); flex: 0 0 auto; width: 43px; height: 43px; border-radius: 11px; display: grid; place-items: center; font-size: 1.42rem; font-weight: 650; font-family: var(--sans); }
.tile-text { flex: 1; }
.tile-arrow { color: var(--wine); padding-top: .06rem; }
.source-note { color: var(--muted); font-size: .77rem; margin-top: 21px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin-block: .28rem .5rem; font-size: clamp(2.45rem, 5vw, 3.7rem); letter-spacing: -.045em; }
.crumb { display: inline-block; margin-bottom: 1.05rem; color: var(--wine); text-decoration: none; font-weight: 750; font-size: .88rem; }
.crumb:hover { text-decoration: underline; }
.study-size { max-width: 805px; margin-inline: auto; }
.panel { border: 1px solid var(--line); border-radius: 18px; padding: clamp(17px, 4vw, 30px); background: var(--white); }
.lesson-intro { background: var(--tone); color: var(--tone-ink); margin-bottom: 15px; border-color: transparent; }
.lesson-intro p { color: var(--ink); margin-top: .55rem; font-size: 1.12rem; }
.lesson-notes { margin-bottom: 15px; }
.lesson-notes h2 { font-size: 1.63rem; margin-bottom: .9rem; }
.fact-list { display: grid; gap: 0; }
.fact { padding: .86rem 0; border-top: 1px solid var(--line); }
.fact h3 { font-size: 1rem; margin-bottom: .35rem; }
.fact p { color: #58444b; }
.memory { margin: 15px 0; border-radius: 14px; background: #f8e8ed; padding: 15px 19px; }
.memory p + p { margin-top: .26rem; }
.recall { margin: 15px 0; }
.recall summary, .review summary { font-weight: 750; cursor: pointer; }
.recall p { margin-top: .65rem; color: var(--muted); }
.lesson-end { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-top: 22px; }
.love-button { display: block; margin: .85rem auto .35rem; border: 0; border-radius: 50%; background: #f8e4eb; color: var(--wine); width: 30px; height: 30px; font-size: .86rem; }
.love-button:hover { background: #efcdd8; }
.love-note { color: var(--wine); text-align: center; font: italic 1.18rem/1.5 var(--serif); margin: .55rem auto 1rem; max-width: 40ch; }
.print-notes { display: none; }

.topic-picker { position: relative; width: min(100%, 360px); }
.topic-picker[open] { z-index: 2; }
.topic-picker summary { display: grid; gap: .34rem; list-style: none; cursor: pointer; border-radius: 11px; }
.topic-picker summary::-webkit-details-marker { display: none; }
.topic-picker summary:focus-visible { outline: none; }
.topic-picker summary:focus-visible .topic-picker-trigger { outline: 2px solid var(--wine); outline-offset: 2px; }
.topic-picker-label { color: var(--muted); font-size: .83rem; font-weight: 750; }
.topic-picker-trigger, .topic-picker-option { display: flex; align-items: center; gap: .58rem; min-width: 0; min-height: 45px; padding: .4rem .6rem; color: var(--ink); text-align: left; font-size: .86rem; font-weight: 750; }
.topic-picker-trigger { border: 1px solid #e3cdd4; border-radius: 10px; background: var(--white); }
.topic-picker summary:hover .topic-picker-trigger, .topic-picker[open] .topic-picker-trigger { border-color: #b97d94; }
.topic-picker-icon { display: grid; place-items: center; flex: 0 0 27px; height: 27px; color: var(--tone-ink); background: var(--tone); border-radius: 8px; font-size: 1.04rem; }
.topic-picker-chevron { flex: 0 0 .48rem; height: .48rem; margin: -.13rem .25rem 0 auto; border: solid var(--wine); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.topic-picker[open] .topic-picker-chevron { margin-top: .2rem; transform: rotate(225deg); }
.topic-picker-options { position: absolute; inset: calc(100% + 6px) 0 auto; display: grid; gap: 3px; max-height: min(55vh, 355px); overflow: auto; padding: 5px; border: 1px solid #e6d3d8; border-radius: 12px; background: var(--white); box-shadow: 0 12px 24px #47203320; }
.topic-picker-option { width: 100%; border: 1px solid transparent; border-radius: 8px; background: transparent; }
.topic-picker-option[aria-pressed="true"], .topic-picker-option:hover { border-color: #78304e20; background: var(--tone); }
.topic-picker-option:focus-visible { outline: 2px solid var(--wine); outline-offset: -2px; }
.topic-picker-check { margin-left: auto; color: var(--tone-ink); }
.study-toolbar { display: flex; gap: .75rem; justify-content: space-between; align-items: start; margin-bottom: 17px; }
.study-toolbar .topic-picker { width: min(280px, 72%); }
.study-toolbar .counter { padding-top: 2.15rem; text-align: right; }
.counter { color: var(--muted); font-size: .84rem; font-weight: 700; padding-bottom: .54rem; }
.flashcard { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; min-height: 270px; gap: 1rem; padding: 30px; border: 1px solid #e7c3ce; border-radius: 22px; color: var(--ink); background: #f8e3e9; box-shadow: 0 5px 0 #edced8; text-align: center; }
.flashcard:hover { background: #f5dce5; }
.flashcard.is-flipped { background: #f2e9f7; border-color: #e2d0ed; box-shadow: 0 5px 0 #e5d8ec; }
.flash-prompt { font: 600 clamp(1.55rem, 4vw, 2.1rem)/1.24 var(--serif); max-width: 28ch; }
.flash-back { font-size: 1.16rem; max-width: 44ch; }
.flash-hint { color: var(--muted); font-size: .83rem; }
.card-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; margin-top: 23px; }
.card-rating { display: flex; flex-wrap: wrap; gap: .55rem; justify-content: center; }
.card-rating .btn[aria-pressed="true"] { background: #f9e3eb; border-color: var(--wine); }
.subtle { color: var(--muted); font-size: .88rem; margin-block: .7rem; }
.card-done { text-align: center; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 17px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: .63rem; }
.mode h2 { font-size: 1.54rem; }
.mode p { color: var(--muted); }
.mode .btn { margin-top: auto; }
.quiz-top { margin-bottom: 15px; }
.quiz-top, #quiz-feedback, #quiz-results { scroll-margin-block: 12px; }
.quiz-meta { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 8px; color: var(--muted); font-size: .85rem; font-weight: 750; }
progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 10px; overflow: hidden; background: #eedde3; accent-color: var(--wine); }
progress::-webkit-progress-bar { background: #eedde3; }
progress::-webkit-progress-value { background: var(--wine); }
.quiz-card h2 { font: 650 clamp(1.32rem, 3.5vw, 1.81rem)/1.3 var(--sans); margin-bottom: 18px; }
.quiz-options { display: grid; gap: 9px; }
.option { width: 100%; text-align: left; color: var(--ink); border: 1px solid #e5d4d7; background: var(--white); border-radius: .7rem; display: flex; align-items: center; padding: .6rem .76rem; min-height: 52px; gap: .7rem; }
.option:hover:not(:disabled), .option.chosen { background: #f9e8ed; border-color: #ac627c; }
.option:disabled { color: var(--ink); }
.option.correct { border-color: #7a9b87; background: #e7f1e8; }
.option.incorrect { border-color: #c88792; background: #f9e5e8; }
.option-letter { display: grid; place-items: center; flex: 0 0 27px; height: 27px; border-radius: 7px; background: #f4e8e9; color: #704653; font-weight: 800; font-size: .82rem; }
.quiz-actions { margin-top: 15px; display: flex; justify-content: end; gap: .6rem; }
.feedback { margin-top: 16px; padding: .73rem .9rem; border-radius: .62rem; background: #f5e8ed; }
.feedback.good { background: #e7f1e8; }
.feedback strong { display: block; }
.score { font: 600 clamp(2.35rem, 6vw, 3.8rem)/1.16 var(--serif); color: var(--wine); margin-bottom: .22rem; }
.review { margin-top: 12px; padding: .78rem .95rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--white); }
.review p { margin-top: .36rem; color: var(--muted); }
.review a { display: inline-block; margin-top: .4rem; color: var(--wine); font-weight: 740; }

.map-heading h1 { font-size: clamp(2.65rem, 6vw, 4rem); line-height: 1.03; }
.map-heading p { max-width: 48ch; }
.guide-layout { display: grid; grid-template-columns: minmax(210px, 258px) minmax(0, 1fr); gap: 17px; align-items: start; }
.guide-topics { position: sticky; top: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--white); }
.guide-topics h2 { margin: 0 0 .7rem .22rem; font-size: 1.25rem; scroll-margin-top: 16px; }
.guide-topics h2:focus, .guide-detail h2:focus { outline: none; }
.guide-topics ul, .guide-terms ul { list-style: none; padding: 0; margin: 0; }
.guide-topics ul { display: grid; gap: 5px; }
.guide-topic { display: flex; align-items: center; gap: .55rem; min-height: 51px; padding: .43rem .5rem; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-size: .86rem; line-height: 1.22; font-weight: 750; }
.guide-topic:hover, .guide-topic[aria-current] { background: var(--tone); border-color: #85465c25; }
.guide-topic[aria-current] { color: var(--tone-ink); }
.guide-topic .map-point-icon { flex-basis: 29px; height: 29px; }
.guide-topic-check { margin-left: auto; color: var(--tone-ink); }

.guide-detail { border: 1px solid var(--line); border-radius: 19px; background: var(--white); }
.guide-reading { padding: clamp(16px, 3.3vw, 30px); border-radius: 18px 18px 0 0; background: var(--tone); }
.guide-detail h2 { font-size: clamp(1.85rem, 4.3vw, 3rem); letter-spacing: -.045em; scroll-margin-top: 58px; }
.guide-explanation { margin-top: .58rem; max-width: 59ch; font-size: clamp(1rem, 2.25vw, 1.11rem); }
.guide-links { display: flex; flex-wrap: wrap; gap: 0 .85rem; }
.guide-back { min-height: 44px; display: inline-flex; align-items: center; gap: .3rem; padding: 0; margin: 0 0 .4rem; border: 0; background: transparent; color: var(--tone-ink); font-size: .82rem; font-weight: 750; text-decoration: underline; text-underline-offset: .18em; }
.guide-all-topics { display: none; }
.guide-memory { margin-top: .9rem; padding: .66rem .8rem; border: 1px solid #6b34421a; border-radius: 9px; background: #fffdfa9e; font-size: .88rem; }
.guide-memory .eyebrow { color: var(--tone-ink); margin-bottom: .14rem; }
.guide-reading .btn { margin-top: .92rem; }
.guide-terms { padding: 17px clamp(16px, 3.3vw, 30px); }
.guide-terms h3 { font: 600 1.25rem/1.2 var(--serif); margin-bottom: .62rem; }
.guide-terms ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.guide-term { display: flex; align-items: center; justify-content: space-between; gap: .42rem; height: 100%; min-height: 46px; padding: .45rem .63rem; border: 1px solid var(--line); border-radius: 9px; background: #fbf7f4; color: var(--ink); text-decoration: none; font-size: .85rem; line-height: 1.25; }
.guide-term:hover { border-color: #ba8498; background: var(--tone); }
.guide-term > span:last-child { flex: 0 0 auto; color: var(--wine); }
.guide-term small { display: block; margin-top: .18rem; color: var(--muted); font-size: .72rem; }
.guide-diagram { margin: 0 clamp(16px, 3.3vw, 30px) 17px; padding-top: .25rem; }
.guide-reading + .guide-diagram { margin-top: 13px; }
.guide-diagram summary { min-height: 44px; cursor: pointer; color: var(--wine); padding: .65rem .68rem; border: 1px solid var(--line); border-radius: 9px; font-size: .82rem; font-weight: 750; }
.guide-diagram summary:hover { background: var(--pink); }
.map-board { container-type: inline-size; margin-top: 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.map-visual {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(145px, .84fr) minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  min-height: 345px;
  padding: 32px 22px;
  background-color: #fff9f6;
  background-image: radial-gradient(circle, #a4627c28 .85px, transparent 1px), radial-gradient(ellipse at center, #f5dce8cc, #fffbf800 73%);
  background-size: 15px 15px, 100% 100%;
}
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-hub {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 112px;
  place-content: center;
  padding: 15px 10px;
  color: #fff8fa;
  text-align: center;
  background: linear-gradient(145deg, #923d5f, #69203f);
  border: 1px solid #761f47;
  border-radius: 18px;
  box-shadow: 0 5px 18px #7f305538, inset 0 1px 0 #fff3;
}
.map-hub strong { font: 600 clamp(1.17rem, 2vw, 1.42rem)/1.18 var(--serif); overflow-wrap: anywhere; }
.map-hub-icon { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #ffdfeb6b; border-radius: 11px; background: #ffffff1e; font-size: 1.24rem; line-height: 1; }
.map-branch { position: relative; display: grid; gap: 12px; }
.map-branch-left { grid-column: 1; grid-row: 1; }
.map-branch-right { grid-column: 3; grid-row: 1; }
.map-point {
  display: flex;
  align-items: center;
  gap: .59rem;
  min-height: 65px;
  min-width: 0;
  padding: .62rem .65rem;
  text-decoration: none;
  color: var(--ink);
  background: #fffefd;
  border: 1px solid #e6d6d8;
  border-radius: 13px;
  box-shadow: 0 2px 5px #4324330a;
}
.map-point:hover, .map-point:focus-visible { border-color: var(--tone-ink); background: var(--tone); }
.map-point-icon { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 9px; background: var(--tone); color: var(--tone-ink); font-size: 1.22rem; font-weight: 720; }
.map-point-copy { display: grid; gap: .23rem; flex: 1; min-width: 0; line-height: 1.23; overflow-wrap: anywhere; }
.map-point-copy strong { font-size: .84rem; font-weight: 800; }
.map-point-copy span { color: #69565f; font-size: .7rem; }
.map-point-arrow { margin-left: auto; color: var(--tone-ink); line-height: 1; font-size: .92rem; }
.map-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem .9rem; padding: .72rem 1.2rem; color: var(--muted); border-top: 1px solid var(--line); background: #fffdfa; font-size: .75rem; }
.map-caption span:first-child { color: var(--wine); font-weight: 760; }
.review-wrap { margin-top: 19px; }
.review-wrap h2 { margin-bottom: .45rem; font-size: 1.6rem; }

@media (max-width: 760px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .guide-topics { position: static; padding: 12px; }
  .guide-topics ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .guide-topic { min-height: 53px; border-color: var(--line); }
  .guide-all-topics { display: inline-flex; }
}

@media (max-width: 1120px) {
  .header-course { display: none; }
}

@media (max-width: 850px) {
  .shell { width: calc(100% - 44px); }
  .hero { grid-template-columns: 1.16fr 1fr; }
  .hero-copy { padding-left: 33px; }
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 890px) {
  .header-inner { min-height: 62px; gap: 10px; }
  .study-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 10px; padding-block: 8px; }
  .wordmark { font-size: 1.14rem; }
  .header-inner .wordmark { min-height: 44px; justify-self: start; }
  .header-inner .brand-mark { width: 29px; height: 29px; }
  .study-upload { font-size: .82rem; padding-inline: .7rem; }
  .nav { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
  .nav a { display: grid; place-items: center; min-height: 44px; padding: .3rem .12rem; font-size: .85rem; text-align: center; }
}

@media (max-width: 600px) {
  .shell { width: calc(100% - 32px); }
  .main { padding-block: 23px 39px; }
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .nav { grid-template-columns: 1fr 1.4fr repeat(3, 1fr); }
  .nav a { font-size: .79rem; }
  .crumb { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: .45rem; }
  .hero { grid-template-columns: 1fr; border-radius: 21px; }
  .hero-copy { padding: 25px 19px 0; }
  .hero h1 { font-size: clamp(2.85rem, 11vw, 3.75rem); }
  .hero p { font-size: .94rem; }
  .hero-actions { margin-top: 1.13rem; }
  .hero-art { height: 181px; margin: -5px 0 0; }
  .hero-art img { object-position: 50% 59%; }
  .hero-art::after { background: linear-gradient(180deg, #f7e2e0, transparent 34%); }
  .stats { margin-block: 14px 28px; padding-block: 9px; }
  .stat { display: grid; gap: .13rem; line-height: 1.15; padding: .35rem .25rem; font-size: .72rem; }
  .stat strong { font-size: 1rem; }
  .section-head { align-items: start; }
  .section-head .btn { white-space: nowrap; font-size: .76rem; padding-inline: .55rem; }
  .chapter-tile { min-height: 108px; padding: 11px; gap: .54rem; }
  .chapter-tile .icon { width: 31px; height: 31px; font-size: 1rem; border-radius: 8px; }
  .tile-arrow { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
  .topic-picker-options { position: static; max-height: none; margin-top: 6px; box-shadow: 0 5px 14px #47203310; }
  .flashcard { min-height: 245px; padding: 22px; }
  .card-rating { order: 3; width: 100%; }
  .quiz-actions .btn, .upload-form .btn { width: 100%; }
}
@container (max-width: 560px) {
  .map-visual { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; min-height: 0; padding: 17px 10px; align-items: start; }
  .map-hub { grid-area: 1 / 1 / 2 / 3; justify-self: center; grid-auto-flow: column; align-items: center; gap: 8px; min-height: 56px; width: min(90%, 240px); padding: 7px 11px; border-radius: 13px; }
  .map-hub strong { text-align: left; font-size: 1.15rem; }
  .map-hub-icon { width: 28px; height: 28px; font-size: 1.02rem; }
  .map-branch { gap: 9px; }
  .map-branch-left { grid-area: 2 / 1; }
  .map-branch-right { grid-area: 2 / 2; }
  .map-point { min-height: 60px; gap: .38rem; padding: .41rem; border-radius: 10px; }
  .map-point-icon { flex-basis: 24px; height: 24px; border-radius: 7px; font-size: .95rem; }
  .map-point-copy strong { font-size: .75rem; }
  .map-point-copy span { font-size: .66rem; }
  .map-point-arrow { display: none; }
  .map-caption { padding-inline: .73rem; }
}

@media (max-width: 420px) {
  .guide-topic { font-size: .76rem; padding-inline: .32rem; gap: .36rem; }
  .guide-topic .map-point-icon { flex-basis: 23px; height: 23px; font-size: .96rem; }
  .guide-term { font-size: .78rem; }
}

@media (max-width: 350px) {
  .shell { width: calc(100% - 24px); }
  .chapter-grid { grid-template-columns: 1fr; gap: 8px; }
  .chapter-tile { min-height: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .option, .chapter-tile, .map-point { transition: background-color .14s, border-color .14s; }
}
@media print {
  body { background: white; color: black; }
  .topbar, .footer, .screen-notes, .skip-link { display: none !important; }
  .print-notes { display: block; }
  .print-notes h1 { margin-bottom: 1rem; }
  .print-notes h2 { margin-block: 1rem .35rem; break-after: avoid; }
  .print-notes p { margin-block: .25rem; }
  .main { width: 100%; padding: 0; }
}
.tile-title, .tile-desc { display: block; }
.tile-title { font-size: 1rem; font-weight: 780; line-height: 1.2; margin-block: .13rem .34rem; }
.tile-desc { color: var(--muted); font-size: .8rem; line-height: 1.4; }
@media (max-width: 600px) {
  .tile-title { font-size: .9rem; }
  .tile-desc { font-size: .735rem; }
}

.lesson-visuals { margin-bottom: 15px; }
.lesson-visuals h2 { margin-bottom: .8rem; font-size: 1.63rem; }
.lesson-visual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.lesson-figure { display: grid; align-content: start; min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fffdfa; }
.lesson-photo { display: block; width: 100%; height: auto; }
.lesson-figure figcaption { display: grid; gap: .25rem; padding: .75rem .83rem; color: #57444b; font-size: .86rem; line-height: 1.47; border-top: 1px solid var(--line); }
.lesson-figure figcaption strong { color: var(--ink); font-size: .95rem; }
.visual-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sugar-groups, .carbon-diagrams, .ring-comparison, .pair-diagram, .polymer-diagram, .gag-diagram { padding: clamp(8px, 2vw, 15px); }
.sugar-groups, .carbon-diagrams, .ring-comparison { display: grid; gap: clamp(6px, 1.3vw, 10px); }
.sugar-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sugar-group { display: grid; align-content: center; justify-items: center; gap: .18rem; padding: .65rem .23rem; min-height: 87px; background: var(--tone); border-radius: 9px; color: var(--tone-ink); text-align: center; line-height: 1.23; }
.sugar-group strong { font-size: clamp(.74rem, 2.36vw, .88rem); }
.sugar-group > span { font-size: .75rem; }
.bead-row { --bead-size: clamp(6px, 1.7vw, 10px); position: relative; display: flex; align-items: center; gap: 1px; margin-block: 0 .28rem; }
.bead-row::before { position: absolute; inset-inline: 3px; top: 50%; content: ''; border-top: 1px solid currentColor; }
.bead-row i, .polymer-branch { position: relative; width: var(--bead-size); height: var(--bead-size); border: 1px solid currentColor; border-radius: 50%; background: var(--tone); }
.sugar-group .bead-row i { background: var(--tone-ink); }

.carbon-diagrams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.carbon-diagram { min-width: 0; border-radius: 9px; padding: .52rem .46rem .43rem; background: #f8f1ed88; }
.carbon-diagram > p { padding-inline: .24rem; margin-bottom: .28rem; font-size: .89rem; }
.carbon-diagram small { color: var(--tone-ink); font-size: .73rem; }
.carbon-chain { display: grid; gap: 2px; padding: 0; margin: 0; list-style: none; }
.carbon-chain li { position: relative; display: flex; align-items: baseline; gap: .32rem; min-height: 22px; padding: .08rem .24rem; font-size: .78rem; }
.carbon-chain li > span:first-child { color: var(--muted); font-size: .67rem; }
.carbon-chain li.carbonyl { color: var(--tone-ink); background: var(--tone); border-radius: 5px; }
.glove-comparison { display: grid; grid-template-columns: 1fr 1fr; background: #f6e8df; }
.glove-comparison .lesson-photo { aspect-ratio: 1.1; object-fit: cover; }
.glove-comparison img + img { transform: scaleX(-1); }

.ring-comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ring-card { display: grid; justify-items: center; align-content: start; gap: .13rem; min-width: 0; padding: 2px .15rem .62rem; text-align: center; color: var(--tone-ink); background: #f5edf8; border-radius: 10px; }
.ring-card > strong { color: var(--ink); font-size: clamp(.83rem, 2.7vw, 1rem); }
.ring-card small { font-size: .75rem; }
.ring-size-guide { grid-column: 1 / -1; display: flex; gap: .35rem .9rem; flex-wrap: wrap; align-items: center; justify-content: center; padding: .31rem .2rem 0; color: var(--tone-ink); font-size: .77rem; font-weight: 750; }
.ring-size-guide small { color: var(--muted); font-size: .72rem; font-weight: 500; text-align: center; }
.ring-shape { font-size: 1.03em; }
.haworth { position: relative; color: #443254; width: min(100%, 210px); height: clamp(108px, 26vw, 144px); font-weight: 780; font-size: clamp(.68rem, 2.6vw, .98rem); isolation: isolate; }
.ring-bonds { position: absolute; inset: 0; background: currentColor; clip-path: polygon(10% 58%, 29% 43%, 63% 43%, 83% 58%, 65% 73%, 29% 73%, 10% 58%, 12% 58%, 30% 71%, 64% 71%, 81% 58%, 62.5% 45%, 30% 45%, 12% 58%); }
.haworth span { position: absolute; }
.ring-oxygen, .ring-carbon, .ring-c6, .ring-oh { transform: translate(-50%, -50%); }
.ring-oxygen { left: 63%; top: 44%; padding-inline: .14em; background: #f5edf8; }
.ring-carbon { left: 92%; top: 58%; font-size: .68em; }
.ring-c6-bond, .ring-oh-bond { border-left: 2px solid currentColor; transform: translateX(-50%); }
.ring-c6-bond { left: 29%; top: 27%; height: 17%; }
.ring-c6 { left: 29%; top: 20%; }
.ring-oh, .ring-oh-bond { left: 82%; color: #812b58; }
.ring-oh { background: #f2dceb; border-radius: 4px; padding-inline: .18em; }
.alpha .ring-oh-bond { top: 58%; height: 24%; }
.alpha .ring-oh { top: 89%; }
.beta .ring-oh-bond { top: 27%; height: 31%; }
.beta .ring-oh { top: 20%; }

.pair-diagram { display: grid; gap: 7px; }
.pair-row { display: grid; gap: .36rem; padding: .46rem .56rem; border-radius: 8px; background: #f0f5ef; }
.pair-row-head { display: flex; justify-content: space-between; gap: .32rem; align-items: baseline; font-size: .84rem; }
.pair-row-head span { color: #365b46; font-size: .71rem; }
.pair-bond { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .33rem; align-items: center; text-align: center; color: #395245; font-size: clamp(.73rem, 2.7vw, .83rem); }
.pair-sugar { background: var(--tone); color: var(--tone-ink); border-radius: 5px; padding: .13rem .2rem; font-weight: 740; }

.polymer-diagram { display: grid; gap: 5px; }
.polymer-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem; align-items: center; min-height: 45px; padding: .36rem .45rem; border-radius: 8px; background: var(--tone); color: var(--tone-ink); }
.polymer-sketch { --bead-size: 8px; display: grid; grid-template-columns: repeat(7, var(--bead-size)); grid-template-rows: repeat(2, var(--bead-size)); gap: 3px 2px; }
.polymer-sketch .bead-row { --bead-size: 8px; grid-row: 2; grid-column: 1 / -1; gap: 2px; margin: 0; }
.polymer-branch { grid-row: 1; }
.polymer-branch::after { position: absolute; left: 50%; bottom: -4px; height: 3px; border-left: 1px solid currentColor; content: ''; }
.polymer-label { display: grid; gap: .14rem; line-height: 1.24; }
.polymer-label strong { color: var(--ink); font-size: .84rem; }
.polymer-label span { font-size: .7rem; }
.gag-diagram { min-height: 172px; aspect-ratio: 3 / 2; display: grid; justify-items: center; align-content: center; gap: .4rem; text-align: center; background: #f1f6fa; color: #375a76; font-size: .82rem; }
.gag-chain, .water-symbols { display: flex; align-items: center; justify-content: center; gap: .33rem; }
.gag-chain span, .water-symbols span { position: relative; padding: .21rem .44rem; border: 1px solid #9bb5c8; border-radius: 8px; background: #e3edf6; font-weight: 750; }
.gag-chain span + span::before { position: absolute; left: -.4rem; top: 50%; width: .4rem; border-top: 1px solid #9bb5c8; content: ''; }
.gag-chain sup { color: #873452; font-weight: 800; }
.gag-arrow { font-size: 1.2rem; line-height: 1; }
.water-symbols span { background: #d6e9f5; border-radius: 50%; }

@media (max-width: 740px) {
  .sugar-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .lesson-figure { break-inside: avoid; }
}

.upload-form { display: grid; gap: .85rem; }
.upload-field { display: grid; gap: .35rem; color: var(--ink); font-size: .9rem; font-weight: 750; }
.upload-field[hidden] { display: none; }
.upload-field input { width: 100%; min-width: 0; min-height: 44px; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fff7fa; color: var(--ink); font: inherit; font-size: 1rem; }
.upload-field input::file-selector-button { margin-right: .55rem; padding: .45rem .6rem; border: 1px solid #e3c5cf; border-radius: 7px; background: var(--pink); color: var(--wine); font: inherit; cursor: pointer; }
.upload-form .subtle { margin: 0; }
.upload-form .btn { justify-self: start; }
.upload-form #upload-status:empty, .upload-form #upload-results:empty { display: none; }
.upload-form #upload-results { padding-left: 1.15rem; margin: 0; overflow-wrap: anywhere; }
