:root {
  color-scheme: light;
  --ink: #173f3c;
  --ink-soft: #58716d;
  --paper: #fffdf4;
  --cream: #fff5cf;
  --blueprint: #d8f0ea;
  --blueprint-line: rgba(33, 112, 102, .13);
  --teal: #24766d;
  --teal-dark: #16524c;
  --mint: #9dd8c6;
  --yellow: #f6c64e;
  --yellow-dark: #d49525;
  --coral: #ed6a4e;
  --coral-dark: #b94735;
  --sky: #78cddb;
  --steel: #d7e2df;
  --steel-dark: #78928c;
  --line: #bdd3cd;
  --success: #2d8262;
  --danger: #c74c3d;
  --shadow: rgba(23, 63, 60, .17);
  font-family: "Avenir Next Rounded", "Trebuchet MS", "Avenir Next", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 300px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(44px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  color: var(--ink);
  background: var(--blueprint);
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

button,
input { font: inherit; }

button { color: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 5px solid var(--yellow);
  outline-offset: 4px;
}

#challenge-title:focus { outline: none; }

[hidden] { display: none !important; }

.blueprint-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(var(--blueprint-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--blueprint-line) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.35) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255,255,255,.35) 2px, transparent 2px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
}

.blueprint-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 8% 13%, rgba(255,255,255,.7), transparent 24%),
    radial-gradient(circle at 92% 82%, rgba(36,118,109,.13), transparent 31%);
}

.corner-tape {
  position: fixed;
  z-index: -1;
  width: 180px;
  height: 42px;
  background: rgba(246, 198, 78, .5);
  border-block: 1px dashed rgba(23,63,60,.2);
}

.tape-one { left: -48px; top: 70px; transform: rotate(-39deg); }
.tape-two { right: -55px; bottom: 74px; transform: rotate(-43deg); }

.topbar {
  width: min(1380px, 100%);
  min-height: 70px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 22px;
  margin: 0 auto 24px;
}

.back-link,
.round-button {
  min-height: 48px;
  border: 3px solid var(--ink);
  box-shadow: 4px 5px 0 rgba(23,63,60,.16);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.back-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px;
  color: inherit;
  background: var(--paper);
  border-radius: 14px;
  font-weight: 900;
  text-decoration: none;
}

.back-link > span:first-child { font-size: 22px; }

.back-link:hover,
.round-button:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 6px 8px 0 rgba(23,63,60,.14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 17px 17px 12px 18px;
  box-shadow: 4px 5px 0 rgba(23,63,60,.15);
  transform: rotate(-3deg);
}

.brand-mark svg {
  width: 44px;
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}

.brand small,
.brand h1 { display: block; }

.brand small {
  color: var(--coral-dark);
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .16em;
  line-height: 1;
  text-transform: uppercase;
}

.brand h1 {
  margin: 3px 0 0;
  font-family: Copperplate, "Copperplate Gothic Bold", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(20px, 2.2vw, 31px);
  letter-spacing: -.045em;
  line-height: 1;
}

.top-actions {
  justify-self: end;
  display: flex;
  gap: 9px;
}

.round-button {
  min-width: 48px;
  padding: 8px 14px;
  background: var(--paper);
  border-radius: 15px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 1000;
}

.read-button { color: var(--paper); background: var(--teal); }

main {
  width: min(1380px, 100%);
  margin: 0 auto;
}

