:root {
  --board: #1b1e1c;
  --chalk: #f4f1e6;
  --chalk-soft: #d1d3c9;
  --line: #7e8780;
  --raised: #303833;
  --blue: #84b8d1;
  --orange: #e6ab80;
  --green: #9dbca4;
  --object-ink: #202b28;
  color-scheme: dark;
  scrollbar-color: var(--line) var(--board);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; position: relative; isolation: isolate; background: var(--board); color: var(--chalk); font: 400 1.25rem/1.5 "Patrick Hand", sans-serif; font-synthesis: none; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: absolute; z-index: -1; inset: 0; background: url("/assets/images/chalkboard-dust.webp") repeat; background-size: 64rem 64rem; opacity: .6; pointer-events: none; }
[hidden] { display: none !important; }
::selection { background: var(--chalk); color: var(--board); }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, output { font: inherit; }
button, .button { min-height: 50px; border: 1px solid var(--line); padding: .55rem 1rem; color: var(--chalk); background: var(--board); border-radius: 4px; cursor: pointer; line-height: 1.3; touch-action: manipulation; }
button:hover, .button:hover { background: var(--raised); border-color: var(--chalk); }
button:disabled { opacity: .5; cursor: default; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--chalk); outline-offset: 5px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 1rem; border: 2px solid var(--chalk); text-decoration: none; }
.skip-link { position: absolute; top: -5rem; left: 1rem; z-index: 20; background: var(--board); padding: .6rem; }
.skip-link:focus { top: 1rem; }
.game-header { max-width: 1280px; margin: auto; padding: 1.4rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.wordmark { font: 400 2.4rem/1.2 "CHAWP", sans-serif; text-decoration: none; }
.game-header nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.game-header nav a { display: inline-flex; align-items: center; min-height: 48px; }
h1, h2 { font-family: "CHAWP", "Patrick Hand", sans-serif; font-weight: 400; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 4.6vw, 4.1rem); line-height: 1.25; margin: 0 0 1.25rem; }
h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.3; margin: 0 0 .8rem; }
h3 { font-size: 1.5rem; font-weight: 400; line-height: 1.3; margin: 0 0 .6rem; }
p { margin: .6rem 0 1rem; }
strong { font-weight: 400; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: .16em; }
.hub-main, .play-main { width: min(1180px, calc(100% - 4rem)); margin: 2.5rem auto 0; }
.play-main { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); gap: 0 2rem; align-items: center; }
.play-main > .play-heading { grid-column: 1; }
.play-main > .adventure-scene { grid-column: 2; grid-row: 1; margin-top: 0; align-self: start; }
.play-main > .play-board, .play-main > .teacher-notes { grid-column: 1 / -1; }
.hub-main { margin-top: 1.5rem; }
.hub-intro { max-width: 780px; margin: 0 0 2rem; }
.hub-intro h1 { font-size: clamp(2rem, 3.3vw, 3rem); margin-bottom: .5rem; }
.hub-intro > p { max-width: 54ch; font-size: 1.3rem; margin: .5rem 0; }
.hub-intro .hub-audience { font-size: 1.1rem; color: var(--chalk-soft); margin-top: .75rem; }
.mission-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2.5rem; }
.mission-entry { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: start; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.mission-image { display: block; padding-top: .25rem; }
.mission-image img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.mission-copy h2 { font-size: 1.5rem; line-height: 1.3; margin-bottom: .5rem; text-wrap: initial; }
.mission-copy h2 a { text-decoration: none; }
.mission-copy h2 a:hover { text-decoration: underline; }
.mission-copy > p { max-width: 42ch; font-size: 1.1rem; line-height: 1.4; margin: .5rem 0; }
.mission-copy .notion { color: var(--chalk-soft); font-size: 1rem; }
.mission-action { display: inline-flex; align-items: center; gap: .75rem; min-height: 48px; font-size: 1.15rem; }
.teacher-section { margin: 2.5rem 0 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.teacher-section > p { max-width: 70ch; }
.teacher-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin: 2rem 0; }
.teacher-columns p { max-width: 50ch; }
details { border-top: 1px solid var(--line); padding: 1.25rem 0; }
summary { cursor: pointer; min-height: 48px; padding: .3rem 0; font-size: 1.4rem; }
details p { max-width: 75ch; }
.game-footer { max-width: 1180px; margin: 4rem auto 0; padding: 2rem 0; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem 2rem; border-top: 1px solid var(--line); color: var(--chalk-soft); }
.game-footer p { margin: 0; }
.game-footer a { display: inline-flex; align-items: center; min-height: 48px; }
.play-heading { max-width: 980px; }
.play-heading > p { max-width: 68ch; font-size: 1.4rem; }
.adventure-scene { position: relative; margin-top: 1.5rem; height: clamp(190px, 20vw, 240px); overflow: hidden; isolation: isolate; }
.adventure-scene img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }
.scene-caption { position: absolute; left: 1rem; bottom: .8rem; padding: .2rem .6rem; background: var(--board); color: var(--chalk); font-size: 1rem; }
.journey-marker { position: absolute; left: 10%; top: 55%; padding: .2rem .5rem; border: 1px solid var(--chalk); background: var(--board); font-size: .8rem; transform: translate(-50%, -50%); opacity: 0; }
.moon-scene.is-travelling .journey-marker { opacity: 1; animation: moon-journey 850ms cubic-bezier(.16,1,.3,1) both; }
@keyframes moon-journey { from { left: 10%; top: 55%; } to { left: 79%; top: 22%; } }
.play-board { margin-top: 2rem; padding: 1.5rem 0; }
.chapter-line { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.chapter-line h2 { font-size: clamp(1.5rem, 2.3vw, 2rem); }
.chapter-line p { white-space: nowrap; font-size: 1rem; color: var(--chalk-soft); }
.story-line { font-size: 1.45rem; max-width: 72ch; min-height: 2.4em; }
.moon-layout { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; margin-top: 1.5rem; }
.cargo-zone { padding: 1rem; border: 2px dashed var(--line); border-radius: 4px; transition: border-color 150ms ease-out, background-color 150ms ease-out; }
.cargo-zone.is-drop-target { border-color: var(--chalk); background: var(--raised); }
.cargo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; padding: .75rem 0; }
.cargo-unit { display: grid; place-items: center; min-width: 0; height: clamp(48px, 5.2vw, 64px); border: 1px solid var(--line); border-radius: 3px; font: 500 1.3rem/1 "Atkinson Hyperlegible Next", sans-serif; color: var(--object-ink); }
.cargo-unit--fixed { background: var(--chalk-soft); border: none; }
.cargo-unit--added { border: none; background: var(--blue); }
.cargo-unit--2 { background: var(--orange); }
.cargo-unit--3 { background: var(--green); }
.cargo-unit--5 { background: #c2b2d5; }
.cargo-overflow { border-top: 1px dashed var(--line); margin-top: .5rem; padding-top: .5rem; }
.cargo-overflow > p { font-size: 1rem; margin: 0; }
.cargo-overflow .cargo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.board-equation { font: 400 clamp(1.65rem, 3.4vw, 2.5rem)/1.35 "CHAWP", sans-serif; margin: .9rem 0 .3rem; min-height: 1.4em; }
.stock-zone { padding-top: .4rem; }
.stock-zone > p { max-width: 40ch; }
.package-stock { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.package { min-height: 90px; min-width: 90px; padding: .4rem .6rem; color: var(--object-ink); border: 0; background: var(--blue); box-shadow: 1px 3px 5px rgb(0 0 0 / 35%), inset 0 1px 1px rgb(255 255 255 / 50%); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.package--2 { background: var(--orange); }
.package--3 { background: var(--green); }
.package--5 { background: #c2b2d5; }
.package:hover { background: var(--blue); box-shadow: 1px 4px 7px rgb(0 0 0 / 45%), inset 0 1px 1px rgb(255 255 255 / 60%); }
.package--2:hover { background: var(--orange); }
.package--3:hover { background: var(--green); }
.package--5:hover { background: #c2b2d5; }
.package[aria-pressed="true"] { outline: 3px solid var(--chalk); outline-offset: 5px; }
.package-value { display: block; font: 600 2rem/1.15 "Atkinson Hyperlegible Next", sans-serif; }
.package-dots { display: block; font-size: .8rem; line-height: 1.5; white-space: nowrap; }
.package-ghost { position: fixed; z-index: 100; margin: 0; pointer-events: none; opacity: .96; cursor: grabbing; box-shadow: 2px 8px 12px rgb(0 0 0 / 45%), inset 0 1px 1px rgb(255 255 255 / 60%); }
.package.is-drag-source { opacity: .45; }
.game-controls { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.3rem; }
.control-note { font-size: 1rem; color: var(--chalk-soft); }
.game-feedback { margin: 1.5rem 0 1rem; min-height: 2.8em; font-size: 1.35rem; max-width: 75ch; }
.action-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.action-row .button { min-height: 56px; }
.hint-text { margin-top: 1.25rem; color: var(--chalk-soft); max-width: 70ch; }
.teacher-notes { margin-top: 3rem; }
.no-js { padding: 1rem 0; color: var(--chalk-soft); }
.route-description { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.route-description p { margin: .5rem 0; }
.number-route { position: relative; height: 270px; margin: 2.4rem 1rem .5rem; }
.route-axis { position: absolute; left: 0; right: 0; bottom: 45px; height: 2px; background: var(--line); }
.route-tick { position: absolute; top: -5px; width: 1px; height: 12px; background: var(--line); }
.route-tick span { position: absolute; top: 17px; left: 50%; transform: translateX(-50%); font: 400 .95rem/1 "Atkinson Hyperlegible Next", sans-serif; }
.route-tick--ten { height: 25px; top: -12px; width: 2px; background: var(--chalk); }
.route-tick--ten span { top: 30px; font-weight: 700; }
.route-ten { position: absolute; left: 50%; top: -27px; transform: translateX(-50%); white-space: nowrap; font-size: 1.1rem; }
.route-segment { position: absolute; height: 2px; background: var(--chalk); }
.route-segment::after { content: ""; position: absolute; width: 10px; height: 10px; right: 1px; top: -4px; border-top: 2px solid var(--chalk); border-right: 2px solid var(--chalk); transform: rotate(45deg); }
.route-segment span { position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); font: 400 1.5rem/1.2 "Patrick Hand", sans-serif; }
.route-segment--first { top: 145px; left: 40%; width: 5%; }
.route-segment--second { top: 105px; left: 45%; width: 30%; border-bottom: 2px dashed var(--chalk); background: none; }
.route-handle { position: absolute; top: 165px; left: 45%; z-index: 1; width: 54px; height: 54px; min-height: 54px; padding: .3rem; border: none; background: var(--orange); color: var(--object-ink); box-shadow: 1px 3px 5px rgb(0 0 0 / 35%), inset 0 1px 1px rgb(255 255 255 / 50%); border-radius: 50%; transform: translateX(-50%); font: 600 1.15rem/1 "Atkinson Hyperlegible Next", sans-serif; cursor: ew-resize; touch-action: none; }
.route-handle:hover { background: var(--orange); }
.canoe-marker { position: absolute; top: 0; left: 40%; width: 96px; height: 64px; transform: translateX(-50%); font: 500 .75rem/1.2 "Atkinson Hyperlegible Next", sans-serif; transition: left 550ms cubic-bezier(.16,1,.3,1); }
.canoe-marker img { display: block; width: 100%; height: 100%; object-fit: contain; }
.canoe-marker > span { position: absolute; bottom: -.3rem; left: 50%; transform: translateX(-50%); padding: 0 .3rem; color: var(--chalk); background: var(--board); }
.canoe-marker::before { content: ""; position: absolute; top: 72px; left: 50%; height: 153px; border-left: 1px dashed var(--line); }
.canoe-marker::after { content: ""; position: absolute; top: 225px; left: 50%; width: 8px; height: 8px; background: var(--chalk); border-radius: 50%; transform: translate(-50%, -50%); }
.split-controls { display: flex; flex-wrap: wrap; gap: 1.3rem 3rem; align-items: center; }
.stepper { display: flex; align-items: center; gap: .8rem; }
.stepper button { width: 54px; height: 54px; padding: 0; font-size: 2rem; }
.stepper output { font: 500 1.8rem/1.2 "Atkinson Hyperlegible Next", sans-serif; min-width: 2ch; text-align: center; }
.remaining-bond p { font: 400 1.6rem/1.3 "Patrick Hand", sans-serif; margin: 0; }
.split-controls > p { flex: 1 1 280px; color: var(--chalk-soft); max-width: 38ch; margin: 0; }
.route-handle.is-dragging { outline: 3px solid var(--chalk); outline-offset: 4px; }
@media (min-width: 1500px) { body { font-size: 1.4rem; } .play-main { max-width: 1280px; } .cargo-unit { height: 74px; } .package { min-width: 105px; min-height: 105px; } }
@media (max-width: 800px) {
  .game-header { padding: 1rem 1.25rem; }
  .game-header nav { gap: .5rem 1rem; font-size: 1.05rem; }
  .hub-main, .play-main { width: calc(100% - 2.5rem); margin-top: 1.8rem; }
  .play-main { display: block; }
  .play-main > .adventure-scene { margin-top: 1.5rem; }
  .mission-list { grid-template-columns: 1fr; gap: .5rem; }
  .mission-entry { grid-template-columns: 128px minmax(0, 1fr); }
  .hub-intro { margin-bottom: 1.5rem; }
  .moon-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .cargo-unit { height: 64px; }
  .teacher-columns { gap: 1.5rem; }
  .game-footer { width: calc(100% - 2.5rem); }
  .chapter-line { align-items: start; }
  .chapter-line p { margin-top: 0; }
  .story-line { min-height: 0; }
}
@media (max-width: 480px) {
  body { font-size: 1.16rem; }
  .game-header { gap: .7rem; align-items: start; }
  .wordmark { font-size: 1.8rem; padding-top: .3rem; }
  .game-header nav { justify-content: end; gap: 0 .8rem; }
  .game-header nav a { min-height: 48px; }
  .play-heading > p, .hub-intro > p { font-size: 1.25rem; }
  .teacher-columns { grid-template-columns: 1fr; }
  .mission-entry { grid-template-columns: 88px minmax(0, 1fr); gap: .75rem; }
  .mission-copy h2 { font-size: 1.3rem; }
  .mission-copy > p { font-size: 1.05rem; }
  .mission-copy .notion { font-size: 1rem; }
  .teacher-section { margin-top: 2rem; }
  .chapter-line { display: block; }
  .chapter-line p { margin: 0 0 1rem; }
  .adventure-scene { height: 190px; }
  .cargo-zone { padding: .65rem; }
  .cargo-grid { gap: .35rem; }
  .cargo-unit { height: 48px; }
  .package-stock { gap: .75rem; }
  .package { min-width: 86px; min-height: 86px; }
  .package-value { font-size: 1.8rem; }
  .game-controls > button { flex: 1 1 160px; }
  .action-row > button { flex: 1 1 150px; }
  .number-route { margin-left: .5rem; margin-right: .5rem; }
  .route-tick:nth-child(even):not(.route-tick--ten) span { display: none; }
  .route-handle { width: 50px; height: 50px; min-height: 50px; }
  .split-controls { gap: 1.2rem 2rem; }
  .board-equation { font-size: 1.65rem; }
  .route-description { gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
