/* Designing a CNC Cutting Board - visual language shared with
   "Understanding CNC Milling Offsets": warm paper page, ink text,
   Space Grotesk headings in one color, dark instrument set
   into the page, JetBrains Mono for machine readouts. */

:root {
    --paper: #f6f3ec;
    --paper-2: #efeadf;
    --ink: #1c1a15;
    --ink-2: #4a463d;
    --ink-3: #8a8478;
    --rule: #d9d3c2;
    --accent: #c8341a;
    --accent-2: #9a2818;
    --machine-bg: #171a20;
    --machine-edge: #262b34;
    --dro-bg: #070c08;
    --dro-green: #39e26f;
    --dro-dim: #7fa88b;
    --warn: #d68a1a;
    --bad: #c8341a;
    --good: #1f5fa8;
    --ghost: #c026a8;
    --ax-x: #ff4d6a;
    --ax-y: #9be22d;
    --ax-z: #3d8bff;
    --mdf: #b99b6b;
    --op-engrave: #ffe14a;
    --op-gutter: #6ee7ff;
    --op-profile: #ff7a1a;
    --display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --sans: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body {
    background-image:
        radial-gradient(circle at 20% 10%, rgba(200, 52, 26, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(200, 52, 26, 0.03) 0%, transparent 50%);
    background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
.serif { font-family: var(--display); }
.mono { font-family: var(--mono); }
p { margin: .35em 0 .8em; }
b, strong { color: var(--ink); font-weight: 600; }
small, .muted { color: var(--ink-3); }
a { color: var(--accent); }
.wrap { max-width: 1380px; margin: 0 auto; padding: 16px 16px 24px; }

/* ===== Masthead ===== */
.masthead { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 12px; gap: 8px; }
@media (max-width: 1250px) { .masthead-lesson { display: none; } }
@media (max-width: 900px) { .masthead { flex-wrap: wrap; } }
.masthead h1 { font-family: var(--display); font-weight: 600; font-size: clamp(22px, 4vw, 40px); margin: 0; letter-spacing: -0.01em; line-height: 1.1; white-space: nowrap; }
.masthead h1 em { font-style: normal; font-weight: inherit; color: inherit; }
.masthead-lesson { font-family: var(--display); font-weight: 500; font-size: clamp(15px, 2.2vw, 24px); color: var(--ink); text-align: right; letter-spacing: -0.01em; line-height: 1.15; margin-left: auto; margin-right: 14px; white-space: nowrap; }
.masthead-lesson-prefix { font-weight: 400; font-style: italic; color: var(--accent); margin-right: 0.3em; }
.masthead-links { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.masthead-who { font-size: 13px; color: var(--ink-2); font-weight: 600; padding: 0 8px; }
.masthead-link { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-3); background: transparent; border: none; padding: 6px 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule); transition: color 0.15s, text-decoration-color 0.15s; }
.masthead-link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.masthead-sep { color: var(--ink-3); font-size: 13px; user-select: none; padding: 0 2px; opacity: 0.6; }

/* ===== Step nav: chevrons with big step numbers ===== */
nav.steps { display: flex; margin: 0 0 14px; filter: drop-shadow(0 1px 2px rgba(28,26,21,.18)); }
nav.steps button { --pt: 16px; appearance: none; flex: 1 1 0; min-width: 0; margin: 0 0 0 calc(var(--pt) * -1 + 4px); padding: 8px 10px 8px calc(var(--pt) + 12px); border: none; border-radius: 0; background: #1c1a15; color: #fff; cursor: pointer; display: flex; align-items: center; gap: 9px; text-align: left; line-height: 1.15; min-height: 58px;
  clip-path: polygon(0 0, calc(100% - var(--pt)) 0, 100% 50%, calc(100% - var(--pt)) 100%, 0 100%, var(--pt) 50%); transition: background 0.12s, color 0.12s; }
nav.steps button:first-child { margin-left: 0; padding-left: 14px; clip-path: polygon(0 0, calc(100% - var(--pt)) 0, 100% 50%, calc(100% - var(--pt)) 100%, 0 100%); }
nav.steps button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, var(--pt) 50%); padding-right: 14px; }
nav.steps .num { font-family: var(--mono); font-size: 30px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: rgba(255,255,255,.9); flex-shrink: 0; min-width: 1.05ch; text-align: center; }
nav.steps .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
nav.steps .tag { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; color: rgba(255,255,255,.55); text-transform: uppercase; white-space: nowrap; }
nav.steps .nm { font-family: var(--sans); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav.steps button:hover:not(:disabled):not(.active) { background: #3a342c; }
nav.steps button.done { background: #1f5fa8; }
nav.steps button.done:hover:not(:disabled) { background: #2a6fbe; }
nav.steps button.done .tag { color: rgba(255,255,255,.7); }
nav.steps button.active { background: var(--accent); }
nav.steps button.active .num { color: #fff; }
nav.steps button.active .tag { color: rgba(255,255,255,.85); }
nav.steps button:disabled { background: var(--paper-2); color: var(--ink-3); cursor: not-allowed; }
nav.steps button:disabled .num, nav.steps button:disabled .tag { color: #b9b2a2; }

/* ===== "What's next" card at the bottom of each step's side column ===== */
.req { color: var(--accent); font-weight: 700; }
.subnav { display: flex; gap: 4px; }
.subnav button { flex: 1 1 auto; white-space: nowrap; appearance: none; border: 1px solid var(--rule); background: #fdfcf8; color: var(--ink-2); font: 700 12px var(--sans); padding: 8px 6px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; justify-content: center; }
.subnav button .sn { font-family: var(--mono); font-weight: 800; width: 20px; height: 20px; display: grid; place-items: center; background: #1c1a15; color: #fff; font-size: 11px; flex: 0 0 20px; }
.subnav button.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #fff; color: var(--ink); }
.subnav button.active .sn { background: var(--accent); }
.subnav button.done .sn { background: var(--good); }
.subnav button:disabled { opacity: .5; cursor: not-allowed; }
.job-head { display: none !important; }
/* Next always sits at the bottom of the right-hand panel, in the page flow (it never floats) */
.go-card { position: static; box-shadow: none; background: none; padding: 0; margin-top: 4px; display: flex; flex-direction: column; gap: 8px; border: 0; }
.go-card .msg { font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.go-card .msg.err { color: var(--accent); font-weight: 600; }
.go-card .row { display: flex; gap: 8px; align-items: stretch; }
.go-card .msg:empty { display: none; }
.go-card #btnNext { width: 100%; font-size: 14px; padding: 11px 14px; }
#btnNext, #introNext, #introPrev { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-arrow { width: 1.25em; height: 1.25em; flex: 0 0 auto; }
.go-card.last #btnNext { display: none; }

/* ===== Bench: dark machine shell + side column ===== */
.step { display: none; }
.step.show { display: flex; gap: 14px; align-items: flex-start; }
.step.wide.show { display: block; }
.machine-shell { flex: 1; min-width: 0; background: var(--machine-bg); border-radius: 0; overflow: hidden; box-shadow: 0 2px 14px rgba(28, 26, 21, 0.16); color: #e8ecf0; position: sticky; top: 10px; }
.shell-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px 0; flex-wrap: wrap; }
.shell-title { font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(232, 236, 240, 0.55); }
.shell-body { padding: 8px 12px 12px; }
.side-col { width: 408px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.panel { background: #fff; border-radius: 0; padding: 12px 14px 16px; }
.panel.card { background: var(--paper-2); border-radius: 0; padding: 18px 20px 14px; }
.panel-label { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--ink); margin: 0 0 8px; text-transform: uppercase; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.step-title { font-family: var(--display); font-size: 25px; line-height: 1.2; color: var(--ink); margin: 0 0 6px; font-weight: 600; }
.step-title em { font-style: normal; font-weight: inherit; color: inherit; }
.step-body { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin: 0; }
.section { border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 10px; }
h3 { font-size: 14px; margin: 0 0 6px; font-weight: 600; }

/* form controls */
label.fld { display: block; font-size: 12.5px; font-weight: 600; margin: 10px 0 4px; color: var(--ink); }
input[type=text], input[type=number], input[type=password], select, textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 0; background: #fff; font-size: 13.5px; box-shadow: inset 0 1px 1px rgba(0,0,0,0.04); }
textarea { font-family: var(--mono); font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px rgba(200,52,26,0.15); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-top: 10px; cursor: pointer; }
.check-line input { margin-top: 2px; flex: 0 0 auto; }

/* buttons (offsets .btn) */
.btn { background: #fdfcf8; color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; font-family: var(--sans); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s; }
.btn:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(200,52,26,0.12); }
.btn:active { background: var(--paper-2); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; border-color: var(--rule); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent-2); }
.btn.primary:hover { background: var(--accent-2); }
.btn.go { background: var(--good); color: #fff; border-color: #164a85; }
.btn.go:hover { background: #164a85; }
.btn.blue { background: #1c1a15; color: #fff; border-color: #1c1a15; }
.btn.blue:hover { background: #3a342c; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btngrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }

/* choice chips */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.chip { border: 1px solid var(--rule); border-radius: 6px; background: #fdfcf8; padding: 7px 5px; cursor: pointer; text-align: center; font-size: 11.5px; font-weight: 600; transition: border-color .12s, box-shadow .12s; }
.chip:hover { border-color: var(--accent); }
.chip svg { display: block; margin: 0 auto 4px; }
.opt-group { font: 600 17px/1.2 var(--display); color: var(--ink); margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.opt-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.opt-label { font-size: 13px; font-weight: 700; color: var(--ink); margin: 12px 0 6px; }
.opt-group + .opt-label { margin-top: 0; }
.chip:disabled { opacity: .35; cursor: not-allowed; }
.chip:disabled:hover { border-color: var(--rule); }
.opt-note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; line-height: 1.4; }
.opt-hint { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
.chip.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #fff; }
.weightchips { grid-template-columns: repeat(3, 1fr); }
.wt-sample { display: block; width: 44px; margin: 2px auto 7px; border-bottom: 2px solid var(--ink); border-radius: 0; }
.weightchips small { display: block; font: 500 10px var(--mono); color: var(--ink-3); margin-top: 2px; }

/* why? / how? callouts */
details.why { background: #fdfcf8; border: 1px solid var(--rule); border-radius: 0; padding: 7px 11px; margin: 8px 0 0; }
details.why summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink); list-style: none; }
details.why summary::-webkit-details-marker { display: none; }
details.why summary::before { content: 'Why '; }
details.why.how summary::before { content: 'How '; }
details.why.what summary::before { content: 'What '; }
details.why[open] summary { margin-bottom: 4px; }
details.why p { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.note { font-size: 13px; background: #fdfcf8; border: 1px dashed var(--accent); border-radius: 0; padding: 9px 11px; color: var(--ink-2); }
.lock { display: inline-flex; gap: 5px; align-items: center; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* status boxes (qr-callout colors) */
.status { border-radius: 0; padding: 8px 10px; font-size: 12.5px; margin-top: 10px; line-height: 1.45; border: 1px solid var(--rule); background: #fdfcf8; color: var(--ink); }
.status.ok { border-color: var(--good); background: var(--good); color: #fff; font-size: 13px; }
.status.ok b { color: #fff !important; font-size: 14px; }
.status.ok b { color: var(--good); }
.status.err { border-color: #e0b4a8; background: #fdf6f4; color: #5c2e24; }
.status.err b { color: var(--accent); }
.status.warn { border-color: #ead3a4; background: #fdf8ee; color: #5e4312; }
.status ul { margin: 4px 0 0; padding-left: 18px; }

/* dark-shell controls (offsets view-toggle-btn / #view-zoom) */
.viewtoggle { display: inline-flex; gap: 4px; }
.view-toggle-btn, .viewtoggle button, .v3views button, .simbar .sbtn {
    appearance: none; border: none; border-radius: 8px; background: rgba(12, 16, 22, 0.72); color: #e8ecf0;
    font-family: var(--sans); font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.25;
    padding: 7px 10px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.28); transition: background .12s, color .12s;
}
.viewtoggle button { background: rgba(255,255,255,.06); }
.view-toggle-btn:hover, .viewtoggle button:hover, .v3views button:hover, .simbar .sbtn:hover { background: rgba(40, 48, 58, 0.92); color: var(--dro-green); }
.viewtoggle button.on, .v3views button.on, .view-toggle-btn.active { background: rgba(57, 226, 111, 0.22); color: var(--dro-green); }
.simbar .sbtn { background: rgba(255,255,255,.06); }
.simbar .sbtn.play { background: var(--accent); color: #fff; }
.simbar .sbtn.play:hover { background: var(--accent-2); color: #fff; }
.simbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.simbar select, .v3opts select { width: auto; background: rgba(255,255,255,.06); color: #e8ecf0; border: 1px solid var(--machine-edge); font-family: var(--sans); font-size: 11px; font-weight: 600; padding: 5px 6px; box-shadow: none; }
.simbar select option, .v3opts select option { color: #1c1a15; }
.shell-opt { font-family: var(--sans); font-size: 9.5px; letter-spacing: .06em; color: rgba(232,236,240,.8); display: inline-flex; gap: 6px; align-items: center; text-transform: uppercase; font-weight: 700; }
.shell-opt input { accent-color: var(--dro-green); }
/* simulation controls (right column) */
.simbtns .btn { flex: 1; font-size: 13.5px; padding: 10px; }
.timeline { position: relative; height: 34px; margin-top: 10px; background: #171a20; border: 1px solid #171a20; }
.timeline .segs { position: absolute; inset: 0; display: flex; }
.timeline .seg { height: 100%; min-width: 0; overflow: hidden; white-space: nowrap; display: flex; align-items: center; justify-content: center; font: 700 10px var(--mono); letter-spacing: .02em; color: #1c1a15; box-shadow: inset -1px 0 0 #171a20; }
.timeline .seg.change { background: #5b6470; color: #fff; }
.timeline .seg.misc { background: #3a3f47; }
.timeline .rest { position: absolute; top: 0; bottom: 0; right: 0; background: rgba(23, 26, 32, 0.62); pointer-events: none; }
#simScrub { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
#simScrub::-webkit-slider-runnable-track { background: transparent; height: 34px; }
#simScrub::-webkit-slider-thumb { -webkit-appearance: none; width: 5px; height: 42px; margin-top: -4px; background: #fff; border: 1px solid #0d0f12; }
#simScrub::-moz-range-track { background: transparent; }
#simScrub::-moz-range-thumb { width: 5px; height: 40px; background: #fff; border: 1px solid #0d0f12; border-radius: 0; }
.confirm .job-body { margin: 0 0 10px; }
#simChecks { margin: 0 0 10px; }
#simChecks .check-line { font-size: 13px; margin: 4px 0; }
.think { border: 1px solid var(--rule); background: #fdfcf8; padding: 10px 12px; margin-top: 10px; }
.think-label { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.think-q { font-size: 13.5px; font-weight: 600; color: var(--ink); margin: 10px 0 6px; line-height: 1.45; }
.think-q:first-of-type { margin-top: 4px; }
.think-note { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; line-height: 1.4; }
.think textarea, .think-panel textarea { width: 100%; min-height: 54px; font: 13px/1.4 var(--sans); padding: 7px 8px; border: 1px solid var(--rule); background: #fff; resize: vertical; margin-top: 6px; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices.row2 { flex-direction: row; } .choices.row2 button { flex: 1; text-align: center; }
.choices.row3 { flex-direction: row; } .choices.row3 button { flex: 1; text-align: center; }
.choices button { text-align: left; background: #fff; border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; font: 600 13px/1.3 var(--sans); color: var(--ink); cursor: pointer; }
.choices button:hover { border-color: var(--ink); }
.choices button.on { background: #1c1a15; color: #fff; border-color: #1c1a15; }
.choices button.good { background: var(--good); border-color: var(--good); color: #fff; }
.choices button.miss { border-color: var(--accent); color: var(--accent); }
.choices.locked button { pointer-events: none; }
.tools3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 4px; }
.tools3 figure { margin: 0; background: #171a20; padding: 6px 4px 8px; text-align: center; }
.tools3 svg { width: 100%; height: 118px; display: block; }
.tools3 figcaption { font: 700 11px var(--sans); color: #e8ecf0; margin-top: 4px; }
.tools3 figcaption small { display: block; font: 500 10px var(--mono); color: rgba(232,236,240,.6); margin-top: 1px; }
.pro { font-size: 13px; line-height: 1.45; background: var(--paper-2); padding: 8px 10px; margin-top: 8px; color: var(--ink); }
.pro b:first-child { color: var(--accent); }
.save-row { margin-top: 6px; align-items: center; flex-wrap: nowrap; }
.save-row .btn { flex: 0 0 auto; }
.save-row .btn:disabled { opacity: 1; background: var(--paper-2); color: var(--ink-2); border-color: var(--rule); cursor: default; }
.recorded { font-size: 13px; line-height: 1.45; margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--ink-3); color: var(--ink); background: transparent; }
#reflectPanel.pre-watch { display: none !important; }
.need { outline: 2px solid #c8341a; outline-offset: 1px; }
.recorded.dirty { border-color: #b8860b; background: #fdf8ee; }
.recorded.dirty .rec-tag { background: #8a5a00; }
.rec-tag { display: inline-block; font: 800 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; background: #1c1a15; color: #fff; padding: 4px 6px; margin-right: 8px; vertical-align: 1px; }
.turn-cap { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); background: rgba(12,16,22,.86); color: #fff; font: 600 13px var(--sans); padding: 8px 12px; pointer-events: none; opacity: 0; transition: opacity .3s; max-width: 80%; text-align: center; }
.turn-cap.show { opacity: 1; }
svg.turning .tp, svg.turning .corner, svg.turning .datum, svg.turning .axisart { opacity: 0; }
.movebox { margin-top: 8px; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.movebox #btnShowMove { grid-column: 1 / -1; }
.movedro { font-family: var(--mono); font-size: 13px; background: var(--dro-bg); color: #e8ecf0; padding: 6px 8px; }
.movedro div { display: flex; justify-content: space-between; gap: 8px; padding: 1px 4px; }
.movedro b { color: #fff; }
.movedro div.chg { background: rgba(255, 179, 71, .22); color: #ffd08a; }
.movedro div.chg b { color: #ffd08a; }
.movedro .ax { font-weight: 800; }
.zgauge { display: flex; gap: 6px; height: 96px; }
.zg-track { position: relative; width: 16px; height: 100%; background: linear-gradient(to bottom, #2a2f37 0 50%, #2d6cb4 50% 100%); }
.zg-zero { position: absolute; left: -3px; right: -3px; top: 50%; height: 2px; background: #fff; }
.zg-tool { position: absolute; left: 50%; width: 10px; height: 10px; background: #ffb347; border: 1px solid #0d0f12; transform: translate(-50%, -50%); top: 50%; transition: top .05s linear; }
.zg-labels { display: flex; flex-direction: column; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); line-height: 1.2; }
#mistakeCanvas { width: 100%; height: auto; display: block; background: #2d6cb4; }
.mistake-code { font: 12px/1.45 var(--mono); background: var(--dro-bg); color: #e8ecf0; padding: 6px 8px; margin: 6px 0 0; white-space: pre-wrap; }
.mistake-code .bad { background: rgba(200, 52, 26, .45); }
.mistake-code .fix { background: rgba(31, 95, 168, .6); }
.js-think { font-size: 12.5px; }
.js-think .q { font-weight: 700; margin-top: 8px; }
.js-think .a { border-bottom: 1px solid var(--rule); padding: 2px 0 4px; min-height: 18px; }
.js-think .f { color: var(--ink-3); font-size: 11.5px; font-style: italic; margin-top: 2px; }
.js-think .a .lbl { font: 800 9.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; background: #1c1a15; color: #fff; padding: 2px 4px; margin-right: 6px; vertical-align: 1px; }
.js-think .st { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; }
.js-think .rb { display: flex; gap: 12px; font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.js-think .rb span { display: flex; align-items: center; gap: 4px; }
.js-think .rb i { width: 11px; height: 11px; border: 1.3px solid var(--ink-2); background: #fff; display: inline-block; }
.js-note { font-size: 11.5px; color: var(--ink-2); margin: 0 0 4px; line-height: 1.4; }
.pace-notes { border: 1px solid var(--rule); background: #fff; padding: 8px 12px; margin: 10px 0 14px; }
.pace-notes summary { font: 600 15px var(--display); cursor: pointer; padding: 2px 0; }
.pace-notes .js-note { margin-top: 6px; }
.js-pace { font-size: 11.5px; width: 100%; }
.js-pace th, .js-pace td { padding: 3px 6px; }
.js-pace td.num { font-family: var(--mono); white-space: nowrap; }
.js-pace td.flag { color: #8a3b12; font-weight: 700; }
.js-lines div { border-bottom: 1px solid #b9b2a2; height: 24px; }
.confirm .btn.go { width: 100%; font-size: 14px; padding: 11px; }
.confirm .btn.go:disabled { background: var(--paper-2); color: var(--ink-3); border-color: var(--rule); cursor: not-allowed; }
.confirm.done { background: var(--good); color: #fff; }
.confirm.done .job-body { color: #fff; }
/* step 3 jobs */
.job-head { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.job-n { font-family: var(--mono); font-size: 15px; font-weight: 800; width: 28px; height: 28px; display: grid; place-items: center; background: #1c1a15; color: #fff; flex: 0 0 28px; }
.job.done .job-n { background: var(--good); }
.job.locked { opacity: .55; }
.job-body { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 8px; }
.job-tip { font-size: 12.5px; color: var(--ink-2); background: var(--paper-2); padding: 7px 9px; margin: 0 0 10px; line-height: 1.45; }
.job-locked { font-size: 13px; color: var(--ink-3); margin: 0; }
.op.hl { border-color: #1c1a15; box-shadow: 0 0 0 1px #1c1a15; }
svg.hl-engrave .tp:not(.tp-engrave), svg.hl-gutter .tp:not(.tp-gutter), svg.hl-profile .tp:not(.tp-profile) { opacity: .12; }
svg.hl-engrave .tp-engrave, svg.hl-gutter .tp-gutter, svg.hl-profile .tp-profile { stroke-width: 0.06; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: rgba(232,236,240,.72); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 0; vertical-align: middle; margin-right: 5px; }
.legend .muted { color: rgba(232,236,240,.45); }
.hint { font-size: 11.5px; color: rgba(232,236,240,.5); }
svg.scene { width: 100%; height: auto; display: block; max-height: calc(100vh - 290px); min-height: 280px; touch-action: none; user-select: none; }
svg.scene:focus { outline: none; }

/* welcome */
.flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.flow div { background: #fdfcf8; border: 1px solid var(--rule); border-radius: 0; padding: 7px 8px; font-size: 11.5px; color: var(--ink-2); line-height: 1.35; }
.flow b { display: block; font-size: 12.5px; margin-bottom: 1px; }
.flow .k { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .12em; color: var(--accent); }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 0; }
.specs dt { color: var(--ink-3); } .specs dd { margin: 0; font-weight: 600; }
.intro-step-dots { display: flex; gap: 5px; justify-content: center; }
.intro-step-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.intro-step-dots span.on { background: var(--accent); }
.intro-step-dots span.done { background: var(--ink-3); }

/* items */
.items { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule); border-radius: 0; padding: 6px 9px; cursor: pointer; background: #fdfcf8; font-size: 13px; }
.item:hover { border-color: var(--accent); }
.item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #fff; }
.item.bad { border-color: #e0b4a8; background: #fdf6f4; }
.item .kind { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); width: 54px; }
.item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.props { background: var(--paper-2); border-radius: 0; padding: 10px 12px 12px; margin-top: 10px; }
.fontgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.fontgrid button { border: 1px solid var(--rule); background: #fff; border-radius: 6px; padding: 3px 4px 4px; cursor: pointer; font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.fontgrid button:hover { border-color: var(--accent); }
.fontgrid button.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--ink); }
.fontgrid svg { display: block; width: 100%; height: 34px; }
.fontgrid button span { display: block; }
.fontgrid button small { display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .02em; }
.val { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); float: right; font-weight: 600; }

/* toolpaths */
.ops { display: flex; flex-direction: column; gap: 6px; }
.op { border: 1px solid var(--rule); padding: 8px 9px; background: #fdfcf8; display: flex; gap: 10px; align-items: center; }
.op .num { font-family: var(--mono); font-weight: 800; font-size: 15px; width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; background: var(--c); color: #1c1a15; border: 1px solid #1c1a15; }
.op .body { flex: 1; font-size: 13px; }
.op .body b { display: block; font-size: 13.5px; }
.op .body small { display: block; line-height: 1.35; color: var(--ink-2); }
.op .body small.muted { color: var(--ink-3); font-family: var(--mono); font-size: 10.5px; margin-top: 2px; }
.op .mv { display: flex; flex-direction: column; gap: 3px; }
.op .mv button { border: none; background: #1c1a15; color: #fff; border-radius: 5px; cursor: pointer; width: 30px; height: 24px; font-size: 10px; }
.op .mv button:hover:not(:disabled) { background: var(--accent); }
.op .mv button:disabled { background: var(--paper-2); color: var(--ink-3); cursor: default; }
table.params, .qr-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.params th, table.params td, .qr-table th, .qr-table td { font-size: 12px; padding: 5px 6px; vertical-align: top; border-bottom: 1px solid #e8e2d6; text-align: left; }
table.params th, .qr-table th { font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); background: #f7f3ea; border-bottom: 1px solid var(--rule); }
table.params td:first-child, .qr-table td:first-child { font-family: var(--mono); font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ===== DRO (same readout as the offsets tool) ===== */
#dro { background: var(--dro-bg); font-family: var(--mono); padding: 10px 12px 9px; border-radius: 0; border: 1px solid #1a2a1e; color: #fff; }
#dro .dro-hdr, #dro .dro-row { display: grid; grid-template-columns: 28px 1fr; gap: 6px; align-items: baseline; }
#dro .dro-hdr { color: #fff; font-size: 14px; letter-spacing: 0.06em; margin-bottom: 4px; }
#dro .dro-hdr { display: flex; justify-content: space-between; }
#dro .dro-pos { font-weight: 700; letter-spacing: 0.12em; }
#dro .dro-col-lab { text-align: right; font-weight: 600; }
#dro .dro-row { line-height: 1.35; padding: 2px 4px; border-radius: 0; }
#dro .dro-ax { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; }
#dro .dro-ax-x { color: var(--ax-x); } #dro .dro-ax-y { color: var(--ax-y); } #dro .dro-ax-z { color: var(--ax-z); }
#dro .dro-val { text-align: right; font-size: 18.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: pre; }
#dro .dro-bar { margin-top: 6px; padding-top: 8px; border-top: 1px solid #808080; font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#dro .dro-bar .cm { color: var(--dro-dim); font-weight: 400; }
.info { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* 3D view */
.simwrap { position: relative; }
canvas { display: block; }
#simCanvas { border-radius: 0; }
.v3wrap { position: relative; width: 100%; height: clamp(300px, calc(100vh - 330px), 64vh); border-radius: 0; overflow: hidden; background: var(--machine-bg); }
#sim3d { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#sim3d:active { cursor: grabbing; }
#v3labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#v3labels .v3datum { line-height: 0; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); }
#v3labels span.v3datum-lab { color: #ffb347; }
#v3labels span { position: absolute; transform: translate(-50%, -50%); font: 700 11px var(--mono); letter-spacing: .06em; white-space: nowrap; text-shadow: 0 0 3px #000, 0 0 5px #000; }
.v3msg { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; text-align: center; padding: 20px; background: rgba(23, 26, 32, .88); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dro-green); }
/* ===== View cube + zoom buttons (copied from Understanding CNC Milling Offsets) ===== */
#viewcube-stack {
    position: absolute;
    top: -10px;
    right: -8px;
    z-index: 7;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: auto;
    min-width: 132px;
}
.viewcube-row {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
}
#viewcube {
    display: block;
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
    cursor: pointer;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    touch-action: none;
}
.vc-face-arrow {
    appearance: none;
    margin: 0;
    padding: 0;
    width: 16px;
    height: 40px;
    border: none;
    background: none;
    color: #f2f5f8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Overlay the cube's edges so showing/hiding never changes the column width */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: color 0.12s ease, filter 0.12s ease;
}
#vc-face-prev { left: 0; }
#vc-face-next { right: 0; }
.vc-face-arrow svg {
    display: block;
    stroke-width: 2.8;
}
/* Hover: light up amber with a glow, matching the cube's hot edges/corners */
.vc-face-arrow:hover {
    color: #ffb347;
    filter: drop-shadow(0 0 3px rgba(255, 190, 100, 0.95)) drop-shadow(0 0 7px rgba(255, 170, 80, 0.5));
}
.vc-face-arrow[hidden] { display: none !important; }
#view-zoom {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
    margin: -4px 12px 0; /* sits just under the cube */
}
.view-toggle-btn {
    appearance: none;
    margin: 6px 0 0;
    padding: 8px 6px;
    border: none;
    border-radius: 0;
    background: rgba(12, 16, 22, 0.72);
    color: #e8ecf0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    transition: background 0.12s, color 0.12s;
}
.view-toggle-btn:hover {
    background: rgba(40, 48, 58, 0.92);
    color: #39e26f;
}
.view-toggle-btn.active {
    background: rgba(57, 226, 111, 0.22);
    color: #39e26f;
}
#view-zoom button {
    appearance: none;
    margin: 0;
    padding: 7px 0;
    border: none;
    border-radius: 8px;
    background: rgba(12, 16, 22, 0.72);
    color: #e8ecf0;
    line-height: 0;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    transition: background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#view-zoom button svg {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}
#view-zoom button:hover {
    background: rgba(40, 48, 58, 0.92);
    color: #39e26f;
}
#view-zoom button:active {
    background: rgba(57, 226, 111, 0.25);
    color: #fff;
}
#view-zoom button.active {
    background: rgba(57, 226, 111, 0.22);
    color: #39e26f;
}

.v3opts { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* G-code */
.codesize { align-items: center; gap: 4px; }
.codesize .shell-title { margin-right: 4px; }
.codesize button { width: 30px; padding: 4px 0; text-transform: none; }
.codebox { height: calc(100vh - 250px); min-height: 360px; overflow: auto; background: var(--dro-bg); border-radius: 0; border: 1px solid #1a2a1e; font-family: var(--mono); font-size: var(--code-fs, 14px); padding: 6px 0; }
.ln { display: flex; gap: 10px; padding: 1px 10px 1px 10px; color: #e8ecf0; cursor: pointer; white-space: pre; }
.ln:hover { background: #111a13; }
.ln.sel { background: #22303f; }
.ln.found { background: rgba(57, 226, 111, 0.16); }
.ln .no { color: var(--c, #4f6153); min-width: 38px; text-align: right; user-select: none; }
.w-g { color: #7fb2ff; } .w-m { color: #ff7fe0; } .w-t { color: #ffb347; } .w-s { color: var(--dro-green); } .w-c { color: var(--dro-dim); font-style: italic; } .w-p { color: #ffe14a; }
.hunt { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.task { border: 1px solid var(--rule); border-radius: 0; padding: 7px 10px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; background: #fdfcf8; line-height: 1.4; }
.task .box { width: 1.15em; height: 1.15em; margin-top: 1px; border: 1.5px solid var(--rule); border-radius: 0; background: #fff; flex: 0 0 1.15em; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.task.done { background: #f2f7fc; }
.task.done .box { background: var(--good); border-color: #164a85; }
.task.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(200,52,26,.12); }
.explain { font-size: var(--explain-fs, 13px) !important; background: #fdfcf8; border: 1px dashed var(--accent); border-radius: 0; padding: 10px 12px; font-size: 13px; color: var(--ink-2); margin-top: 10px; min-height: 64px; line-height: 1.5; }
.explain code, .qr-body code { font-family: var(--mono); font-size: 12px; background: var(--paper-2); border-radius: 0; padding: 0 4px; color: var(--ink); }
#codeCanvas { border-radius: 0; margin-top: 10px; }

/* job sheet */
#jobsheet { background: #fff; border: 1px solid var(--rule); border-radius: 0; padding: 24px 26px; max-width: 1000px; margin: 0 auto; box-shadow: 0 2px 14px rgba(28, 26, 21, 0.08); }
#jobsheet h1 { font-family: var(--display); font-weight: 500; font-size: 28px; letter-spacing: -0.01em; margin: 0 0 2px; line-height: 1.15; }
#jobsheet h1 em { font-style: normal; font-weight: inherit; color: inherit; }
.js-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.js-box { border: 1px solid var(--rule); border-radius: 0; padding: 10px; background: #fdfcf8; }
.js-box h3 { font-family: var(--display); font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.js-box h3 em { font-style: normal; font-weight: inherit; color: inherit; }
.js-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; }
.js-table th, .js-table td { border: 1px solid var(--rule); padding: 5px 7px; text-align: left; }
.js-table th { background: #f7f3ea; font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; margin: 4px 0; }
.check .sq { width: 14px; height: 14px; border: 1.5px solid var(--ink-2); flex: 0 0 14px; margin-top: 2px; border-radius: 0; background: #fff; }
.sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; font-size: 12px; color: var(--ink-3); }
.sign div { border-top: 1.5px solid var(--ink); padding-top: 4px; }
.sheet-head { max-width: 1000px; margin: 0 auto 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

/* bottom nav (intro-nav look) */
.intro-btn { background: #fdfcf8; border: 1px solid var(--rule); border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.intro-btn:hover { background: #f0eeea; }
.intro-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent-2); }
.intro-btn.primary:hover { background: var(--accent-2); }
.intro-btn:disabled { opacity: .45; cursor: not-allowed; }

/* site footer */
.site-footer { margin-top: 28px; padding: 14px 8px 8px; text-align: center; }
.site-footer a { font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ===== Modals (offsets .modal-backdrop / .modal / .modal-close / .modal-toolbar) ===== */
.modal { position: fixed; inset: 0; background: rgba(28, 26, 21, 0.45); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 36px 16px; overflow: auto; }
.modal.show { display: flex; }
.modal-card { background: var(--paper); border-radius: 0; max-width: 880px; width: 100%; padding: 26px 32px 30px; box-shadow: 0 8px 40px rgba(28, 26, 21, 0.3); position: relative; }
.modal-card.qr { max-width: 720px; }
.modal-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-3); line-height: 1; }
.modal-close:hover { color: var(--accent); }
.modal-toolbar { display: flex; gap: 8px; position: absolute; top: 16px; right: 52px; }
.modal-card h2 { font-family: var(--display); font-weight: 500; font-size: 28px; letter-spacing: -0.01em; margin: 0 0 6px; line-height: 1.15; }
.modal-card h2 em { font-style: normal; font-weight: inherit; color: inherit; }
.qr-lede { color: var(--ink-2); font-size: 13.5px; margin: 2px 0 10px; line-height: 1.45; }
.qr-section-title { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 20px 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.qr-section-title em { font-style: normal; font-weight: inherit; color: inherit; }
.qr-section-title.first { border-top: none; padding-top: 0; margin-top: 10px; }
.qr-body { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin: 0 0 8px; }
.qr-eq { font-family: var(--mono); font-size: 13.5px; text-align: center; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 0; padding: 9px 10px; margin: 8px 0; color: var(--ink); line-height: 1.45; }
.qr-eq b { color: var(--accent); }
.qr-fig { display: block; margin: 10px auto; max-width: 100%; height: auto; }
.qr-fig-caption { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: -2px 0 10px; font-style: italic; line-height: 1.4; }
.qr-list { padding-left: 18px; margin: 6px 0 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.qr-list li { margin: 3px 0; }
.qr-callouts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
.qr-callout { font-size: 12.5px; line-height: 1.4; color: var(--ink); border-radius: 0; padding: 8px 10px; border: 1px solid var(--rule); background: #fdfcf8; }
.qr-callout-warn { border-color: #e0b4a8; background: #fdf6f4; color: #5c2e24; }
.qr-callout-ok { border-color: #b7d4c0; background: #f3faf5; color: #1a3d28; }
.qr-muted { display: block; font-size: 10.5px; font-weight: 500; color: var(--ink-3); margin-top: 2px; font-family: var(--sans); }
.clipgroup + .clipgroup { margin-top: 14px; }
.clipgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.clipgrid button { border: 1px solid var(--rule); border-radius: 6px; background: #fdfcf8; padding: 8px; cursor: pointer; font-size: 12px; font-weight: 600; }
.clipgrid button:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(200,52,26,.12); }
.clipgrid svg { width: 100%; height: 76px; display: block; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.tgrid label { font-size: 12px; font-weight: 600; display: block; margin-top: 6px; }
fieldset { border: 1px solid var(--rule); border-radius: 0; margin: 10px 0; padding: 6px 12px 12px; background: #fdfcf8; }
legend { font-family: var(--mono); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 0 6px; color: var(--ink-2); }
#svg-work { position: absolute; left: -10000px; top: 0; width: 200px; height: 200px; visibility: hidden; overflow: hidden; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .step.show { flex-direction: column; }
    .side-col { width: 100%; }
    .machine-shell { position: static; width: 100%; }
    nav.steps .nm { display: none; }
    nav.steps .num { font-size: 24px; }
}
/* the tour on smaller Chromebooks: keep the picture and the card side by side while there is room,
   then stack them with the card (the instructions) first and a shorter picture */
@media (max-width: 1100px) and (min-width: 761px) {
    body.touring .step[data-step="0"].show { flex-direction: row; }
    body.touring .step[data-step="0"] .side-col { width: 330px; }
    body.touring .step[data-step="0"] .machine-shell { position: sticky; top: 10px; }
    body.touring .intro-title { font-size: 22px; }
    body.touring .intro-body { font-size: 13.5px; }
}
@media (max-width: 760px) {
    body.touring .step[data-step="0"] .side-col { order: -1; }
    body.tour-pic .intro-stage svg { height: 42vh; min-height: 200px; }
    body.touring .step[data-step="0"] .v3wrap { height: 44vh; min-height: 220px; }
}
@media (max-width: 640px) {
    nav.steps button { --pt: 10px; padding-right: 4px; gap: 0; min-height: 46px; justify-content: center; }
    nav.steps .txt { display: none; }
    .masthead h1 { white-space: normal; }
    .masthead-lesson { display: none; }
    .js-grid, .qr-callouts { grid-template-columns: 1fr; }
    .flow { grid-template-columns: 1fr 1fr; }
}
/* ---------- guided introduction (style of the offsets tool's tour; square corners) ---------- */
.intro-card { background: var(--paper-2); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--rule); }
.intro-card[hidden] { display: none; }
.intro-count { font: 700 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.intro-title { font-family: var(--display); font-size: 25px; line-height: 1.2; color: var(--ink); margin: 0; font-weight: 600; }
.intro-title em { font-style: normal; font-weight: inherit; color: inherit; }
.intro-stage { display: none; }
body.tour-pic .intro-stage { display: block; }
body.tour-pic .intro-stage svg { display: block; width: 100%; height: calc(100vh - 290px); min-height: 280px; max-height: 620px; }
body.tour-pic .step[data-step="0"] #introV3host, body.tour-pic .step[data-step="0"] #svgIntro { display: none !important; }
.intro-check { margin-top: 12px; }
.intro-card .choices button { font-size: 13px; }
.intro-try { background: #fdfcf8; border: 1px dashed var(--accent); padding: 10px; margin-top: 12px; }
.intro-try-label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.intro-try-msg { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; margin-top: 8px; min-height: 36px; }
.minijog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.minijog.cut { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.jogbtn { font: 700 13px var(--mono); padding: 10px 4px; border: 1px solid var(--rule); border-bottom-width: 3px; border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; touch-action: none; user-select: none; }
.jogbtn:active { transform: translateY(1px); border-bottom-width: 2px; }
.jogbtn.jog-ax-x { border-bottom-color: #ff4d6a; } .jogbtn.jog-ax-x:hover, .jogbtn.jog-ax-x:active { background: #ffe8ec; }
.jogbtn.jog-ax-y { border-bottom-color: #7fbf1f; } .jogbtn.jog-ax-y:hover, .jogbtn.jog-ax-y:active { background: #eef9dc; }
.jogbtn.jog-ax-z { border-bottom-color: #3d8bff; } .jogbtn.jog-ax-z:hover, .jogbtn.jog-ax-z:active { background: #e3eeff; }
.jogbtn:not([class*="jog-ax-"]):hover { background: #f0eeea; }
.intro-body3d { position: relative; }
/* intro jogging: the camera is locked so the arrows and the tool stay where students expect them */
body.tour-3d #sim3d { pointer-events: none; }
body.tour-3d #viewcube-stack { display: none !important; }
body.tour-3d .step[data-step="0"] #svgIntro { display: none !important; }
.intro-dro { position: absolute; left: 22px; top: 18px; z-index: 5; background: rgba(7,12,8,.92); color: #fff; font: 700 15px var(--mono); padding: 8px 12px 9px; min-width: 150px; pointer-events: none; }
.intro-dro[hidden] { display: none; }
.intro-dro .dh { font-size: 10px; letter-spacing: .14em; color: rgba(232,236,240,.6); margin-bottom: 4px; }
.intro-dro div:not(.dh) { display: flex; justify-content: space-between; gap: 18px; line-height: 1.5; }
.intro-stage .jog-ar { opacity: .55; transition: opacity .15s; }
.intro-stage .jog-ar.on { opacity: 1; }
.intro-body { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin: 0; }
.intro-body b { color: var(--ink); }
.intro-defs { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; }
.intro-defs dt { font: 700 12px var(--mono); color: #fff; background: #2d6cb4; padding: 2px 6px; align-self: start; margin-top: 1px; }
.intro-defs dd { margin: 0; }
.intro-step-dots { display: flex; gap: 5px; justify-content: center; }
.intro-step-dots span { width: 7px; height: 7px; background: var(--rule); }
.intro-step-dots span.on { background: var(--accent); }
.intro-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.intro-skip { margin-right: auto; background: transparent; border: none; color: var(--ink-3); font: 500 13px var(--sans); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.intro-skip:hover { color: var(--ink); background: #f0eeea; }
.intro-btn { background: #fdfcf8; border: none; border-radius: 6px; padding: 8px 16px; font: 600 13px var(--sans); cursor: pointer; color: var(--ink); }
.intro-btn:hover { background: #f0eeea; }
.intro-btn:disabled { opacity: .45; cursor: default; }
.intro-btn.primary { background: var(--accent); color: #fff; }
.intro-btn.primary:hover { background: var(--accent-2); }
body.touring .step[data-step="0"] .side-col > :not(.intro-card) { display: none !important; }
/* during the tour: no step bar and no masthead links, only "Skip introduction" */
.masthead-skip { display: none; }
body.touring #stepNav, body.touring .masthead-links > :not(.masthead-skip) { display: none !important; }
body.touring .masthead-links > .masthead-skip { display: inline-block; }
.linkish { background: none; border: none; padding: 0; font: inherit; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

@media print {
    @page { size: letter; margin: 0.35in 0.4in; }
    body { background: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body * { visibility: hidden; }
    body:not(.print-qr) #jobsheet, body:not(.print-qr) #jobsheet * { visibility: visible; }
    body:not(.print-qr) #jobsheet { position: absolute; left: 0; top: 0; width: 100%; max-width: none; border: 0; padding: 0; box-shadow: none; }
    body:not(.print-qr) .modal { display: none !important; }
    body.print-qr .wrap { display: none !important; }
    body.print-qr .modal { display: block !important; position: static !important; inset: auto; overflow: visible !important; background: none; padding: 0; }
    body.print-qr #modalCard, body.print-qr #modalCard * { visibility: visible; }
    body.print-qr #modalCard { box-shadow: none; border-radius: 0; max-width: none; padding: 0; background: #fff; }
    body.print-qr .qr-section-title { break-after: avoid; margin: 10px 0 5px; padding-top: 7px; font-size: 16px; }
    body.print-qr .qr-list, body.print-qr .qr-lede { font-size: 11.5px; margin: 3px 0 6px; }
    body.print-qr .qr-list li { margin: 1px 0; }
    body.print-qr .qr-table th, body.print-qr .qr-table td { padding: 2px 6px; font-size: 10.5px; line-height: 1.3; }
    body.print-qr .qr-muted { display: inline; margin-left: 6px; }
    body.print-qr .qr-fig { max-height: 140px; width: auto; margin: 2px auto; }
    body.print-qr .qr-fig-caption { display: none; }
    body.print-qr .qr-eq { padding: 5px 8px; margin: 5px 0; font-size: 12px; }
    body.print-qr .qr-callout { font-size: 11.5px; padding: 6px 8px; }
    body.print-qr .modal-card h2 { font-size: 24px; }
    .modal-close, .modal-toolbar, .noprint { display: none !important; }
    .js-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; margin: 8px 0; }
    .js-box, .qr-callouts, .qr-table, .qr-fig { break-inside: avoid; }
    .js-box { padding: 7px; }
    #jobsheet svg { max-height: 250px !important; }
    #jobsheet { font-size: 12px; }
    .check { margin: 2px 0; font-size: 11px; }
    .js-table th, .js-table td { padding: 3px 5px; font-size: 11px; }
}