.mission-strip {
  position: relative;
  min-height: 108px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(16px, 3vw, 34px);
  padding: 18px clamp(18px, 3vw, 34px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px 16px 24px 19px;
  box-shadow: 8px 9px 0 var(--shadow);
}

.mission-strip::before {
  content: "";
  position: absolute;
  right: 24%;
  bottom: -7px;
  width: 104px;
  height: 15px;
  background: rgba(246,198,78,.68);
  transform: rotate(-1deg);
}

.mission-stamp {
  display: grid;
  place-items: center;
  width: 78px;
  height: 68px;
  color: var(--coral-dark);
  border: 4px double var(--coral);
  border-radius: 50%;
  font-family: Copperplate, "Arial Rounded MT Bold", sans-serif;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .08em;
  line-height: 1.2;
  text-align: center;
  transform: rotate(-7deg);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.mission-strip h2,
.panel-head h2,
.challenge-head h2,
.modal-card h2,
.completion-card h2 {
  margin: 0;
  font-family: Copperplate, "Copperplate Gothic Bold", "Arial Rounded MT Bold", sans-serif;
  letter-spacing: -.045em;
}

.mission-strip h2 { font-size: clamp(22px, 3vw, 34px); }

.mission-strip p:last-child {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.bolt-score {
  min-width: 112px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding: 10px 13px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 17px 13px 16px 12px;
  box-shadow: 4px 5px 0 rgba(23,63,60,.12);
  transform: rotate(2deg);
}

.bolt-score > span { margin-right: 8px; color: var(--yellow-dark); font-size: 25px; }
.bolt-score strong { font-size: 31px; line-height: 1; }
.bolt-score small { color: var(--ink-soft); font-weight: 900; }

.repair-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  margin: 24px 4px;
  padding: 0;
  list-style: none;
}

.repair-track li {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.repair-track li::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 20px;
  right: 50%;
  width: 100%;
  height: 5px;
  background: var(--line);
}

.repair-track li:first-child::before { display: none; }

.repair-track li.done::before,
.repair-track li.current::before { background: var(--teal); }

.repair-track li span {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: 50%;
  font-weight: 1000;
  transition: transform 240ms ease, background 240ms ease, border-color 240ms ease;
}

.repair-track li b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repair-track li.current { color: var(--ink); }
.repair-track li.current span {
  color: var(--paper);
  background: var(--coral);
  border-color: var(--ink);
  box-shadow: 3px 4px 0 var(--shadow);
  transform: translateY(-3px) rotate(-4deg);
}

.repair-track li.done { color: var(--teal-dark); }
.repair-track li.done span {
  color: var(--paper);
  background: var(--teal);
  border-color: var(--teal-dark);
}

.repair-track li.done span::after { content: "✓"; }
.repair-track li.done span { font-size: 0; }
.repair-track li.done span::after { font-size: 17px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.13fr) minmax(410px, .87fr);
  gap: clamp(18px, 2.5vw, 34px);
  align-items: stretch;
}

.workspace.mission-complete .robot-card { grid-column: 1 / -1; }
.workspace.mission-complete .robot-stage { min-height: 470px; }

.robot-card,
.challenge-card {
  min-width: 0;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 9px 11px 0 var(--shadow);
}

.robot-card { border-radius: 27px 18px 23px 19px; overflow: hidden; }
.challenge-card {
  align-self: start;
  min-height: 610px;
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 3vw, 34px);
  border-radius: 17px 27px 19px 24px;
}

.panel-head,
.challenge-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-head {
  min-height: 82px;
  justify-content: space-between;
  padding: 16px 22px;
  background:
    linear-gradient(90deg, transparent 0 72%, rgba(23,63,60,.05) 72% 73%, transparent 73%),
    var(--cream);
  border-bottom: 3px solid var(--ink);
}

.panel-head h2 { font-size: 28px; }

