* {
  box-sizing: border-box;
}
body {
  font-size: 17px;
  line-height: 1.5;
}
body.pi-paper {
  background-image: none;
  isolation: isolate;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--pi-paper-tex);
  opacity: 0.2;
}
.pi-grain::after {
  opacity: 0.18;
}
.stage.pi-birch {
  background-image: none;
  isolation: isolate;
}
.stage.pi-birch::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  background-image: var(--pi-birch-tex);
  background-size: 512px 128px;
  opacity: 0.24;
}
button,
input {
  font: inherit;
  color: var(--ink);
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--green-deep);
  text-underline-offset: 4px;
}
svg {
  display: block;
  width: 100%;
  height: 100%;
}
.svg-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
}
.shell {
  max-width: 1256px;
  margin: auto;
  padding: 0 44px;
}
.skip-link {
  position: fixed;
  top: -120px;
  left: 12px;
  z-index: 30;
  background: var(--paper-raised);
  padding: 16px;
  border-radius: 18px;
}
.skip-link:focus {
  top: 12px;
}
.masthead {
  min-height: 102px;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font: 400 27px var(--font-display);
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  min-height: 60px;
}
.draft-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 14px;
}
.draft-mark span {
  width: 9px;
  height: 9px;
  border: 1px solid var(--sunflower-deep);
  border-radius: 50%;
  background: var(--sunflower);
}
.back-link {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 48px 0 38px;
  gap: 24px;
}
h1 {
  font-size: clamp(38px, 4.5vw, 60px);
  line-height: 1.06;
  letter-spacing: -0.025em;
}
.intro p {
  margin-top: 16px;
  color: var(--ink-muted);
  font-size: 19px;
}
.intro-object {
  width: 142px;
  height: 88px;
  border-radius: 30px;
  transform: rotate(-8deg);
  box-shadow: var(--edge-2);
  position: relative;
  margin-right: 24px;
  flex: none;
}
.intro-track {
  position: absolute;
  inset: 23px 20px;
  border-radius: 50px;
  background: var(--green);
  border: 2px solid var(--green-deep);
}
.intro-track i {
  position: absolute;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  right: 4px;
  top: 3px;
}
.intro-star {
  position: absolute;
  width: 46px;
  height: 46px;
  color: var(--sunflower);
  right: -20px;
  top: -17px;
  transform: rotate(20deg);
}
.toy-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.toy-tabs button {
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--paper-sunk);
  padding: 17px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  font-size: 18px;
  font-weight: 650;
  transition:
    transform 140ms ease,
    background 140ms ease;
}
.toy-tabs button[aria-selected='true'] {
  background: var(--paper-raised);
  box-shadow: var(--edge-1);
}
.toy-tabs button:hover {
  transform: translateY(-2px);
}
.toy-tabs small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-top: 2px;
}
.tab-number {
  border-radius: 50%;
  background: var(--birch);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
}
[aria-selected='true'] .tab-number {
  background: var(--green);
  color: var(--ink);
}
.workbench {
  border: 1px solid var(--line-strong);
  border-radius: 32px;
  padding: 28px 30px 0;
  background: var(--paper-raised);
  box-shadow: var(--edge-2);
}
.bench-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
h2 {
  font-size: 33px;
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.bench-heading p {
  color: var(--ink-muted);
  margin-top: 6px;
}
.reset {
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  border-radius: 50px;
  min-height: 60px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  flex: none;
}
.reset span {
  font-size: 25px;
}
.reset:hover {
  background: var(--paper-sunk);
}
.bench-body {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(250px, 1fr);
  gap: 32px;
  align-items: stretch;
}
.stage {
  border-radius: 26px;
  padding: 20px 24px 18px;
  min-width: 0;
  position: relative;
  border-bottom: 5px solid var(--birch-edge);
}
.stage-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--ink-muted);
  font-size: 13px;
}
.tiny-dot {
  width: 7px;
  height: 7px;
  background: var(--ink-muted);
  border-radius: 50%;
}
.bench-aside {
  padding: 18px 0 12px;
  align-self: center;
}
.aside-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.step-disc {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 13px;
}
h3 {
  font-size: 23px;
  line-height: 1.18;
}
.bench-aside p {
  color: var(--ink-muted);
  font-size: 15px;
}
.action {
  border: 1px solid var(--line-strong);
  min-height: 60px;
  padding: 12px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 650;
  box-shadow: var(--edge-1);
  transition:
    transform 140ms,
    box-shadow 140ms;
}
.action:hover {
  transform: translateY(-1px);
}
.action:active {
  transform: translateY(3px);
  box-shadow: none;
}
.action.secondary {
  background: var(--paper-raised);
}
.action.primary {
  background: var(--green);
  border-color: var(--green-deep);
  box-shadow: 0 3px 0 var(--green-deep);
}
.bench-aside .action {
  margin-top: 22px;
  width: 100%;
}
.bench-aside .small-note {
  font-size: 13px;
  margin-top: 14px;
}
.discovery {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 105px;
  padding: 24px 0;
}
.discovery-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green-soft);
  font-size: 27px;
  flex: none;
}
.discovery h3 {
  font-size: 24px;
}
.discovery p {
  font-size: 15px;
  color: var(--ink-muted);
  margin-top: 5px;
}
details {
  border-top: 1px solid var(--line);
}
summary {
  cursor: pointer;
  min-height: 60px;
  padding: 19px 0;
  color: var(--ink-muted);
  font-size: 14px;
}
details p {
  max-width: 850px;
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--ink-muted);
}
.page-foot {
  padding: 26px 0 36px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--ink-muted);
  font-size: 13px;
}
.no-script {
  padding: 20px;
  background: var(--sunflower-soft);
  border-radius: 18px;
  margin-bottom: 20px;
}
.noise-machine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  align-items: center;
  gap: 18px;
  max-width: 460px;
  margin: 18px auto 14px;
}
.screen-housing {
  padding: 14px 14px 10px;
  border-radius: 26px;
  background: var(--green);
  border: 1px solid var(--green-deep);
  box-shadow: 0 5px 0 var(--green-deep);
}
.screen-bezel {
  background: var(--ink-muted);
  padding: 9px;
  border-radius: 15px;
}
#noise-canvas {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  image-rendering: pixelated;
}
.screen-caption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
}
.crank-column {
  text-align: center;
}
.crank {
  --crank-size: 128px;
  height: calc(var(--crank-size) * 1.09375);
  width: calc(var(--crank-size) * 1);
  position: relative;
  background: transparent;
  border: none;
  touch-action: none;
  padding: 0;
}
.crank-base {
  position: absolute;
  width: calc(var(--crank-size) * 0.71875);
  height: calc(var(--crank-size) * 0.71875);
  left: calc(var(--crank-size) * 0.140625);
  top: calc(var(--crank-size) * 0.1875);
  background: var(--paper-sunk);
  border: calc(var(--crank-size) * 0.015625) solid var(--line-strong);
  border-radius: 50%;
  box-shadow: var(--edge-2);
}
.crank-arm {
  position: absolute;
  left: calc(var(--crank-size) * 0.429688);
  top: calc(var(--crank-size) * 0.15625);
  width: calc(var(--crank-size) * 0.140625);
  height: calc(var(--crank-size) * 0.484375);
  background: var(--ink-muted);
  border-radius: calc(var(--crank-size) * 0.09375);
  transform-origin: calc(var(--crank-size) * 0.070312)
    calc(var(--crank-size) * 0.390625);
  transform: rotate(var(--turn, 0deg));
  transition: transform 180ms ease-out;
}
.crank-arm i {
  position: absolute;
  width: calc(var(--crank-size) * 0.375);
  height: calc(var(--crank-size) * 0.375);
  left: calc(var(--crank-size) * -0.117188);
  top: calc(var(--crank-size) * -0.101562);
  background: var(--sunflower);
  border: calc(var(--crank-size) * 0.007812) solid var(--sunflower-deep);
  box-shadow: 0 calc(var(--crank-size) * 0.03125) 0 var(--sunflower-deep);
  border-radius: 50%;
}
.crank-hub {
  position: absolute;
  width: calc(var(--crank-size) * 0.1875);
  height: calc(var(--crank-size) * 0.1875);
  background: var(--paper-raised);
  border: calc(var(--crank-size) * 0.015625) solid var(--line-strong);
  left: calc(var(--crank-size) * 0.40625);
  top: calc(var(--crank-size) * 0.453125);
  border-radius: 50%;
  pointer-events: none;
}
.crank-caption {
  font-size: 13px;
  color: var(--ink-muted);
}
.scrubber {
  max-width: 450px;
  margin: auto;
}
.scrubber label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
input[type='range'] {
  width: 100%;
  height: 60px;
  margin: 0;
  accent-color: var(--green-deep);
  cursor: ew-resize;
}
.shape-options {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.shape-options button {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 16px 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--paper);
  font-size: 14px;
}
.shape-options button[aria-pressed='true'] {
  background: var(--green-soft);
  border: 2px solid var(--green-deep);
  padding: 15px 9px 11px;
}
.shape-options svg {
  width: 44px;
  height: 44px;
}
.scoreboard {
  display: flex;
  justify-content: center;
  gap: 42px;
  margin-top: 18px;
}
.scoreboard div {
  text-align: center;
}
.scoreboard span {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
}
.scoreboard strong {
  font: 400 44px var(--font-display);
  font-variant-numeric: tabular-nums;
}
.scoreboard small {
  font: 400 20px var(--font-sans);
  color: var(--ink-muted);
}
.robot-world {
  height: 185px;
  position: relative;
  margin: 0 18px;
}
.path-rail {
  position: absolute;
  height: 13px;
  border-radius: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  left: 0;
  right: 0;
  bottom: 44px;
  box-shadow: var(--edge-1);
}
.path-stops {
  display: flex;
  justify-content: space-between;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 47px;
}
.path-stops i {
  width: 6px;
  height: 6px;
  background: var(--ink-muted);
  border-radius: 50%;
}
.little-robot {
  position: absolute;
  width: 84px;
  height: 100px;
  bottom: 54px;
  left: 0%;
  transform: translateX(-35%);
  transition: left 430ms ease-in-out;
  z-index: 2;
}
.little-robot > svg {
  width: 84px;
}
#held-apple {
  position: absolute;
  width: 35px;
  height: 40px;
  right: -7px;
  bottom: 44px;
}
.little-robot.has-delivered {
  transform: translateX(-120%);
}
.little-robot.carrying > svg {
  transform: rotate(-4deg);
}
.world-apple.in-basket {
  bottom: 83px;
}
.world-apple {
  position: absolute;
  width: 33px;
  height: 38px;
  bottom: 58px;
  left: 4%;
  transition: left 350ms ease;
}
.basket {
  position: absolute;
  right: -16px;
  bottom: 58px;
  width: 64px;
  height: 46px;
  border-radius: 5px 5px 18px 18px;
  background: var(--birch-edge);
  border: 2px solid var(--ink-muted);
  display: flex;
  justify-content: space-evenly;
}
.basket i {
  height: 100%;
  width: 3px;
  background: var(--ink-muted);
}
.basket span {
  position: absolute;
  width: 44px;
  height: 24px;
  border: 3px solid var(--ink-muted);
  border-bottom: none;
  border-radius: 25px 25px 0 0;
  top: -25px;
}
.path-start,
.path-end {
  position: absolute;
  bottom: 12px;
  font-size: 12px;
  color: var(--ink-muted);
}
.path-start {
  left: -10px;
}
.path-end {
  right: -20px;
}
.run-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 4px;
}
.run-controls .action {
  flex: none;
  min-width: 185px;
}
#robot-action {
  font-size: 13px;
  color: var(--ink-muted);
}
.reward-options {
  position: relative;
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.reward-options > button:not(.reward-coin) {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  min-height: 86px;
  padding: 12px;
  background: var(--paper);
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}
.reward-options > button[aria-pressed='true'] {
  border: 2px solid var(--green-deep);
  padding: 11px;
  background: var(--green-soft);
}
.reward-options small {
  display: block;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 3px;
}
.reward-socket {
  width: 48px;
  height: 48px;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  flex: none;
}
.reward-coin {
  position: absolute;
  width: 60px;
  height: 60px;
  top: 13px;
  left: 7px;
  background: var(--sunflower);
  border: 2px solid var(--sunflower-deep);
  box-shadow: 0 3px 0 var(--sunflower-deep);
  border-radius: 50%;
  font-weight: 650;
  font-size: 21px;
  touch-action: none;
  transition: top 300ms cubic-bezier(0.2, 0.8, 0.2, 1.2);
}
.reward-coin.dragging {
  transition: none;
  cursor: grabbing;
}
@media (max-width: 950px) {
  .shell {
    padding: 0 28px;
  }
  .bench-body {
    gap: 24px;
    grid-template-columns: minmax(0, 1.5fr) minmax(225px, 1fr);
  }
  .workbench {
    padding: 24px 24px 0;
  }
  .stage {
    padding: 18px 16px;
  }
  .noise-machine {
    grid-template-columns: minmax(0, 1fr) 100px;
    gap: 4px;
  }
  .crank {
    --crank-size: 100px;
  }
  .run-controls {
    flex-direction: column;
    gap: 10px;
  }
  .toy-tabs button {
    padding: 15px;
    gap: 10px;
    font-size: 16px;
  }
  .toy-tabs small {
    font-size: 11px;
  }
}
@media (max-width: 720px) {
  .shell {
    padding: 0 20px;
  }
  .masthead {
    min-height: 82px;
    gap: 12px;
  }
  .draft-mark {
    font-size: 12px;
  }
  .back-link {
    display: none;
  }
  .intro {
    padding: 32px 0 28px;
  }
  .intro p {
    font-size: 16px;
    max-width: 320px;
  }
  .intro-object {
    width: 95px;
    height: 74px;
    margin-right: 10px;
  }
  .intro-track {
    inset: 19px 12px;
  }
  .intro-track i {
    width: 26px;
    height: 26px;
    top: 3px;
  }
  .toy-tabs {
    gap: 7px;
    margin-bottom: 16px;
  }
  .toy-tabs button {
    flex-direction: column;
    padding: 12px 4px;
    gap: 8px;
    text-align: center;
    border-radius: 18px;
    font-size: 14px;
  }
  .toy-tabs small {
    display: none;
  }
  .tab-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .workbench {
    border-radius: 26px;
    padding: 22px 18px 0;
  }
  h2 {
    font-size: 28px;
  }
  .bench-heading {
    gap: 12px;
    align-items: flex-start;
  }
  .bench-heading p {
    font-size: 14px;
  }
  .reset {
    padding: 0 13px;
    min-height: 60px;
    font-size: 13px;
    gap: 5px;
  }
  .bench-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .stage {
    padding: 18px 16px 16px;
  }
  .bench-aside {
    padding: 22px 4px 10px;
  }
  .aside-heading {
    margin-bottom: 14px;
  }
  .bench-aside .action {
    margin-top: 16px;
  }
  .noise-machine {
    max-width: 400px;
    grid-template-columns: minmax(0, 1fr) 100px;
  }
  .shape-options button {
    flex-direction: row;
    justify-content: center;
  }
  .shape-options svg {
    width: 30px;
    height: 30px;
  }
  .run-controls {
    flex-direction: row;
  }
  .discovery {
    align-items: flex-start;
    gap: 12px;
    padding: 22px 0;
  }
  .discovery h3 {
    font-size: 22px;
  }
  .discovery p {
    font-size: 14px;
  }
  .page-foot {
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
  }
}
@media (max-width: 400px) {
  .shell {
    padding: 0 12px;
  }
  .brand {
    font-size: 23px;
  }
  .draft-mark {
    font-size: 11px;
    gap: 6px;
  }
  .intro-object {
    display: none;
  }
  h1 {
    font-size: 40px;
  }
  .workbench {
    padding: 20px 12px 0;
  }
  h2 {
    font-size: 25px;
  }
  .stage {
    padding: 15px 12px;
  }
  .screen-housing {
    padding: 9px;
    border-radius: 20px;
  }
  .screen-caption {
    font-size: 9px;
  }
  .noise-machine {
    grid-template-columns: minmax(0, 1fr) 85px;
  }
  .crank {
    --crank-size: 85px;
  }
  .crank-caption {
    font-size: 11px;
  }
  .run-controls {
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Standalone pages keep the toy close to its title, with ordinary navigation. */
.standalone-toy .masthead {
  min-height: 84px;
}
.standalone-toy .intro {
  padding: 30px 0 26px;
}
.standalone-toy h1 {
  font-size: clamp(38px, 4.2vw, 52px);
}
.standalone-toy .intro p {
  margin-top: 10px;
  font-size: 18px;
}
.standalone-toy .back-link {
  display: flex;
}
.standalone-toy .bench-heading {
  margin-bottom: 20px;
}
.standalone-toy .bench-aside {
  padding-top: 12px;
}
.other-toys {
  padding-top: 32px;
}
.other-toys h2 {
  font-size: 24px;
  margin-bottom: 16px;
}
.other-toys > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.other-toys a {
  min-height: 60px;
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
  transition: background 140ms ease-out;
}
.other-toys a:hover {
  background: var(--paper-sunk);
}
.other-toys [aria-current='page'] {
  background: var(--green-soft);
  border-color: var(--green-deep);
}
.no-script p + p {
  margin-top: 12px;
}
.workbench:not([data-ready]) button:disabled {
  opacity: 0.6;
}
.workbench .dragging {
  z-index: 10;
}
.crank.dragging .crank-arm {
  transition: none;
}
@media (max-width: 720px) {
  .standalone-toy .masthead {
    min-height: 76px;
  }
  .standalone-toy .intro {
    padding: 24px 0;
  }
  .standalone-toy .intro p {
    max-width: 100%;
    font-size: 16px;
  }
  .standalone-toy .back-link {
    font-size: 13px;
    gap: 6px;
  }
  .other-toys > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .other-toys a {
    justify-content: center;
    padding: 12px 8px;
    font-size: 14px;
  }
}
