:root {
  color-scheme: light;
  --navy: #243b5a;
  --navy-dark: #17283f;
  --blue: #2468a2;
  --teal: #0d727a;
  --purple: #6847a7;
  --orange: #d8841d;
  --cream: #f8f7f3;
  --paper: #fffdfa;
  --slate: #e7eef3;
  --charcoal: #1f2937;
  --muted: #5f6975;
  --line: #ccd7df;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.15);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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 {
  font: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #8a4f00;
}

.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(-150%);
}

.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);
}
.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;list-style:none;margin:0 auto;max-width:1100px;padding:0}.progress-nav li{border-radius:999px;color:#52647a;font-size:.82rem;font-weight:700;padding:.45rem .7rem;text-align:center}.progress-nav li[aria-current="step"]{background:#243b5a;color:#fff}.copy-status{align-self:center;color:#294f3d;font-weight:700;min-height:1.4em}

.brand-button {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.brand-title {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 40px);
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: screen-in 260ms 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(880px, 100%);
  margin: 0 auto 22px;
  text-align: center;
}

.eyebrow,
.section-label {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  color: var(--navy-dark);
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.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 {
  margin-right: auto;
  margin-bottom: 0;
  margin-left: auto;
  max-width: 760px;
  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, 0.14);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.town-map > img,
.school-stage > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.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, 0.93);
  border: 2px solid rgba(36, 59, 90, 0.72);
  border-radius: 14px;
  box-shadow: 0 12px 25px rgba(31, 41, 55, 0.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: var(--orange);
  border: 4px solid white;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(31, 41, 55, 0.25);
  transform: translateX(-50%);
}

.map-hotspot:hover {
  background: white;
  box-shadow: 0 16px 32px rgba(31, 41, 55, 0.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: var(--blue);
  font-weight: 750;
  background: rgba(255, 255, 255, 0.7);
  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, 0.14);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.school-stage > img {
  position: absolute;
  inset: 0;
  filter: saturate(0.92);
}

.school-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background: linear-gradient(180deg, rgba(23, 40, 63, 0.08), rgba(23, 40, 63, 0.35));
  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, 0.96);
  border: 1px solid rgba(36, 59, 90, 0.22);
  border-radius: 20px;
  box-shadow: 0 14px 30px rgba(31, 41, 55, 0.22);
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 170ms ease;
}

.student-card:hover {
  box-shadow: 0 20px 40px rgba(31, 41, 55, 0.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 {
  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: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.student-card-topic {
  display: block;
  color: var(--muted);
  font-size: 0.94rem;
}

.encounter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.82fr);
  gap: 24px;
  align-items: stretch;
}

.student-scene,
.work-card,
.question-panel,
.summary-card {
  background: var(--paper);
  border: 1px solid rgba(36, 59, 90, 0.16);
  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, 0.96);
  border: 2px solid rgba(36, 59, 90, 0.58);
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(31, 41, 55, 0.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, 0.96);
  border-right: 2px solid rgba(36, 59, 90, 0.58);
  border-bottom: 2px solid rgba(36, 59, 90, 0.58);
  transform: rotate(45deg);
}

.work-card {
  padding: clamp(24px, 4vw, 38px);
}

.work-card h2 {
  margin: 20px 0 8px;
}

.math-work {
  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: 0.9rem;
  font-weight: 750;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-button {
  width: 100%;
  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:not(:disabled) {
  background: #f8fbfc;
  border-color: var(--blue);
  transform: translateX(3px);
}

.question-button.is-asked {
  color: #52606d;
  background: #eef3f5;
  border-color: #b8c7d1;
}

.question-button.is-asked::after {
  float: right;
  content: "Asked";
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.encounter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 20px;
}

.case-notes-fallback {
  flex: 1 0 100%;
  width: 100%;
  min-height: 180px;
  padding: 14px;
  color: var(--charcoal);
  background: white;
  border: 2px solid var(--navy);
  border-radius: 10px;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}

.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 {
  color: #7a8792;
  background: #dce3e7;
  border-color: #dce3e7;
  cursor: not-allowed;
}

.secondary-button:disabled {
  color: #7a8792;
  background: #eef2f4;
  border-color: #c8d1d7;
  cursor: not-allowed;
}

.secondary-button {
  color: var(--navy);
  background: white;
  border: 2px solid var(--navy);
}

.secondary-button:hover {
  background: #eff4f7;
}

.summary-card {
  width: min(820px, 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: 0.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, 0.8);
  }

  .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;
  }

  .summary-actions {
    grid-template-columns: 1fr;
  }

  .encounter-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .encounter-actions .primary-button,
  .encounter-actions .secondary-button {
    width: 100%;
  }

  .copy-status,
  .case-notes-fallback {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .map-hotspot,
  .student-card,
  .student-scene,
  .work-card,
  .question-panel,
  .summary-card,
  .speech-bubble {
    border: 2px solid CanvasText;
  }
}
