/*! Solar System Repair Co. | Source: https://orbitalforest.com */
/* v151 repair benches: one bounded machine, visible clues, touch-sized native controls. */
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode {
  width: min(920px, calc(100vw - 24px)); height: min(680px, calc(100dvh - 120px));
  max-height: calc(100dvh - 120px); grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr);
  padding: 16px; gap: 0; overflow: hidden; --bench-cell: 52px;
}
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode .dialogue-content {
  display: grid; grid-template-rows: auto minmax(0,1fr); grid-template-columns: minmax(0,1fr);
  grid-column: 1; grid-row: 1; overflow: hidden; min-height: 0; padding: 0; gap: 6px;
}
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode .dialogue-content::after { display: none; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode :is(.dialogue-portrait,.dialogue-heading,#dialogue-line,#question-prompt,#answer-feedback) { display: none; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode #mission-review-code { grid-row:1; margin:0; min-height:18px; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode #answer-grid { display:block; grid-row:2; min-height:0; height:100%; margin:0; overflow:hidden; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode .dialogue-actions { position:absolute; bottom:20px; right:20px; z-index:5; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode[data-bench-scope="mission"] .bench-test { visibility:hidden; }
#game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode #next-question-button { max-width:260px; height:64px; min-height:64px; }
#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode { width:min(920px,calc(100vw - 24px)); height:min(680px,calc(100dvh - 120px)); max-height:calc(100dvh - 120px); display:grid; grid-template-rows:auto auto minmax(0,1fr); gap:5px; overflow:hidden; padding:16px; }
#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode :is(.dialogue-portrait,#backyard-activity-copy,#backyard-activity-eyebrow,#backyard-activity-controls,#backyard-activity-feedback) { display:none; }
#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode #backyard-activity-title { margin:0 32px 0 0; font-size:16px; }
#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode #backyard-activity-review-code { margin:0; }
#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode #backyard-activity-target { min-height:0; height:100%; margin:0; }
#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode { width:min(920px,calc(100vw - 24px)); height:min(680px,calc(100dvh - 120px)); max-height:calc(100dvh - 120px); padding:16px; display:grid; grid-template-columns:minmax(0,1fr); overflow:hidden; }
#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode .dialogue-content { display:grid; grid-template-rows:auto auto minmax(0,1fr); min-height:0; overflow:hidden; padding:0; }
#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode :is(.dialogue-portrait,.dialogue-counter,#beach-dialogue-line,#beach-fishing-visual) { display:none; }
#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode #beach-dialogue-choices { display:block; min-height:0; margin:0; }
#game-shell[data-ui-layout] :is(#mission-dialogue-console,#backyard-activity-panel,#beach-dialogue-console).is-bench-mode[hidden] { display:none; }
.repair-bench { --bench-cell:52px; --bench-ink:#17313a; --bench-accent:#d19735; height:100%; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) 90px; gap:8px; color:#eedfbd; overflow:hidden; }
.bench-top { display:grid; gap:4px; }
.bench-instruction { font-size:15px; line-height:1.3; margin:0; max-width:750px; }
.bench-clue { display:block; padding:6px 9px; font-size:14px; line-height:1.3; color:#ffe3a4; border-left:4px solid #d7a759; background:#162b33; }
.bench-work { min-height:0; min-width:0; display:grid; grid-template-columns:minmax(0,1fr) 200px; gap:10px; align-items:center; }
.bench-work:not(:has(.bench-rack)) { grid-template-columns:minmax(0,1fr); }
.bench-machine { position:relative; height:100%; min-height:0; display:grid; align-content:center; padding:10px; background:#10262bd9; border:2px solid #7b8780; border-radius:7px 2px 5px 3px; overflow:hidden; }
.bench-art { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; opacity:.36; pointer-events:none; filter:saturate(.8); }
.bench-assembly { position:relative; z-index:1; display:grid; align-content:center; justify-items:center; min-height:0; gap:10px; }
.bench-reference,.bench-balance-beam { text-align:center; font:700 15px/1.3 ui-monospace,monospace; color:#ffe3a4; background:#142e35ed; padding:5px 8px; border:1px solid #7a8d86; }
.bench-slots { width:100%; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.bench-slots:is([data-mode="wires"],[data-mode="program"],[data-mode="balance"]) { grid-template-columns:repeat(2,minmax(0,1fr)); }
.bench-slots[data-mode="gears"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
.bench-socket-group { display:grid; gap:4px; justify-items:center; }
.bench-socket-label { font-size:12px; line-height:1.2; text-align:center; background:#102b32df; padding:3px; }
#game-shell .bench-button { border:2px solid #665c49; border-image:none; border-radius:4px 2px 5px 2px; box-shadow:inset 0 2px #fff3,0 4px 0 #050e10; color:#17313a; background:#e6d5ab; font:800 15px/1.15 ui-monospace,monospace; min-height:44px; min-width:44px; margin:0; padding:5px; touch-action:manipulation; position:relative; cursor:pointer; }
#game-shell .bench-button:hover:not(:disabled) { filter:brightness(1.08); }
#game-shell .bench-button:active:not(:disabled) { transform:translateY(3px); box-shadow:inset 0 2px #0002,0 1px 0 #050e10; }
#game-shell .bench-button:focus-visible { outline:3px solid #87e4e8; outline-offset:2px; }
#game-shell .bench-button:disabled { cursor:default; }
.bench-button svg { display:block; width:100%; height:100%; fill:#b7ad8d; stroke:#27454b; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.bench-button .bench-accent { fill:#e5a441; }
.bench-button .bench-ghost { fill:none; stroke-dasharray:8 5; }
#game-shell .bench-socket { width:100%; max-width:128px; height:96px; display:grid; justify-items:center; grid-template-rows:minmax(0,1fr) auto; background:#c4b698; }
#game-shell .bench-socket.is-filled { background:#f0d991; }
.bench-socket svg { max-width:75px; }
.bench-stamp { display:block; position:relative; font-size:14px; text-align:center; color:#102a32; }
.bench-live { font:12px/1.35 ui-monospace,monospace; padding:4px; background:#142e35ef; text-align:center; max-width:100%; }
.bench-rack { display:grid; align-content:center; gap:6px; min-height:0; }
.bench-rack-label { text-align:center; font:700 12px/1.2 ui-monospace,monospace; color:#ffe3a4; }
.bench-parts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
#game-shell .bench-part { height:78px; display:grid; grid-template-rows:minmax(0,1fr) auto; justify-items:center; }
.bench-part svg { max-width:58px; }
#game-shell .bench-part.is-selected { background:#ffd880; outline:3px solid #ffde9b; outline-offset:1px; transform:translateY(-3px); }
#game-shell .bench-part.is-used { background:#a8bcb4; }
.bench-bottom { position:relative; display:grid; grid-template-columns:90px minmax(0,1fr) 96px; gap:8px; align-items:center; }
.bench-tools { display:grid; gap:2px; }
#game-shell .bench-tools .bench-button { font-size:12px; min-height:44px; }
.bench-feedback { margin:0; line-height:1.3; font-size:13px; }
#game-shell .bench-test { width:80px; height:80px; justify-self:end; background:#dec374; border:5px solid #384c4b; font-size:18px; box-shadow:0 6px #051a1e,inset 0 2px #fff5; }
#game-shell .bench-exit { position:absolute; right:0; bottom:0; height:64px; width:min(260px,80%); background:#21383a; color:#b9dfc1; border:2px solid #84998f; box-shadow:none; font-size:14px; z-index:4; }
#game-shell .is-repaired .bench-test { visibility:hidden; }
.is-repaired .bench-machine { border-color:#80c99b; }
.is-repaired .bench-feedback { align-self:start; margin-top:2px; }
.bench-patch,.bench-pipes { display:grid; gap:3px; }
.bench-patch { grid-template-columns:repeat(var(--bench-columns,4),var(--bench-cell)); }
.bench-pipes { grid-template-columns:repeat(var(--bench-columns,3),var(--bench-cell)); grid-template-rows:repeat(var(--bench-rows,3),var(--bench-cell)); }
#game-shell .bench-square,#game-shell .bench-pipe { width:var(--bench-cell); height:var(--bench-cell); min-width:44px; min-height:44px; padding:0; }
#game-shell .bench-square { background:#273e43; border-color:#71837c; color:#e4d9b8; }
#game-shell .bench-square.is-filled { background:#cfab62; color:#163039; }
#game-shell .bench-square[data-part="1"] { background:#a9c9bf; }
#game-shell .bench-square[data-part="2"] { background:#daa38f; }
#game-shell .bench-square[data-part="3"] { background:#b5afcb; }
#game-shell .bench-square[data-part="4"] { background:#99b685; }
#game-shell .bench-square[data-part="5"] { background:#d4b494; }
#game-shell .bench-pipe { background:#334950; border-color:#8b9f99; }
.bench-pipe svg { fill:#4d696e; stroke:#99a69e; }
.bench-pipe .bench-pipe-run { stroke-width:19; fill:none; }
.bench-pipe.has-flow .bench-pipe-run { stroke:#75c4ce; }
.bench-pipe-frame { display:grid; grid-template-columns:44px auto 44px; gap:4px; align-items:center; }
.bench-port { font:800 12px/1.3 ui-monospace,monospace; color:#ffda80; grid-row:1; }
.bench-port:first-child { align-self:start; margin-top:calc((var(--in-row) - 1)*(var(--bench-cell) + 3px) + 16px); }
.bench-port:last-child { grid-column:3; align-self:start; margin-top:calc((var(--out-row) - 1)*(var(--bench-cell) + 3px) + 16px); }
.bench-pipes { grid-column:2; grid-row:1; }
.bench-knobs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; width:100%; max-width:500px; }
.bench-knob { display:grid; justify-items:center; gap:6px; }
.bench-knob-label { font-size:14px; background:#142e35e0; padding:3px; }
.bench-wheel { width:96px; height:96px; position:relative; }
.bench-wheel svg { width:100%; height:100%; fill:#b7a982; stroke:#324950; stroke-width:4; }
.bench-knob-number { position:absolute; inset:0; display:grid; place-items:center; font:800 30px ui-monospace,monospace; color:#173039; }
.bench-adjust { display:grid; grid-template-columns:repeat(2,minmax(44px,1fr)); gap:7px; }
@media(max-width:600px) {
  .repair-bench { --bench-cell:44px; gap:6px; grid-template-rows:auto minmax(0,1fr) 88px; }
  .bench-instruction { font-size:13px; } .bench-clue { font-size:12px; padding:5px 6px; }
  .bench-work { grid-template-columns:minmax(0,1fr) 106px; gap:6px; }
  .bench-machine { padding:5px; }.bench-assembly { gap:6px; }
  .bench-parts { gap:6px; }.bench-rack-label { font-size:10px; }
  #game-shell .bench-part { height:70px; padding:3px; }.bench-stamp { font-size:12px; }
  .bench-slots { gap:4px; }.bench-socket-label { font-size:10px; }
  #game-shell .bench-socket { height:73px; padding:3px; min-width:44px; }.bench-live { font-size:10px; }
  .bench-reference,.bench-balance-beam { font-size:11px; padding:4px; }
  .bench-tools { gap:0; }
  .bench-bottom { grid-template-columns:66px minmax(0,1fr) 80px; gap:6px; }.bench-feedback { font-size:11px; }
  #game-shell .bench-tools .bench-button { font-size:10px; padding:3px; }
  .bench-knobs { gap:8px; }.bench-wheel { width:78px; height:78px; }.bench-knob-label { font-size:12px; }
  .bench-pipe-frame { grid-template-columns:36px auto 36px; gap:2px; }.bench-port { font-size:10px; }
  #game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode,#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode,#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode { padding:10px; width:calc(100vw - 12px); height:calc(100dvh - 104px); max-height:calc(100dvh - 104px); }
}
@media(max-height:550px) and (min-width:480px) {
  #game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode,#game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode,#game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode { width:calc(100vw - 12px); height:calc(100dvh - 12px); max-height:calc(100dvh - 12px); padding:8px; }
  .repair-bench { --bench-cell:44px; gap:4px; grid-template-rows:auto minmax(0,1fr) 48px; }.bench-top { gap:2px; }
  .bench-instruction { font-size:12px; }.bench-clue { font-size:12px; padding:3px 6px; }
  .bench-work { grid-template-columns:minmax(0,1fr) 210px; gap:6px; }.bench-machine { padding:4px; }.bench-assembly { gap:4px; }
  .bench-parts { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; } #game-shell .bench-part { height:48px; }
  .bench-rack { align-self:start; }
  .bench-machine { align-content:start; }
  .bench-machine:has(.bench-patch) { padding:1px; }
  .bench-slots:is([data-mode="wires"],[data-mode="program"],[data-mode="balance"]) { grid-template-columns:repeat(4,minmax(0,1fr)); }
  #game-shell .bench-socket { height:66px; }.bench-socket-label { font-size:10px; }.bench-live,.bench-reference,.bench-balance-beam { font-size:11px; }
  .bench-tools { display:flex; }.bench-bottom { grid-template-columns:140px minmax(0,1fr) 80px; }.bench-feedback { font-size:11px; }
  #game-shell .bench-test { width:60px; height:60px; font-size:15px; }.bench-wheel { width:68px;height:68px; }.bench-knob-label { font-size:11px; }.bench-adjust { grid-template-columns:repeat(4,44px); gap:5px; }
}

@media(max-width:380px) {
  .bench-work:has(.bench-patch) { grid-template-columns:minmax(191px,1fr) 92px; gap:4px; }
  .bench-work:has(.bench-patch) .bench-machine { padding:1px; }
  .bench-work:has(.bench-patch) .bench-parts { grid-template-columns:repeat(2,44px);gap:4px; }
  #game-shell .bench-work:has(.bench-patch) .bench-part { height:60px; }
}
@media(max-height:360px) and (min-width:480px) {
  .bench-instruction { display:none; }
  .bench-clue { font-size:11px; line-height:1.2; }
  .bench-feedback { font-size:10px; }
  .bench-bottom { gap:5px; }
}
/* Small-height portrait windows use the whole overlay frame, like landscape. */
@media(max-height:600px) and (max-width:600px) {
  #game-shell[data-ui-layout] #mission-dialogue-console.is-bench-mode,
  #game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode,
  #game-shell[data-ui-layout] #beach-dialogue-console.is-bench-mode { height:calc(100dvh - 12px);max-height:calc(100dvh - 12px); }
}
@media(max-height:480px) and (max-width:479px) {
  .bench-instruction { display:none; }
  #game-shell .bench-part { height:48px; }
  .bench-tools { display:grid;grid-template-columns:repeat(2,44px);gap:2px; }
  .bench-bottom { grid-template-columns:90px minmax(0,1fr) 80px; }
  .repair-bench { grid-template-rows:auto minmax(0,1fr) 80px;gap:4px; }
  #game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode { grid-template-rows:auto minmax(0,1fr); }
  #game-shell[data-ui-layout] #backyard-activity-panel.is-bench-mode #backyard-activity-title { display:none; }
}
@media(prefers-reduced-motion:no-preference) {
  .is-repaired .bench-socket-group:has(svg polygon) svg { animation:bench-gears-turn 8s linear infinite; }
}
@keyframes bench-gears-turn { to { transform:rotate(360deg); } }
body.reduce-motion .is-repaired .bench-socket svg { animation:none; }
