:root {
  color-scheme: dark;
  --bg: #090c19;
  --surface: #11182a;
  --surface-raised: #181f35;
  --line: #2b3451;
  --white: #f6f7ff;
  --soft: #d3dbef;
  --muted: #9aa8c5;
  --mint: #a9fbdf;
  --cyan: #92e8ff;
  --pink: #ffaaba;
  --warm: #ffca8a;
  --purple: #c9b5fa;
  --green: #67ebbc;
  --error: #ff9aab;
  --game-accent: var(--mint);
  --radius: 22px;
  --font: 'Trebuchet MS', 'Segoe UI', sans-serif;
  --heading: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-width: 290px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 10% -15%, #202647 0, transparent 37%),
    radial-gradient(ellipse at 98% 21%, #21163370, transparent 41%),
    var(--bg);
  color: var(--white);
  font-size: 16px;
  line-height: 1.45;
}

button, input {
  font: inherit;
}

button {
  color: inherit;
  touch-action: manipulation;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #fff4c4;
  outline-offset: 4px;
}

img, svg {
  display: block;
  max-width: 100%;
}

p, h1, h2, h3 {
  margin: 0;
}

[hidden] {
  display: none !important;
}

/* Shared shell and controls */
.shell {
  width: min(100% - 88px, 1280px);
  margin-inline: auto;
  padding-bottom: 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--white);
  font: 800 17px/1.1 var(--heading);
  text-align: left;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: #203841;
  color: var(--mint);
  border: 1px solid #47726f;
  box-shadow: inset 0 1px 0 #d9ffef23, 0 0 25px #75f9dc14;
  font-size: 22px;
  line-height: 1;
}

.brand-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.brand small {
  display: block;
  color: var(--muted);
  font: 700 11px/1.3 var(--font);
  margin-top: 4px;
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button,
.answer-target {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-flex;
  min-height: 48px;
  justify-content: center;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 9px 16px;
  font: 800 15px/1.2 var(--font);
  text-decoration: none;
  text-align: center;
}

.primary-button {
  background: var(--mint);
  color: #11242b;
  border-color: #b7ffe8;
  box-shadow: 0 4px 0 #4fbc9d, 0 7px 22px #71efc340;
}

.primary-button:hover:not(:disabled) {
  background: #c9ffed;
  transform: translateY(-2px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #4fbc9d;
}

.secondary-button,
.icon-button {
  background: #151c2d;
  border-color: var(--line);
  color: var(--soft);
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: #212a43;
  border-color: #526183;
  color: var(--white);
}

.icon-button {
  min-width: 46px;
  padding-inline: 12px;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

[aria-pressed='true'].icon-button,
[aria-pressed='true'].secondary-button {
  color: var(--mint);
  border-color: #529786;
  background: #193437;
}

.primary-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  opacity: .48;
  box-shadow: none;
}

/* Home and six-week map */
.eyebrow {
  display: inline-block;
  margin-bottom: 15px;
  color: var(--mint);
  font-weight: 800;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  font: 800 clamp(24px, 2.8vw, 34px)/1.08 var(--heading);
  letter-spacing: -.025em;
}

.section-heading p {
  color: var(--muted);
  font-size: 14px;
}

/* Mission header and stage */
.game-view,
.result-view {
  max-width: 1080px;
  margin-inline: auto;
}

.game-head {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 17px;
}

.game-head h2 {
  line-height: 1.05;
  letter-spacing: -.023em;
  font-size: 21px;
}

.progress-track {
  overflow: hidden;
  min-width: 90px;
  height: 9px;
  border-radius: 10px;
  background: #282f48;
  border: 1px solid #353d58;
}

.progress-track > span,
.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #57e4b7, var(--game-accent));
  box-shadow: 0 0 14px var(--game-accent);
  transition: width 260ms ease;
}

.challenge {
  position: relative;
  border-radius: 25px;
  min-height: 495px;
  padding: clamp(19px, 3.1vw, 42px);
  isolation: isolate;
  overflow: clip;
  border: 1px solid #37405e;
  background:
    radial-gradient(ellipse at 50% -19%, #35415a 5%, transparent 63%),
    linear-gradient(163deg, #171e36 1%, #13182b 52%, #101728 100%);
  box-shadow: 0 14px 35px #03051074;
}

.challenge h1,
.challenge h2,
.challenge-title {
  color: var(--white);
  font: 900 clamp(29px, 4.3vw, 49px)/1.11 var(--heading);
  letter-spacing: -.045em;
  text-wrap: balance;
}

.challenge .challenge-prompt {
  margin-top: 10px;
  color: var(--soft);
  font-size: clamp(16px, 1.9vw, 21px);
  text-wrap: pretty;
}

.challenge-scene {
  display: grid;
  align-items: center;
  justify-items: center;
  width: 100%;
  min-width: 0;
  margin: 22px auto 24px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 40%), 1fr));
  justify-content: center;
  gap: 13px;
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
}

