/* Build Crew's whole stylesheet, in cascade order: the first look (shell, title, HUD, sticks, tray, modals), the
   shared Parent Zone skin, responsive layouts, then the tween "equipment console" restyle (0.2), which overrides
   colors and sizes from the first look, its own responsive layouts, and last contrast fixes. Order matters: later
   rules intentionally win, so add new rules next to the layer they adjust. */
:root {
  color-scheme: dark;
  --ink: #edf2f6;
  --cream: #edf2f6;
  --paper: #192735;
  --gold: #f2b538;
  --line: #465460;
  --muted: #a5b5c3;
  font-family: Inter, 'Helvetica Neue', Arial, system-ui, sans-serif;
  color: var(--ink);
  font-weight: 600;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #344452;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
  border-radius: 5px;
  background: var(--cream);
  padding: 10px 16px;
  transition:
    transform 0.15s,
    background 0.15s;
}
button:hover {
  background: #354958;
  transform: translateY(-2px);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #f2b538;
  outline-offset: 3px;
}
button svg {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}
button span[data-icon] {
  display: inline-flex;
}
button kbd {
  font-size: 10px;
  opacity: 0.55;
  margin-left: 5px;
}
button small {
  font-size: 11px;
  opacity: 0.75;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-weight: 850;
  letter-spacing: -0.04em;
}
p {
  line-height: 1.6;
}
.tiny {
  font-size: 12px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
#app,
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}
#world {
  display: block;
  touch-action: none;
}
.eyebrow {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow i {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #f2b538;
  border-radius: 50%;
}
h1 {
  font-size: clamp(38px, 4.6vw, 70px);
  line-height: 1.05;
  margin: 20px 0;
}
h1 em {
  font-style: normal;
  color: #f2b538;
}
#done-total {
  margin-left: 7px;
  color: #afc0cc;
}
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#hud button,
#hud .stick,
#hud .tray {
  pointer-events: auto;
}
.hud-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: linear-gradient(#11202cf0, #11202c00);
  min-height: 115px;
}
.icon-button {
  width: 45px;
  min-width: 45px;
  height: 45px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  background: #172735ed;
  gap: 0;
}
.icon-button kbd {
  display: none;
}
.job-label {
  flex: 1;
}
.job-label h2 {
  font-size: 24px;
  margin: 5px 0;
}
.job-label p {
  font-size: 13px;
  font-weight: 600;
  max-width: 560px;
}
.progress {
  background: #172735ed;
  border: 1px solid #50616f;
  border-radius: 5px;
  padding: 12px 16px;
  white-space: nowrap;
  font-size: 13px;
  box-shadow: 0 2px 8px #00000018;
}
.hint {
  position: absolute;
  top: 126px;
  left: 50%;
  transform: translateX(-50%);
  background: #e6edf2db;
  color: #eef3f5;
  border-radius: 5px;
  padding: 10px 20px;
  font-size: 12px;
  text-align: center;
  max-width: 80%;
  pointer-events: none;
}
.hint:empty {
  display: none;
}
.hud-tools {
  position: absolute;
  top: 160px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tool-button {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #172735ed;
  font-size: 11px;
  padding: 8px 12px;
  box-shadow: 0 2px 8px #00000018;
}
.tool-button svg {
  width: 16px;
  height: 16px;
}
.drive-deck {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 3%;
  right: 3%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.stick-wrap {
  text-align: center;
}
.stick-wrap > span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.13em;
  margin-bottom: 10px;
  text-shadow: 0 1px #13212d;
}
.stick-wrap small {
  display: block;
  font-size: 9px;
  margin-top: 5px;
  opacity: 0.7;
}
.stick {
  width: 120px;
  height: 120px;
  background: #eef3f580;
  border: 2px solid #90a6b37a;
  border-radius: 50%;
  position: relative;
  touch-action: none;
  box-shadow: inset 0 2px 12px #00000020;
  backdrop-filter: blur(5px);
}
.stick-dot {
  width: 49px;
  height: 49px;
  background: #efb136;
  border: 2px solid #ffd67f;
  border-radius: 50%;
  position: absolute;
  inset: 0;
  margin: auto;
  will-change: transform;
  box-shadow: 0 5px 12px #00000040;
  pointer-events: none;
}
.stick-arrows {
  font-size: 29px;
  color: #e6edf244;
  line-height: 1.5;
  position: absolute;
  inset: 10px;
  pointer-events: none;
}
.center-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.machines {
  display: flex;
  gap: 7px;
}
.machine-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #172735ed;
  border: 2px solid transparent;
  padding: 7px 13px;
  text-align: left;
  min-width: 120px;
}
.machine-card.on {
  border-color: #f2b538;
  background: #2a3a45;
}
.machine-card svg {
  width: 43px;
  height: 34px;
}
.machine-card b,
.machine-card small {
  display: block;
}
.machine-card b {
  font-size: 12px;
}
.machine-card small {
  font-size: 10px;
  font-weight: 500;
}
.work-buttons {
  display: flex;
  gap: 7px;
}
.grab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #e6edf2;
  color: var(--cream);
  font-size: 15px;
  min-width: 185px;
  justify-content: center;
}
.grab:hover {
  background: #ffc75a;
}
.joint-buttons {
  display: flex;
  gap: 4px;
}
.joint-buttons button {
  font-size: 10px;
  min-width: 52px;
  min-height: 44px;
  background: #1e3042e8;
  padding: 7px 9px;
}
.camera-hint {
  font-size: 10px;
  background: #142330d9;
  border-radius: 5px;
  padding: 4px 9px;
}
.tray {
  position: absolute;
  right: 20px;
  top: 140px;
  width: 340px;
  padding: 16px;
  background: #182735fa;
  border: 1px solid #354958;
  border-radius: 6px;
  box-shadow: 0 12px 40px #e6edf220;
  max-height: calc(100dvh - 360px);
  overflow: auto;
}
.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tray-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.tray-row button {
  font-size: 11px;
  border: 1px solid #4d6475;
  padding: 8px 10px;
}
.tray-row .swatch {
  width: 44px;
  height: 44px;
  border: 4px solid #223441;
  border-radius: 50%;
}
.tray-row button.on {
  outline: 2px solid #f2b538;
  outline-offset: 1px;
}
.day-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  margin: 15px 0;
}
.daylight {
  height: 44px;
  flex: 1;
  position: relative;
  touch-action: none;
  cursor: pointer;
}
.daylight:before {
  content: '';
  position: absolute;
  inset: 18px 0;
  background: linear-gradient(90deg, #3b5379, #ecc76d);
  border-radius: 10px;
}
.daylight i {
  position: absolute;
  top: 10px;
  left: 72%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #efb136;
  border: 2px solid #e0bf7a;
  transform: translateX(-50%);
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.reduced-motion * {
  transition: none !important;
  scroll-behavior: auto !important;
}
/* Styles for the shared Parent Zone, imported as a live module rather than a fork. */
.sub,
.pz-help {
  font-size: 12px;
  line-height: 1.6;
  color: #758273;
}
.seg,
.pz-players,
.btns,
.pz-actions,
.pz-chips,
.pz-code-row,
.pz-join-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}
.seg button.on,
.pz-ptab.on,
.pz-chips button.on {
  background: #547c67;
  color: white;
}
/* Responsive layouts for the first look: tablets (850 px and narrower), short landscape screens, phones and
   short phones. Each block only adjusts sizes and positions set above. */
@media (max-width: 850px) {
  .stick {
    width: 96px;
    height: 96px;
  }
  .stick-dot {
    width: 43px;
    height: 43px;
  }
  .machine-card {
    min-width: 95px;
    padding: 6px 8px;
    gap: 5px;
  }
  .machine-card svg {
    width: 32px;
  }
  .machine-card small {
    font-size: 9px;
  }
  .job-label h2 {
    font-size: 20px;
  }
  .job-label p {
    font-size: 11px;
  }
  .hud-top {
    gap: 7px;
    padding: 12px;
  }
  .hud-tools {
    left: 12px;
    top: 145px;
  }
  .drive-deck {
    gap: 7px;
    left: 2%;
    right: 2%;
    bottom: 10px;
  }
  .camera-hint {
    font-size: 9px;
  }
  .hint {
    top: 112px;
    font-size: 11px;
    padding: 8px 15px;
  }
  .joint-buttons button {
    font-size: 9px;
    padding: 4px 7px;
  }
  .tray {
    right: 12px;
    top: 115px;
    max-height: calc(100dvh - 320px);
  }
}
@media (max-height: 600px) and (min-width: 650px) {
  .stick {
    width: 84px;
    height: 84px;
  }
  .stick-dot {
    width: 37px;
    height: 37px;
  }
  .hud-tools {
    top: 112px;
    gap: 4px;
  }
  .hud-tools button {
    font-size: 10px;
  }
  .hint {
    top: 92px;
    left: auto;
    right: 12px;
    transform: none;
    max-width: 45%;
    font-size: 10px;
  }
  .drive-deck {
    bottom: 8px;
  }
  .center-controls {
    gap: 4px;
  }
  .camera-hint {
    display: none;
  }
  .machine-card {
    min-height: 45px;
  }
  .joint-buttons button {
    min-height: 44px;
  }
  .tray {
    top: 80px;
    max-height: calc(100dvh - 145px);
    width: 300px;
  }
  .job-label p {
    max-width: 550px;
  }
  .progress {
    padding: 10px;
  }
  .hud-top {
    min-height: 90px;
  }
}
@media (max-width: 600px) {
  .hud-top {
    flex-wrap: wrap;
    gap: 6px;
  }
  .job-label {
    width: calc(100% - 63px);
    flex: auto;
  }
  .job-label h2 {
    font-size: 19px;
  }
  .job-label p {
    font-size: 11px;
    max-width: 95%;
  }
  .progress {
    position: absolute;
    top: 113px;
    right: 12px;
    font-size: 11px;
    padding: 9px 12px;
  }
  #repeat-goal,
  #pause {
    position: absolute;
    top: 13px;
    right: 62px;
  }
  #pause {
    right: 12px;
  }
  .job-label {
    padding-right: 70px;
  }
  .hint {
    top: 162px;
    width: 85%;
    max-width: none;
    font-size: 11px;
  }
  .hud-tools {
    top: 113px;
    left: 12px;
    max-width: 65%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .hud-tools .tool-button {
    padding: 7px 9px;
    font-size: 10px;
  }
  .hud-tools .tool-button svg {
    display: none;
  }
  .drive-deck {
    flex-wrap: wrap;
    align-items: flex-end;
    bottom: 12px;
    gap: 5px;
  }
  .center-controls {
    order: -1;
    width: 100%;
    gap: 6px;
  }
  .stick-wrap > span {
    font-size: 9px;
  }
  .stick {
    width: 94px;
    height: 94px;
  }
  .stick-wrap {
    margin: 0 7%;
  }
  .machines {
    gap: 4px;
    width: 100%;
    justify-content: center;
  }
  .machine-card {
    padding: 5px 7px;
    min-width: 97px;
    gap: 4px;
  }
  .machine-card b {
    font-size: 11px;
  }
  .machine-card svg {
    width: 29px;
  }
  .machine-card small {
    font-size: 8px;
  }
  .joint-buttons {
    gap: 3px;
  }
  .joint-buttons button {
    min-width: 44px;
    padding: 5px 7px;
  }
  .camera-hint {
    display: none;
  }
  .work-buttons .grab {
    min-width: 190px;
  }
  .tray {
    left: 12px;
    right: 12px;
    width: auto;
    top: 214px;
    max-height: calc(100dvh - 490px);
    min-height: 160px;
  }
}
@media (max-width: 600px) {
  .hint {
    top: 218px;
  }
}
/* ---- The tween restyle (0.2): everything below overrides the first look. ---- */
/* Equipment console: crisp panels, amber actions and compact operator controls. */
button {
  font-weight: 650;
  border: 1px solid #516473;
  background: #203343;
  box-shadow: none;
}
button:hover {
  transform: none;
  background: #354c5d;
}
button:active {
  transform: translateY(1px);
}
h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.025em;
}
.eyebrow,
.wordmark {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.13em;
}
.eyebrow i {
  border-radius: 0;
}
.primary,
.grab {
  background: #f2b538;
  color: #172531;
  border-color: #f2b538;
  box-shadow: none;
}
.primary:hover,
.grab:hover {
  background: #ffcb60;
}
.job-label h2 {
  font-size: 25px;
}
.hud-top {
  padding-top: 16px;
  min-height: 120px;
  background: linear-gradient(#10202df7, #10202dc7 70%, #10202d00);
}
.progress {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  border-left: 3px solid #f2b538;
  border-radius: 4px;
}
.hint {
  border-left: 3px solid #f2b538;
  border-radius: 3px;
  color: #e7eff5;
}
.tool-button {
  font-size: 11px;
  border-radius: 4px;
}
.machine-card {
  border-radius: 4px;
  border: 1px solid #596b78;
  min-width: 125px;
}
.machine-card.on {
  border-color: #f2b538;
  box-shadow: inset 0 3px #f2b538;
}
.machine-card b {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #f2b538;
}
.machine-card small {
  color: #bbcbd6;
}
.stick {
  width: 100px;
  height: 100px;
  background: #142532c9;
  backdrop-filter: none;
  border: 1px solid #a0b3bf;
  box-shadow: none;
}
.stick-dot {
  width: 36px;
  height: 36px;
  background: #f2b538;
  border: 3px solid #283d4b;
  box-shadow: 0 0 0 1px #f2b538;
}
.stick-arrows {
  font-family: monospace;
  font-size: 24px;
  line-height: 1.5;
  color: #aec1cf66;
  inset: 9px;
}
.stick-wrap > span {
  color: #f0f4f7;
  background: #132531ed;
  padding: 7px 9px;
  border-radius: 3px;
  text-shadow: none;
  margin-bottom: 7px;
}
.stick-wrap small {
  color: #a8becd;
  opacity: 1;
}
.drive-deck {
  bottom: max(14px, env(safe-area-inset-bottom));
}
.center-controls {
  padding: 9px;
  background: #13222de8;
  border: 1px solid #586b7870;
  border-radius: 5px;
}
.camera-hint {
  background: transparent;
  color: #b0c3d0;
}
.joint-buttons button {
  border: 1px solid #607585;
}
.tray-row .swatch {
  border-radius: 4px;
}
.daylight i {
  border-radius: 3px;
}
.tiny {
  color: #adbfcb;
}
@media (min-width: 851px) {
  .center-controls {
    gap: 7px;
  }
  .stick {
    width: 94px;
    height: 94px;
  }
  .hud-tools {
    top: 155px;
  }
}
@media (max-width: 850px) {
  .stick {
    width: 88px;
    height: 88px;
  }
  .stick-dot {
    width: 32px;
    height: 32px;
  }
  .stick-arrows {
    font-size: 20px;
  }
  .job-label h2 {
    font-size: 21px;
  }
}
@media (max-width: 600px) {
  .center-controls {
    padding: 6px;
  }
  .machine-card {
    min-width: 97px;
  }
  .machine-card b {
    font-size: 10px;
  }
  .stick {
    width: 84px;
    height: 84px;
  }
  .stick-wrap > span {
    font-size: 8px;
  }
  .job-label h2 {
    font-size: 19px;
  }
  .hud-top {
    min-height: 140px;
  }
  .hint {
    top: 218px;
  }
  .drive-deck {
    bottom: 10px;
  }
  .progress {
    font-size: 10px;
  }
}
@media (max-height: 600px) and (min-width: 650px) {
  .stick {
    width: 72px;
    height: 72px;
  }
  .stick-dot {
    width: 29px;
    height: 29px;
  }
  .stick-arrows {
    font-size: 17px;
    inset: 7px;
  }
  .stick-wrap > span {
    margin-bottom: 4px;
    padding: 5px;
  }
  .center-controls {
    padding: 5px;
  }
  /* Two columns, so the sandbox's four tools stay above the DRIVE stick label instead of running down behind it. */
  .hud-tools {
    top: 113px;
    display: grid;
    grid-template-columns: repeat(2, max-content);
  }
  .job-label h2 {
    font-size: 20px;
  }
  .hud-top {
    min-height: 100px;
  }
  .hint {
    top: 103px;
  }
}
/* Contrast and compact-landscape fixes that must come after the restyle. */
.hint {
  background: #14232ff2;
  color: #edf4f8;
}
.job-label p {
  color: #cad8e1;
}
/* Sandbox tray actions: Wrecking ball and Clear site sit at the top of the tray, above the drive deck's reach. Clear
   site asks first: the button turns into "Yes, clear" beside a "Clear site?" prompt. */
.tray-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0 0 4px;
}
.tray-actions .tool-button {
  border: 1px solid #4d6475;
  min-height: 44px;
}
.tray-actions .tool-button.armed {
  background: #f2b538;
  color: #172735;
  border-color: #f2b538;
  font-weight: 800;
}
.clear-ask {
  font-size: 12px;
  font-weight: 700;
  color: #f2d48a;
}
.clear-ask:empty {
  display: none;
}
/* Toasts: one at a time, in a slot placed under the hint line by hud.js (top and left are set there). The stylesheet
   position is only the title screen's. */