.status-lamp {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-lamp i {
  width: 11px;
  height: 11px;
  background: var(--coral);
  border: 2px solid var(--coral-dark);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(237,106,78,.16);
}

.robot-card.complete .status-lamp i {
  background: #54ce8e;
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(84,206,142,.2), 0 0 14px #54ce8e;
}

.robot-stage {
  position: relative;
  min-height: 528px;
  display: grid;
  place-items: center;
  padding: 4px 20px 54px;
  background:
    linear-gradient(90deg, transparent 48%, rgba(23,63,60,.05) 48% 52%, transparent 52%),
    radial-gradient(circle at 50% 45%, #fffef8 0 30%, rgba(255,253,244,.3) 53%, transparent 69%),
    repeating-linear-gradient(0deg, rgba(36,118,109,.04) 0 2px, transparent 2px 12px),
    #eaf4ef;
  overflow: hidden;
}

.robot-stage::before,
.robot-stage::after {
  content: "";
  position: absolute;
  top: 19px;
  width: 82px;
  height: 44px;
  border: 3px solid rgba(23,63,60,.12);
}

.robot-stage::before { left: 20px; border-right: 0; border-bottom: 0; }
.robot-stage::after { right: 20px; border-left: 0; border-bottom: 0; }

.robot-svg {
  position: relative;
  z-index: 2;
  width: min(100%, 570px);
  max-height: 465px;
  overflow: visible;
}

.floor-shadow { fill: rgba(23,63,60,.16); }
.bench-line { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.body { fill: #c8d8d4; stroke: var(--ink); stroke-width: 6; }
.body-highlight { fill: none; stroke: #f7fbf9; stroke-width: 8; stroke-linecap: round; opacity: .75; }
.body-rivet { fill: var(--steel-dark); stroke: var(--ink); stroke-width: 2; }
.limb { fill: none; stroke: var(--steel-dark); stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.joint { fill: var(--yellow); stroke: var(--ink); stroke-width: 5; }
.claw { fill: none; stroke: var(--ink); stroke-width: 9; stroke-linecap: round; }
.wheel circle:first-child { fill: var(--coral); stroke: var(--ink); stroke-width: 6; }
.wheel circle:last-child { fill: var(--yellow); stroke: var(--ink); stroke-width: 4; }
.battery-box { fill: var(--paper); stroke: var(--ink); stroke-width: 5; }
.battery-fill { fill: var(--yellow); stroke: var(--yellow-dark); stroke-width: 3; }
.bolt { fill: var(--coral); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.neck { fill: var(--steel-dark); stroke: var(--ink); stroke-width: 5; }
.head { fill: var(--yellow); stroke: var(--ink); stroke-width: 6; }
.ear { fill: var(--coral); stroke: var(--ink); stroke-width: 6; }
.robot-eyes circle { fill: var(--paper); stroke: var(--ink); stroke-width: 5; }
.robot-eyes .eye-dot { fill: var(--teal); stroke: none; }
.robot-mouth { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.antenna { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }
.antenna-tip { fill: var(--coral); stroke: var(--ink); stroke-width: 5; }
.signal { fill: none; stroke: var(--coral); stroke-width: 5; stroke-linecap: round; opacity: .9; }
.heart-ring { fill: var(--paper); stroke: var(--ink); stroke-width: 5; }
.heart { fill: var(--coral); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }

.robot-part {
  opacity: .16;
  filter: grayscale(1);
  transform: translateY(7px);
  transform-origin: center;
  transition: opacity 450ms ease, filter 450ms ease, transform 450ms cubic-bezier(.2, 1.4, .4, 1);
}

.robot-part.repaired {
  opacity: 1;
  filter: grayscale(0);
  transform: translateY(0);
}

.robot-part.just-repaired { animation: install-part 750ms cubic-bezier(.2, 1.5, .4, 1); }

.repair-sparks {
  fill: none;
  stroke: var(--yellow-dark);
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0;
}

.robot-stage.repairing .repair-sparks { animation: spark-flash 800ms ease; }

.robot-stage.happy .robot-svg { animation: robot-dance 900ms ease-in-out infinite alternate; }
.robot-stage.happy .antenna-tip { animation: beacon 500ms ease-in-out infinite alternate; }
.robot-stage.happy .heart { animation: heartbeat 650ms ease-in-out infinite; transform-origin: 260px 290px; }

.speech-bubble {
  position: absolute;
  z-index: 4;
  top: 36px;
  right: 25px;
  width: min(205px, 38%);
  padding: 12px 14px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px 16px 5px 16px;
  box-shadow: 4px 5px 0 var(--shadow);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  transform: rotate(1deg);
}

.speech-bubble::after {
  content: "";
  position: absolute;
  right: 26px;
  bottom: -11px;
  width: 17px;
  height: 17px;
  background: var(--paper);
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}

.hanging-cable {
  position: absolute;
  z-index: 1;
  top: -7px;
  width: 3px;
  height: 132px;
  background: var(--ink);
}

.hanging-cable::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: -7px;
  width: 15px;
  height: 18px;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 4px;
}

.cable-left { left: 16%; }
.cable-right { right: 10%; height: 88px; }

.work-light {
  position: absolute;
  z-index: 1;
  top: 0;
  width: 90px;
  height: 205px;
  background: linear-gradient(to bottom, rgba(246,198,78,.23), transparent);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
}

.light-left { left: 24%; transform: rotate(6deg); }
.light-right { right: 21%; transform: rotate(-8deg); }

.parts-label {
  position: absolute;
  z-index: 3;
  right: 20px;
  bottom: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font: 900 9px/1 Copperplate, sans-serif;
  letter-spacing: .12em;
}

.parts-label i { width: 8px; height: 8px; background: var(--teal); border-radius: 50%; }
.parts-label i:nth-child(3) { background: var(--yellow); }
.parts-label i:nth-child(4) { background: var(--coral); }

.challenge-head {
  padding-bottom: 19px;
  border-bottom: 3px dashed var(--line);
}

.challenge-head > div:nth-child(2) { min-width: 0; flex: 1; }
.challenge-head h2 { font-size: clamp(20px, 2.4vw, 28px); }

.station-badge {
  flex: 0 0 auto;
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 14px 18px 13px 17px;
  box-shadow: 4px 5px 0 var(--shadow);
  font: 1000 19px/1 Copperplate, sans-serif;
  transform: rotate(-3deg);
}

.mini-progress { display: flex; gap: 6px; }
.mini-progress i {
  width: 12px;
  height: 12px;
  background: var(--line);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.mini-progress i.active { background: var(--yellow); }
.mini-progress i.done { background: var(--teal); }

.problem-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 22px;
}

.problem-copy {
  min-height: 44px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(15px, 1.7vw, 18px);
  font-weight: 800;
  line-height: 1.45;
}

.equation {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 13px 0 18px;
  padding: 11px 17px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(36,118,109,.1) 23px 24px),
    #fbf7e9;
  border: 2px solid var(--line);
  border-radius: 17px;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 1000;
  letter-spacing: .02em;
}

.equation .blank {
  min-width: 62px;
  padding-inline: 7px;
  color: var(--coral-dark);
  border-bottom: 5px solid var(--coral);
  text-align: center;
}

.solver {
  min-height: 175px;
  display: grid;
  place-items: center;
}

.counter-solver { width: 100%; }

.counter-tray {
  min-height: 104px;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  background: #edf5f1;
  border: 3px solid var(--ink);
  border-radius: 20px 16px 20px 13px;
  box-shadow: inset 0 -7px 0 rgba(23,63,60,.08);
}

.counter-cell {
  position: relative;
  width: 34px;
  height: 45px;
  background: var(--yellow);
  border: 3px solid var(--ink);
  border-radius: 8px 8px 11px 11px;
  box-shadow: 2px 3px 0 rgba(23,63,60,.15);
  animation: pop-in 240ms cubic-bezier(.2,1.5,.4,1);
}

.counter-cell::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 9px;
  width: 10px;
  height: 5px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
}

.counter-cell::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--coral-dark);
  font-size: 21px;
  font-weight: 1000;
}

.tray-empty {
  align-self: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.counter-controls {
  display: grid;
  grid-template-columns: 54px minmax(74px, 1fr) 54px;
  align-items: center;
  gap: 9px;
  width: min(260px, 100%);
  margin: 13px auto 0;
}

.counter-controls button,
.answer-choice,
.number-point {
  border: 3px solid var(--ink);
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.counter-controls button {
  height: 49px;
  background: var(--paper);
  border-radius: 14px;
  font-size: 28px;
  font-weight: 1000;
}

.counter-controls button:not(:disabled):hover,
.answer-choice:hover,
.number-point:hover { transform: translateY(-3px); box-shadow: 3px 5px 0 var(--shadow); }
.counter-controls button:disabled { opacity: .35; cursor: not-allowed; }

.counter-value {
  height: 49px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--teal);
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-size: 27px;
  font-weight: 1000;
}

.choice-solver {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.answer-choice {
  min-height: 70px;
  display: grid;
  place-items: center;
  padding: 10px;
  background: var(--cream);
  border-radius: 16px 12px 18px 14px;
  box-shadow: 3px 4px 0 rgba(23,63,60,.13);
  font-size: 28px;
  font-weight: 1000;
}

.answer-choice:nth-child(2) { transform: rotate(1deg); }
.answer-choice:nth-child(3) { transform: rotate(-1deg); }
.answer-choice.selected {
  color: var(--paper);
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(36,118,109,.2), 3px 4px 0 rgba(23,63,60,.16);
}

.answer-choice:disabled,
.number-point:disabled { cursor: default; }
.answer-choice.correct { color: var(--paper); background: var(--success); }

.numberline-solver { width: 100%; padding: 20px 2px 4px; }

.numberline-scroll {
  overflow-x: auto;
  padding: 13px 7px 20px;
  scrollbar-color: var(--teal) transparent;
}

.numberline {
  position: relative;
  min-width: 945px;
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  align-items: start;
}

.numberline::before {
  content: "";
  position: absolute;
  top: 19px;
  left: 18px;
  right: 18px;
  height: 5px;
  background: var(--ink);
  border-radius: 3px;
}

.number-point {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  justify-self: center;
  padding: 0;
  background: var(--paper);
  border-width: 2px;
  border-radius: 50%;
  font-size: 0;
}

.number-point::after {
  content: attr(data-value);
  position: absolute;
  top: 44px;
  font-size: 11px;
  font-weight: 900;
}

.number-point.start { background: var(--yellow); }
.number-point.selected { color: var(--paper); background: var(--teal); transform: translateY(-4px) scale(1.08); }
.number-point.correct { background: var(--success); }

.numberline-instruction {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.feedback,
.model-box {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
}

.feedback {
  background: #fff0d0;
  border: 2px solid var(--yellow-dark);
}

.feedback.correct { color: #164e3a; background: #ddf4e8; border-color: var(--success); }
.feedback.try-again { color: #78372f; background: #ffebe4; border-color: var(--coral); }

.feedback-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--coral);
  border-radius: 50%;
  font-weight: 1000;
}

.feedback.correct .feedback-icon { background: var(--success); }
.feedback strong { font-size: 14px; }
.feedback p,
.model-box p { margin: 2px 0 0; font-size: 12px; font-weight: 700; line-height: 1.4; }

.model-box {
  background: #e7f4ef;
  border: 2px dashed var(--teal);
}

.model-box > span { color: var(--yellow-dark); font-size: 24px; }
.model-box b { color: var(--teal-dark); }

.challenge-actions { margin-top: 17px; }

.primary-button {
  width: 100%;
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 18px;
  color: var(--paper);
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 15px 18px 13px 17px;
  box-shadow: 5px 6px 0 rgba(23,63,60,.2);
  cursor: pointer;
  font-weight: 1000;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.primary-button:not(:disabled):hover { transform: translateY(-3px); box-shadow: 7px 9px 0 rgba(23,63,60,.17); }
.primary-button:active { transform: translateY(2px); box-shadow: 2px 3px 0 rgba(23,63,60,.2); }
.primary-button:disabled { opacity: .38; filter: grayscale(.7); cursor: not-allowed; }
.next-button { background: var(--teal); }

.completion-card {
  position: relative;
  min-height: 210px;
  display: grid;
  grid-template-columns: auto 1fr minmax(190px, 260px);
  align-items: center;
  gap: clamp(20px, 4vw, 50px);
  margin-top: 32px;
  padding: clamp(24px, 4vw, 45px);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 9px 11px 0 var(--shadow);
  overflow: hidden;
}

.completion-card::after {
  content: "";
  position: absolute;
  right: 10%;
  bottom: -50px;
  width: 230px;
  height: 110px;
  background: var(--yellow);
  border-radius: 50%;
  opacity: .15;
}

.completion-stamp {
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  color: var(--coral-dark);
  border: 7px double var(--coral);
  border-radius: 50%;
  font: 1000 17px/1 Copperplate, sans-serif;
  transform: rotate(-9deg);
}

.completion-card h2 { font-size: clamp(28px, 4vw, 48px); }
.completion-copy > p:last-of-type { color: var(--ink-soft); font-weight: 700; }

.completion-stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.completion-stats span {
  padding: 8px 10px;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}
.completion-stats b { color: var(--coral-dark); font-size: 17px; }
.restart-button { position: relative; z-index: 1; background: var(--teal); }

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(14, 48, 45, .72);
  backdrop-filter: blur(7px);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(760px, 92vh);
  max-height: min(760px, 92dvh);
  overflow-y: auto;
  padding: clamp(28px, 5vw, 48px);
  background:
    repeating-linear-gradient(0deg, transparent 0 28px, rgba(36,118,109,.06) 28px 29px),
    var(--paper);
  border: 4px solid var(--ink);
  border-radius: 24px 17px 27px 19px;
  box-shadow: 13px 15px 0 rgba(7,35,32,.28);
}

.modal-card h2 { font-size: clamp(28px, 6vw, 44px); line-height: 1.02; }
.modal-card > p:not(.eyebrow):not(.privacy-note) { color: var(--ink-soft); font-weight: 700; line-height: 1.5; }

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  font-size: 27px;
  font-weight: 900;
}

.intro-card { text-align: center; }

.intro-robot {
  position: relative;
  width: 120px;
  height: 94px;
  margin: 4px auto 22px;
}

.intro-robot > span {
  position: absolute;
  inset: 18px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--yellow);
  border: 4px solid var(--ink);
  border-radius: 28px 28px 23px 23px;
  box-shadow: 5px 6px 0 var(--shadow);
}

.intro-robot > span i {
  width: 17px;
  height: 17px;
  background: var(--teal);
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.intro-robot > span b {
  position: absolute;
  bottom: 15px;
  width: 34px;
  height: 9px;
  border-bottom: 4px solid var(--ink);
  border-radius: 50%;
}

.intro-antenna {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 58px;
  width: 4px;
  height: 22px;
  background: var(--ink);
}

.intro-antenna::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -5px;
  width: 14px;
  height: 14px;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.intro-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 25px 0;
  padding: 0;
  list-style: none;
}

.intro-list li {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 11px 7px;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
}

.intro-list span,
.how-to-list span {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--teal);
  border-radius: 50%;
  font-weight: 1000;
}

.modal-start { margin-top: 16px; }

.manual-tab {
  display: inline-block;
  margin-bottom: 17px;
  padding: 7px 10px;
  color: var(--paper);
  background: var(--coral);
  font: 1000 9px/1 Copperplate, sans-serif;
  letter-spacing: .1em;
  transform: rotate(-2deg);
}

.how-to-list { margin: 24px 0; padding: 0; list-style: none; }
.how-to-list li { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin: 13px 0; }
.how-to-list p { margin: 2px 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.how-to-list b { color: var(--ink); }

.privacy-note {
  padding: 12px 14px;
  color: var(--ink-soft);
  background: #e5f2ed;
  border-left: 5px solid var(--teal);
  font-size: 12px;
  line-height: 1.5;
}

.celebration {
  position: fixed;
  z-index: 30;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -30px;
  width: 13px;
  height: 24px;
  background: var(--confetti-color);
  border: 2px solid var(--ink);
  animation: confetti-fall var(--fall-time) cubic-bezier(.15,.72,.35,1) forwards;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes install-part {
  0% { opacity: .15; transform: translateY(-35px) rotate(-5deg) scale(.8); }
  60% { opacity: 1; transform: translateY(5px) rotate(2deg) scale(1.06); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}

@keyframes spark-flash {
  0%, 100% { opacity: 0; stroke-dashoffset: 40; }
  35%, 70% { opacity: 1; stroke-dashoffset: 0; }
}

@keyframes robot-dance {
  from { transform: translateY(0) rotate(-1deg); }
  to { transform: translateY(-10px) rotate(1deg); }
}

@keyframes beacon {
  from { fill: var(--coral); filter: drop-shadow(0 0 0 var(--coral)); }
  to { fill: var(--yellow); filter: drop-shadow(0 0 8px var(--coral)); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.16); }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(9px) scale(.75); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes confetti-fall {
  0% { transform: translate3d(0, -5vh, 0) rotate(0); }
  100% { transform: translate3d(var(--drift), 110vh, 0) rotate(680deg); }
}

@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(350px, .95fr) minmax(390px, 1.05fr); }
  .speech-bubble { top: 23px; right: 16px; }
  .robot-stage { min-height: 500px; }
}

@media (max-width: 880px) {
  body { padding-inline: max(16px, env(safe-area-inset-left)); }
  .workspace { grid-template-columns: 1fr; }
  .robot-stage { min-height: 450px; }
  .robot-svg { max-height: 395px; }
  .challenge-card { min-height: auto; }
  .solver { min-height: 145px; }
  .completion-card { grid-template-columns: auto 1fr; }
  .completion-card .restart-button { grid-column: 1 / -1; width: min(330px, 100%); justify-self: center; }
}

@media (max-width: 700px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .brand { justify-self: center; }
  .brand-mark { width: 47px; height: 47px; border-radius: 14px; }
  .brand-mark svg { width: 36px; }
  .brand small { display: none; }
  .brand h1 { font-size: 19px; }
  .back-label,
  .action-label { display: none; }
  .back-link,
  .round-button { min-width: 44px; min-height: 44px; padding: 7px 11px; }
  .mission-strip { grid-template-columns: 1fr auto; }
  .mission-stamp { display: none; }
  .mission-strip p:last-child { display: none; }
  .bolt-score { min-width: 93px; }
  .repair-track b { display: none; }
  .repair-track { margin: 21px 0; }
  .repair-track li { gap: 0; }
  .robot-stage { min-height: 410px; padding-inline: 5px; }
  .robot-svg { width: 100%; max-height: 385px; }
  .speech-bubble { width: 148px; font-size: 10px; }
}

@media (max-width: 500px) {
  body { padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar { margin-bottom: 15px; }
  .brand-mark { display: none; }
  .brand h1 { max-width: 126px; font-size: 17px; line-height: .95; text-align: center; }
  .top-actions { gap: 6px; }
  .top-actions .round-button { min-width: 40px; width: 40px; min-height: 40px; height: 40px; padding: 4px; }
  .back-link { min-width: 40px; min-height: 40px; padding: 4px 10px; }
  .mission-strip { min-height: 90px; padding: 15px; border-radius: 16px; }
  .mission-strip h2 { font-size: 20px; line-height: 1.08; }
  .mission-strip .eyebrow { font-size: 9px; }
  .bolt-score { min-width: 76px; padding: 8px; }
  .bolt-score > span { margin-right: 3px; font-size: 19px; }
  .bolt-score strong { font-size: 25px; }
  .bolt-score small { font-size: 9px; }
  .repair-track li span { width: 34px; height: 34px; border-width: 2px; }
  .repair-track li::before { top: 15px; height: 4px; }
  .robot-card,
  .challenge-card { box-shadow: 6px 7px 0 var(--shadow); }
  .panel-head { min-height: 69px; padding: 12px 15px; }
  .panel-head h2 { font-size: 23px; }
  .robot-stage { min-height: 340px; }
  .robot-svg { max-height: 322px; }
  .speech-bubble { top: 14px; right: 9px; width: 122px; padding: 8px 9px; border-width: 2px; }
  .hanging-cable { height: 70px; }
  .cable-right { display: none; }
  .challenge-card { padding: 19px 15px; }
  .challenge-head { gap: 10px; }
  .challenge-head h2 { font-size: 19px; }
  .station-badge { width: 47px; height: 47px; }
  .equation { min-height: 68px; margin-bottom: 14px; font-size: 32px; }
  .choice-solver { gap: 8px; }
  .answer-choice { min-height: 60px; font-size: 24px; }
  .completion-card { grid-template-columns: 1fr; text-align: center; }
  .completion-stamp { width: 95px; height: 95px; justify-self: center; font-size: 13px; }
  .completion-stats { justify-content: center; }
  .intro-list { grid-template-columns: 1fr; }
  .intro-list li { grid-template-columns: auto 1fr; align-items: center; justify-items: start; text-align: left; }
}

@media (max-height: 700px) and (min-width: 881px) {
  .robot-stage { min-height: 430px; }
  .robot-svg { max-height: 395px; }
  .challenge-card { min-height: 530px; }
}

@media (pointer: coarse) {
  .answer-choice { min-height: 74px; }
  .number-point { width: 34px; height: 34px; }
}

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