/* Layout: full-height workbench. Parts rail on the left, the 3D build plate fills the rest; on phones the plate sits on top. */
/* Bridge from the app's older variable names to the design tokens (tokens.css). The old light theme is gone: the app is dark only.
   As each component is restyled it moves to the token names directly, and these aliases shrink. */
:root {
  --bg: var(--navy); --panel: var(--blueprint); --ink: var(--paper);
  --accent: var(--yellow); --accent-ink: var(--yellow-ink); --accent-soft: var(--raise);
  --hot: var(--danger); --hot-soft: rgba(255, 122, 92, .16);
  --scene: var(--navy);
  --mono: var(--body);
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font: var(--t-body); }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.app { height: 100%; display: grid; grid-template-columns: minmax(300px, 370px) 1fr; }
.panel { overflow: auto; background: var(--panel); padding: var(--s4) var(--s4) 40px; display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.stage { position: relative; min-width: 0; min-height: 0; background: var(--scene); overflow: hidden; }
#c { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.brand h1 { margin: 0; line-height: 0; }
.brand h1 img { display: block; height: 40px; width: auto; }

.sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: calc(var(--s3) + var(--weight));
  background-image: linear-gradient(90deg, var(--faint) var(--dash), transparent var(--dash)); background-size: calc(var(--dash) + var(--gap)) var(--weight); background-position: 0 100%; background-repeat: repeat-x; }
.sec h2 { margin: 0; font: var(--t-head); letter-spacing: var(--track-head); text-transform: uppercase; color: var(--paper); }
.sec-h .aside { font: var(--t-small); color: var(--muted); }