.answer-target {
  position: relative;
  min-height: clamp(73px, 12.5vw, 113px);
  min-width: 0;
  padding: 14px 12px;
  color: var(--white);
  border: 1px solid #536487;
  border-bottom-width: 4px;
  border-radius: 18px;
  background: linear-gradient(167deg, #28334f 8%, #1a243a 91%);
  font: 900 clamp(26px, 4.8vw, 51px)/1.1 var(--heading);
  letter-spacing: -.045em;
  text-wrap: pretty;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 24px #080f278f;
}

.answer-target:hover:not(:disabled) {
  border-color: var(--game-accent);
  color: #fff;
  background: linear-gradient(167deg, #33496a 8%, #263b52 91%);
  transform: translateY(-3px);
}

.answer-target:active:not(:disabled) {
  transform: translateY(2px);
}

.answer-target[data-state='correct'],
.answer-target.correct,
.answer-target.is-correct,
.answer-target.is-hit {
  background: linear-gradient(156deg, #356c58, #1c3e3a);
  border-color: var(--green);
  color: #d0ffec;
  box-shadow: 0 0 30px #67ebbc47;
}

.answer-target[data-state='incorrect'],
.answer-target[data-state='wrong'],
.answer-target.incorrect,
.answer-target.is-wrong {
  background: linear-gradient(156deg, #69394d, #443044);
  border-color: var(--error);
  color: #fff1f4;
  animation: shake-target 220ms ease 1;
}

@keyframes shake-target {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(-6px); }
  68% { transform: translateX(6px); }
}

.result-view {
  padding: clamp(32px, 6vw, 68px);
  border: 1px solid #45586e;
  border-radius: 25px;
  background: radial-gradient(ellipse at 50% 0, #263d4e, #182338 52%, #11172a 100%);
  text-align: center;
}

.result-view h1,
.result-view h2 {
  margin-bottom: 15px;
  font: 900 clamp(37px, 6vw, 66px)/1.05 var(--heading);
  letter-spacing: -.045em;
}

.result-view p {
  color: var(--soft);
}

.result-view .button-row {
  justify-content: center;
  margin-top: 26px;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  color: var(--bg);
  background: var(--mint);
  padding: 9px 14px;
  border-radius: 7px;
}

.skip-link:focus {
  transform: none;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  clip-path: inset(50%);
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

@media (max-width: 1050px) {
  .shell {
    width: calc(100% - 56px);
  }

}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 32px);
  }

  .topbar {
    min-height: 69px;
  }

}

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 24px);
  }

  .topbar {
    gap: 8px;
  }

  .top-actions {
    gap: 7px;
  }

  .brand {
    font-size: 15px;
    gap: 7px;
  }

  .brand-mark {
    flex-basis: 35px;
    width: 35px;
    height: 35px;
    border-radius: 10px;
  }

  .game-head {
    gap: 9px;
    margin-bottom: 11px;
  }

  .challenge {
    min-height: 420px;
    border-radius: 19px;
  }

  .answer-grid {
    gap: 9px;
  }

  .answer-target {
    border-radius: 13px;
  }
}

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

.brand-type {
  display: grid;
  gap: 1px;
}

.control-label {
  white-space: nowrap;
}

.game-meta {
  min-width: 0;
}

.game-meta .eyebrow {
  margin-bottom: 5px;
}

.progress-wrap {
  display: grid;
  justify-items: end;
  gap: 5px;
  width: clamp(110px, 17vw, 202px);
}

.progress-count {
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.progress-wrap .progress-track {
  width: 100%;
}

.challenge {
  --stage-width: 820px;
}

.challenge-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.challenge-header p {
  margin-top: 10px;
  color: var(--soft);
  font-size: clamp(16px, 1.9vw, 21px);
  text-wrap: pretty;
}

.hint-button,
.next-button {
  flex: none;
  min-height: 44px;
  border: 1px solid #536385;
  border-radius: 12px;
  padding: 9px 13px;
  background: #24314c;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800;
}

.hint-button:hover:not(:disabled) {
  border-color: var(--game-accent);
  color: var(--white);
}

.next-button {
  min-width: 105px;
  border-color: #b7ffe8;
  background: var(--mint);
  box-shadow: 0 3px 0 #4fbc9d;
  color: #11242b;
}

.next-button:hover:not(:disabled) {
  background: #c9ffed;
}

.next-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: none;
}

.next-button:disabled,
.hint-button:disabled {
  opacity: .44;
}

.challenge-scene {
  position: relative;
  min-height: 75px;
  max-width: var(--stage-width);
}

.challenge-scene:empty {
  display: none;
}

.challenge-scene > * {
  min-width: 0;
}

/* Illustrations and interactive tasks */
.object-pile {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  width: min(100%, 480px);
  min-height: 83px;
  padding: 13px;
  border: 1px solid #4b5c77;
  border-radius: 15px;
  background: #101b2c;
}

.object-token {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: clamp(28px, 5vw, 45px);
  min-height: clamp(31px, 5vw, 45px);
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--game-accent) 32%, #283954);
  border-radius: 10px;
  background: color-mix(in srgb, var(--game-accent) 15%, #192944);
  color: var(--game-accent);
  font: 900 clamp(18px, 3.8vw, 28px)/1 var(--heading);
}

.object-token[aria-pressed='true'] {
  border-color: var(--game-accent);
  background: var(--game-accent);
  color: #0b1c22;
}

.object-token svg {
  width: 70%;
}

.scene-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  justify-items: stretch;
  gap: 15px;
  width: min(100%, 660px);
}

.object-group {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px 9px;
  border-radius: 17px;
  border: 1px solid #465574;
  background: #19243b;
  color: var(--soft);
  font-weight: 800;
}

.object-group > .object-pile {
  border-color: #31455b;
  padding: 7px;
  min-height: 74px;
}

.object-group .object-token {
  width: clamp(23px, 4vw, 38px);
  min-height: clamp(25px, 4vw, 39px);
  font-size: clamp(16px, 2.8vw, 25px);
}

.place-blocks {
  --rod-color: #8adcf8;
  --cube-color: #ffc98f;
  display: flex;
  align-items: end;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 24px);
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #4c587b;
  border-radius: 16px;
  background: #14213a;
}