/* ---- Phones and tablets (0.4): the touch layout ----
   The page gets `html.touch` when a touch screen is the main pointer (index.html; ?touch=1 forces it). Everything
   below is scoped to it, so a laptop's layout is untouched. The yard fills the screen: a one-line top bar, a slim hint
   strip, and the controls floating over the scene as translucent overlays: two sticks in the bottom corners, a small
   cluster (Grab, Hop, Recover, Horn) between them, the extra joint buttons as a vertical strip by the right stick, the
   machine cards as a strip down the right edge and the site tools down the left. Every target is at least 44 px. The
   sticks, joint buttons and the canvas take no browser gestures (touch-action: none), so a touch is a control from the
   first pointerdown with no tap delay. Motion uses transforms only. */
.touch-only {
  display: none;
}
.stick small.drag,
.desktop-only-label {
  display: none;
}
[data-hold],
.stick,
#world {
  touch-action: none;
}
html.touch {
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);
  --stick: clamp(88px, 25vw, 112px);
  --edge: 10px;
  --lift: calc(var(--sa-b) + 14px);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
html.touch body {
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html.touch .touch-only {
  display: inline-flex;
}
html.touch .desktop-only,
html.touch .stick-wrap small.kb,
html.touch .camera-hint,
html.touch #hud kbd,
html.touch .tray .tiny {
  display: none;
}
html.touch .stick-wrap small.drag {
  display: block;
}
html.touch .stick-wrap.used small.drag {
  display: none;
}
/* A held button must not stay lifted by the sticky :hover of a touch screen. */
html.touch button:hover {
  transform: none;
}
html.touch #hud button {
  transition: none;
}
/* No blur behind sheets: blurring a canvas that redraws every frame costs a phone more than it is worth. */
html.touch .veil,
html.touch #modal:has(.reward-art),
html.touch .quiet {
  backdrop-filter: none;
}
/* The top bar: back, the job name, the count, read aloud, pause, on one line. */
html.touch .hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 0;
  align-items: center;
  gap: 6px;
  padding: calc(var(--sa-t) + 4px) calc(var(--sa-r) + var(--edge)) 4px calc(var(--sa-l) + var(--edge));
  background: linear-gradient(#10202df0, #10202dcc 65%, #10202d00);
}
html.touch .hud-top {
  flex-wrap: nowrap;
}
html.touch .job-label {
  flex: 1;
  width: auto;
  min-width: 0;
  padding: 0;
}
/* The first look's small-window rules place these absolutely; here they are plain items of the bar. */
html.touch .progress,
html.touch #repeat-goal,
html.touch #pause {
  position: static;
  order: 0;
}
html.touch #job-number,
html.touch #goal {
  display: none;
}
html.touch .job-label h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.touch .progress {
  flex: none;
  padding: 7px 10px;
  font-size: 11px;
  line-height: 1.2;
}
html.touch .hud-top .icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 8px;
}
/* The hint: one slim strip right under the bar, at most two lines, never over the pad (the camera frames the yard
   below it). After a few seconds it shows the job's goal instead (hud.js). */
