@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }

/* Palette: the grey of a parts tray for the stage, machinist's layout blue for anything operated, and the yellow of
   gear marking compound for one thing only: the compound on the teeth, on the model and in the diagrams. */
:root {
  --drape: #E4E6E7;
  --drape-2: #C4C9CD;
  --paper: #F6F7F7;
  --ink: #171B1E;
  --ink-2: #555D63;
  --line: #CBD0D3;
  --tool: #2346B0;
  --tool-ink: #FFFFFF;
  --tool-soft: #DFE6F7;
  --warn: #8F3A10;
  --warn-soft: #F6E3D6;
  --tag: #F2B705;
  --wiped: #2B3035;
  --halo: rgba(228, 230, 231, 0.92);
  --display: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --drape: #1F2326; --drape-2: #101315; --paper: #15181A; --ink: #E7EAEC; --ink-2: #9BA4AA; --line: #2D3337;
    --tool: #8FA9F5; --tool-ink: #0A1B4A; --tool-soft: #1C2742; --warn: #F2B08A; --warn-soft: #3A2317;
    --halo: rgba(31, 35, 38, 0.9); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --drape: #1F2326; --drape-2: #101315; --paper: #15181A; --ink: #E7EAEC; --ink-2: #9BA4AA; --line: #2D3337;
  --tool: #8FA9F5; --tool-ink: #0A1B4A; --tool-soft: #1C2742; --warn: #F2B08A; --warn-soft: #3A2317;
  --halo: rgba(31, 35, 38, 0.9); color-scheme: dark;
}

html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  height: 100%; margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--tool); outline-offset: 2px; }

#app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font: 600 24px/1.1 var(--display); letter-spacing: 0.005em; }
.top p { margin: 1px 0 0; font-size: 13px; color: var(--ink-2); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.top .brand { flex: none; font: 700 15px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }

main { display: grid; grid-template-columns: minmax(0, 1fr) 388px; min-height: 0; }

/* segmented controls and toggles: anything you operate is layout blue */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); overflow: hidden; flex: none; }
.seg button { border: 0; background: none; padding: 6px 11px; font-size: 13.5px; line-height: 1.25; white-space: nowrap; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--tool); color: var(--tool-ink); }
.tog { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); padding: 6px 11px; font-size: 13.5px; line-height: 1.25; white-space: nowrap; flex: none; }
.tog[aria-pressed="true"] { background: var(--tool-soft); border-color: var(--tool); }
.tog.plain { background: var(--paper); }

/* ------------------------------ stage ------------------------------ */
#stage {
  position: relative; min-height: 0; min-width: 0; overflow: hidden; touch-action: none;
  background: radial-gradient(115% 95% at 50% 44%, var(--drape) 0%, var(--drape) 38%, var(--drape-2) 100%);
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline: none; }
#gl:active { cursor: grabbing; }
#gl:focus-visible { outline: 2px solid var(--tool); outline-offset: -3px; }
#leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#leaders .lead { fill: none; stroke: var(--ink); stroke-opacity: 0.5; stroke-width: 1; }
#leaders .dot { fill: var(--ink); fill-opacity: 0.85; }
#leaders .on.lead { stroke: var(--tool); stroke-opacity: 1; stroke-width: 1.5; }
#leaders .on.dot { fill: var(--tool); }
#labels { position: absolute; inset: 0; pointer-events: none; }
.lbl {
  position: absolute; left: 0; top: 0; pointer-events: auto; border: 0; background: none; padding: 2px 3px; margin: 0;
  font: 500 14px/1.15 var(--display); color: var(--ink); white-space: nowrap; will-change: transform;
  text-shadow: 0 0 3px var(--halo), 0 0 3px var(--halo), 0 0 6px var(--halo);
}
.lbl:hover, .lbl.on { color: var(--tool); }
.lbl.on { font-weight: 600; }
.compact .lbl { font-size: 12.5px; }

