:root {
  color-scheme: light;
  --navy: #243b5a;
  --navy-dark: #17283f;
  --blue: #2468a2;
  --teal: #147b83;
  --purple: #6847a7;
  --orange: #c96f00;
  --paper: #fffdfa;
  --slate: #e7eef3;
  --charcoal: #1f2937;
  --muted: #4f5c69;
  --line: #b9c8d3;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.15);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--charcoal);
  background: radial-gradient(circle at 15% 0%, rgba(36, 104, 162, 0.09), transparent 36rem), linear-gradient(180deg, #f6f3ea 0%, #edf3f5 100%);
  font-family: Inter, ui-rounded, "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 4px solid #17283f; outline-offset: 4px; box-shadow: 0 0 0 7px #f6c453; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 1000; padding: 10px 14px; color: white; background: var(--navy-dark); border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.site-header { position: relative; z-index: 50; padding: 18px clamp(18px, 4vw, 52px); color: white; background: linear-gradient(120deg, var(--navy-dark), var(--navy)); box-shadow: 0 8px 24px rgba(23, 40, 63, 0.18); }
.brand-button { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px; color: inherit; text-align: left; background: var(--navy-dark); border: 0; border-radius: 10px; cursor: pointer; }
.brand-title { font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 800; letter-spacing: .01em; }
.brand-subtitle { color: rgba(255,255,255,.82); font-size: .82rem; }
.progress-nav { background: #fff; border-bottom: 1px solid #d7e0eb; padding: .65rem clamp(1rem,4vw,3rem); }
.progress-nav ol { display: grid; grid-template-columns: repeat(4,1fr); gap: .5rem; max-width: 1100px; margin: 0 auto; padding: 0; list-style: none; }
.progress-nav li { border-radius: 999px; color: #465b72; font-size: .82rem; font-weight: 750; padding: .45rem .7rem; text-align: center; }
.progress-nav li[aria-current="step"] { background: var(--navy); color: #fff; }
main { width: min(1440px,100%); margin: 0 auto; padding: clamp(18px,3vw,40px); }
.screen { display: none; }
.screen.is-active { display: block; animation: screen-in 220ms ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.intro-panel, .school-heading, .encounter-heading { width: min(900px,100%); margin: 0 auto 22px; text-align: center; }
.eyebrow, .section-label { margin: 0 0 7px; color: var(--teal); font-size: .78rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; color: var(--navy-dark); font-size: clamp(2rem,5vw,3.45rem); line-height: 1.05; letter-spacing: -.035em; }
h2 { color: var(--navy); font-size: clamp(1.18rem,2.5vw,1.55rem); line-height: 1.2; }
.intro-panel > p:last-child, .school-heading > p:last-child, .encounter-heading > p:last-child { max-width: 780px; margin-right: auto; margin-bottom: 0; margin-left: auto; color: var(--muted); font-size: clamp(1rem,2vw,1.16rem); }
.town-map { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16/9; min-height: 480px; background: #d9e7e4; border: 1px solid rgba(36,59,90,.18); border-radius: 28px; box-shadow: var(--shadow); }
.town-map > img, .school-stage > img { width: 100%; height: 100%; object-fit: cover; }
.location-a11y { display: none; }
.map-hotspot { position: absolute; display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 13px 16px; color: var(--navy-dark); text-align: left; background: rgba(255,253,250,.96); border: 2px solid rgba(36,59,90,.76); border-radius: 14px; box-shadow: 0 12px 25px rgba(31,41,55,.18); cursor: pointer; transform: translate(-50%,-50%); transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.map-hotspot::after { position: absolute; bottom: -14px; left: 50%; width: 18px; height: 18px; content: ""; background: #d8841d; border: 4px solid white; border-radius: 50%; box-shadow: 0 3px 8px rgba(31,41,55,.25); transform: translateX(-50%); }
.map-hotspot:hover { background: white; box-shadow: 0 16px 32px rgba(31,41,55,.25); transform: translate(-50%,-54%); }
.map-hotspot span { font-weight: 850; }
.map-hotspot small { color: var(--muted); }
.hotspot-elementary { top: 72%; left: 25%; }
.hotspot-middle { top: 30%; left: 74%; }
.hotspot-high { top: 27%; left: 25%; }
.text-button { margin-bottom: 18px; padding: 8px 12px; color: #175786; font-weight: 780; background: rgba(255,255,255,.86); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.school-stage { position: relative; overflow: hidden; min-height: 650px; background: var(--slate); border: 1px solid rgba(36,59,90,.16); border-radius: 28px; box-shadow: var(--shadow); }
.school-stage > img { position: absolute; inset: 0; filter: saturate(.92); }
.school-stage::after { position: absolute; inset: 0; z-index: 1; content: ""; background: linear-gradient(180deg,rgba(23,40,63,.08),rgba(23,40,63,.38)); pointer-events: none; }
.student-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(16px,2vw,26px); align-items: end; min-height: 650px; padding: clamp(170px,20vw,255px) clamp(20px,4vw,50px) 44px; }
.student-card { overflow: hidden; padding: 0; text-align: left; background: rgba(255,253,250,.98); border: 1px solid rgba(36,59,90,.25); border-radius: 20px; box-shadow: 0 14px 30px rgba(31,41,55,.22); cursor: pointer; transition: transform 170ms ease, box-shadow 170ms ease; }
.student-card:hover { box-shadow: 0 20px 40px rgba(31,41,55,.3); transform: translateY(-6px); }
.student-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; object-position: center 24%; background: var(--slate); }
.student-card-content { display: block; padding: 18px; }
.student-card-name { display: block; margin-bottom: 3px; color: var(--navy-dark); font-size: 1.3rem; font-weight: 850; }
.student-card-grade { display: block; margin-bottom: 9px; color: var(--teal); font-size: .8rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.student-card-topic { display: block; color: var(--muted); font-size: .94rem; }
.encounter-layout { display: grid; grid-template-columns: minmax(0,1.18fr) minmax(330px,.82fr); gap: 24px; align-items: stretch; }
.student-scene, .work-card, .question-panel, .summary-card { background: var(--paper); border: 1px solid rgba(36,59,90,.18); border-radius: var(--radius); box-shadow: var(--shadow); }
.student-scene { position: relative; overflow: hidden; min-height: 560px; }
.student-scene img { width: 100%; height: 100%; min-height: 560px; object-fit: cover; }
.speech-bubble { position: absolute; top: 28px; right: 28px; width: min(46%,420px); padding: 20px 22px; color: var(--charcoal); background: rgba(255,253,250,.97); border: 2px solid rgba(36,59,90,.64); border-radius: 18px; box-shadow: 0 10px 25px rgba(31,41,55,.18); font-size: clamp(1rem,2vw,1.15rem); font-weight: 650; line-height: 1.45; }
.speech-bubble::after { position: absolute; bottom: -17px; left: 44px; width: 28px; height: 28px; content: ""; background: rgba(255,253,250,.97); border-right: 2px solid rgba(36,59,90,.64); border-bottom: 2px solid rgba(36,59,90,.64); transform: rotate(45deg); }
.work-card { padding: clamp(24px,4vw,38px); }
.work-card h2 { margin: 20px 0 8px; }
.math-work { overflow-wrap: anywhere; padding: 18px; color: var(--navy-dark); background: #f0f4f6; border-left: 5px solid var(--purple); border-radius: 12px; font-family: "Avenir Next", "Segoe UI", sans-serif; font-size: 1.07rem; white-space: pre-line; }
.question-panel { margin-top: 24px; padding: clamp(22px,4vw,36px); }
.question-panel-heading { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.question-panel-heading h2 { margin-bottom: 0; }
.question-progress { flex: 0 0 auto; margin: 0; padding: 8px 12px; color: var(--navy); background: #edf3f6; border-radius: 10px; font-size: .9rem; font-weight: 780; }
.question-list { display: grid; gap: 12px; }
.response-list { display: grid; gap: 10px; margin-top: 14px; }
.student-response { margin: 0; padding: 14px 16px; color: var(--charcoal); background: #f7f3e8; border-left: 5px solid var(--orange); border-radius: 10px; }
.question-button { width: 100%; min-height: 52px; padding: 16px 18px; color: var(--navy-dark); text-align: left; background: white; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color 150ms ease, background 150ms ease, transform 150ms ease; }
.question-button:hover { background: #f8fbfc; border-color: var(--blue); transform: translateX(3px); }
.question-button.is-asked { color: #465765; background: #eef3f5; border-color: #9eb1be; }
.question-button.is-asked::after { float: right; content: "Asked"; color: var(--teal); font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.encounter-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; padding-top: 20px; }
.primary-button, .secondary-button { min-height: 48px; padding: 12px 20px; border-radius: 12px; font-weight: 800; cursor: pointer; }
.primary-button { color: white; background: var(--navy); border: 2px solid var(--navy); }
.primary-button:hover:not(:disabled) { background: var(--navy-dark); }
.primary-button:disabled, .secondary-button:disabled { color: #46515b; background: #dce3e7; border-color: #9aa8b2; cursor: not-allowed; }
.secondary-button { color: var(--navy); background: white; border: 2px solid var(--navy); }
.secondary-button:hover:not(:disabled) { background: #eff4f7; }
.copy-status { align-self: center; min-height: 1.4em; color: #24583f; font-weight: 750; }
.case-notes-fallback { width: 100%; min-height: 14rem; margin-top: 4px; padding: 14px; color: var(--charcoal); background: white; border: 2px solid var(--navy); border-radius: 12px; }
.summary-card { width: min(840px,100%); margin: 8vh auto 0; padding: clamp(28px,6vw,62px); text-align: center; }
.summary-card h1 { font-size: clamp(2rem,4vw,3rem); }
.summary-card > p:not(.eyebrow) { color: var(--muted); font-size: 1.08rem; }
.summary-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 28px; }
.end-card { border-top: 8px solid var(--teal); }
.noscript-message { margin: 30px; padding: 20px; color: white; background: #8b2c2c; }

@media (max-width: 980px) {
  .town-map { min-height: 520px; }
  .map-hotspot { min-width: 160px; padding: 10px 12px; font-size: .88rem; }
  .student-grid { grid-template-columns: 1fr; padding-top: 220px; }
  .student-card { display: grid; grid-template-columns: 150px 1fr; }
  .student-card img { height: 100%; aspect-ratio: auto; }
  .encounter-layout { grid-template-columns: 1fr; }
  .student-scene { min-height: auto; }
  .student-scene img { min-height: auto; aspect-ratio: 16/9; }
}
@media (max-width: 680px) {
  .progress-nav ol { grid-template-columns: 1fr 1fr; }
  .site-header { padding: 14px 18px; }
  .brand-subtitle { display: none; }
  main { padding: 16px; }
  .town-map { display: grid; gap: 10px; aspect-ratio: auto; min-height: 0; padding-bottom: 14px; background: white; }
  .town-map > img { aspect-ratio: 16/9; object-fit: cover; }
  .map-hotspot { position: static; width: calc(100% - 28px); margin: 0 14px; transform: none; }
  .map-hotspot:hover { transform: translateY(-2px); }
  .map-hotspot::after { display: none; }
  .school-stage, .student-grid { min-height: 0; }
  .school-stage > img { position: relative; aspect-ratio: 16/9; }
  .school-stage::after { display: none; }
  .student-grid { padding: 14px; background: rgba(237,243,245,.9); }
  .student-card { grid-template-columns: 110px 1fr; }
  .student-card-content { padding: 14px; }
  .student-card-name { font-size: 1.12rem; }
  .speech-bubble { position: relative; top: auto; right: auto; width: auto; margin: -2px 14px 14px; border-radius: 14px; }
  .speech-bubble::after { display: none; }
  .question-panel-heading { display: block; }
  .question-progress { display: inline-block; margin-top: 12px; }
  .encounter-actions { display: grid; grid-template-columns: 1fr; }
  .summary-actions { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (forced-colors: active) {
  .map-hotspot, .student-card, .student-scene, .work-card, .question-panel, .summary-card, .speech-bubble, .question-button { border: 2px solid CanvasText; }
  .progress-nav li[aria-current="step"] { border: 2px solid CanvasText; }
}