html.touch .hint {
  top: calc(var(--sa-t) + 56px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 2 * var(--edge) - var(--sa-l) - var(--sa-r));
  padding: 5px 12px;
  font-size: 12px;
  line-height: 1.3;
  background: #14232fd9;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
html.touch .hint:empty {
  display: none;
}
html.touch .hint.goal {
  color: #cad8e1;
  border-left-color: #8aa0b0;
}
/* Site tools down the left edge: icon over a short label. */
html.touch .hud-tools {
  top: calc(var(--sa-t) + 104px);
  left: calc(var(--sa-l) + var(--edge));
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  max-width: none;
  gap: 6px;
}
html.touch .tool-button {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: 58px;
  min-height: 50px;
  padding: 4px 3px;
  font-size: 9.5px;
  line-height: 1.1;
  text-align: center;
  background: #172735b8;
}
html.touch .tool-button svg,
html.touch .hud-tools .tool-button svg {
  display: block;
  width: 18px;
  height: 18px;
}
/* The drive deck stops being a band: its parts float over the scene where they are placed below. */
html.touch .drive-deck,
html.touch .center-controls {
  display: contents;
}
html.touch .center-controls {
  padding: 0;
  background: none;
  border: 0;
}
html.touch .stick-wrap {
  position: absolute;
  bottom: var(--lift);
  margin: 0;
  z-index: 0;
}
html.touch .stick-wrap:first-child {
  left: calc(var(--sa-l) + var(--edge));
}
html.touch .stick-wrap:last-child {
  right: calc(var(--sa-r) + var(--edge));
}
html.touch .stick-wrap > span {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin: 0 0 3px;
  padding: 2px 7px;
  width: max-content;
  font-size: 9px;
  line-height: 1.25;
  background: #132531a8;
  pointer-events: none;
}
html.touch .stick-wrap small {
  margin: 0;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  text-transform: none;
}
html.touch .stick {
  width: var(--stick);
  height: var(--stick);
  background: #14253270;
  border: 2px solid #c4d3dd66;
}
html.touch .stick::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
html.touch .stick.held {
  background: #14253299;
  border-color: #f2b538b0;
}
html.touch .stick-dot {
  width: 42px;
  height: 42px;
  background: #f2b538;
  border: 3px solid #283d4b;
  opacity: 0.92;
}
html.touch .stick-arrows {
  font-size: 18px;
  inset: 8px;
  color: #d8e3ea40;
}
/* The cluster between the sticks: Grab on top, Hop, Recover and Horn below. */
html.touch .work-buttons {
  position: absolute;
  left: 50%;
  bottom: var(--lift);
  transform: translateX(-50%);
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: min(190px, calc(100vw - 2 * (var(--stick) + var(--edge) + 8px) - var(--sa-l) - var(--sa-r)));
}
html.touch .work-buttons .grab {
  grid-column: 1 / -1;
  min-width: 0;
  height: 50px;
  font-size: 15px;
  gap: 8px;
  background: #f2b538ee;
}
html.touch .work-buttons .icon-button {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 6px;
  background: #172735c4;
  border-color: #6d8190;
}
html.touch .work-buttons .grab:active,
html.touch .work-buttons .icon-button:active,
html.touch .joint-buttons button:active {
  background: #ffcb60;
  color: #172531;
}
/* The extra joints, a vertical strip above the right stick (beside it in landscape). */
html.touch .joint-buttons {
  position: absolute;
  right: calc(var(--sa-r) + var(--edge));
  bottom: calc(var(--lift) + var(--stick) + 34px);
  z-index: 1;
  flex-direction: column;
  gap: 6px;
}
html.touch .joint-buttons button {
  width: 58px;
  min-width: 58px;
  min-height: 46px;
  padding: 4px 3px;
  font-size: 10px;
  line-height: 1.15;
  background: #172735c4;
  border-color: #6d8190;
}
/* The machine cards: a strip down the right edge, art over the unit ID; a lone machine needs no card. */
html.touch .machines {
  position: absolute;
  top: calc(var(--sa-t) + 104px);
  right: calc(var(--sa-r) + var(--edge));
  flex-direction: column;
  justify-content: flex-start;
  width: auto;
  gap: 6px;
}
html.touch .machines:has(.machine-card:only-child) {
  display: none;
}
html.touch .machine-card {
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  width: 58px;
  min-width: 58px;
  min-height: 54px;
  padding: 3px;
  text-align: center;
  background: #172735c4;
}
html.touch .machine-card svg {
  width: 38px;
  height: 28px;
}
html.touch .machine-card b {
  font-size: 8.5px;
  letter-spacing: 0.04em;
}
html.touch .machine-card small {
  display: none;
}
/* The materials tray as a bottom sheet above the sticks: it scrolls inside itself, its rows scroll sideways, and it
   leaves the sticks, the cluster and the joint strip uncovered. */
html.touch .tray .tool-button {
  flex-direction: row;
  width: auto;
  min-height: 44px;
  padding: 6px 12px;
  font-size: 12px;
}
html.touch .tray {
  z-index: 3;
  left: calc(var(--sa-l) + var(--edge));
  right: calc(var(--sa-r) + var(--edge) + 66px);
  top: auto;
  bottom: calc(var(--lift) + var(--stick) + 40px);
  width: auto;
  min-height: 0;
  max-height: min(48dvh, 340px);
  padding: 8px 10px 10px;
  background: #182735f2;
  overscroll-behavior: contain;
  touch-action: pan-y;
  animation: tray-up 0.18s ease-out;
}
html.touch .tray-head {
  margin-bottom: 2px;
}
html.touch .tray-head b {
  font-size: 13px;
}
html.touch .tray-actions {
  margin: 0;
}
html.touch .tray-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 6px -10px;
  padding: 2px 10px;
  scrollbar-width: none;
  touch-action: pan-x;
}
html.touch .tray-row::-webkit-scrollbar {
  display: none;
}
html.touch .tray-row button {
  flex: none;
}
html.touch .day-row {
  margin: 6px 0 0;
}
@keyframes tray-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}
html.touch.reduced-motion .tray {
  animation: none;
}
/* Wide, short screens (a phone on its side): the bar is thinner, the cluster is one row, the sticks keep the lower
   corners and the tray moves to the left, clear of the right stick and its joints. */