.ten-rods,
.one-cubes {
  display: flex;
  align-items: end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.one-cubes {
  max-width: 121px;
}

.ten-rod {
  width: clamp(10px, 2.5vw, 22px);
  height: clamp(59px, 11vw, 107px);
  border-radius: 4px;
  background: repeating-linear-gradient(to bottom, var(--rod-color) 0%, var(--rod-color) 8.5%, #5287a6 8.5%, #5287a6 10%);
  border: 1px solid #8ad8fa;
  box-shadow: 0 2px 6px #00000064;
}

.one-cube {
  width: clamp(13px, 2.6vw, 22px);
  height: clamp(13px, 2.6vw, 22px);
  border: 1px solid #ffdda9;
  border-radius: 4px;
  background: var(--cube-color);
  box-shadow: 0 2px 5px #00000056;
}

.sequence,
.paint-grid,
.order-bank,
.order-result {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
  max-width: 100%;
}

.sequence-chip,
.paint-cell,
.line-point,
.stepper button {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 45px;
  border: 1px solid #627395;
  border-radius: 10px;
  background: #273551;
  color: var(--white);
  font: 800 19px/1 var(--heading);
}

.sequence-chip {
  padding: 5px 10px;
}

.sequence-chip:disabled {
  opacity: .42;
}

.sequence-chip[aria-pressed='true'],
.paint-cell[aria-pressed='true'],
.line-point[aria-pressed='true'] {
  border-color: var(--game-accent);
  background: var(--game-accent);
  color: #142632;
  box-shadow: 0 0 12px color-mix(in srgb, var(--game-accent) 31%, transparent);
}

.paint-grid {
  width: min(100%, 550px);
  margin-inline: auto;
  padding: 12px;
  border: 1px solid #414f70;
  border-radius: 14px;
  background: #101b30;
}

.paint-cell {
  min-width: clamp(35px, 6vw, 52px);
  min-height: clamp(35px, 6vw, 52px);
  padding: 0;
}

.sequence-chip:not(:disabled):hover,
.paint-cell:not(:disabled):hover,
.line-point:not(:disabled):hover,
.stepper button:not(:disabled):hover {
  border-color: #c8d7f0;
}

.paint-cell[data-gap='true'],
.sequence-chip.is-gap {
  color: var(--muted);
  border-style: dashed;
  background: #131d33;
}

.number-line {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: 4px;
  width: min(100%, 1000px);
  min-height: 68px;
  overflow-x: auto;
  padding: 7px 4px 11px;
  scrollbar-color: #62779e #172236;
}

.line-point {
  position: relative;
  flex: 0 0 auto;
  min-width: 41px;
  min-height: 40px;
  padding: 4px;
  font-size: 16px;
}

.line-point::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 2px;
  height: 7px;
  background: #7b8ea9;
}

.line-point.is-start,
.line-point[data-start='true'] {
  border-style: dashed;
  border-color: var(--warm);
  color: var(--warm);
}

.activity-panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, var(--stage-width));
  min-width: 0;
  margin-inline: auto;
}

.activity-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px auto 0;
}

.order-bank,
.order-result {
  width: 100%;
}

.order-result {
  min-height: 60px;
  padding: 7px 12px;
  border: 1px dashed #647498;
  border-radius: 13px;
  background: #111a2e;
}

.order-result .sequence-chip {
  color: #162631;
  background: var(--game-accent);
  border-color: var(--game-accent);
}

.place-builder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.build-lane {
  display: grid;
  justify-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 7px;
  border-radius: 13px;
  border: 1px solid #4f6182;
  background: #1c2a43;
}

.build-lane .place-blocks {
  width: 100%;
  min-height: 48px;
  border-color: #35485f;
  padding: 6px;
}

.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stepper button {
  min-height: 38px;
  min-width: 38px;
}

.stepper button:disabled {
  opacity: .42;
}

.stepper output {
  min-width: 1ch;
  font: 900 26px/1 var(--heading);
  text-align: center;
}

.write-form {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  width: 100%;
}

.write-form input {
  width: min(100%, 335px);
  min-height: 49px;
  padding: 7px 13px;
  background: #101a2d;
  border: 1px solid #58688e;
  border-radius: 11px;
  color: var(--white);
  font-weight: 800;
  font-size: 17px;
}

.write-form input::placeholder {
  color: #9caccb;
}

.answer-target {
  display: grid;
  place-items: center;
}

.answer-label {
  max-width: 100%;
}

.answer-target[data-format='word'],
.answer-target--word {
  font-size: clamp(18px, 2.8vw, 28px);
  line-height: 1.2;
  letter-spacing: -.02em;
}

.answer-key {
  position: absolute;
  top: 7px;
  left: 7px;
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 6px;
  color: #d3def3;
  background: #101c30a8;
  border: 1px solid #687c9a;
  font: 800 11px/1 var(--font);
  letter-spacing: 0;
}

.feedback-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, var(--stage-width));
  min-height: 57px;
  margin: 16px auto 0;
}

.feedback-text {
  min-width: 0;
  color: var(--soft);
  font-weight: 800;
}

.feedback-text[data-state='correct'],
.feedback-bar[data-state='correct'] .feedback-text,
.feedback-bar.is-correct .feedback-text {
  color: var(--green);
}

.feedback-text[data-state='wrong'],
.feedback-bar[data-state='wrong'] .feedback-text,
.feedback-bar.is-wrong .feedback-text {
  color: var(--error);
}

/* Arcade feedback */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: clip;
  pointer-events: none;
  border-radius: inherit;
}

.pulse-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--game-accent);
  box-shadow: 0 0 8px var(--game-accent);
  animation: particle-burst 460ms cubic-bezier(.15, .55, .35, 1) both;
}

@keyframes particle-burst {
  from { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(.35); opacity: 0; }
}

.result-view {
  max-width: min(100%, 790px);
}

.result-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.result-card .eyebrow,
.result-card h2 {
  margin-bottom: 0;
}

.result-card p {
  max-width: 470px;
}