.bar { position: absolute; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.bar::-webkit-scrollbar { display: none; }
.bar > * { pointer-events: auto; }
.bar.scenes { top: 12px; }
.bar.display { bottom: 12px; right: 136px; }
.bar .cap { font-size: 13px; color: var(--ink-2); flex: none; margin-left: 4px; text-shadow: 0 0 4px var(--halo); }

#compass { position: absolute; right: 8px; bottom: 6px; width: 124px; height: 92px; pointer-events: none; overflow: visible; }
#compass line { stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
#compass text { font: 500 11px var(--sans); fill: var(--ink); dominant-baseline: middle; }

#hint {
  position: absolute; left: 50%; top: 56px; transform: translateX(-50%); margin: 0; padding: 5px 12px; border-radius: 6px;
  font-size: 13px; color: var(--ink-2); background: var(--halo); pointer-events: none; transition: opacity 0.4s; width: max-content; max-width: calc(100% - 24px); text-align: center;
}
#hint.gone { opacity: 0; }
#tip {
  position: absolute; left: 0; top: 0; pointer-events: none; padding: 3px 8px; border-radius: 4px; white-space: nowrap;
  font: 500 14px/1.3 var(--display); background: var(--ink); color: var(--paper);
}
#fail { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--ink-2); }

/* ------------------------------ panel ------------------------------ */
#panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-left: 1px solid var(--line); background: var(--paper); }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: 0; border-bottom: 2px solid transparent; background: none; padding: 11px 9px 9px; font-weight: 500; font-size: 14.5px; white-space: nowrap; color: var(--ink-2); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--tool); }
#scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 28px; touch-action: pan-y; }
#scroll section { padding-top: 14px; }
#scroll h2 { font: 600 18px/1.25 var(--display); margin: 20px 0 6px; }
#scroll h2:first-child { margin-top: 2px; }
#scroll p { margin: 0 0 10px; max-width: 62ch; }
#scroll ul { margin: 0 0 10px; padding-left: 18px; max-width: 62ch; }
#scroll li { margin-bottom: 5px; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
#scroll p.center { text-align: center; margin: 2px auto 0; }

/* selected structure: the left rule carries the structure's colour in the model */
#detail { margin: 14px 0 2px; padding: 2px 0 4px 13px; border-left: 5px solid var(--c, var(--line)); }
#detail .role { display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: 10px; background: var(--tool-soft); margin-bottom: 5px; }
#detail .role.avoid { background: var(--warn-soft); color: var(--warn); }
#detail h2 { font: 600 23px/1.15 var(--display); margin: 0; }
#detail .aka { font-size: 13.5px; color: var(--ink-2); margin: 1px 0 8px; }
#detail p { margin: 0 0 8px; }
.wand b, .where b { font-weight: 700; }
#detail .warn { background: var(--warn-soft); color: var(--warn); padding: 7px 10px; border-radius: 5px; font-size: 14px; }
#detail .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.group { margin-top: 14px; }
.group > header { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 5px; border-bottom: 1px solid var(--line); }
.group > header label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; flex: 1; cursor: pointer; }
.group > header .note { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.row input, .group > header input { accent-color: var(--tool); width: 16px; height: 16px; flex: none; margin: 0; }
.row button { flex: 1; display: flex; align-items: center; gap: 9px; border: 0; background: none; text-align: left; padding: 7px 2px; font-size: 14.5px; min-width: 0; }
.row button:hover { color: var(--tool); }
.row.on button { font-weight: 700; }
.row.off button { color: var(--ink-2); }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }

