:root {
  --sky: #bfdde1;
  --paper: #f5eedc;
  --ink: #173b3f;
  --coral: #e75b45;
  --mustard: #e5b94f;
  --sea: #5fa7ae;
  --cycle: 2.4s;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--sky);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
}
button, body { letter-spacing: 0; }

.scene-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 24px 0 20px;
}

.masthead, .controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  font: 700 11px/1.2 "Cascadia Code", Consolas, monospace;
}

h1 {
  margin: 0;
  font: 700 clamp(38px, 6vw, 70px)/.92 Georgia, "Times New Roman", serif;
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  font: 700 13px/1 "Cascadia Code", Consolas, monospace;
  text-transform: uppercase;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
  border: 2px solid var(--ink);
  animation: pulse var(--cycle) ease-in-out infinite;
}

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--sky);
}

.artwork {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 430px;
  max-height: 70vh;
}

.controls p {
  margin: 0;
  font: italic 700 17px/1.2 Georgia, "Times New Roman", serif;
}

button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--coral);
  color: var(--paper);
  font: 750 14px/1 "Segoe UI", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
button:hover { background: #cc4937; transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button:focus-visible { outline: 4px solid var(--paper); outline-offset: 3px; }
.button-icon { font-size: 22px; line-height: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.wheel { transform-box: fill-box; transform-origin: center; animation: spin var(--cycle) linear infinite; }
.crank { transform-box: fill-box; transform-origin: 0 50%; animation: spin var(--cycle) linear infinite; }
.body-bob { animation: bob calc(var(--cycle) / 2) ease-in-out infinite; transform-origin: 590px 440px; }
.wing { animation: wing calc(var(--cycle) / 2) ease-in-out infinite; transform-origin: 500px 370px; }
.arm { animation: steer calc(var(--cycle) / 2) ease-in-out infinite; transform-origin: 625px 350px; }
.leg-back { animation: pedal-back var(--cycle) linear infinite; transform-origin: 620px 570px; }
.leg-front { animation: pedal-front var(--cycle) linear infinite; transform-origin: 620px 570px; }
.road-lines { animation: road calc(var(--cycle) * .6) linear infinite; }
.wave-a { animation: wave calc(var(--cycle) * 2) ease-in-out infinite alternate; }
.wave-b { animation: wave calc(var(--cycle) * 2.4) ease-in-out infinite alternate-reverse; }
.cloud-a { animation: drift calc(var(--cycle) * 8) linear infinite; }
.cloud-b { animation: drift calc(var(--cycle) * 10) linear infinite reverse; }
.foreground-grass { animation: grass calc(var(--cycle) / 2) ease-in-out infinite alternate; transform-origin: 50% 100%; }

body[data-speed="slow"] { --cycle: 4s; }
body[data-speed="cruise"] { --cycle: 2.4s; }
body[data-speed="sprint"] { --cycle: 1.25s; }
body[data-speed="sprint"] .body-bob { animation-timing-function: linear; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes wing { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-7deg); } }
@keyframes steer { 0%,100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }
@keyframes pedal-back { 0% { transform: rotate(0deg); } 50% { transform: rotate(10deg); } 100% { transform: rotate(0deg); } }
@keyframes pedal-front { 0% { transform: rotate(8deg); } 50% { transform: rotate(-8deg); } 100% { transform: rotate(8deg); } }
@keyframes road { to { transform: translateX(-180px); } }
@keyframes wave { to { transform: translateX(55px); } }
@keyframes drift { from { transform: translateX(-110px); } to { transform: translateX(1250px); } }
@keyframes grass { to { transform: skewX(-5deg); } }
@keyframes pulse { 50% { transform: scale(.72); } }

@media (max-width: 640px) {
  .scene-shell { width: min(100% - 20px, 1180px); padding: 16px 0; gap: 10px; }
  .masthead { align-items: flex-end; }
  h1 { font-size: clamp(36px, 12vw, 50px); }
  .eyebrow { max-width: 210px; }
  .status { font-size: 11px; padding-bottom: 3px; }
  .stage { aspect-ratio: 3 / 4; }
  .artwork { width: 100%; height: 100%; min-height: 0; max-height: none; }
  .controls p { font-size: 15px; }
  button { padding: 0 15px; }
}

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