:root {
  --ink: #171713;
  --paper: #fffdf7;
  --cream: #f4efe1;
  --red: #e8432f;
  --blue: #1596c8;
  --green: #5ca83b;
  --yellow: #f4bd27;
  --muted: #6a6961;
  --line: #d8d3c5;
  --shadow: 0 6px 0 var(--ink);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-rounded, "Avenir Next", Arial, sans-serif;
}

button, a { font: inherit; }
button { color: inherit; }

button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 4px solid #0b71d9;
  outline-offset: 3px;
}

[hidden] { display: none !important; }

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

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  min-height: 64px;
  padding: 8px 18px;
  color: white;
  background: var(--ink);
  border-bottom: 3px solid var(--ink);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover { transform: translateY(-1px); }

.brand {
  justify-self: start;
  margin-left: 12px;
  color: white;
  text-decoration: none;
  font-family: "Arial Black", Inter, sans-serif;
  font-size: 25px;
  letter-spacing: 0;
}

.brand b { display: inline-block; font-weight: 900; }
.brand b:nth-of-type(1) { color: var(--red); }
.brand b:nth-of-type(2) { color: var(--yellow); }
.brand b:nth-of-type(3) { color: var(--green); }
.brand b:nth-of-type(4) { color: var(--blue); }
.brand b:nth-of-type(5) { color: white; }

.top-actions { display: flex; align-items: center; gap: 18px; }
.progress { display: flex; align-items: center; gap: 7px; }
.progress i {
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
  background: transparent;
}
.progress i.done { background: var(--green); border-color: var(--green); }
.progress i.current { width: 14px; height: 14px; background: var(--yellow); border-color: var(--yellow); }

.lesson-shell { min-height: 100vh; }

.mission-brief {
  display: grid;
  grid-template-columns: 72px minmax(240px, 1fr) minmax(230px, 310px) auto;
  align-items: center;
  gap: 18px;
  min-height: 118px;
  padding: 20px clamp(20px, 4vw, 64px);
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
}

.brief-actions { display: grid; justify-items: center; gap: 12px; }
.brief-actions .icon-button { color: var(--ink); }
.brief-actions .progress i { border-color: var(--ink); }