/* routes: depth strip, wall map, readout */
.field { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin: 10px 0; }
.field label { font-weight: 700; font-size: 14px; }
.field output { font-variant-numeric: tabular-nums; font-size: 14px; }
.field input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--tool); margin: 2px 0; }
#steps { border: 1px solid var(--tool); border-radius: 8px; background: var(--tool-soft); padding: 10px 14px 12px; margin: 0 0 12px; }
#scroll #steps h2 { margin: 2px 0 6px; }
#scroll #steps p { margin: 0 0 8px; }
#steps .acts { margin-top: 4px; }
.tog:disabled { opacity: 0.45; cursor: default; }
#scroll #routeHint { margin: 8px 0 2px; }
#stripBox { margin: 12px 0 4px; }
#strip { display: block; width: 100%; max-width: 330px; margin: 0 auto; touch-action: none; cursor: ew-resize; user-select: none; -webkit-user-select: none; overflow: visible; }
#strip .zone { stroke: var(--paper); stroke-width: 0.6; }
#strip .frame { fill: none; stroke: var(--ink); stroke-opacity: 0.4; stroke-width: 0.8; }
#strip .tick { stroke: var(--paper); stroke-width: 1.3; stroke-opacity: 0.9; }
#strip text { font: 500 10.5px var(--sans); fill: var(--ink-2); text-anchor: middle; }
#strip .smark { fill: var(--tag); stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
#scroll .zline { margin: 8px 0 3px; }
.zline button.link { margin-right: 0; padding: 0; font-size: inherit; }
#zoneOut { min-height: 3.2em; }
#map { display: block; width: 100%; max-width: 330px; margin: 6px auto 0; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
#map text { font: 500 11px var(--sans); fill: var(--ink-2); text-anchor: middle; dominant-baseline: middle; }
#map text.num { font: 600 14px var(--display); fill: var(--ink); }
#map .cell { stroke: var(--paper); stroke-width: 0.6; }
#map .none { fill: var(--line); fill-opacity: 0.55; }
#map .ring { fill: none; stroke: var(--ink); stroke-opacity: 0.55; stroke-width: 0.8; stroke-dasharray: 2 2; }
#map .mark { fill: var(--tag); stroke: var(--ink); stroke-width: 1.5; }
#map .spoke { stroke: var(--ink); stroke-width: 1.3; }
#hits { list-style: none; padding: 0; margin: 4px 0 10px; }
#hits li { margin: 0; }
#hits button { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center; width: 100%; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); background: none; padding: 7px 2px; text-align: left; font-size: 14.5px; }
#hits button:hover { color: var(--tool); }
#hits .d { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#hits .far { opacity: 0.6; }
#hits .empty { color: var(--ink-2); padding: 7px 2px; }
#probeWarn { background: var(--warn-soft); color: var(--warn); padding: 7px 10px; border-radius: 5px; font-size: 14px; margin: 0 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; cursor: pointer; }
.check input { accent-color: var(--tool); width: 16px; height: 16px; margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--ink-2); margin: 8px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
#stripLegend { justify-content: center; margin-top: 4px; }