.search::placeholder, textarea::placeholder { color: var(--muted); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.btn { font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: 10px 14px; border-radius: var(--radius); border: var(--rule-solid); background-color: transparent; color: var(--paper); cursor: pointer; white-space: nowrap; }
.btn:hover { background-color: var(--raise); }
.btn:active { translate: 0 1px; transition: translate var(--press); }
.btn.dashed { border: 1.5px solid transparent; }
.btn.primary { background-color: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.btn.primary:hover { background-color: var(--yellow-hover); }
.btn.solid { background-color: var(--paper); color: var(--blueprint); border-color: var(--paper); }
.btn.solid:hover { background-color: var(--muted); border-color: var(--muted); }
a.btn { display: inline-block; text-decoration: none; }
.btn.small { padding: 7px 10px; font-size: 15px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .btn:active, .tb:active { translate: none; } }
.hint { margin: 0; font: var(--t-small); color: var(--muted); }
details.more > summary { cursor: pointer; font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; color: var(--paper); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; width: fit-content; }
details.more > summary:hover { color: var(--yellow); }
details.more[open] > summary { margin-bottom: 8px; }
textarea { width: 100%; min-height: 96px; resize: vertical; font: var(--t-field); line-height: 1.5; padding: 10px 12px; border: 1.5px solid var(--line); background: var(--sunk); color: var(--paper); border-radius: var(--radius); }
.msg { font: var(--t-small); padding: 8px 10px; border-radius: var(--radius); background: var(--navy); border: 1.5px solid var(--yellow); }
.msg.warn { border-color: var(--danger); }
.msg:empty { display: none; }

.tray { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tray-item { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--radius); border: 1.5px solid transparent; cursor: pointer; }
.tray-item:hover { background: var(--raise); }
.tray-item.active { background: var(--raise); border-color: var(--yellow); }
.tray-item img { width: 40px; height: 40px; }
.tray-item .nm { min-width: 0; }
.tray-item .nm b { font: var(--t-num); font-variant-numeric: tabular-nums; }
.tray-item .nm span { display: block; font: var(--t-small); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { font: var(--t-num); font-variant-numeric: tabular-nums; padding: 3px 7px; border-radius: var(--radius); background: var(--sunk); border: 1.5px solid var(--line); white-space: nowrap; }
.count.done { border-color: var(--accent); color: var(--accent); }
.count.over { border-color: var(--danger); color: var(--danger); }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 6px; border-radius: var(--radius); }
.x:hover { color: var(--hot); }
.tray-empty { font: var(--t-small); color: var(--muted); padding: calc(10px + var(--weight)); border-radius: var(--radius); }

.unknown { display: block; cursor: default; background: var(--hot-soft); border-color: transparent; padding: 10px; }
.unknown:hover { background: var(--hot-soft); }
.unknown p { margin: 0 0 8px; font-size: 13px; }
.defform { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.defform input, .defform select { width: 100%; }
.defform label { min-width: 0; display: flex; flex-direction: column; gap: 3px; font: 800 13px/1 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: var(--track); }
.defform .wide { grid-column: 1 / -1; }
.defform input, .defform select { color: var(--paper); padding: 7px 8px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--sunk); font: var(--t-field); text-transform: none; letter-spacing: 0; min-width: 0; }
.defform .acts { grid-column: 1 / -1; display: flex; gap: 6px; justify-content: flex-end; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 7px; border-radius: var(--radius); background-color: var(--panel); position: sticky; top: 0; z-index: 2; }
.tabs::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: var(--s4); background: var(--panel); }   /* keeps parts out of the space above the stuck tabs */
/* Dashed = a container or something not active yet. Solid = active or pressable now (see DESIGN.md). Drawn as backgrounds so the gap can be set. */
.tabs, .drop, .tray-empty, .chip:not([aria-pressed="true"]), .btn.dashed, .marquee {
  --c: var(--faint);
  background-image:
    linear-gradient(90deg, var(--c) var(--dash), transparent var(--dash)), linear-gradient(90deg, var(--c) var(--dash), transparent var(--dash)),
    linear-gradient(180deg, var(--c) var(--dash), transparent var(--dash)), linear-gradient(180deg, var(--c) var(--dash), transparent var(--dash));
  background-size: calc(var(--dash) + var(--gap)) var(--weight), calc(var(--dash) + var(--gap)) var(--weight), var(--weight) calc(var(--dash) + var(--gap)), var(--weight) calc(var(--dash) + var(--gap));
  background-position: 0 0, 0 100%, 0 0, 100% 0; background-repeat: repeat-x, repeat-x, repeat-y, repeat-y; background-origin: border-box;
}
.drop:hover, .drop.over, .app.dragging .drop, .chip:not([aria-pressed="true"]):hover, .btn.dashed:hover { --c: var(--paper); }
.tab { font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: 11px 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--paper); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tab:hover { background: var(--raise); }
.tab[aria-selected="true"] { background: var(--yellow); color: var(--yellow-ink); }
.tabcount { font: var(--t-num); font-variant-numeric: tabular-nums; opacity: .85; }
.tabcount:empty { display: none; }
.tabpanel { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.tabpanel[hidden] { display: none !important; }
.bom tbody tr { cursor: pointer; }
.bom tbody tr:hover td { background: var(--raise); }
.part { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(8px + var(--weight)) 4px calc(7px + var(--weight)); border-radius: var(--radius); border: 0; background-color: var(--raise); color: var(--paper); cursor: pointer; text-align: center; min-width: 0; }
.part:hover { box-shadow: inset 0 0 0 1.5px var(--line); }
.part.active, .part.active:hover { box-shadow: inset 0 0 0 1.5px var(--yellow); }   /* chosen now: solid */
#outline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.marquee { position: absolute; pointer-events: none; --c: var(--paper); background-color: color-mix(in srgb, var(--paper) 10%, transparent); }
.marquee[hidden] { display: none; }
#c.can-grab { cursor: grab; }
#c.can-pick { cursor: pointer; }
#c.grabbing { cursor: grabbing; }
.colorpick { position: relative; }
.colorpick[hidden], .colorpick .bar[hidden], .selinfo[hidden] { display: none; }
/* With a selection the bar becomes a card beside the mode toolbar, the same height: the piece, then its color as a button. The picker opens over the view. */
.colorpick.inline { flex: 1 1 0; min-width: min(440px, 100%); pointer-events: none; }
.colorpick.inline > * { pointer-events: auto; }
.colorpick.inline > .bar { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 0; max-width: 100%; padding: var(--s1); background: var(--panel); border: 1px solid var(--hairline); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.colorpick.inline #tColor { height: 44px; flex: none; gap: var(--s2); padding: 0 var(--s3); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.colorpick.inline #tColor .cdot { width: 20px; }
.sep { width: 1px; height: 28px; flex: none; align-self: center; background: var(--hairline); }
.sep[hidden] { display: none; }
.selacts { display: flex; gap: var(--s1); margin-right: calc(-1 * var(--s1)); }
.selacts[hidden], .selacts .tb[hidden] { display: none; }
.selacts .tb { width: 44px; height: 44px; flex: none; justify-content: center; padding: 0; }
.selacts .tb .ic { width: 20px; height: 20px; }
.selinfo { display: flex; gap: var(--s3); align-items: center; min-width: 0; padding: 0 var(--s3) 0 var(--s1); }
.selinfo img { width: 44px; height: 44px; flex: none; object-fit: contain; }
.selinfo > div { min-width: 0; max-width: 320px; }
.selinfo .nm { font: var(--t-label); margin-bottom: var(--s1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selinfo .sub { font: var(--t-num); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selinfo dl div { display: flex; gap: var(--s2); }
.selinfo dt, .selinfo .muted { color: var(--muted); }
.selinfo dd { margin: 0; }
.selinfo ul { max-height: 96px; overflow: auto; }
.modes { align-items: center; gap: var(--s1); background: var(--panel); border: 1.5px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.modes .tb { width: 44px; height: 44px; justify-content: center; padding: 0; }
.modes .tb .ic { width: 24px; height: 24px; }
.modes .tb[aria-pressed="true"] { background: var(--paper); color: var(--blueprint); }
.modes .tb[aria-pressed="true"]:hover:not(:disabled) { background: var(--paper); }   /* or the general hover would put a dark fill under the dark icon */
.cdot { width: 18px; flex: none; }
.cdot[hidden] { display: none; }
.palette { max-height: calc(100vh - 90px); overflow: auto; position: absolute; top: calc(100% + 6px); left: 0; width: min(300px, calc(100vw - 32px)); padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.palette h2 { margin: 0; }
.drop { display: flex; flex-direction: column; gap: 4px; padding: calc(var(--s5) + var(--weight)); border: 0; border-radius: var(--radius); background-color: transparent; cursor: pointer; text-align: center; }
.drop b { font: var(--t-head); letter-spacing: var(--track-head); text-transform: uppercase; }
.drop span { font: var(--t-small); color: var(--muted); }
.drop:hover, .drop.over { background-color: var(--raise); }
.app.dragging .drop { background-color: var(--raise); }
.shots { display: flex; flex-direction: column; gap: 10px; }
.shots:empty { display: none; }
.shot { display: grid; grid-template-columns: 72px minmax(0, 1fr); min-width: 0; gap: 10px; padding: 10px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--raise); }
.shot > img { width: 72px; height: 72px; object-fit: contain; border-radius: var(--radius); background: var(--navy); }
.shot .body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.shot .note { font: var(--t-small); color: var(--muted); margin: 0; }
.pill { align-self: flex-start; font: 800 13px/1 var(--body); letter-spacing: var(--track); text-transform: uppercase; padding: 5px 8px; border-radius: var(--radius); border: 1.5px solid var(--line); }
.pill.ok { color: var(--accent); border-color: var(--accent); }
.pill.new { color: var(--ink); }
.pill.need { color: var(--hot); border-color: var(--hot); }
.pill.busy { color: var(--muted); }
.shot .shapeonly { display: contents; }
.shot .shapeonly[hidden] { display: none !important; }
.tray-item img.photo, .bom img.photo { object-fit: contain; border-radius: var(--radius); background: var(--raise); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(28px, 1fr)); gap: 6px; }
.sw { aspect-ratio: 1; max-width: 100%; border: 0; border-radius: var(--radius); cursor: pointer; position: relative; display: block; padding: 0; background: transparent; }
span.sw { display: inline-block; cursor: inherit; }
/* the chosen color: a yellow frame, drawn as its own box so its corners stay at --radius (an offset outline rounds them) */
.sw[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border: 2px solid var(--yellow); border-radius: var(--radius); pointer-events: none; }
/* A swatch is a square. Order status: greyed and struck through = can't order, "?" = not tested yet. The mark carries it,
   not color alone; the words are in the tooltip. */
.sw .brick, .sw .fill, .sw .slash { position: absolute; inset: 0; }
.sw .fill { border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--hairline); }
.sw.trans .fill { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 3px, transparent 3px 7px) !important; }
.sw .slash { background: linear-gradient(to top right, transparent calc(50% - 2.5px), var(--navy) calc(50% - 2.5px) calc(50% - 1px), var(--paper) calc(50% - 1px) calc(50% + 1px), var(--navy) calc(50% + 1px) calc(50% + 2.5px), transparent calc(50% + 2.5px)); }
.sw .mk { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; display: grid; place-items: center; border-radius: var(--radius); background: var(--navy); color: var(--paper); font: var(--t-num); font-size: 11px; font-style: normal; pointer-events: none; }
.swnote { margin: 0; color: var(--muted); font: var(--t-small); }
.swnote:empty { display: none; }
.tip { position: fixed; z-index: 20; max-width: min(260px, calc(100vw - 16px)); padding: var(--s2) var(--s3); border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--navy); color: var(--paper); font: var(--t-small); white-space: pre-line; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.tip[hidden] { display: none; }
.colorname { display: inline-flex; align-items: center; gap: var(--s2); font: var(--t-body); }
.colorname .sw { width: 18px; flex: none; }

/* Search and category stay under the tabs while the parts scroll (--tabs-h is measured by app.js). With "Add another way" open it is too tall to pin. */
.pinned { display: flex; flex-direction: column; gap: 10px; position: sticky; top: var(--tabs-h, 52px); z-index: 2; margin: calc(-1 * var(--s2)) 0; padding: var(--s2) 0 var(--s4); background: var(--panel); }
.pinned:has(#otherWays[open]) { position: static; }
.filterrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); }
.filterrow details[open] { flex-basis: 100%; }
.catpick { position: relative; display: inline-flex; max-width: 100%; }
.catpick[hidden] { display: none; }
.catbtn { display: inline-flex; align-items: center; gap: var(--s4); font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: var(--s2) var(--s3); border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--sunk); color: var(--paper); cursor: pointer; }
.catbtn:hover { background: var(--raise); }
.catlist { position: absolute; top: calc(100% + var(--s1)); left: 0; z-index: 5; min-width: max(100%, 200px); max-height: 60vh; overflow: auto; display: flex; flex-direction: column; padding: var(--s1); border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.catlist[hidden] { display: none; }
.catlist button { flex: none; text-align: left; font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: var(--s3); border: 0; border-radius: var(--radius); background: transparent; color: var(--paper); cursor: pointer; }
.catlist button:hover, .catlist button:focus-visible { background: var(--raise); }
.catlist button[aria-selected="true"] { background: var(--paper); color: var(--blueprint); }
.ways { display: flex; flex-direction: column; gap: 10px; }
.offer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.more-parts { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: 6px 11px; border-radius: var(--radius); border: 1.5px solid var(--line); background-color: transparent; color: var(--paper); cursor: pointer; }
.chip[aria-pressed="true"] { background-color: var(--paper); color: var(--blueprint); border-color: var(--paper); }
.chip:not([aria-pressed="true"]) { border-color: transparent; }
.search { font: var(--t-field); padding: 10px 12px; border: 1.5px solid var(--line); background: var(--sunk); color: var(--paper); border-radius: var(--radius); width: 100%; }
.shelf { grid-column: 1 / -1; margin: var(--s3) 0 0; font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; color: var(--paper); }
.shelf:first-child { margin-top: 0; }
.catlist button small { font: var(--t-num); color: var(--muted); margin-left: var(--s3); float: right; }
.catlist button[aria-selected="true"] small { color: var(--blueprint); }
.part { content-visibility: auto; contain-intrinsic-size: auto 104px; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }

.part img { width: 56px; height: 56px; }
.part b { font: var(--t-num); font-variant-numeric: tabular-nums; color: var(--muted); }
.part span { font: 14px/1.2 var(--body); color: var(--paper); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.bomwrap { overflow-x: auto; }
table.bom { width: 100%; border-collapse: collapse; font: var(--t-body); font-variant-numeric: tabular-nums; }
.bom td { padding: var(--s2) var(--s1); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.bom td.pic { width: 44px; }
.bom td.q { text-align: right; padding-right: var(--s3); font: var(--t-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bom img { width: 36px; height: 36px; display: block; }
.bom .nm, .bom .meta { display: block; }
.bom .nm { font: var(--t-small); color: var(--paper); }
.bom .meta { font: var(--t-small); color: var(--muted); }
.bom a { color: var(--muted); font: var(--t-num); font-variant-numeric: tabular-nums; }
.bom a:hover { color: var(--yellow); }
.buildfiles { display: flex; flex-direction: column; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.buildfiles .pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); align-self: stretch; }
.buildfiles [hidden] { display: none; }
#tExample { align-self: stretch; }
.linkbtn { font: var(--t-label); letter-spacing: var(--track); text-transform: uppercase; padding: var(--s2); border: 0; border-radius: var(--radius); background: transparent; color: var(--danger); text-decoration: underline; text-decoration-thickness: var(--weight); text-underline-offset: 4px; cursor: pointer; }
.bom td.warncell { width: 32px; padding-left: 0; padding-right: 0; }
.warnmark { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--danger); cursor: help; }
.warnmark .ic { width: 16px; height: 16px; }
#orderReport:empty { display: none; }
.done { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); padding: var(--s4); border-radius: var(--radius); background: var(--raise); }
.done h2 { display: flex; align-items: center; gap: var(--s2); }
.done h2 .ic { width: 20px; height: 20px; color: var(--ok); }
.done p { margin: 0; font: var(--t-small); color: var(--muted); }
.done details.more[open] > summary { margin-bottom: var(--s3); }
.done details > * + * { margin-top: var(--s3); }
.byhand ul { display: flex; flex-direction: column; gap: var(--s2); margin: 0; padding: 0; list-style: none; font: var(--t-small); }
.done a { color: var(--yellow); }
.done ol a { color: inherit; }   /* the site name is not set apart from the words around it */
.done ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); counter-reset: step; font: var(--t-body); }
.done ol li { counter-increment: step; display: flex; align-items: center; gap: var(--s3); }
.done ol li::before { content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; flex: none; border: 1.5px solid var(--line); border-radius: var(--radius); font: var(--t-num); }
.row { display: flex; flex-wrap: wrap; gap: 6px; }

/* HUD over the 3D view */
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: var(--radius); background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--hairline); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tb { display: inline-flex; align-items: center; gap: 6px; font: var(--t-label); font-size: 15px; letter-spacing: var(--track); text-transform: uppercase; padding: 8px 10px; border-radius: var(--radius); border: 0; background: transparent; color: var(--paper); cursor: pointer; }
.tb .ic { width: 18px; height: 18px; flex: none; }
.tb:active:not(:disabled) { translate: 0 1px; transition: translate var(--press); }
.tb:hover:not(:disabled) { background: var(--raise); }
.tb:disabled { opacity: .38; cursor: default; }
.tb kbd { font: var(--t-num); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 1px 4px; text-transform: none; letter-spacing: 0; }
.boot { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--scene); color: var(--muted); font-size: 14px; }
.boot.failed { color: var(--hot); }
.notice { position: absolute; left: 12px; right: 12px; bottom: 76px; z-index: 3; display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 8px 8px 12px; border-radius: var(--radius); background: var(--navy); border: 1.5px solid var(--danger); font: var(--t-body); }
.notice.info { border-color: var(--yellow); }
.hud-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; pointer-events: none; font: var(--t-num); color: var(--muted); }
.helpwrap { position: relative; margin-left: auto; pointer-events: auto; }
.help { width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: var(--yellow); color: var(--yellow-ink); font: 800 24px/1 var(--body); position: relative; cursor: pointer; }
.help::before, .help::after { content: ""; position: absolute; top: -6px; width: 10px; height: 6px; background: var(--yellow); }
.help::before { left: 7px; } .help::after { right: 7px; }
.help:hover, .help:hover::before, .help:hover::after { background: var(--yellow-hover); }
.helppop { position: absolute; right: 0; bottom: calc(100% + 14px); z-index: 6; width: min(340px, calc(100vw - 32px)); max-height: min(560px, calc(100svh - 110px)); overflow: auto; padding: var(--s3); display: flex; flex-direction: column; gap: var(--s3); border-radius: var(--radius); background: var(--panel); border: 1.5px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35); color: var(--paper); text-align: left; }
.helppop h2 { margin: 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.actions .tb kbd { margin-left: auto; }
.keys { margin: 0; padding-top: var(--s2); border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 4px; font: var(--t-small); }
.keys div { display: grid; grid-template-columns: 104px 1fr; gap: var(--s2); }
.keys dt { color: var(--paper); font-weight: 700; }
.keys dd { margin: 0; color: var(--muted); }
.example-tag { font: 600 11px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

@media (max-width: 820px) {
  html, body { height: auto; }
  .app { grid-template-columns: 1fr; height: auto; }
  .stage { order: -1; height: 62svh; }
  .panel { border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  #catalog { max-height: 60svh; overflow: auto; }   /* hundreds of parts: they scroll in place, so the page stays short */
  .pinned { position: static; }
  .tb kbd { display: none; }
  .colorpick.inline > .bar { flex-wrap: wrap; }
  .colorpick.inline .sep { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* text for screen readers only */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#c:focus-visible { outline-offset: -3px; }

.helppop .foot { padding-top: var(--s2); border-top: 1px solid var(--hairline); }
.helppop .foot a { color: var(--yellow); }
body.about { overflow: auto; height: auto; }
body.about main { max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; line-height: 1.55; }
body.about h1 { font-size: 22px; } body.about h2 { font-size: 15px; margin-top: 28px; }
body.about a { color: var(--accent); }
