:root {
  --forest: #1f3b2d;
  --moss: #4f7d3a;
  --leaf: #7ed957;
  --bark: #6b4a2b;
  --wood: #e8c189;
  --wood-dark: #8a5a2b;
  --grass: #d9a441;
  --sunset: #ff7a1a;
  --sunset-deep: #d95a00;
  --sky: #7cc6e8;
  --blueprint: #1f5aa6;
  --paper: #fff6e3;
  --paper-2: #fdecc8;
  --card: #ffffff;
  --ink: #1d2b1f;
  --muted: #5b4a3a;
  --good: #2f8f46;
  --radius: 18px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(circle at 1px 1px, #e9d7b0 1px, transparent 0);
  background-size: 22px 22px;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--sunset-deep); font-weight: 800; }
h1, h2, h3 { line-height: 1.1; margin: 0 0 0.4em; }
h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sunset); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  padding: 0.5em 1em; min-height: 44px;
  background: var(--card); border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: var(--shadow-sm); font-weight: 900; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform 0.08s, box-shadow 0.08s; white-space: nowrap;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--sunset); color: #fff; text-shadow: 0 1px 0 #0004; }
.btn-quiet { background: transparent; box-shadow: none; border-style: dashed; }
.btn-small { min-height: 38px; padding: 0.3em 0.8em; font-size: 0.92em; }
.btn-big { min-height: 52px; font-size: 1.1em; padding: 0.5em 1.4em; }
.btn-ico { display: inline-flex; width: 1.6em; height: 1.6em; margin: -0.2em 0; }
.btn-ico svg { width: 100%; height: 100%; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: var(--shadow-sm), 0 0 0 0 #ff7a1a88; } 50% { box-shadow: var(--shadow-sm), 0 0 0 8px #ff7a1a00; } }

/* ---------- Hero ---------- */
.hero { position: relative; background: linear-gradient(#ffb36b, #ffd9a0 38%, #cdeefa 78%); overflow: hidden; border-bottom: 3px solid var(--ink); }
.hero-inner { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; padding: 36px var(--gutter) 0; }
.kicker { margin: 0 0 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.14em; font-size: 14px; text-shadow: 0 1px 0 #fff9; }
.hero h1 {
  font-family: var(--display); font-weight: 400; font-size: clamp(48px, 10vw, 112px); line-height: 0.95;
  color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 5px 5px 0 var(--ink); margin: 0 0 14px; letter-spacing: 0.02em;
}
.hero h1 .sub { display: block; font-size: 0.42em; color: var(--sunset); -webkit-text-stroke: 2px var(--ink); text-shadow: 3px 3px 0 var(--ink); margin-top: 10px; }
.trip-facts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.trip-facts li { display: flex; align-items: center; gap: 10px; font-size: clamp(20px, 3vw, 28px); font-weight: 900; text-shadow: 0 1px 0 #fff9; }
.trip-facts .fi { font-size: 1.05em; line-height: 1; }
.trip-facts .tbd { color: var(--muted); font-style: italic; font-weight: 700; }
.hero-cta { margin: 0 0 6px; }
.hero-scene { position: relative; height: clamp(210px, 30vw, 380px); margin-top: -10px; }
.hero-art { display: block; width: 100%; height: 100%; }
.hero-pause {
  position: absolute; right: 12px; top: 18px; width: 40px; height: 40px; border-radius: 999px;
  background: #fff8; border: 2px solid var(--ink); cursor: pointer; font-size: 16px; z-index: 2;
}

/* Hero animation. Each moving group sits at a good spot without its animation (the frozen flyer). */
.hero .spin, .hero .spin-fast { transform-box: fill-box; transform-origin: center; }
.hero .spin { animation: spin 0.9s linear infinite; }
.hero .spin-fast { animation: spin 0.18s linear infinite; }
.hero .drive { animation: drive 20s linear infinite; animation-delay: -4s; }
.hero .fly { animation: fly 26s linear infinite; animation-delay: -9s; }
.hero .bob { animation: bob 3.2s ease-in-out infinite; }
.hero .bob-slow { animation: bob 4.4s ease-in-out infinite; }
.hero .leaf { animation: fall 11s linear infinite; }
.hero .l2 { animation-duration: 13s; animation-delay: -4s; }
.hero .l3 { animation-duration: 12s; animation-delay: -8s; }
.hero .l4 { animation-duration: 14s; animation-delay: -2s; }
.hero .l5 { animation-duration: 10s; animation-delay: -6s; }
.hero.paused * { animation-play-state: paused !important; }
.hero.still * { animation: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
/* The car is drawn 14x and the plane 11x, so these distances are in their own units. */
@keyframes drive { from { transform: translateX(-36px); } to { transform: translateX(86px); } }
@keyframes fly { from { transform: translateX(-112px); } to { transform: translateX(52px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.9px); } }
@keyframes fall {
  0% { transform: translate(0, -80px) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  50% { transform: translate(40px, 140px) rotate(200deg); }
  90% { opacity: 1; }
  100% { transform: translate(-10px, 360px) rotate(400deg); opacity: 0; }
}

/* ---------- Sections ---------- */
.section { padding: 48px var(--gutter) 8px; }
.section-head { margin-bottom: 18px; }
.section-head h2 { font-size: clamp(34px, 6vw, 56px); margin: 0; color: var(--forest); text-shadow: 3px 3px 0 #fff, 5px 5px 0 var(--grass); }
.section-head .eyebrow { font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; font-size: 13px; color: var(--sunset-deep); margin: 0 0 4px; }
.section-head p { margin: 6px 0 0; max-width: 640px; font-weight: 600; color: var(--muted); }

.tool-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool-card { position: relative; background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px 16px; }
.tool-card h3 { font-size: 24px; margin: 6px 0 2px; color: var(--forest); }
.tool-card p { margin: 0; font-weight: 600; color: var(--muted); font-size: 15px; line-height: 1.4; }
.tc-ico { display: block; width: 56px; height: 56px; }
.tc-ico svg { width: 100%; height: 100%; }
.tc-num { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border-radius: 50%; background: var(--wood); border: 2px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-size: 16px; }
@media (max-width: 860px) { .tool-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) {
  .tool-cards { gap: 10px; }
  .tool-card { padding: 10px 12px 12px; }
  .tool-card h3 { font-size: 20px; }
  .tool-card p { font-size: 14px; }
  .tc-ico { width: 44px; height: 44px; }
}

footer { margin-top: 56px; background: var(--forest); color: #e8efe2; border-top: 3px solid var(--ink); padding: 26px 0 40px; font-size: 14px; }
footer .wrap { display: grid; gap: 6px; }
footer .big { font-family: var(--display); font-size: 22px; color: #fff; letter-spacing: 0.03em; }

/* ---------- The build game window ---------- */
.bw {
  position: relative; display: flex; flex-direction: column;
  background: #f4e2c0; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.bw-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--forest); border-bottom: 3px solid var(--ink); }
.bw-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: 1; min-width: 0; }
.bw-steps li { flex: 1 1 0; min-width: 0; }
.step-chip {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 4px 6px;
  border: 2px solid var(--ink); border-radius: 12px; background: #2c5240; color: #d6e6cf; cursor: pointer; font-weight: 900; font-size: 14px;
}
.step-chip .sc-ico { width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.step-chip .sc-ico svg { width: 100%; height: 100%; }
.step-chip .emo { font-size: 18px; line-height: 1; }
.step-chip.done { background: #376a52; color: #fff; }
.step-chip.done .sc-label::after { content: ' ✓'; color: var(--leaf); }
.step-chip.current { background: var(--paper); color: var(--forest); box-shadow: inset 0 -3px 0 var(--sunset); }
.step-chip.locked { opacity: 0.5; cursor: not-allowed; }
.step-chip.locked .sc-ico { filter: grayscale(1); }
.bw-actions { display: flex; gap: 6px; flex: none; }
.bw-icon {
  position: relative; width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper);
  cursor: pointer; font-size: 18px; display: grid; place-items: center; padding: 0;
}
.bw-count { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--sunset); color: #fff; border: 2px solid var(--ink); font-size: 11px; font-weight: 900; line-height: 16px; }
.bw-count:empty { display: none; }
.bw.viewing .bw-steps { opacity: 0.6; }

.bw-stage { position: relative; aspect-ratio: 16 / 8.2; max-height: 62vh; min-height: 230px; background: #c29467; overflow: hidden; }
.bw-svg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.bw-svg:focus-visible { outline: 3px solid var(--sunset); outline-offset: -3px; }
.bw[data-step='saw'] .bw-svg, .bw[data-step='sand'] .bw-svg, .bw[data-step='paint'] .bw-svg { touch-action: none; cursor: none; }
.bw[data-step='hammer'] .bw-svg { touch-action: manipulation; cursor: pointer; }
@media (hover: none) { .bw .bw-svg { cursor: auto !important; } }
.bw-instr {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); margin: 0; max-width: calc(100% - 20px); width: max-content;
  padding: 5px 14px; background: #fffdf6ee; border: 2px solid var(--ink); border-radius: 999px; font-weight: 900; font-size: 15px;
  text-align: center; pointer-events: none; line-height: 1.3;
}
.bw[data-step='plan'] .bw-instr { background: #ffffffe8; }
.bw-toast {
  position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 16px); max-width: calc(100% - 24px); width: max-content;
  padding: 8px 16px; background: var(--ink); color: #fff; border-radius: 14px; font-weight: 800; font-size: 15px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; line-height: 1.3;
}
.bw-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* SVG bits */
.bw-svg .sprite { filter: drop-shadow(0.06px 0.12px 0.06px #0006); }
.cut-active { animation: march 0.7s linear infinite; }
@keyframes march { to { stroke-dashoffset: -0.36px; } }
.cut-start { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.fuzz { transition: opacity 0.25s; }
.fuzz.gone { opacity: 0; }
.wobble { transform-box: fill-box; transform-origin: center; animation: wobble 1.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@media (prefers-reduced-motion: reduce) { .wobble, .cut-active, .cut-start, .pulse { animation: none; } }
/* The blueprint: everything as white lines. */
.bp * { fill: #ffffff12; stroke: #fff; stroke-width: 0.045px; }
.bp [vector-effect='non-scaling-stroke'] { stroke-width: 1.3px; }
.bp .bp-block { fill: none; stroke-opacity: 0.55; stroke-dasharray: 0.22px 0.16px; }
.bp .marks * { fill: none; stroke-opacity: 0.6; }
.bp text { fill: #fff; stroke: none; font-family: var(--display); letter-spacing: 0.06em; }

/* The tray under the stage */
.bw-tray { display: grid; gap: 10px; padding: 12px; border-top: 3px solid var(--ink); background: var(--paper); }
.bw-panel:empty { display: none; }
.bw[data-step='plan'] .bw-tools, .bw[data-step='go'] .bw-tools, .bw.viewing .bw-tools { display: none; }

.opt-row { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 10px; margin-bottom: 8px; }
.opt-label { font-family: var(--display); font-size: 17px; letter-spacing: 0.03em; color: var(--forest); line-height: 1.1; }
.opt-grid { display: grid; gap: 8px; }
.opt-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opt-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px 4px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 12px; cursor: pointer; font-weight: 900; font-size: 14px; line-height: 1.1; text-align: center;
  transition: transform 0.08s;
}
.opt:hover:not(:disabled) { transform: translateY(-1px); }
.opt.sel { background: #ffe3c4; box-shadow: inset 0 0 0 2px var(--sunset), 2px 2px 0 var(--ink); }
.opt:disabled { cursor: default; opacity: 0.55; }
.opt.sel:disabled { opacity: 1; }
.opt svg { width: 100%; max-width: 64px; height: 26px; }
.opt-emoji { font-size: 24px; line-height: 1; }
.opt small { font-weight: 700; color: var(--muted); font-size: 11px; }
.opt-name { overflow-wrap: anywhere; }
.panel-cta { display: flex; justify-content: center; padding-top: 4px; }

.meter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meter { flex: 1 1 200px; min-width: 0; }
.meter-top { display: flex; justify-content: space-between; font-weight: 900; font-size: 15px; margin-bottom: 4px; }
.bar { height: 16px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.bar i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--leaf), var(--leaf) 8px, #6cc94a 8px, #6cc94a 16px); transition: width 0.15s; }

.bw-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px 7px;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px; cursor: pointer; font-weight: 900; font-size: 13px; line-height: 1.1;
  box-shadow: 2px 2px 0 var(--ink); transition: transform 0.08s;
}
.tool-ico { width: 38px; height: 38px; }
.tool-ico svg { width: 100%; height: 100%; }
.tool.on { background: #ffe3c4; box-shadow: inset 0 0 0 2px var(--sunset), 2px 2px 0 var(--ink); transform: translateY(-2px); }
.tool.locked { background: #eee6d6; cursor: not-allowed; }
.tool.locked .tool-ico { opacity: 0.45; filter: grayscale(0.6); }
.tool-badge { position: absolute; top: -8px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 12px; }
.tool-badge.ok { background: var(--good); color: #fff; font-weight: 900; }
.nope { animation: nope 0.4s; }
@keyframes nope { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.swatches { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.swatch { aspect-ratio: 1; max-height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: var(--c); cursor: pointer; padding: 0; }
.swatch.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); transform: scale(0.9); }
.paint-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-weight: 900; cursor: pointer; min-height: 34px; }
.seg button.sel { background: var(--ink); color: #fff; }

.go-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.go-form label { display: grid; gap: 2px; font-weight: 900; font-size: 14px; }
.go-form input { min-height: 44px; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; min-width: 0; }
.go-done { display: grid; gap: 8px; justify-items: center; text-align: center; }
.go-title { margin: 0; font-size: 18px; font-weight: 700; }
.go-title b { font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: 0.03em; color: var(--forest); }
.go-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Garage */
.bw-garage { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 14px; background: #1d2b1f99; }
.garage-card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 14px; }
.garage-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.garage-head h3 { margin: 0; font-size: 26px; color: var(--forest); }
.garage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.g-item { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 6px 8px; }
.g-thumb { width: 96px; height: 56px; background: #c2e6f7; border-radius: 8px; }
.g-info { display: grid; min-width: 0; line-height: 1.2; }
.g-info b { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.g-info span { font-size: 13px; font-weight: 700; color: var(--muted); }
.g-btns { display: flex; gap: 6px; }
.garage-empty, .garage-note { margin: 4px 0 0; font-weight: 700; color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  .section { padding-top: 36px; }
  .bw { border-radius: 14px; margin: 0 -6px; }
  .bw-head { padding: 6px; gap: 5px; }
  .bw-steps { gap: 4px; }
  .step-chip { padding: 3px; min-height: 38px; border-radius: 10px; }
  .step-chip .sc-label { display: none; }
  .step-chip.done::after { content: ''; }
  .step-chip.done { box-shadow: inset 0 -3px 0 var(--leaf); }
  .bw-icon { width: 36px; height: 36px; font-size: 16px; }
  .bw-stage { aspect-ratio: 4 / 3; max-height: 56vh; min-height: 220px; }
  .bw-instr { font-size: 13px; top: 8px; padding: 4px 10px; }
  .bw-toast { font-size: 14px; }
  .bw-tray { padding: 10px 8px; gap: 8px; }
  .opt-row { grid-template-columns: 1fr; gap: 4px; margin-bottom: 6px; }
  .opt-label { font-size: 15px; }
  .opt-grid { gap: 6px; }
  .opt { min-height: 50px; font-size: 12.5px; padding: 5px 2px; }
  .opt svg { height: 22px; }
  .opt-emoji { font-size: 21px; }
  .tool { font-size: 12px; }
  .tool-ico { width: 32px; height: 32px; }
  .swatches { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .swatch { max-height: 40px; justify-self: center; width: 40px; }
  .go-form { grid-template-columns: 1fr 1fr; }
  .go-form .btn { grid-column: 1 / -1; }
  .g-item { grid-template-columns: 72px 1fr; }
  .g-thumb { width: 72px; height: 44px; }
  .g-btns { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 380px) { .bw-actions .bw-icon[aria-label^='Sound'] { display: none; } }