/* ------------------------------ notes ------------------------------ */
/* your own notes carry a solid blue rule; notes someone sent you carry a dashed grey one, so the two are never confused */
.row.noted button::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tool); margin-left: auto; flex: none; }
textarea { display: block; width: 100%; font: inherit; font-size: 16px; /* under 16px, iOS zooms the page when the box is tapped */ color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; resize: vertical; }
textarea.mono { font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.notesbox { margin: 12px 0 4px; }
#scroll h3 { font: 700 13.5px/1.3 var(--sans); margin: 12px 0 5px; }
#scroll ul.notes, #scroll ul.pick { list-style: none; padding: 0; margin: 0 0 8px; }
.anote { border-left: 3px solid var(--tool); padding: 3px 0 3px 10px; margin: 0 0 9px; }
.anote.shared { border-left: 3px dashed var(--ink-2); }
.anote .loc { font-weight: 700; font-size: 13.5px; }
#scroll .anote .txt, #scroll .msg { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 2px; }
.anote .acts { margin-top: 0; gap: 0; }
button.link { border: 0; background: none; padding: 3px 0; margin-right: 14px; color: var(--tool); font-size: 13.5px; text-decoration: underline; text-underline-offset: 2px; }
.tog.go { background: var(--tool); color: var(--tool-ink); border-color: var(--tool); }
.tog.go:disabled { opacity: 0.45; cursor: default; }
.tog.danger { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.editor { margin: 4px 0 8px; }
.editor .count { margin-left: auto; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lab { display: block; font-weight: 700; font-size: 14px; margin: 10px 0 4px; }
.work { margin-top: 10px; }
.pick .check { align-items: flex-start; margin: 6px 0; }
.pick .check input { margin-top: 3px; flex: none; }
.pick .check span { overflow-wrap: anywhere; }
#scroll p.warn { background: var(--warn-soft); color: var(--warn); padding: 7px 10px; border-radius: 5px; font-size: 14px; margin: 10px 0; }
#scroll .msg { font: 500 17px/1.45 var(--display); margin: 0 0 8px; }
.incoming { border: 1px solid var(--tool); border-radius: 8px; background: var(--tool-soft); padding: 12px 14px 12px; margin: 14px 0 12px; }
#scroll .incoming h2 { margin-top: 0; }
.set { border-top: 1px solid var(--line); padding-top: 9px; margin-top: 10px; }
.flash { background: var(--tool-soft); padding: 6px 10px; border-radius: 5px; font-size: 14px; }
.qr { display: block; width: 216px; max-width: 100%; margin: 12px 0 6px; border-radius: 4px; }
#scroll .out-links { list-style: none; padding: 0; }
#scroll .out-links a, #tab-guide a { color: var(--tool); text-underline-offset: 2px; }
#scroll .owner { border: 1px dashed var(--warn); color: var(--warn); padding: 7px 10px; border-radius: 5px; font-size: 13.5px; }
input[type="file"] { display: block; font-size: 13.5px; margin: 8px 0 2px; max-width: 100%; }
#map .pin { fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; pointer-events: none; }
#map .pin.shared { fill: var(--paper); stroke: var(--ink); }

/* first-run notice */
#first { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px)); background: rgba(10, 14, 12, 0.55); }
#first .sheet { background: var(--paper); color: var(--ink); border-radius: 10px; padding: 20px 22px 18px; max-width: 440px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28); }
#first h2 { font: 600 23px/1.2 var(--display); margin: 0 0 8px; }
#first p { margin: 0 0 10px; }
#first .acts { margin-top: 4px; gap: 10px; }
#first .go { border: 0; border-radius: 6px; background: var(--tool); color: var(--tool-ink); padding: 9px 16px; font-weight: 500; }
#first .tog { padding: 9px 14px; font-size: inherit; }
#walkCta { margin: 0 0 10px; }

/* ------------------------------ setup bench ------------------------------ */
/* walk-through steps: tools and figures as two-column lists */
#steps h3 { margin: 10px 0 4px; }
#scroll ul.kv { list-style: none; padding: 0; margin: 0 0 8px; border-top: 1px solid color-mix(in srgb, var(--tool) 35%, transparent); }
ul.kv li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 4px 0; margin: 0; border-bottom: 1px solid color-mix(in srgb, var(--tool) 22%, transparent); font-size: 14px; }
ul.kv b { font: 600 15.5px/1.2 var(--display); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* a tooth flank laid flat: yellow is marking compound, the dark patch is where the pinion has wiped it */
#tab-bench:not([hidden]) { display: flex; flex-direction: column; }
#tab-bench #steps.idle { order: 2; margin: 18px 0 0; }
.watch { position: sticky; top: 0; z-index: 3; background: var(--paper); margin: 0 -16px; padding: 6px 16px 7px; border-bottom: 1px solid var(--line); }
.pats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
#scroll .nums { display: flex; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; margin: 5px 0 0; font-size: 13.5px; color: var(--ink-2); max-width: none; }
.nums b { font: 600 17px/1 var(--display); color: var(--ink); font-variant-numeric: tabular-nums; margin-left: 2px; }
.nums b.bad { color: var(--warn); }
.pat { margin: 0; min-width: 0; }
.tooth { display: block; width: 100%; height: auto; }
.tooth .flank { fill: var(--tag); }
.tooth .edge { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.tooth .wiped { fill: var(--wiped); }
.tooth .target { fill: none; stroke: var(--wiped); stroke-opacity: 0.6; stroke-width: 1; stroke-dasharray: 3 2.5; }
.tooth text { font: 500 9.5px var(--sans); fill: var(--ink-2); }
.pat figcaption { font-size: 13px; text-align: center; color: var(--ink-2); margin-top: 1px; }
.pat figcaption b { color: var(--ink); font-weight: 700; }
#scroll .readout { margin: 10px 0 4px; }

/* a reading: the needle is the value, the blue band is the range the guide allows */
.reading { margin: 12px 0 0; }
.rhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rhead b { font-size: 14px; }
.rhead output { font: 600 20px/1.05 var(--display); font-variant-numeric: tabular-nums; text-align: right; }
.gauge { display: block; width: 100%; height: 22px; margin: 1px 0 0; }
.gauge .track { fill: var(--line); }
.gauge .band { fill: var(--tool-soft); stroke: var(--tool); stroke-width: 1; }
.gauge .pin { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.reading.bad output, .reading.bad .state { color: var(--warn); }
.reading.bad .pin { stroke: var(--warn); }
#scroll .reading p { margin: 0; }
#scroll .todo { margin: 14px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--tool-soft); border: 1px solid var(--tool); }

/* the three shim packs: each carries the color of its pack in the model */
.packs { margin: 14px 0 8px; border-top: 1px solid var(--line); }
.pack { padding: 9px 0 8px 11px; border-bottom: 1px solid var(--line); border-left: 5px solid var(--c); }
.pack.on { background: color-mix(in srgb, var(--c) 10%, transparent); }
.phead { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.pname { border: 0; background: none; padding: 0; display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; text-align: left; }
.pname:hover { color: var(--tool); }
.phead output { font-size: 13.5px; font-variant-numeric: tabular-nums; margin-left: auto; text-align: right; }
.pctl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; margin-top: 6px; }
.pctl input[type="range"] { width: 100%; accent-color: var(--tool); margin: 0; }
.tog.nudge { width: 38px; padding: 5px 0 6px; font-size: 18px; line-height: 1; text-align: center; }

[hidden] { display: none !important; }

/* ------------------------------ small screens ------------------------------ */
@media (max-width: 880px) {
  main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(260px, 53%) minmax(0, 1fr); }
  #panel { border-left: 0; border-top: 1px solid var(--line); }
  .top { padding: 8px 12px; }
  .top h1 { font-size: 19px; }
  .top p { display: none; }
  .top .brand { font-size: 12.5px; letter-spacing: 0.05em; }
  .top.branded p { display: block; font-size: 11.5px; }
  .bar { left: 8px; right: 8px; }
  .bar.scenes { top: 8px; }
  .bar.display { bottom: 8px; right: 8px; }
  #compass { bottom: 44px; right: 2px; width: 108px; height: 80px; }
  #hint { top: 48px; font-size: 12px; }
  .seg button, .tog { padding: 6px 9px; font-size: 13px; }
  button.link { padding: 9px 0; }
  .zline button.link { padding: 0; }
  /* keyboard up while typing: trim the page to the visible area and let the panel cover the model */
  .kb body { height: var(--vvh, 100%); }
  .kb .top { display: none; }
  .kb main { position: relative; }
  .kb #panel { position: absolute; inset: 0; z-index: 6; background: var(--paper); border-top: 0; }
  .tabs button { padding: 11px 6px 9px; }
}
@media (prefers-reduced-motion: reduce) { #hint { transition: none; } }