@media (orientation: landscape) and (max-height: 520px) {
  html.touch {
    --stick: clamp(84px, 24vh, 100px);
    --lift: calc(var(--sa-b) + 10px);
  }
  html.touch .hud-top {
    padding-top: calc(var(--sa-t) + 2px);
    padding-bottom: 2px;
  }
  html.touch .hint {
    top: calc(var(--sa-t) + 50px);
    padding: 3px 12px;
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }
  html.touch .hud-tools,
  html.touch .machines {
    top: calc(var(--sa-t) + 82px);
  }
  html.touch .work-buttons {
    grid-template-columns: 104px repeat(3, 46px);
    width: auto;
  }
  html.touch .work-buttons .grab {
    grid-column: auto;
    height: 46px;
    font-size: 14px;
  }
  html.touch .work-buttons .icon-button {
    height: 46px;
  }
  html.touch .joint-buttons {
    right: calc(var(--sa-r) + var(--edge) + var(--stick) + 10px);
    bottom: var(--lift);
  }
  /* The tray sits over the middle of the screen, between the left tools and the joint strip, with its title, tools and
     close button on one row. The sticks, the joints and the machine cards stay uncovered. */
  html.touch .tray {
    left: calc(var(--sa-l) + var(--edge) + var(--stick) + 8px);
    right: calc(var(--sa-r) + var(--edge) + var(--stick) + 10px + 58px + 8px);
    width: auto;
    top: calc(var(--sa-t) + 78px);
    bottom: var(--lift);
    max-height: none;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-content: start;
    align-items: center;
    gap: 4px 10px;
    z-index: 3;
  }
  html.touch .tray-head {
    display: contents;
  }
  html.touch .tray-head b {
    grid-column: 1;
    grid-row: 1;
  }
  html.touch .tray-actions {
    grid-column: 2;
    grid-row: 1;
  }
  html.touch #close-tray {
    grid-column: 3;
    grid-row: 1;
  }
  html.touch .tray-row,
  html.touch .day-row {
    grid-column: 1 / -1;
    margin-top: 0;
    margin-bottom: 0;
  }
  /* Sheets: a short card that fits the screen. */
  html.touch .modal-actions {
    margin-top: 8px;
  }
  html.touch .reward-art {
    margin: 4px 0;
    padding: 6px 10px 10px;
  }
  html.touch .reward-art svg {
    max-height: 84px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.touch .tray {
    animation: none;
  }
}
/* ---- The Lab (0.5): the XP pill, the build challenge line, the finished-sheet strip, the board's Lab rows ---- */
/* The title's Lab buttons sit beside Parents in the header, so the panel never grows. */
/* The Lab's XP pill sits in the top bar between the job name and the count. */
/* (#lab-hud is Build Crew's own slot; the pill the Lab mounts inside it is a button.lab-hud with its own styles and stays tappable.) */
#lab-hud {
  flex: none;
  display: flex;
  align-items: center;
  align-self: flex-start;
}
#lab-hud:empty {
  display: none;
}
html.touch #lab-hud {
  align-self: center;
}
/* A blueprint's challenge: a second line in the count, in amber, with a tick once it is met. */
.progress.with-challenge {
  white-space: normal;
  line-height: 1.3;
}
.progress small {
  display: block;
  margin-top: 3px;
  color: #f2b538;
  font-size: 11px;
  white-space: nowrap;
}
.progress small.met::after {
  content: ' \2713';
}
html.touch .progress.with-challenge {
  padding: 5px 9px;
}
html.touch .progress small {
  margin-top: 1px;
  font-size: 9.5px;
}
/* The finished sheet: the "Neat build!" badge and the Lab's strip. */
.lab-results {
  margin-top: 8px;
}
.lab-results:empty {
  display: none;
}
html.touch .lab-results {
  margin-top: 4px;
}
/* The board's Lab rows. */
/* Five machine cards on a phone: two short columns so the strip never reaches the right stick. */
html.touch .machines:has(.machine-card:nth-child(4)) {
  display: grid;
  grid-template-columns: repeat(2, 54px);
  gap: 5px;
}
html.touch .machines:has(.machine-card:nth-child(4)) .machine-card {
  width: 54px;
  min-width: 54px;
  min-height: 46px;
}
html.touch .machines:has(.machine-card:nth-child(4)) .machine-card svg {
  width: 32px;
  height: 22px;
}
/* A narrow phone (portrait) with the Lab pill: the top bar takes a second row for the pill and the count, so the job
   name keeps its room; the hint strip and the side columns move down by that row (the Lab's pill is a 44 px target). Without the Lab nothing changes. */
