:root {
  --ink: #20392f;
  --muted: #556456;
  --paper: #f5f1e7;
  --gold: #ac8844;
  --green: #24483e;
  --line: #d5d4c3;
  --serif: Georgia, 'Times New Roman', serif;
  --body-size: 18px;
  --question-size: 24px;
  --answer-size: 18px;
  --control-size: 17px;
  --header-height: 72px;
}
:root.large-text {
  --body-size: 20px;
  --question-size: 28px;
  --answer-size: 21px;
  --control-size: 19px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--ink);
  font: var(--body-size)/1.6 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(#f5f1e7f8, #f5f1e7f8), url('assets/parchment.webp');
  background-size: auto, 100% auto;
}
body.dialog-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .68; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #ad6327;
  outline-offset: 3px;
}
h1, h2, h3, h4, p { margin-top: 0; }
a { color: var(--green); }
[hidden] { display: none !important; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.topbar {
  min-height: var(--header-height);
  padding: 8px max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #f9f6ee; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 25;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); font: bold 15px/1.3 var(--serif); letter-spacing: .055em; flex-shrink: 0; }
.brand small { display: block; font: 12px/1.4 system-ui; letter-spacing: .12em; margin-top: 4px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.saved { font-size: 14px; color: var(--muted); margin-right: 6px; }
.saved::before { content: '✓ '; color: #38684b; }
.header-button, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; min-width: 48px; padding: 10px 14px;
  font-size: var(--control-size); font-weight: 600;
  background: #fcf9f0; border: 1px solid #bdc4b2; border-radius: 7px;
}
.header-button:hover, .secondary:hover { background-color: #e9eddf; }
.icon-btn { padding: 8px; font-size: 32px; line-height: 1; }
.text-size-button { font-size: 21px; }
.text-size-button[aria-pressed='true'] { color: #fff8e6; background: var(--green); border-color: var(--green); }
.bag-count { display: inline-grid; place-items: center; min-width: 25px; height: 25px; padding: 0 5px; border-radius: 20px; background: #e5e5d6; color: var(--ink); font-size: 15px; }
main { max-width: 1640px; margin: auto; padding: 25px 28px 10px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { font-size: 14px; line-height: 1.4; letter-spacing: .1em; font-weight: 650; margin: 0 0 8px; color: #655f4e; }
.eyebrow span { margin: 0 8px; color: var(--gold); }
h1 { font-family: var(--serif); font-weight: normal; font-size: clamp(32px, 3vw, 47px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.025em; }
.subhead { color: var(--muted); font-size: 17px; margin: 0; }
.lock-progress { flex-shrink: 0; text-align: right; }
.lock-progress > span { font-size: 16px; color: var(--muted); }
#lockMarks { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 7px; }
.lock-mark { display: grid; place-items: center; width: 34px; height: 38px; border: 1px solid #bcc6b4; border-radius: 14px 14px 4px 4px; background: #e5e7dc; color: #5e705f; }
.lock-mark.done { background: var(--green); color: #efdba1; border-color: var(--green); }
.lock-mark .icon { width: 20px; height: 20px; }
.game-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr) 250px; gap: 24px; align-items: start; }
.mission-panel { padding: 16px 0; }
.mission-panel h2 { font-family: var(--serif); font-size: 31px; font-weight: normal; line-height: 1.2; margin-bottom: 16px; }
.mission-panel > p:not(.eyebrow) { font-size: 17px; color: var(--muted); }
.mission-current { margin: 22px 0; padding: 14px; border-left: 3px solid var(--gold); background: #e9e5d6; border-radius: 0 5px 5px 0; }
.step-number { color: #705526; font-size: 14px; font-weight: 700; letter-spacing: .06em; }
.mission-current p { font-size: 18px; line-height: 1.5; margin: 5px 0 0; }
.quest-steps { display: grid; gap: 14px; font-size: 16px; }
.quest-step { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); }
.quest-step > span { display: grid; place-items: center; min-width: 24px; height: 24px; border: 1px solid #9eaf99; border-radius: 50%; font-size: 14px; }
.quest-step.done { color: var(--green); }
.quest-step.done > span { background: var(--green); color: #fff6e1; }
.book-note { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.book-note > span, .tiny-label { font-size: 14px; font-weight: 650; letter-spacing: .05em; color: #705e35; }
.book-note p { font-size: 16px; margin-top: 8px; color: var(--muted); }
.exploration { min-width: 0; }
.room-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 10px; }
.room-tab { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px; padding: 9px 6px; background: #eeeddf; border: 1px solid #c4cbb7; border-radius: 6px; font-size: var(--control-size); line-height: 1.3; text-align: center; }
.room-tab.active { color: #fff7e4; background: var(--green); border-color: var(--green); font-weight: 650; }
.room-tab .roman { display: none; }
.room-tab .icon { width: 17px; height: 17px; }
.scene-caption { display: flex; align-items: center; gap: 13px; padding: 9px 4px 13px; }
.scene-caption > span { display: grid; place-items: center; min-width: 45px; min-height: 45px; padding: 5px; border: 1px solid #b5bd9f; background: #e7e4d4; border-radius: 50%; font: 14px/1.2 var(--serif); text-align: center; }
.scene-caption h2 { margin: 0; font-family: var(--serif); font-size: 29px; line-height: 1.2; font-weight: normal; }
.scene-caption p { margin: 4px 0 0; color: var(--muted); font-size: 16px; line-height: 1.4; }
.room-stage { position: relative; width: 100%; aspect-ratio: 3/2; overflow: hidden; border: 1px solid #8a754c; border-radius: 8px 8px 0 0; background: #182b29; }
.room-art { position: absolute; inset: 0; overflow: hidden; }
.generated-scene { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.scene-shade { position: absolute; inset: 0; background: linear-gradient(0deg, #091d1324, transparent 60%); pointer-events: none; }
.hotspot { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; min-width: 56px; min-height: 56px; padding: 4px; z-index: 2; background: transparent; border: 0; color: #f9e3ac; }
.spot-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid #f1d592; border-radius: 50%; background: #102d29f2; box-shadow: 0 0 0 4px #e9da9b35, 0 3px 12px #0008; font-size: 23px; font-weight: 700; }
.hotspot.done .spot-icon { background: #cfb771; color: #15382d; }
.hotspot.locked .spot-icon { background: #293e36ee; color: #f5e6c4; border-color: #d8c69e; }
.hotspot:focus-visible { outline-color: #fff1b1; border-radius: 50%; }
.spot-label { display: none; }
.room-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; color: #eee9cd; background: #183a30; border-radius: 0 0 6px 6px; font-size: 15px; line-height: 1.4; }
.room-footer > span { display: flex; align-items: center; gap: 7px; }
.live-dot { width: 7px; height: 7px; background: #e6ce87; border-radius: 50%; flex-shrink: 0; }
.station-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding-top: 12px; }
.station-chip { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 58px; padding: 10px 12px; text-align: left; border: 1px solid #b6bca4; border-radius: 7px; background: #fbf6e8; color: var(--ink); font-size: var(--control-size); line-height: 1.35; }
.station-chip > span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.station-chip > .icon { width: 19px; height: 19px; }
.station-chip.done { background: #e4ead7; }
.station-number { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff4d8; font-size: 18px; font-weight: 700; }
.station-number .icon { width: 20px; height: 20px; }
.satchel-panel { padding: 19px 17px; background: #faf8ef; border: 1px solid var(--line); border-radius: 8px; }
.satchel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.satchel-title h2 { font-family: var(--serif); font-size: 27px; font-weight: normal; line-height: 1.3; margin: 0; }
.satchel-title > span { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; border-radius: 50%; background: #e5e5d6; font-size: 17px; }
.muted { color: var(--muted); font-size: 16px; }
.satchel-panel > .muted { margin: 7px 0 16px; }
.empty-satchel { padding: 20px 12px; border: 1px dashed #b7bda8; border-radius: 5px; text-align: center; color: var(--muted); }
.empty-satchel > .icon { width: 32px; height: 32px; color: #8b743d; margin-bottom: 7px; }
.empty-satchel p { font-family: var(--serif); font-size: 21px; margin-bottom: 8px; }
.empty-satchel small { font-size: 16px; }
.inventory-item { display: flex; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.inventory-item > .icon { color: #8d6e31; margin-top: 3px; }
.inventory-item strong { display: block; font-size: 17px; line-height: 1.4; }
.inventory-item .muted { display: block; margin-top: 3px; }
.code-fragment { display: block; font-family: var(--serif); font-size: 24px; line-height: 1.5; color: var(--green); }
.satchel-bottom { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; }
.satchel-bottom p { font-size: 16px; color: var(--muted); margin: 8px 0 14px; }
#sealSlots, .seal-row { display: flex; gap: 12px; }
.seal-slot { display: grid; place-items: center; width: 52px; height: 56px; border: 1px dashed #a7ad94; border-radius: 5px; color: #7c806b; }
.seal-slot.earned { background: #183a30; border: 1px solid #183a30; color: #edd48d; }
.bag-inventory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 22px; }
.bag-inventory .empty-satchel { grid-column: 1/-1; }
.bag-seals { margin-top: 24px; }
.bag-seals h3 { font: normal 25px/1.3 var(--serif); margin-bottom: 12px; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 18px 0 5px; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); }
.quiet { min-height: 48px; padding: 10px 12px; border: 0; background: transparent; font-size: 17px; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
/* One reading area, with a separate fixed-height header and action footer. */
dialog {
  position: fixed; inset: auto; left: 50%; top: calc(var(--visible-top, 0px) + var(--visible-height, 100dvh) * .5);
  transform: translate(-50%, -50%); margin: 0; padding: 0;
  width: min(1100px, calc(100% - 32px)); height: min(920px, calc(var(--visible-height, 100dvh) - 32px));
  max-height: calc(var(--visible-height, 100dvh) - 32px); max-width: calc(100% - 32px);
  overflow: hidden; border: 1px solid #a7a487; border-radius: 12px; color: var(--ink); background: #f9f6ed; box-shadow: 0 25px 100px #0006;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #0d2423cc; }
.modal-top { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 18px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: #f9f6ed; }
.modal-heading { min-width: 0; }
.modal-top .eyebrow { font-size: 14px; line-height: 1.4; margin-bottom: 5px; letter-spacing: .035em; }
.modal-top h2 { font: normal 28px/1.25 var(--serif); margin: 0; overflow-wrap: anywhere; }
.modal-tools { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.read-button { min-width: 135px; }
#modalBody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 24px 28px; }
#modalBody > p { font-size: var(--body-size); }
.modal-actions { flex-shrink: 0; padding: 12px 24px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #c6cbb6; background: #f7f3e7; box-shadow: 0 -5px 15px #253e2510; }
.modal-actions > .primary { display: flex; width: fit-content; margin-left: auto; }
.quiz-layout { max-width: 860px; margin: 0 auto; }
.quiz-sidebar { margin-bottom: 20px; }
.question-picker { background: #ecebdc; border: 1px solid #c4cab4; border-radius: 6px; }
.question-picker summary { min-height: 48px; padding: 10px 14px; font-size: 17px; cursor: pointer; }
.question-picker summary > span:first-child { font-weight: 700; margin-right: 12px; }
.picker-status { color: #53624e; font-size: 16px; }
.question-jumps { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 14px 14px; }
.qjump { width: 48px; height: 48px; padding: 4px; background: #fffaf0; border: 1px solid #acb69e; border-radius: 6px; font-size: 18px; }
.qjump.current { outline: 2px solid var(--green); outline-offset: -2px; font-weight: 700; }
.qjump.correct { background: #d4e2c8; color: #244d30; border-color: #8ba581; }
.mini-progress { height: 6px; background: #dedfcd; overflow: hidden; border-radius: 4px; margin: 9px 0; }
.mini-progress > span { display: block; height: 100%; background: var(--green); }
.question { font: 600 var(--question-size)/1.5 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; white-space: pre-line; margin: 0 0 24px; }
.options { display: grid; gap: 12px; }
.option { display: flex; align-items: flex-start; gap: 14px; width: 100%; min-height: 62px; text-align: left; padding: 15px 16px; border: 1px solid #bfc6b1; border-radius: 7px; color: var(--ink); background: #fffdf7; font-size: var(--answer-size); line-height: 1.55; }
.option > span:first-child { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; background: #e8e9db; border-radius: 50%; font-size: 17px; font-weight: 650; }
.option-text { flex: 1; min-width: 0; }
.option.selected { border: 2px solid #315f3f; padding: 14px 15px; background: #e8efdf; }
.option.selected > span:first-child { background: #315f3f; color: #fff; }
.option:disabled { opacity: 1; }
.option:disabled:not(.selected) { color: #596455; background: #efefe4; }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 18px; border-radius: 6px; font-size: var(--control-size); font-weight: 650; line-height: 1.35; text-decoration: none; }
.primary { border: 1px solid var(--green); background: var(--green); color: #fff7e5; }
.primary:hover:not(:disabled) { background: #35634f; }
.secondary { border: 1px solid #9fae94; background: #f9f6ec; color: var(--green); }
.primary .icon, .secondary .icon { width: 21px; height: 21px; }
.feedback { background: #eee1c3; color: #62491d; padding: 12px 15px; border-radius: 6px; font-size: var(--body-size); line-height: 1.45; margin: 16px 0; }
.feedback.success { background: #ddebd4; color: #244f2c; }
.feedback:empty { display: none; }
.modal-actions .feedback { margin: 0 0 10px; max-height: 24vh; overflow-y: auto; }
.word-bank { margin: 20px 0; padding: 0; border: 1px solid #c4b98f; border-radius: 6px; background: #eee6d1; }
.word-bank summary { min-height: 48px; padding: 11px 14px; font-size: var(--control-size); font-weight: 650; cursor: pointer; }
.word-bank > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 9px; padding: 0 12px 12px; }
.word-bank button { min-height: 48px; padding: 10px 12px; border: 1px solid #b4a981; border-radius: 5px; background: #fffaf0; font-size: var(--answer-size); line-height: 1.35; }
.word-bank button.chosen { background: var(--green); border-color: var(--green); color: #fff7dd; }
.word-bank > p { padding: 0 14px 12px; margin: 0; }
.word-bank:not(details) { padding: 15px; font-size: var(--body-size); }
.word-bank:not(details) > div { display: block; padding: 4px; }
.field-label { display: block; font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.answer-input, select { width: 100%; min-height: 56px; padding: 12px 14px; border: 1px solid #9aaa91; border-radius: 6px; font-size: var(--answer-size); line-height: 1.5; background: #fffdf7; }
.answer-input:disabled { background: #e6eddd; color: #315a36; opacity: 1; }
.reward-screen { text-align: center; padding: 12px 5px 24px; }
.reward-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 18px; background: #eadfbf; border: 1px solid #b6a164; border-radius: 50%; color: #886725; }
.reward-icon .icon { width: 37px; height: 37px; }
.reward-screen h3 { font: normal 32px/1.3 var(--serif); margin: 0 0 14px; }
.reward-screen p { max-width: 670px; margin: 0 auto 20px; color: var(--muted); font-size: var(--body-size); }
.reward-screen p.eyebrow { font-size: 14px; }
.reward-screen > .muted { font-size: var(--body-size); }
.reward-code { display: block; width: fit-content; max-width: 100%; padding: 13px 24px; margin: 22px auto; border: 1px solid #b5a471; background: #ece1c4; font: normal 32px/1.4 var(--serif); }
.lock-view { max-width: 680px; margin: auto; text-align: center; }
.lock-view > p { font-size: var(--body-size); color: var(--muted); }
.lock-visual { width: 180px; margin: 0 auto 22px; border: 1px solid #b6a167; border-radius: 55px 55px 7px 7px; padding: 18px; color: #e6ca89; background: linear-gradient(135deg, #294739, #132c29); }
.lock-visual .icon { width: 34px; height: 34px; }
.lock-visual strong { display: block; font: normal 18px/1.4 var(--serif); letter-spacing: .1em; margin-top: 5px; }
.digits { display: flex; justify-content: center; gap: 10px; margin: 24px 0; }
.digits input { width: 62px; min-height: 68px; padding: 4px; text-align: center; background: #fffdf5; border: 1px solid #9eaa8b; border-radius: 6px; font-size: 30px; }
.color-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0; text-align: left; }
.color-fields select { font-size: var(--answer-size); margin-top: 8px; }
.cipher-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 25px; align-items: start; }
.cipher-layout > section { min-width: 0; }
.cipher-wheel { display: block; width: 100%; max-width: 500px; height: auto; margin: auto; }
.wheel-controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 18px; }
.wheel-controls button { min-width: 94px; min-height: 52px; padding: 9px 12px; background: #e8e4d1; border: 1px solid #a7b396; border-radius: 6px; font-size: 24px; }
.wheel-controls button span { font-size: 17px; }
.wheel-controls > span { font-size: 16px; text-align: center; }
.cipher-notes h3 { font-size: 15px; letter-spacing: .055em; color: #705b29; margin-bottom: 12px; }
.riddle { font: normal 21px/1.6 var(--serif); white-space: pre-line; margin-bottom: 22px; }
.large-text .riddle { font-size: 24px; }
.cipher-notes p { font-size: var(--body-size); color: var(--muted); }
#pairings > .alignment-list { display: grid; grid-template-columns: 1fr; gap: 0; width: 100%; padding: 0; }
.alignment-list > span { display: flex; justify-content: space-between; gap: 18px; padding: 8px 4px; border-bottom: 1px solid #d2c9ad; font-size: 18px; }
.alignment-list strong { font-weight: 700; }
.intro-art { min-height: 225px; padding: 26px; border: 1px solid #819378; border-radius: 7px; color: #f8ebca; background: linear-gradient(90deg, #102b29f5, #102b29c9 60%, #102b2960), url('assets/courtyard.webp?v=2') center 55% / cover; }
.intro-art h3 { font: normal 34px/1.25 var(--serif); margin-bottom: 14px; }
.intro-art p { max-width: 670px; margin-bottom: 0; color: #e1e7d4; font-size: var(--body-size); }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 25px 0; }
.how-steps h4 { font: normal 25px/1.3 var(--serif); margin: 8px 0; }
.how-steps p { font-size: var(--body-size); color: var(--muted); }
.how-steps .icon { color: #8b7033; }
#modalBody > .muted { font-size: var(--body-size) !important; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 24px 0; }
.settings-section { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 20px; }
.settings-section h3 { font: normal 27px/1.3 var(--serif); }
.settings-section p { color: var(--muted); font-size: var(--body-size); }
.danger { color: #863a2e; border-color: #b68876; }
.seal-display { display: flex; justify-content: center; gap: 20px; margin: 24px 0; }
.seal-display > div { display: grid; place-items: center; width: 80px; height: 92px; background: #193d31; border: 2px solid #b39a5e; border-radius: 5px 5px 30px 30px; color: #e8c979; }
.seal-display .icon { width: 42px; height: 42px; }
.victory-title { font-size: 43px !important; }
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 25px; padding: 18px; border-block: 1px solid var(--line); margin: 24px 0; }
.stats strong { display: block; font: normal 29px/1.4 var(--serif); }
.stats small { font-size: 15px; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: calc(100% - 32px); padding: 14px 20px; border: 1px solid #b9a369; border-radius: 6px; color: #fff2cb; background: #173e31; font-size: 17px; text-align: center; opacity: 0; pointer-events: none; }
#toast.show { opacity: 1; }
/* Student iPads: a clear next step, a broad room, and an always-reachable item dock. */
@media (max-width: 1280px) {
  :root { --header-height: 68px; }
  .saved { display: none; }
  main { padding: 16px 20px 120px; }
  .page-heading { margin-bottom: 14px; }
  .page-heading .eyebrow { display: none; }
  h1 { font-size: 34px; margin-bottom: 5px; }
  .subhead { font-size: 16px; }
  #lockMarks { display: none; }
  .lock-progress { max-width: 155px; }
  .lock-progress > span { font-size: 17px; font-weight: 650; }
  .game-layout { display: flex; flex-direction: column; gap: 14px; }
  .mission-panel { width: 100%; padding: 0; }
  .mission-panel > .eyebrow, .mission-panel > h2, .mission-panel > p, .quest-steps, .book-note { display: none; }
  .mission-current { display: flex; align-items: center; gap: 15px; margin: 0; padding: 11px 14px; }
  .step-number { flex-shrink: 0; }
  .mission-current p { margin: 0; font-size: 18px; }
  .exploration { width: 100%; }
  .room-tabs { position: sticky; top: var(--header-height); z-index: 15; background: var(--paper); padding: 5px 0; }
  .scene-caption { padding: 5px 0 11px; }
  .scene-caption h2 { font-size: 27px; }
  .room-stage { max-width: min(100%, max(620px, calc((100svh - 300px) * 1.5))); margin: 0 auto; border-radius: 7px; }
  .room-footer { background: transparent; color: var(--muted); font-size: 16px; padding: 11px 0; }
  .room-footer .live-dot { background: #6b7c52; }
  .satchel-panel { display: none; }
  .station-list { position: fixed; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: 0; z-index: 20; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); border: 1px solid #b9bfa8; border-bottom: 0; border-radius: 10px 10px 0 0; background: #f8f4e8; box-shadow: 0 -7px 22px #1a321b1c; }
  .station-chip { min-height: 60px; padding: 9px 10px; }
  .station-list:has(> :only-child) { grid-template-columns: 1fr; max-width: 600px; margin: 0 auto; }
  .station-list:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 1fr; max-width: 850px; margin: 0 auto; }
  .page-footer { margin-top: 10px; }
  #toast { bottom: 110px; }
  dialog { left: 0; top: var(--visible-top, 0px); transform: none; width: 100%; max-width: 100%; height: var(--visible-height, 100dvh); max-height: var(--visible-height, 100dvh); border: 0; border-radius: 0; }
  .modal-top { padding-top: max(13px, env(safe-area-inset-top)); }
  .quiz-layout { max-width: 900px; }
}
@media (max-width: 900px) {
  .brand { font-size: 13px; gap: 8px; }
  .brand small { font-size: 11px; }
  .topbar { padding-inline: 14px; gap: 10px; }
  .header-actions { gap: 6px; }
  .header-button { padding: 9px 10px; }
  .room-stage { max-width: 100%; }
  .cipher-layout { grid-template-columns: 1fr; gap: 20px; }
  .cipher-wheel { max-width: 490px; }
  .cipher-notes { border-top: 1px solid var(--line); padding-top: 22px; }
  .how-steps { grid-template-columns: 1fr; gap: 16px; }
  .how-steps > div { display: grid; grid-template-columns: 28px 1fr; gap: 0 15px; }
  .how-steps h4 { margin: 0 0 7px; }
  .how-steps p { grid-column: 2; margin-bottom: 0; }
}
@media (max-width: 900px) and (orientation: portrait) {
  main { padding-bottom: 180px; }
  .station-list { grid-template-columns: 1fr 1fr; }
  .station-chip { min-height: 58px; }
  #toast { bottom: 170px; }
}
@media (max-width: 600px) {
  .topbar { padding: 8px 10px; }
  .brand { display: none; }
  .header-actions { width: 100%; justify-content: space-between; gap: 5px; }
  .header-button { font-size: 16px; padding: 9px; gap: 5px; }
  .header-button .icon { width: 21px; height: 21px; }
  .text-size-button { font-size: 20px; }
  main { padding-inline: 12px; padding-bottom: 180px; }
  .page-heading { align-items: flex-start; gap: 10px; }
  h1 { font-size: 29px; }
  .subhead { display: none; }
  .lock-progress { max-width: 82px; }
  .lock-progress > span { font-size: 16px; }
  .mission-current { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; }
  .mission-current p { font-size: 17px; }
  .room-tabs { gap: 4px; }
  .room-tab { font-size: 15px; min-height: 54px; }
  .room-tab .icon { display: none; }
  .scene-caption > span { display: none; }
  .scene-caption h2 { font-size: 26px; }
  .scene-caption p { font-size: 16px; }
  .hotspot { min-height: 48px; min-width: 48px; }
  .spot-icon { width: 42px; height: 42px; font-size: 21px; box-shadow: 0 0 0 2px #e9da9b35, 0 3px 8px #0008; }
  .room-footer { flex-wrap: wrap; gap: 5px; }
  .room-footer > span { font-size: 15px; }
  .station-list { grid-template-columns: 1fr 1fr; left: 6px; right: 6px; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); gap: 7px; }
  .station-chip { font-size: 16px; min-height: 58px; padding: 9px; gap: 7px; }
  .station-number { width: 26px; height: 26px; font-size: 17px; }
  .station-chip > .icon { display: none; }
  .page-footer > span { display: none; }
  .page-footer { justify-content: flex-end; }
  .modal-top { padding: 12px; gap: 10px; }
  .modal-top h2 { font-size: 23px; }
  .modal-top .eyebrow { font-size: 14px; letter-spacing: 0; }
  .modal-tools { gap: 5px; }
  .modal-tools .read-button { min-width: 48px; }
  .read-button > span { display: none; }
  #modalBody { padding: 18px 15px 22px; }
  .modal-actions { padding-inline: 12px; }
  .question-picker summary > span { display: block; }
  .question-picker summary { padding: 9px 12px; }
  .question { font-size: var(--question-size); line-height: 1.45; }
  .option { padding: 13px 12px; gap: 10px; }
  .option.selected { padding: 12px 11px; }
  .quiz-actions { gap: 8px; }
  .quiz-actions .form-row { gap: 7px; justify-content: flex-end; }
  .primary, .secondary { padding: 11px 12px; }
  .quiz-actions .primary, .quiz-actions .secondary { font-size: 16px; }
  .quiz-actions .primary .icon { display: none; }
  .word-bank > div { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 9px 9px; }
  .word-bank button { font-size: var(--answer-size); padding-inline: 7px; overflow-wrap: anywhere; }
  .digits input { width: 55px; }
  .color-fields { grid-template-columns: 1fr; }
  .bag-inventory { grid-template-columns: 1fr; }
  .intro-art { padding: 20px; }
  .intro-art h3 { font-size: 29px; }
  .reward-screen h3 { font-size: 29px; }
  .victory-title { font-size: 35px !important; }
  .stats { gap: 18px; padding-inline: 0; }
  .stats small { font-size: 14px; }
  .wheel-controls { gap: 8px; }
  .wheel-controls button { min-width: 84px; }
}
@media (max-height: 550px) and (max-width: 1280px) {
  .modal-top { padding-block: 8px; }
  .modal-top .eyebrow { display: none; }
  .modal-actions { padding-block: 8px; }
  .modal-actions .feedback { max-height: 16vh; }
  #modalBody { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, main, #toast { display: none !important; }
  dialog[open] { display: block; position: static; width: 100%; height: auto; max-height: none; max-width: none; transform: none; border: 0; box-shadow: none; overflow: visible; }
  .modal-top, .modal-actions, .reward-screen button { display: none !important; }
  #modalBody { display: block; overflow: visible; padding: 0; }
  body { background: white; font-size: 14px; }
  .teacher-page { display: block !important; }
}