.mission-number {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-family: "Arial Black", sans-serif;
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #916215;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.mission-copy h1 {
  margin: 0;
  font-family: "Arial Black", Inter, sans-serif;
  font-size: clamp(24px, 2.2vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

.mission-copy > p:last-child { margin: 7px 0 0; color: #4f4e48; font-size: 16px; }

.rocky-coach {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.rocky-coach p {
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: white;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.rocky-coach strong, .rocky-coach span { display: block; }
.rocky-coach strong { margin-bottom: 2px; font-size: 11px; text-transform: uppercase; }

.rocky {
  position: relative;
  width: 68px;
  height: 60px;
  border: 3px solid var(--ink);
  border-radius: 42% 52% 38% 44%;
  background: #8c8d86;
  box-shadow: inset -9px -7px 0 #70716b;
}

.rocky-eye { position: absolute; top: 20px; width: 7px; height: 9px; border-radius: 50%; background: var(--ink); }
.rocky-eye.left { left: 20px; }
.rocky-eye.right { right: 20px; }
.rocky-mouth { position: absolute; left: 27px; top: 34px; width: 14px; height: 7px; border-bottom: 3px solid var(--ink); border-radius: 50%; }
.rocky-arm { position: absolute; right: -13px; top: 12px; width: 17px; height: 6px; border: 3px solid var(--ink); border-left: 0; border-radius: 0 8px 8px 0; transform: rotate(-35deg); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(390px, 42fr);
  min-height: calc(100vh - 118px);
}

.dance-stage {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) 50px;
  min-width: 0;
  color: white;
  background: var(--ink);
  border-right: 3px solid var(--ink);
}

.target-bar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px 22px;
  color: var(--ink);
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.target-bar > span { font-family: "Arial Black", sans-serif; font-size: 17px; white-space: nowrap; }

.target-steps {
  --target-count: 3;
  display: grid;
  grid-template-columns: repeat(var(--target-count), minmax(18px, 38px));
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.target-steps li,
.compare-grid li {
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: white;
  font-family: "Arial Black", sans-serif;
  font-size: 19px;
}

.target-steps li.clap, .compare-grid li.clap { color: #b5271a; background: #ffd9d2; }
.target-steps li.step, .compare-grid li.step { color: #075f84; background: #cbedfa; }
.target-steps li.turn, .compare-grid li.turn { color: #276b16; background: #d9f1cf; }
.target-steps li.current { outline: 4px solid var(--yellow); outline-offset: 2px; transform: translateY(-2px); }
.target-steps li.done { opacity: .48; }

.theater {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: #282824;
}

.backdrop-lines {
  position: absolute;
  inset: 10% 8% 22%;
  opacity: .13;
  border: 2px solid white;
  box-shadow: inset 0 0 0 18px #282824, inset 0 0 0 20px white;
}

.spotlight {
  position: absolute;
  top: -60px;
  width: 44%;
  height: 95%;
  opacity: .18;
  background: var(--yellow);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}
.spotlight.left { left: -4%; transform: rotate(8deg); }
.spotlight.right { right: -4%; transform: rotate(-8deg); }

.stage-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: 28%;
  border-top: 3px solid var(--ink);
  background: var(--blue);
  transform: perspective(250px) rotateX(24deg);
  transform-origin: bottom;
}

.stage-floor i { flex: 1; border-right: 2px solid rgba(23, 23, 19, .45); }
.stage-floor i:nth-child(odd) { background: #34acd5; }

.robot-dancer {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 48%;
  width: 142px;
  height: 232px;
  transform: translate(-50%, -50%);
  transform-origin: 50% 76%;
  animation: robot-idle 2.2s ease-in-out infinite;
}

.robot-dancer .head {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 21px;
  width: 100px;
  height: 76px;
  border: 6px solid white;
  border-radius: 24px;
  background: #10110f;
  box-shadow: 0 5px 0 #080806;
}

.robot-dancer .antenna { position: absolute; z-index: 4; top: 0; left: 67px; width: 8px; height: 27px; border: 3px solid var(--ink); background: var(--yellow); }
.robot-dancer .antenna::before { content: ""; position: absolute; left: -7px; top: -10px; width: 16px; height: 16px; border: 3px solid var(--ink); border-radius: 50%; background: var(--red); }
.robot-dancer .eye { position: absolute; top: 24px; width: 12px; height: 15px; border-radius: 50%; background: #8eed70; }
.robot-dancer .eye.left { left: 24px; }
.robot-dancer .eye.right { right: 24px; }
.robot-dancer .smile { position: absolute; left: 35px; bottom: 13px; width: 23px; height: 11px; border-bottom: 4px solid #8eed70; border-radius: 50%; }
.robot-dancer .ear { position: absolute; z-index: 4; top: 43px; width: 20px; height: 32px; border: 4px solid var(--ink); background: var(--red); }
.robot-dancer .ear.left { left: 6px; border-radius: 12px 3px 3px 12px; }
.robot-dancer .ear.right { right: 6px; border-radius: 3px 12px 12px 3px; }
.robot-dancer .body { position: absolute; z-index: 3; left: 34px; top: 98px; width: 74px; height: 73px; border: 5px solid var(--ink); border-radius: 8px; background: var(--yellow); box-shadow: inset -8px -6px 0 #dfa61c; }
.robot-dancer .star { position: absolute; left: 25px; top: 12px; font-family: "Arial Black", sans-serif; color: var(--red); font-size: 30px; font-style: normal; }
.robot-dancer .body b { position: absolute; bottom: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.robot-dancer .body b:first-of-type { left: 19px; }
.robot-dancer .body b:last-of-type { right: 19px; }
.robot-dancer .arm { position: absolute; z-index: 2; top: 108px; width: 53px; height: 16px; border: 4px solid var(--ink); border-radius: 10px; background: #9c9d98; transform-origin: center; }
.robot-dancer .arm.left { left: 0; transform: rotate(-28deg); }
.robot-dancer .arm.right { right: 0; transform: rotate(28deg); }
.robot-dancer .arm b { position: absolute; top: -9px; width: 22px; height: 27px; border: 4px solid var(--ink); border-radius: 50%; background: var(--blue); }
.robot-dancer .arm.left b { left: -13px; }
.robot-dancer .arm.right b { right: -13px; background: var(--red); }
.robot-dancer .leg { position: absolute; z-index: 2; top: 164px; width: 18px; height: 48px; border: 4px solid var(--ink); border-radius: 8px; background: #9c9d98; transform-origin: top; }
.robot-dancer .leg.left { left: 43px; transform: rotate(7deg); }
.robot-dancer .leg.right { right: 43px; transform: rotate(-7deg); }
.robot-dancer .leg b { position: absolute; bottom: -15px; width: 38px; height: 20px; border: 4px solid var(--ink); border-radius: 8px; background: var(--red); }
.robot-dancer .leg.left b { right: -4px; }
.robot-dancer .leg.right b { left: -4px; background: var(--blue); }

.robot-dancer.move-clap { animation: robot-clap .48s ease-out both; }
.robot-dancer.move-step { animation: robot-step .48s ease-out both; }
.robot-dancer.move-turn { animation: robot-turn .48s ease-out both; }
.robot-dancer.success { animation: robot-success .7s ease-out infinite alternate; }

.execution-strip {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0 20px;
  color: var(--ink);
  background: var(--yellow);
  border-top: 3px solid var(--ink);
  font-size: 14px;
}
.execution-strip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-light { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 50%; background: white; }
.status-light.running { background: var(--blue); }
.status-light.error { background: var(--red); }
.status-light.success { background: var(--green); }

.builder {
  min-width: 0;
  padding: clamp(24px, 3vw, 44px);
  background: var(--paper);
}

.stage-heading { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 12px; }
.stage-badge { display: grid; width: 44px; height: 44px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; color: white; background: var(--red); font-family: "Arial Black", sans-serif; font-size: 18px; }
.stage-heading h2 { margin: 0; font-family: "Arial Black", sans-serif; font-size: clamp(24px, 2.3vw, 34px); line-height: 1.05; letter-spacing: 0; }
.action-copy { min-height: 40px; margin: 14px 0 19px; color: var(--muted); font-size: 15px; line-height: 1.45; }

.move-palette { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.move-tile {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 102px;
  padding: 10px 6px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  cursor: grab;
  touch-action: none;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.move-tile.pointer-dragging { opacity: .55; transform: scale(.96); box-shadow: 0 2px 0 var(--ink); cursor: grabbing; }
.move-tile:hover, .move-tile.suggested { transform: translateY(-4px); box-shadow: 0 9px 0 var(--ink); }
.move-tile:active { cursor: grabbing; transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.move-tile span { font-family: "Arial Black", sans-serif; font-size: 34px; line-height: 1; }
.move-tile strong { font-family: "Arial Black", sans-serif; font-size: 14px; letter-spacing: 0; }
.move-tile.clap { background: #ffdad3; }
.move-tile.step { background: #cceefa; }
.move-tile.turn { background: #d8efcf; }

.sequence-block { margin-top: 3px; }
.sequence-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sequence-heading h3 { margin: 0 0 10px; font-family: "Arial Black", sans-serif; font-size: 18px; }
.sequence-heading span { color: var(--muted); font-size: 12px; font-weight: 800; }
.sequence-list {
  display: flex;
  align-items: stretch;
  gap: 9px;
  min-height: 108px;
  padding: 12px;
  margin: 0;
  overflow-x: auto;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  list-style: none;
  scrollbar-width: thin;
}
.sequence-list.empty::after {
  content: "DROP FIRST MOVE HERE";
  display: grid;
  width: 100%;
  min-height: 76px;
  place-items: center;
  border: 2px dashed #99978e;
  border-radius: 6px;
  color: #737168;
  font-family: "Arial Black", sans-serif;
  font-size: 12px;
}
.sequence-list.drag-over { background: #fff4bf; }
.sequence-hint { margin: 8px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.program-node { position: relative; flex: 0 0 auto; min-width: 68px; }
.move-node {
  display: grid;
  width: 68px;
  min-height: 76px;
  padding: 7px 4px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: white;
  cursor: grab;
}
.move-node.clap { background: #ffdad3; }
.move-node.step { background: #cceefa; }
.move-node.turn { background: #d8efcf; }
.move-node b { font-family: "Arial Black", sans-serif; font-size: 24px; }
.move-node small { font-size: 10px; font-weight: 900; }
.move-node.selected { outline: 4px solid var(--yellow); outline-offset: 2px; }
.move-node.active { transform: translateY(-4px); box-shadow: 0 5px 0 var(--yellow); }
.move-node.error { outline: 4px solid var(--red); outline-offset: 2px; }

.loop-node {
  min-width: max-content;
  padding: 7px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
}
.loop-node > button {
  width: 100%;
  padding: 2px 5px 7px;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.loop-node > button.selected { text-decoration: underline 3px; }
.loop-node > button.error { color: #9e1d12; }
.loop-children { display: flex; gap: 6px; padding: 7px; margin: 0; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); list-style: none; }
.loop-children .move-node { width: 55px; min-height: 58px; }
.loop-children .move-node b { font-size: 19px; }
.loop-children .loop-node { padding: 5px; }

.phase-controls { margin-top: 24px; }
.repeat-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.repeat-button {
  min-height: 88px;
  padding: 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: white;
  box-shadow: 0 5px 0 var(--ink);
  font-family: "Arial Black", sans-serif;
  font-size: 27px;
  cursor: pointer;
}
.repeat-button:hover, .repeat-button.suggested { transform: translateY(-4px); background: #fff0a5; box-shadow: 0 9px 0 var(--ink); }
.repeat-button small { display: block; font-family: Inter, sans-serif; font-size: 10px; }

.primary-button {
  width: 100%;
  min-height: 58px;
  padding: 12px 20px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  color: white;
  background: var(--red);
  box-shadow: 0 6px 0 var(--ink);
  font-family: "Arial Black", sans-serif;
  font-size: 17px;
  cursor: pointer;
}
.primary-button:hover { transform: translateY(-3px); box-shadow: 0 9px 0 var(--ink); }
.primary-button:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.run-panel { display: grid; gap: 13px; text-align: center; }
.run-panel .primary-button { min-height: 72px; font-size: 22px; }
.run-note { margin: 0; color: var(--muted); font-size: 12px; }

.prediction-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: #fff7cf;
  box-shadow: 0 5px 0 var(--ink);
}
.prediction-panel > p { margin: 0; font-size: 15px; font-weight: 900; }
.prediction-stepper { display: grid; grid-template-columns: 64px minmax(76px, 1fr) 64px; align-items: center; gap: 12px; }
.prediction-stepper button {
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 9px;
  background: white;
  box-shadow: 0 4px 0 var(--ink);
  font-family: "Arial Black", sans-serif;
  font-size: 34px;
  cursor: pointer;
}
.prediction-stepper button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.prediction-stepper button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.prediction-stepper button:disabled { opacity: .45; cursor: default; transform: none; }
.prediction-stepper strong { font-family: "Arial Black", sans-serif; font-size: 46px; line-height: 1; }
.prediction-feedback { padding: 9px 11px; border-radius: 7px; font-size: 13px !important; line-height: 1.35; }
.prediction-feedback.matches { color: #275f1b; background: #dbf2d2; }
.prediction-feedback.learning { color: #6e5413; background: #fff0a5; }

.coach-highlight { animation: coach-pulse .7s ease-out 2; }

.observe-panel { margin-top: 18px; }
.compare-grid { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 10px; }
.compare-grid p { margin: 0; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.compare-grid ol { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(22px, 1fr); gap: 4px; padding: 0; margin: 0; overflow-x: auto; list-style: none; }
.compare-grid li { min-width: 24px; font-size: 13px; }
.compare-grid li.mismatch { outline: 4px solid var(--red); outline-offset: -3px; }
.compare-grid li.missing { color: #777; background: white; border-style: dashed; }
.inspect-controls { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px; margin: 18px 0; }
.icon-button.compact { width: 44px; height: 44px; color: var(--ink); font-size: 18px; }
.inspect-controls strong { font-size: 13px; line-height: 1.35; text-align: center; }

.result-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(23, 23, 19, .76);
}
.result-sheet { width: min(440px, 100%); padding: 36px; border: 3px solid var(--ink); border-radius: 8px; background: var(--paper); box-shadow: 10px 10px 0 var(--yellow); text-align: center; }
.result-sheet h2 { margin: 8px 0; font-family: "Arial Black", sans-serif; font-size: 34px; letter-spacing: 0; }
.result-sheet > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.success-disc { display: grid; width: 72px; height: 72px; margin: 0 auto 15px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; color: white; background: var(--green); font-size: 38px; font-weight: 900; }

@keyframes robot-idle {
  0%, 100% { transform: translate(-50%, -50%) rotate(-2deg); }
  50% { transform: translate(-50%, calc(-50% - 7px)) rotate(2deg); }
}
@keyframes robot-clap {
  0% { transform: translate(-50%, -50%) scale(1); }
  45% { transform: translate(-50%, -50%) scale(.9) rotate(-5deg); }
  100% { transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes robot-step {
  0% { transform: translate(-50%, -50%); }
  50% { transform: translate(calc(-50% + 28px), calc(-50% - 18px)) rotate(8deg); }
  100% { transform: translate(-50%, -50%); }
}
@keyframes robot-turn {
  0% { transform: translate(-50%, -50%) rotate(0); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes robot-success {
  from { transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  to { transform: translate(-50%, calc(-50% - 18px)) rotate(8deg) scale(1.08); }
}
@keyframes coach-pulse {
  0%, 100% { outline: 4px solid transparent; outline-offset: 2px; }
  50% { outline: 4px solid var(--blue); outline-offset: 4px; transform: translateY(-3px); }
}

@media (max-width: 900px) {
  .mission-brief { grid-template-columns: 56px minmax(0, 1fr); }
  .mission-number { width: 52px; height: 52px; font-size: 13px; }
  .rocky-coach { grid-column: 1 / -1; grid-template-columns: 50px 1fr; }
  .rocky { width: 48px; height: 43px; }
  .rocky-eye { top: 13px; }
  .rocky-eye.left { left: 13px; }
  .rocky-eye.right { right: 13px; }
  .rocky-mouth { left: 18px; top: 25px; width: 11px; }
  .workspace { grid-template-columns: 1fr; }
  .dance-stage { grid-template-rows: auto 340px 48px; border-right: 0; border-bottom: 3px solid var(--ink); }
  .theater { min-height: 340px; }
}

@media (max-width: 560px) {
  .topbar { grid-template-columns: 40px minmax(0, 1fr) auto; min-height: 56px; padding: 6px 10px; }
  .topbar .icon-button { width: 38px; height: 38px; font-size: 20px; }
  .brand { margin-left: 7px; font-size: 18px; }
  .top-actions { gap: 8px; }
  .progress { gap: 4px; }
  .progress i { width: 7px; height: 7px; border-width: 1px; }
  .progress i.current { width: 10px; height: 10px; }
  .lesson-shell { min-height: calc(100vh - 56px); }
  .mission-brief { min-height: 112px; padding: 12px 14px; gap: 9px 12px; }
  .mission-number { width: 46px; height: 46px; font-size: 11px; }
  .mission-copy h1 { font-size: 22px; }
  .mission-copy > p:last-child { margin-top: 4px; font-size: 13px; }
  .rocky-coach { grid-template-columns: 40px 1fr; gap: 8px; }
  .rocky { width: 39px; height: 34px; border-width: 2px; }
  .rocky-eye { top: 10px; width: 5px; height: 7px; }
  .rocky-eye.left { left: 10px; }
  .rocky-eye.right { right: 10px; }
  .rocky-mouth { left: 14px; top: 20px; width: 9px; border-width: 2px; }
  .rocky-arm { display: none; }
  .rocky-coach p { padding: 7px 9px; font-size: 11px; box-shadow: 2px 2px 0 var(--ink); }
  .rocky-coach strong { display: inline; margin-right: 4px; }
  .rocky-coach span { display: inline; }
  .workspace { min-height: 0; }
  .dance-stage { grid-template-rows: auto 208px 42px; }
  .target-bar { min-height: 54px; padding: 8px 10px; gap: 8px; }
  .target-bar > span { font-size: 12px; }
  .target-steps { gap: 3px; grid-template-columns: repeat(var(--target-count), minmax(11px, 28px)); justify-content: end; }
  .target-steps li { border-width: 1px; border-radius: 4px; font-size: clamp(9px, 3.7vw, 15px); }
  .theater { min-height: 208px; }
  .robot-dancer { top: 45%; scale: .72; }
  .execution-strip { min-height: 42px; padding: 0 10px; gap: 7px; font-size: 11px; }
  .execution-strip > span:last-child { font-size: 10px; }
  .builder { padding: 24px 16px 34px; }
  .stage-heading { grid-template-columns: 40px 1fr; gap: 9px; }
  .stage-badge { width: 38px; height: 38px; font-size: 15px; }
  .stage-heading h2 { font-size: 24px; }
  .action-copy { min-height: 0; margin: 10px 0 16px; font-size: 13px; }
  .move-palette { gap: 7px; margin-bottom: 21px; }
  .move-tile { min-height: 84px; padding: 8px 3px; box-shadow: 0 4px 0 var(--ink); }
  .move-tile span { font-size: 27px; }
  .move-tile strong { font-size: 11px; }
  .sequence-list { min-height: 93px; padding: 9px; gap: 7px; }
  .sequence-list.empty::after { min-height: 67px; font-size: 10px; }
  .sequence-hint { font-size: 10px; }
  .move-node { width: 59px; min-height: 65px; }
  .loop-children .move-node { width: 44px; min-height: 52px; }
  .loop-children { gap: 4px; padding: 5px; }
  .loop-node { padding: 5px; }
  .repeat-options { gap: 7px; }
  .repeat-button { min-height: 75px; font-size: 23px; box-shadow: 0 4px 0 var(--ink); }
  .phase-controls { margin-top: 20px; }
  .run-panel .primary-button { min-height: 64px; font-size: 19px; }
  .compare-grid { grid-template-columns: 52px minmax(0, 1fr); gap: 7px; }
  .compare-grid ol { grid-auto-columns: minmax(18px, 1fr); }
  .compare-grid li { min-width: 19px; font-size: 10px; }
  .result-sheet { padding: 28px 22px; }
  .result-sheet h2 { font-size: 29px; }
}

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