.result-card .result-icon {
  display: grid;
  min-width: 77px;
  min-height: 77px;
  place-items: center;
  border: 1px solid #6ea88e;
  border-radius: 22px;
  color: var(--mint);
  background: #254c4b;
  font-size: 42px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.site-footer a,
.site-footer button {
  color: var(--soft);
}

@media (max-width: 760px) {
  .answer-key {
    display: none;
  }
}

@media (max-width: 480px) {
  .top-actions .control-label {
    position: absolute;
    overflow: hidden;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    white-space: nowrap;
  }

  .top-actions .icon-button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }

  .progress-wrap {
    width: 65px;
  }

  .progress-track {
    min-width: 60px;
  }

  .game-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .game-head h2 {
    font-size: 16px;
  }

  .game-head .eyebrow {
    font-size: 10px;
  }

  .back-button {
    min-width: 34px;
    min-height: 38px;
    padding: 6px;
    font-size: 12px;
  }

  .challenge-scene {
    margin: 16px auto 20px;
  }

  .challenge-header {
    gap: 8px;
  }

  .hint-button {
    min-height: 38px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .answer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .place-builder {
    gap: 7px;
  }

  .stepper {
    gap: 5px;
  }

  .stepper button {
    min-width: 34px;
    min-height: 36px;
  }
}

/* Interactive screen details */
.game-view,
.result-view {
  --game-accent: var(--week-accent, var(--mint));
}

.challenge-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.challenge-tools .hint-button {
  min-width: 43px;
  max-width: 44px;
  padding: 9px;
}

.voice-note {
  width: fit-content;
  max-width: 100%;
  margin-top: 11px;
  padding: 5px 10px;
  border: 1px solid #715d50;
  border-radius: 8px;
  color: #ffe2b0;
  background: #30273b;
  font-size: 13px;
}

.scene-caption {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.word-card {
  width: min(100%, 340px);
  padding: 11px 15px;
  border: 1px solid #57728b;
  border-radius: 14px;
  background: #15253b;
  color: var(--game-accent);
  text-align: center;
  font: 900 clamp(22px, 4vw, 37px)/1.2 var(--heading);
  overflow-wrap: anywhere;
}

.sequence-chip.is-blank {
  min-width: 43px;
  border-style: dashed;
  color: var(--muted);
  background: #141d32;
}

.order-board {
  width: 100%;
}

.order-board .order-result {
  margin-top: 9px;
}

.line-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 3px 4px 8px;
  scrollbar-color: #62779e #172236;
}

.line-scroll .number-line {
  width: max-content;
  min-width: 100%;
  overflow: visible;
  margin-inline: auto;
  padding-inline: 5px;
}

.line-scroll .line-point {
  min-width: 35px;
  min-height: 43px;
}

.line-scroll .line-point.is-marked {
  border-color: var(--warm);
  color: #ffe1bd;
  background: #4b3b40;
}

.line-scroll .line-point[aria-pressed='true'] {
  border-color: var(--game-accent);
  color: #142632;
  background: var(--game-accent);
}

.paint-cell .object-token {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
}

.paint-cell .object-token svg {
  width: min(24px, 100%);
}

.feedback-text.has-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-text.has-feedback svg {
  flex: none;
}

.feedback-text.feedback-good {
  color: var(--green);
}

.feedback-text.feedback-bad,
.answer-target.is-miss {
  color: var(--error);
}

.answer-target.is-miss {
  background: linear-gradient(156deg, #69394d, #443044);
  border-color: var(--error);
  animation: shake-target 220ms ease 1;
}

.feedback-text.feedback-hint {
  color: #ffe1bd;
}

.result-emblem {
  display: grid;
  place-items: center;
  width: 95px;
  height: 95px;
  margin-bottom: 8px;
  border: 1px solid color-mix(in srgb, var(--game-accent) 65%, #263b51);
  border-radius: 26px;
  background: color-mix(in srgb, var(--game-accent) 21%, #142534);
  color: var(--game-accent);
  box-shadow: 0 0 45px color-mix(in srgb, var(--game-accent) 19%, transparent);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  width: min(100%, 500px);
  margin: 8px auto;
}

.result-stats > div {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 10px 6px;
  border: 1px solid #4f5970;
  border-radius: 13px;
  background: #142337;
}

.result-stats strong {
  color: var(--game-accent);
  font: 900 clamp(19px, 4vw, 32px)/1.1 var(--heading);
}

.result-stats span {
  color: var(--soft);
  font-size: 12px;
}

.result-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 11px;
}

/* Teacher summary */
.teacher-dialog {
  width: min(100% - 24px, 760px);
  max-height: min(88vh, 790px);
  padding: clamp(17px, 3.2vw, 29px);
  border: 1px solid #5b6b88;
  border-radius: 20px;
  background: #162036;
  color: var(--white);
  box-shadow: 0 20px 70px #080c19d9;
}

.teacher-dialog::backdrop {
  background: #070b16bb;
  backdrop-filter: blur(4px);
}

.teacher-dialog > .section-heading {
  align-items: center;
  margin-bottom: 12px;
}

.teacher-dialog p {
  margin-bottom: 10px;
  color: var(--soft);
}

.teacher-dialog p:last-child {
  margin-bottom: 0;
}

.teacher-dialog h3 {
  margin-top: 14px;
  color: var(--white);
  font-size: 18px;
}

.teacher-dialog ul {
  margin: 6px 0 12px;
  padding-inline-start: 22px;
  color: var(--soft);
}

.teacher-map {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.teacher-row {
  border: 1px solid #3e4d67;
  border-radius: 12px;
  background: #1b2940;
}

.teacher-row > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 12px;
  gap: 7px 10px;
  align-items: center;
  min-height: 47px;
  padding: 9px 11px;
  cursor: pointer;
}

.teacher-row > summary::after {
  content: '+';
  color: var(--mint);
  font-weight: 900;
}

.teacher-row[open] > summary::after {
  content: '−';
}

.teacher-row > ul {
  margin: 3px 13px 10px;
}

.teacher-week {
  min-width: 0;
  color: var(--white);
  font-weight: 800;
}

.teacher-week small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.teacher-metrics {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.3;
  text-align: end;
}

.teacher-row button.secondary-button {
  min-height: 38px;
  padding: 6px 11px;
  font-size: 13px;
}

@media (max-width: 480px) {
  .challenge-tools {
    gap: 5px;
  }

  .challenge-tools .hint-button {
    min-width: 34px;
    max-width: 35px;
    padding: 7px;
  }

  .challenge-tools .hint-button svg {
    width: 18px;
    height: 18px;
  }

  .result-view {
    padding: 22px 14px 27px;
  }

  .result-stats span {
    font-size: 11px;
  }

  .teacher-row > summary {
    grid-template-columns: minmax(0, 1fr) 12px;
  }

  .teacher-row > summary::after {
    grid-column: 2;
    grid-row: 1;
  }

  .teacher-metrics {
    grid-row: 2;
    text-align: start;
  }
}

.object-pile {
  --tile-size: clamp(31px, 5vw, 45px);
  display: grid;
  grid-template-columns: repeat(5, var(--tile-size));
  width: fit-content;
  max-width: 100%;
}

.object-token {
  width: var(--tile-size);
  min-height: var(--tile-size);
}

.object-group > .object-pile {
  --tile-size: clamp(22px, 4vw, 37px);
  gap: 4px;
}

.object-group .object-token {
  width: var(--tile-size);
  min-height: var(--tile-size);
}

.scene-groups {
  grid-template-columns: repeat(auto-fit, minmax(min(126px, 100%), 1fr));
  justify-items: stretch;
  gap: 10px;
}

.challenge.is-arcade .answer-target::before,
.challenge.is-arcade .answer-target::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid color-mix(in srgb, var(--game-accent) 79%, transparent);
  pointer-events: none;
  opacity: .7;
}

.challenge.is-arcade .answer-target::before {
  top: 9px;
  right: 9px;
  border-width: 2px 2px 0 0;
  border-radius: 0 5px 0 0;
}

.challenge.is-arcade .answer-target::after {
  bottom: 9px;
  left: 9px;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 0 5px;
}

.challenge.is-arcade .answer-target:hover::before,
.challenge.is-arcade .answer-target:hover::after {
  opacity: 1;
}

@media (max-width: 480px) {
  .object-group {
    padding: 8px 4px;
  }

  .object-group > .object-pile {
    padding: 4px;
    gap: 3px;
  }
}

.challenge.is-arcade::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(137deg, #121a2c 15%, #101a2d21 76%), url('./assets/luma-city.webp') center 59% / cover;
  opacity: .14;
  pointer-events: none;
}

.count-token {
  position: relative;
  display: grid;
  width: var(--tile-size);
  height: var(--tile-size);
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.count-token:hover:not(:disabled) .object-token {
  border-color: var(--game-accent);
}

.count-token.is-counted .object-token {
  border-color: var(--game-accent);
  background: #335a61;
  color: #e0fff3;
}

.count-token.is-counted::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--game-accent);
  color: #173337;
  font: 900 11px/17px var(--font);
  text-align: center;
}

.count-token.is-counted svg {
  opacity: .65;
}

.line-cue {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.pulse-wrong {
  --game-accent: var(--error);
}

@media (max-width: 550px) {
  .object-pile {
    --tile-size: clamp(37px, 11vw, 42px);
  }

  .answer-grid:has(.answer-target:nth-child(3):last-child):not(:has([data-format='word'])) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.teacher-row > p {
  margin: 0 11px 8px;
  color: #ffe1bd;
  font-size: 13px;
}

.teacher-row > button.secondary-button {
  margin: 0 11px 11px;
}

/* Flight console */
.challenge.is-arcade {
  padding: clamp(16px, 2.8vw, 32px);
}

.is-arcade .challenge-header h2[tabindex='-1']:focus {
  outline: none;
}

.is-arcade .challenge-scene {
  margin-block: 15px 16px;
}

.arcade-arena {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, var(--stage-width));
  margin: 16px auto 0;
  padding: 13px 13px 0;
  border: 1px solid #536a83;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #10243b60 0, #122443a6 43%, #0c1932 100%),
    url('./assets/luma-city.webp') left 30% / 230% auto no-repeat;
  box-shadow: inset 0 1px 0 #b8ffeb23, 0 11px 22px #080f2570;
  touch-action: manipulation;
}

.arcade-arena .answer-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 9px;
}

.arcade-arena .answer-target {
  min-height: 83px;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: clamp(27px, 4.5vw, 44px);
}

.arcade-arena .answer-target[data-format='word'] {
  font-size: clamp(17px, 2vw, 26px);
}

.arcade-arena .answer-target:hover:not(:disabled),
.arcade-arena .answer-target:active:not(:disabled) {
  transform: none;
}

.arcade-arena .answer-target.is-aimed:not(.is-miss, .is-wrong, .is-correct, .is-hit),
.arcade-arena .answer-target[aria-pressed='true']:not(.is-miss, .is-wrong, .is-correct, .is-hit) {
  border-color: var(--game-accent);
  color: #fff;
  background: linear-gradient(170deg, #345460, #1d3448);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--game-accent) 49%, transparent),
    0 0 22px color-mix(in srgb, var(--game-accent) 31%, transparent);
}

.arcade-arena .answer-target[aria-pressed='true']::before,
.arcade-arena .answer-target[aria-pressed='true']::after {
  opacity: 1;
  border-color: var(--game-accent);
}

.arcade-lane {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 123px;
  margin-top: 11px;
  border: 1px solid #547485;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #1b365773, #0d2238b0 60%, #10213a);
}

.arcade-lane::before {
  content: '';
  position: absolute;
  inset: -35% -34% 0;
  z-index: -1;
  transform: perspective(165px) rotateX(42deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(90deg, transparent 0 59px, #789cb93e 60px 61px),
    repeating-linear-gradient(0deg, #152e468f 0 24px, #709cb552 25px 26px);
  mask-image: linear-gradient(180deg, transparent 25%, #000 72%);
  pointer-events: none;
}

.arcade-lane::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  z-index: -1;
  background: repeating-linear-gradient(90deg, transparent 0 18px, #86eedf97 19px 31px, transparent 32px 48px);
  pointer-events: none;
}

.arcade-pilot {
  position: absolute;
  z-index: 1;
  left: var(--pilot-x, 50%);
  top: var(--pilot-y, 52%);
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 13px #66e4eb54);
  pointer-events: none;
}

.arcade-pilot::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: auto 11% 1%;
  height: 13%;
  border-radius: 50%;
  background: #5debdba1;
  filter: blur(7px);
}

.arcade-pilot > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 110ms ease-out;
}

.arcade-pilot.is-moving > img {
  transform: translateY(-2px) scale(1.035);
}

.arcade-reticle {
  position: absolute;
  z-index: 4;
  left: var(--reticle-x, 50%);
  top: var(--reticle-y, 50%);
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  border: 1.5px dashed currentColor;
  border-radius: 50%;
  color: #f0fffa;
  filter: drop-shadow(0 0 4px #071525);
  pointer-events: none;
}

.arcade-reticle.is-locked {
  border-style: solid;
  color: var(--game-accent);
  filter: drop-shadow(0 0 4px #081726) drop-shadow(0 0 2px currentColor);
}

.arcade-reticle::before,
.arcade-reticle::after {
  content: '';
  position: absolute;
  inset: -5px 50%;
  width: 1px;
  background: linear-gradient(currentColor 0 6px, transparent 6px calc(100% - 6px), currentColor calc(100% - 6px));
}

.arcade-reticle::after {
  transform: rotate(90deg);
}

.arcade-projectiles {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.arcade-shot {
  position: absolute;
  left: var(--shot-x);
  top: var(--shot-y);
  width: 34px;
  height: 7px;
  transform: translate(-95%, -50%) rotate(var(--shot-angle));
  transform-origin: 95% center;
  border-radius: 50% 10px 10px 50%;
  background: linear-gradient(90deg, transparent, var(--game-accent) 68%, #fff 96%);
  filter: drop-shadow(0 0 5px var(--game-accent));
  pointer-events: none;
}

.arcade-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  width: min(100%, var(--stage-width));
  margin: 12px auto 0;
}

.movement-pad {
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 6px;
}

.movement-pad button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid #4d6581;
  border-bottom-width: 3px;
  border-radius: 11px;
  background: linear-gradient(166deg, #273953, #1b283f);
  color: #e5f1ff;
  touch-action: none;
  user-select: none;
}

.movement-pad button svg {
  width: 21px;
  height: 21px;
}

.movement-pad [data-move='left'] svg { transform: rotate(180deg); }
.movement-pad [data-move='up'] svg { transform: rotate(-90deg); }
.movement-pad [data-move='down'] svg { transform: rotate(90deg); }

.movement-pad button:hover:not(:disabled) {
  border-color: var(--game-accent);
}

.movement-pad button.is-moving,
.movement-pad button:active {
  transform: translateY(2px);
  border-color: var(--game-accent);
  background: #345751;
  color: #fff;
}

.flight-help {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.32;
  text-wrap: pretty;
}

.flight-help-touch {
  display: none;
}

.fire-button[data-fire] {
  justify-self: end;
  min-width: 132px;
  min-height: 48px;
  padding-inline: 14px;
  white-space: nowrap;
  touch-action: manipulation;
}

.arcade-controls[inert] .movement-pad,
.arcade-controls[inert] .fire-button {
  opacity: .48;
}

.is-arcade .feedback-bar {
  min-height: 44px;
  margin-top: 12px;
}

@media (hover: hover) and (pointer: fine) {
  .arcade-arena:has(.arcade-reticle:not([hidden])) {
    cursor: none;
  }

  .arcade-arena:has(.arcade-reticle:not([hidden])) .answer-target:not(:disabled) {
    cursor: none;
  }
}

@media (min-width: 761px) {
  .is-arcade .scene-objects .object-pile:has(.count-token:nth-child(11)) {
    grid-template-columns: repeat(10, var(--tile-size));
  }
}

@media (max-width: 620px), (hover: none) {
  .flight-help-desktop {
    display: none;
  }

  .flight-help-touch {
    display: inline;
  }
}

@media (max-width: 620px) {
  .challenge.is-arcade {
    padding: 13px;
  }

  .arcade-arena {
    padding: 9px 9px 0;
    border-radius: 13px;
  }

  .arcade-arena .answer-grid {
    gap: 6px;
  }

  .arcade-arena .answer-target {
    min-height: 61px;
    padding: 7px 5px;
    font-size: clamp(24px, 7vw, 34px);
  }

  .arcade-arena .answer-target[data-format='word'] {
    font-size: clamp(13px, 3.7vw, 21px);
    hyphens: auto;
  }

  .arcade-arena .answer-target::before,
  .arcade-arena .answer-target::after {
    width: 10px;
    height: 10px;
  }

  .arcade-arena .answer-target::before {
    top: 5px;
    right: 5px;
  }

  .arcade-arena .answer-target::after {
    bottom: 5px;
    left: 5px;
  }

  .arcade-lane {
    height: 99px;
    margin-top: 8px;
  }

  .arcade-pilot {
    width: 69px;
    height: 69px;
  }

  .arcade-controls {
    grid-template-columns: 1fr auto;
    gap: 7px 10px;
  }

  .movement-pad {
    grid-template-columns: repeat(3, 44px);
    gap: 4px;
  }

  .movement-pad [data-move='up'] { grid-area: 1 / 2; }
  .movement-pad [data-move='left'] { grid-area: 2 / 1; }
  .movement-pad [data-move='down'] { grid-area: 2 / 2; }
  .movement-pad [data-move='right'] { grid-area: 2 / 3; }

  .flight-help {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 4px;
  }

  .fire-button[data-fire] {
    min-width: 105px;
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-pilot.is-moving > img {
    transform: none;
  }
}

.guided-answers {
  width: min(100%, var(--stage-width));
  margin: 0 auto;
}

.guided-answers .answer-grid {
  width: 100%;
}

.guided-answers .answer-target.is-picked:not(.is-correct, .is-wrong) {
  border-color: var(--game-accent);
  background: #294b51;
}

.guided-answers .activity-actions {
  margin-top: 16px;
}

.result-stats.check-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.teacher-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  padding: 12px;
  background: #20394a;
  border: 1px solid #536a7b;
  border-radius: 12px;
}

.teacher-mode small {
  display: block;
  margin-top: 3px;
  color: var(--soft);
}

.teacher-mode button[aria-pressed='true'] {
  border-color: var(--mint);
  color: var(--mint);
}

.teacher-week-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 12px 12px;
}

.teacher-week-actions button.secondary-button {
  margin: 0;
  min-height: 44px;
}

.teacher-row .teacher-result {
  margin: 0 12px 8px;
  padding: 8px 10px;
  border-left: 2px solid #7bc8b1;
  background: #17243b;
}

@media (max-width: 420px) {
  .teacher-mode {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .teacher-mode button {
    justify-self: start;
  }
}

@media (max-width: 550px) {
  .scene-objects .object-pile {
    --tile-size: 44px;
    grid-template-columns: repeat(4, var(--tile-size));
  }

  .object-group > .object-pile {
    --tile-size: 44px;
    grid-template-columns: repeat(3, var(--tile-size));
  }
}

@media (max-width: 369px) {
  .scene-groups {
    grid-template-columns: 1fr;
  }

  .object-group > .object-pile {
    grid-template-columns: repeat(5, var(--tile-size));
  }
}

/* The first district's lantern challenge */
.lantern-layout {
  margin-top: 14px;
}

.lantern-board {
  --lantern-gold: #ffdd88;
  --bridge-glow: #9af9d2;
  width: min(100%, var(--stage-width));
  margin: 0 auto;
  padding: clamp(12px, 2.4vw, 22px);
  overflow: hidden;
  border: 1px solid #536a85;
  border-radius: 20px;
  background:
    linear-gradient(180deg, #10203dbd, #121c37e8 80%),
    #182d4e url('./assets/luma-city.webp') center 53% / cover;
  box-shadow: inset 0 1px #ffffff21, 0 12px 30px #040b1e6b;
}

.lantern-scene {
  display: grid;
  gap: 14px;
}

.lantern-count {
  display: flex;
  width: max-content;
  max-width: 100%;
  min-height: 42px;
  margin: 0 auto;
  padding: 6px 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 9px;
  border: 1px solid #657f98;
  border-radius: 12px;
  background: #122541;
  color: #efeffb;
  font-size: .92rem;
  font-weight: 700;
  text-align: center;
}

.lantern-count strong,
.lantern-count output {
  color: var(--lantern-gold);
  font-size: clamp(1.16rem, 3.6vw, 1.65rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.lantern-town {
  display: grid;
  width: min(100%, 530px);
  margin: 5px auto 0;
  padding: 12px 0 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(8px, 2vw, 22px);
}

.lantern-building {
  --roof-color: #9ac9ff;
  --house-top: #375a86;
  --house-base: #2a426b;
  position: relative;
  min-width: 0;
  padding: clamp(6px, 1vw, 12px);
  border: 1px solid #ffffff47;
  border-bottom-width: 4px;
  border-radius: 11px 11px 8px 8px;
  background: linear-gradient(155deg, var(--house-top), var(--house-base));
  box-shadow: inset 0 1px #ffffff24, 0 5px 0 #111c34, 0 10px 18px #09111fc7;
}

.lantern-building:nth-child(2) {
  --roof-color: #d3b1fa;
  --house-top: #74538a;
  --house-base: #4a3a72;
}

.lantern-building:nth-child(3) {
  --roof-color: #92dec8;
  --house-top: #3b786f;
  --house-base: #2d575a;
}

.lantern-building::before {
  position: absolute;
  top: -12px;
  right: -3px;
  left: -3px;
  height: 17px;
  border-radius: 4px;
  background: var(--roof-color);
  box-shadow: inset 0 -4px #00000029;
  clip-path: polygon(0 100%, 0 78%, 13% 13%, 87% 13%, 100% 78%, 100% 100%);
  pointer-events: none;
  content: '';
}

.lantern-windows {
  display: grid;
  grid-template-columns: repeat(2, minmax(44px, 1fr));
  gap: clamp(4px, 1vw, 9px);
  margin-top: 6px;
}

.lantern-window {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 44px;
  min-height: clamp(44px, 7vw, 62px);
  place-items: center;
  padding: 4px;
  border: 2px solid #94aacc;
  border-bottom-width: 4px;
  border-radius: 10px;
  background: linear-gradient(145deg, #324969, #182945);
  color: #d3e2fb;
  box-shadow: inset 0 3px 7px #020e27b3;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s, transform .12s;
}

.lantern-window > svg {
  width: clamp(19px, 3.1vw, 25px);
  height: clamp(19px, 3.1vw, 25px);
}

.lantern-window:hover:not(:disabled) {
  border-color: #fff3cc;
}

.lantern-window:active:not(:disabled) {
  transform: translateY(2px);
}

.lantern-window:focus-visible {
  z-index: 1;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.lantern-window[aria-pressed='true'] {
  border-color: #fff0b7;
  border-bottom-color: #d99539;
  background: radial-gradient(ellipse at 46% 37%, #fff8cc, var(--lantern-gold) 55%, #f8b664);
  color: #403019;
  box-shadow: inset 0 0 0 1px #fff5c3, 0 0 11px #ffd17a99;
}

.lantern-window[aria-pressed='true']::after {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
  content: '';
}

.lantern-window:disabled {
  cursor: default;
  opacity: 1;
}

.lantern-bridge {
  display: grid;
  width: min(100%, 530px);
  margin: 0 auto;
  gap: 4px 6px;
  color: #e7f2ff;
  font-size: .83rem;
  font-weight: 800;
}

.bridge-track {
  display: flex;
  gap: clamp(3px, .7vw, 6px);
}

.lantern-bridge > span {
  margin-bottom: 4px;
  text-align: center;
}

.bridge-segment {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  min-height: 18px;
  border: 1px solid #7f95b7;
  border-bottom: 4px solid #526283;
  border-radius: 5px 5px 3px 3px;
  background: repeating-linear-gradient(130deg, #223550 0 4px, #324663 4px 7px);
}

.bridge-segment.is-lit {
  border-color: #d5fff0;
  border-bottom-color: #5ebaa7;
  background: linear-gradient(180deg, #c0ffe1, var(--bridge-glow));
  box-shadow: 0 0 8px #80fbd091;
}

.lantern-board.is-complete {
  border-color: #c3ffe9;
  box-shadow: inset 0 0 25px #84f3cf33, 0 0 28px #47c9a038;
}

.lantern-board.is-complete .bridge-segment.is-lit {
  animation: lantern-bridge-arrival .68s ease-out both;
  animation-delay: var(--segment-delay, 0ms);
}

@keyframes lantern-bridge-arrival {
  0% { transform: translateY(0); filter: brightness(.42); }
  36% { transform: translateY(-3px); filter: brightness(1.25); }
  100% { transform: translateY(0); filter: brightness(1); }
}

.lantern-actions {
  display: flex;
  margin: 14px auto 0;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
}

.lantern-actions button {
  min-height: 44px;
}

@media (max-width: 430px) {
  .challenge.is-lantern {
    padding: 13px;
  }

  .lantern-scene {
    gap: 11px;
  }

  .lantern-town {
    width: min(100%, 290px);
    padding-block: 9px 5px;
  }

  .lantern-windows {
    grid-template-columns: minmax(44px, 1fr);
    gap: 4px;
  }

  .lantern-window {
    min-height: 44px;
    border-radius: 7px;
  }

  .lantern-actions .primary-button,
  .lantern-actions .secondary-button {
    padding-inline: 12px;
  }
}

@media (max-width: 380px) {
  .lantern-actions {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    align-items: stretch;
  }

  .lantern-actions .primary-button,
  .lantern-actions .secondary-button {
    min-width: 0;
    padding-inline: 6px;
    gap: 5px;
    white-space: normal;
  }

  .lantern-actions .primary-button svg {
    flex-shrink: 0;
    width: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lantern-window {
    transition: none;
  }

  .lantern-window:active:not(:disabled) {
    transform: none;
  }

  .lantern-board.is-complete .bridge-segment.is-lit {
    animation: none;
  }
}

/* City map */
.on-city-map {
  --map-paper: #fbf0d7;
  --map-ink: #292644;
  --map-quiet: #59516a;
  --map-line: #d3bea1;
  --map-action: #ffba68;
  --map-light: #ffe091;
  background: var(--map-paper);
  color: var(--map-ink);
}

.on-city-map .topbar {
  min-height: 76px;
  margin-bottom: clamp(14px, 3.2vw, 46px);
  border-bottom: 1px solid var(--map-line);
}

.on-city-map .topbar .brand-type { display: none; }

.on-city-map .topbar .brand-mark {
  width: 46px;
  height: 46px;
  border: 0;
  background: var(--map-ink);
  box-shadow: none;
}

.on-city-map .topbar .icon-button {
  min-width: 44px;
  min-height: 44px;
  border-color: var(--map-line);
  border-radius: 12px;
  background: transparent;
  color: var(--map-ink);
}

.on-city-map .topbar .icon-button[aria-pressed='true'] {
  background: #e4ecdb;
  border-color: #9bab92;
  color: #273f42;
}

.on-city-map .topbar button:focus-visible,
.city-intro button:focus-visible,
.city-demo:focus-visible { outline-color: #43416b; }

.city-home {
  display: grid;
  grid-template-columns: minmax(0, .48fr) minmax(0, 1fr);
  gap: clamp(22px, 4vw, 58px);
  align-items: center;
  padding-bottom: 18px;
}

.city-intro {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 20px;
  padding-block: 0 42px;
}

.city-intro h1 {
  font: 800 clamp(40px, 5.3vw, 76px)/.93 var(--heading);
  letter-spacing: -.056em;
}

.city-intro h1 span {
  display: block;
  margin-bottom: .28em;
  font-size: .56em;
  line-height: 1;
  letter-spacing: -.035em;
}

.city-intro p {
  max-width: 24ch;
  font-size: clamp(17px, 1.65vw, 22px);
  line-height: 1.3;
  color: var(--map-quiet);
}

.city-play {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  min-width: min(100%, 205px);
  margin-top: 5px;
  padding: 9px 18px;
  border: 2px solid var(--map-ink);
  border-radius: 13px;
  background: var(--map-action);
  box-shadow: 0 4px var(--map-ink);
  font-size: 19px;
  font-weight: 800;
  text-align: left;
  transition: background-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.city-play:active {
  transform: translateY(3px);
  box-shadow: 0 1px var(--map-ink);
}

.city-map { min-width: 0; }

.city-map-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 12px;
  padding: 0 2px 9px;
}

.city-map-heading h2 {
  font-size: clamp(16px, 2.2vw, 23px);
  line-height: 1.2;
}

.city-map .map-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--map-quiet);
  font-size: 13px;
  font-weight: 700;
}

.city-map .map-status svg { color: #8b490e; }

.city-board {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  background: #265572;
  border: 2px solid var(--map-ink);
  border-radius: 16px;
}

.city-art {
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.city-pin {
  position: absolute;
  inset: var(--pin-y) auto auto var(--pin-x);
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  min-width: 48px;
  min-height: 46px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  transform: translate(-50%, -40%);
  font-weight: 800;
  line-height: 1;
}

.city-pin-number {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(32px, 7cqw, 48px);
  aspect-ratio: 1;
  border: 2px solid var(--map-paper);
  border-radius: 50%;
  background: var(--map-ink);
  box-shadow: 0 2px 0 #181d38;
  color: var(--map-paper);
  font-size: clamp(16px, 3.7cqw, 23px);
}

.city-pin-label {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--map-ink);
  color: var(--map-paper);
  font-size: clamp(11px, 2.9cqw, 15px);
  white-space: nowrap;
}

.city-pin[aria-current] .city-pin-number,
.city-pin.is-complete .city-pin-number {
  border-color: var(--map-ink);
  background: var(--map-light);
  color: var(--map-ink);
}

.city-pin[aria-current] .city-pin-number {
  box-shadow: 0 0 0 3px var(--map-light), 0 0 0 5px var(--map-ink);
}

.city-pin-check {
  position: absolute;
  inset: auto -6px -4px auto;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid var(--map-paper);
  border-radius: 50%;
  background: #305b4b;
  color: var(--map-paper);
}

.city-demo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--map-line);
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

@media (hover: hover) {
  .on-city-map .topbar .icon-button:hover,
  .city-demo:hover { background: #f0dfc2; }
  .city-play:hover { background: #ffca88; }
  .city-pin:hover .city-pin-label { text-decoration: underline; }
}

@media (max-width: 760px) {
  .on-city-map .topbar { min-height: 62px; }
  .city-home { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .city-intro { gap: 8px; padding: 0 2px; }
  .city-intro h1 { font-size: clamp(30px, 9.3vw, 51px); line-height: 1; }
  .city-intro h1 br { display: none; }
  .city-intro h1 span { margin-bottom: 3px; }
  .city-intro p { max-width: none; font-size: 16px; }
  .city-play { min-height: 49px; }
}

@media (min-width: 761px) and (max-height: 520px) {
  .on-city-map .topbar { min-height: 56px; margin-bottom: 12px; }
  .city-intro { gap: 12px; padding-block-end: 0; }
  .city-intro h1 { font-size: clamp(32px, 11vh, 58px); }
  .city-map { width: min(100%, calc((100vh - 124px) * 1.5)); justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  .city-play { transition: none; }
  .city-play:active { transform: none; }
}