@media (max-width: 470px) {
  html.touch .hud-top:has(#lab-hud .lab-hud) {
    flex-wrap: wrap;
    row-gap: 3px;
  }
  html.touch .hud-top:has(#lab-hud .lab-hud) .job-label {
    flex: 1 1 0;
  }
  html.touch .hud-top:has(#lab-hud .lab-hud)::after {
    content: '';
    order: 7;
    flex: 0 0 100%;
    height: 0;
  }
  html.touch .hud-top:has(#lab-hud .lab-hud) #lab-hud {
    order: 8;
  }
  html.touch .hud-top:has(#lab-hud .lab-hud) .progress {
    order: 9;
    margin-right: auto;
  }
  html.touch #hud:has(#lab-hud .lab-hud) .hint {
    top: calc(var(--sa-t) + 106px);
  }
  html.touch #hud:has(#lab-hud .lab-hud) .hud-tools,
  html.touch #hud:has(#lab-hud .lab-hud) .machines {
    top: calc(var(--sa-t) + 154px);
  }
}
/* The job board's site rows (0.6): the site code with a coloured rule (yard amber, harbor seafoam, hillside sage)
   and the site's done count at the right. */
/* With twenty jobs' paints, decals and horns the looks row scrolls sideways instead of wrapping into a tall block or
   widening the title panel. */
