/* Build sheet — phone first. The rig dock (readout + money + slider) is pinned
   to the bottom of the screen on a phone, under the thumb; from 960px up it
   becomes a sticky left column. Same DOM in both — nothing is duplicated. */

/* MOC-10: this file loads after css/style.css on index.html only. These undo
   the old paper builder's rules for class names the build sheet reuses. */
.page-builder .sheet { background: none; border: 0; border-radius: 0; }
.page-builder .results { padding-top: 0; }
.page-builder .dyno { margin: 0; }
.page-builder .step { padding-top: 0; }
.page-builder .step + .step { margin-top: 0; }
.page-builder .total-row { flex-wrap: nowrap; }
.page-builder .legend { gap: 6px 16px; }
.page-builder .lg { align-items: initial; gap: 0; }
.page-builder .seg { overflow: visible; }
.page-builder .seg.seg-scroll { overflow-x: auto; }
/* MOC-75: hold the button row's height while sheet.js fills it, so Fuel/Induction don't jolt the page on load */
.rig-setup .seg { min-height: 44px; }
.page-builder .site-bar-in { max-width: 1240px; }
/* ad rails sit outside the 1240px sheet, not the old 1020px column */
.page-builder .ad-rail { display: none; }
.page-builder .ad-left { left: calc(50vw - 620px - 190px); }
.page-builder .ad-right { right: calc(50vw - 620px - 190px); }
@media (min-width: 1640px) { .page-builder .ad-rail { display: block; } }

.brand { display: block; line-height: 0; border-radius: var(--r-ctl); }
.menu-btn { display: none; }

.sheet { max-width: 1240px; margin: 0 auto; padding: 16px 16px calc(232px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }

/* ---------- rig ---------- */
.rig-setup { display: grid; gap: 14px; }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }

.rig-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line-2);
  border-radius: 18px 18px 0 0; box-shadow: 0 -18px 40px rgba(0, 0, 0, .55);
  padding: 12px 16px calc(10px + env(safe-area-inset-bottom));
}
.rig-dock::before { /* grab-bar affordance, purely visual */
  content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2);
}

.readouts { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.readout-hp { display: grid; gap: 2px; min-width: 0; }
.hp-v { display: flex; align-items: baseline; gap: 4px; color: var(--red); }
.hp-v output { font: 700 44px/0.95 var(--f-display); letter-spacing: -.01em; }
.hp-v small { font: 600 16px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; }
.hp-sub { font: 500 12px/1.3 var(--f-mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ticket { flex: none; padding: 8px 20px 9px 18px; min-width: 148px; text-align: right; justify-items: end; transform-origin: right center; }
.ticket .t-v { font-size: 28px; }
.ticket .t-d { font: 600 11px/1.2 var(--f-mono); margin-top: 2px; white-space: nowrap; }
.ticket::before, .ticket::after { background: var(--surface); }
.ticket .t-d.idle { opacity: .7; } /* MOC-75: .55 was 3.8:1 on the ticket; .7 ≈ 5.9:1 */
.ticket.bump { animation: bump .32s var(--ease-out); }
@keyframes bump { 30% { transform: scale(1.045); } }

/* the track: a cost profile with a range input laid over it */
.track { position: relative; margin-top: 10px; padding-top: 18px; }
.profile { display: block; width: 100%; height: 46px; overflow: visible; }
.pf-area { fill: var(--cream); opacity: .10; }
.pf-area.on { opacity: .28; }
.pf-line { fill: none; stroke: var(--cream); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.pf-tick { stroke: var(--cream); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .7; }
.pf-tick.major { stroke-width: 2; opacity: 1; }
.pf-hatch { stroke: var(--line-2); stroke-width: 2; }
.pf-wall { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.pf-pos { stroke: var(--red); stroke-width: 2; vector-effect: non-scaling-stroke; }
.at-wall .pf-wall { stroke: var(--red); }

.cliff-tags { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
.ctag {
  position: absolute; transform: translateX(-50%); top: 0;
  font: 600 10.5px/1 var(--f-mono); color: var(--cream); background: var(--bg);
  border: 1px solid var(--cream); border-radius: var(--r-ctl); padding: 2px 4px; cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s;
}
.ctag.near { background: var(--cream); color: var(--cream-ink); animation: nudge 1.2s ease-in-out infinite; }
.ctag.passed { opacity: .55; }
@keyframes nudge { 50% { transform: translateX(-50%) translateY(-2px); } }

.range { -webkit-appearance: none; appearance: none; position: absolute; left: 0; right: 0; bottom: 14px; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.range::-webkit-slider-runnable-track { height: 44px; background: transparent; }
.range::-moz-range-track { height: 44px; background: transparent; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 44px; border-radius: var(--r-pill);
  background: var(--red); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--red), 0 0 16px rgba(255, 90, 74, .55);
}
.range::-moz-range-thumb { width: 14px; height: 44px; border-radius: 999px; background: var(--red); border: 3px solid var(--surface); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }

.scale { position: relative; height: 14px; margin-top: 2px; font: 500 10.5px/14px var(--f-mono); color: var(--muted); }
.scale span { position: absolute; left: 0; white-space: nowrap; }
.scale small { font-size: inherit; opacity: .85; }
.scale .wall { transform: translateX(-100%); padding-right: 4px; color: var(--text); }
.scale .wall.left { transform: none; padding: 0 0 0 4px; }
.ghost-l { white-space: pre; position: absolute; right: 0; top: 30px; padding-left: 8px; font: 600 10.5px/1.3 var(--f-mono); color: var(--muted); text-align: right; }

.hint { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 500 13.5px/1.3 var(--f-body); color: var(--muted); min-height: 36px; }
.hint .ico { flex: none; width: 18px; height: 18px; color: var(--cream); }
.hint b { color: var(--text); font-weight: 600; }
.hint span { flex: 1; }
.hint.warn .ico { color: var(--red); }
.hint-btn { flex: none; font: 600 13px/1 var(--f-body); color: var(--cream-ink); background: var(--cream); border: 0; border-radius: var(--r-pill); padding: 9px 12px; min-height: 36px; cursor: pointer; }

.change { margin-top: 8px; border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; background: var(--raised); }
.change.flash { animation: flash 1.4s var(--ease-out); }
@keyframes flash { 0% { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-dim); } }
.change-h { display: flex; justify-content: space-between; margin: 0 0 4px; font: 600 11px/1.2 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.change-h .cd { color: var(--cream); letter-spacing: 0; }
.change ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.change li { display: grid; grid-template-columns: 14px 18px 1fr auto; align-items: center; gap: 6px; font: 500 13px/1.35 var(--f-body); }
.change li .ico { width: 16px; height: 16px; }
.change li .sgn { width: 12px; height: 12px; }
.change li.in .sgn { color: var(--red); }
.change li.out { color: var(--muted); }
.change li.out .nm { text-decoration: line-through; text-decoration-color: var(--control); }
.change .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.change .pr { font-weight: 600; }
.change li.more { display: block; font-size: 12px; color: var(--muted); padding-left: 44px; }
.hint .short, .change-s { display: none; }
/* phone: the dock gets one-line versions — the full change list lives in the parts sheet */
@media (max-width: 959px) {
  .hint .long, .change-h, .change ul, .readout-hp .label { display: none; }
  .hint .short { display: inline; }
  .hint { margin-top: 4px; }
  .change { padding: 6px 10px; margin-top: 6px; }
  .change-s { display: flex; align-items: center; gap: 4px; margin: 0; font: 500 13px/1.3 var(--f-body); color: var(--muted); }
  .change-s span:first-of-type { flex: 1; }
  .change-s b { color: var(--text); }
  .change-s .cd { font: 600 13px var(--f-mono); color: var(--cream); }
  .sheet { padding-bottom: calc(250px + env(safe-area-inset-bottom)); }
}

/* ---------- panels ---------- */
.results { display: grid; gap: 16px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; min-width: 0; }
.panel-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; margin-bottom: 12px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; letter-spacing: .005em; }
h1 { font-size: 26px; line-height: 1.05; }
h2 { font-size: 24px; }
.sub { margin: 2px 0 0; font: 500 13px/1.4 var(--f-mono); color: var(--muted); }

.stats { display: flex; gap: 20px; margin: 0; }
.stats div { display: grid; }
.stats dt { font: 600 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.stats dd { margin: 0; font: 700 22px/1 var(--f-display); }
.stats dd small { font: 500 12px/1 var(--f-body); color: var(--muted); }
.stats .hp { color: var(--red); } .stats .tq { color: var(--blue); }
@media (max-width: 959px) { .stats { width: 100%; justify-content: space-between; gap: 8px; } .stats dd { font-size: 19px; } .stats dd small { display: block; margin-top: 3px; font-size: 11px; } }

/* ---------- dyno chart ---------- */
.dyno-wrap { position: relative; margin: 0 -6px; }
.dyno { display: block; width: 100%; height: 250px; touch-action: pan-y; }
.dyno .g { stroke: var(--grid); stroke-width: 1; }
.dyno .ax { font: 500 10.5px var(--f-mono); fill: var(--stock); }
.c-stock { fill: none; stroke: var(--stock); stroke-width: 1.5; stroke-dasharray: 5 4; }
.c-stock.tq { stroke-dasharray: 2 4; opacity: .8; }
.c-hp { fill: none; stroke: var(--red); stroke-width: 2.75; stroke-linejoin: round; transition: d .16s var(--ease-out); }
.c-tq { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; transition: d .16s var(--ease-out); }
.c-fill { fill: url(#hpfill); transition: d .16s var(--ease-out); }
.c-hp.sweep, .c-tq.sweep { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sweep 1.1s var(--ease-out) .1s forwards; }
@keyframes sweep { to { stroke-dashoffset: 0; } }
#c-pk { transition: transform .16s var(--ease-out); }
.pk { fill: var(--red); stroke: var(--surface); stroke-width: 2; }
.pk-t { font: 600 12px var(--f-mono); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.xh { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.xh-hp { fill: var(--red); stroke: var(--surface); stroke-width: 2; }
.xh-tq { fill: var(--blue); stroke: var(--surface); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; display: grid; gap: 2px; min-width: 136px; padding: 8px 10px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); font: 500 12px/1.35 var(--f-mono); }
.tip b { font-weight: 600; color: var(--muted); }
.tip .hp { color: var(--red); } .tip .tq { color: var(--blue); } .tip .st { color: var(--muted); }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; margin: 8px 0 0; font: 500 12px/1 var(--f-mono); color: var(--muted); align-items: center; }
.lg { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--red); margin-right: -10px; vertical-align: middle; }
.lg-tq { border-color: var(--blue); }
.lg-stock { border-top: 2px dashed var(--stock); }

/* ---------- parts sheet: plain on purpose ---------- */
.watch { display: flex; gap: 10px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line-2); border-left: 3px solid var(--cream); border-radius: 6px; background: var(--raised); font-size: 14px; }
.watch .ico { flex: none; color: var(--cream); width: 20px; height: 20px; margin-top: 1px; }
.watch ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.pgroup { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.pgroup h3 { display: flex; align-items: center; gap: 8px; font: 600 12px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pgroup h3 .ico { width: 22px; height: 22px; color: var(--text); }
.prow { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "pn pp" "pn pl"; gap: 0 16px; padding: 8px 0 8px 30px; border-radius: 6px; position: relative; }
.prow + .prow { border-top: 1px dashed var(--line); }
.pn { grid-area: pn; display: grid; gap: 2px; min-width: 0; }
.pn .nm { font-weight: 600; font-size: 15px; }
.pn .why { font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.pp { grid-area: pp; text-align: right; font-weight: 600; font-size: 15px; }
.pp .incl { font-weight: 500; color: var(--muted); font-size: 13px; }
.pl { grid-area: pl; text-align: right; font: 500 12px/1.6 var(--f-mono); color: var(--muted); }
.badge { display: inline-block; vertical-align: 2px; margin-left: 4px; font: 600 10px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--red-ink); background: var(--red); border-radius: var(--r-ctl); padding: 3px 5px; }
.prow.is-new::before { content: ""; position: absolute; left: 10px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--red); }
.animate .prow.is-new { animation: rowin 1.6s var(--ease-out); }
@keyframes rowin { 0% { background: var(--red-dim); transform: translateX(6px); } 30% { transform: none; } }
.pgroup.gone h3 .ico { color: var(--muted); }
.prow.is-gone .nm, .prow.is-gone .pp { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--control); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 2px solid var(--text); margin-top: 8px; padding-top: 12px; }
.total-row span { font-weight: 600; }
.total-row strong { font: 700 28px/1 var(--f-body); color: var(--cream); }
.fine { font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; }
.notice { margin: 0; padding: 10px 12px; border: 1px solid var(--line-2); border-left: 3px solid var(--cream); border-radius: 6px; font-size: 14px; }

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  .sheet { grid-template-columns: 380px minmax(0, 1fr); align-items: start; gap: 24px; padding: 24px 24px 64px; }
  .rig { position: sticky; top: 84px; display: grid; gap: 16px; }
  .rig-setup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; }
  .rig-dock { position: static; border: 1px solid var(--line-2); border-radius: var(--r-panel); box-shadow: none; padding: 18px 18px 14px; }
  .rig-dock::before { display: none; }
  .hp-v output { font-size: 56px; }
  .ticket .t-v { font-size: 32px; }
  .profile { height: 64px; }
  .dyno { height: 380px; }
  .panel { padding: 20px 22px; }
  h1 { font-size: 32px; }
  .hp-sub { white-space: normal; }
  .prow { grid-template-columns: 1fr 96px 76px; grid-template-areas: "pn pp pl"; align-items: baseline; padding-left: 30px; }
}
@media (max-width: 959px) {
  .topbar-in { height: 52px; padding: 0 16px; gap: 12px; }
  .topbar .wordmark { height: 22px; }
  .nav, .topbar .btn-ghost { display: none; }
  .menu-btn { display: grid; gap: 5px; align-content: center; justify-items: end; width: 44px; height: 44px; background: none; border: 0; padding: 0 2px; cursor: pointer; }
  .menu-btn span { display: block; height: 2px; width: 22px; background: var(--text); }
  .menu-btn span + span { width: 14px; }
  .rig-setup { grid-template-columns: 1fr; }
}

/* ============================================================================
   MOC-7 gearing. Same rules as the rest of the sheet: chrome gets the drawing,
   numbers stay plain. No new colours — A is filled, B is hollow/dashed, so the
   two setups separate without a hue (and survive greyscale / colour-blindness).
   ============================================================================ */
.gearing { border-top: 1px solid var(--line); margin-top: 14px; }
.gr-toggle { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 2px; min-height: 64px; background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; border-radius: var(--r-ctl); }
.gr-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line-2); }
.gr-ico .ico { width: 24px; height: 24px; }
.gr-tt { flex: 1; display: grid; gap: 3px; min-width: 0; }
.gr-h { font: 700 21px/1 var(--f-display); letter-spacing: .01em; }
.gr-sum { font: 500 13.5px/1.35 var(--f-body); color: var(--muted); }
.gr-sum > span { display: block; }
.gr-sum b { color: var(--text); font-weight: 600; }
.gr-chev { flex: none; width: 10px; height: 10px; margin: 0 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s var(--ease-out); }
.gearing.open .gr-chev { transform: rotate(225deg) translateY(-3px); }
.gr-toggle:hover .gr-chev { border-color: var(--text); }
.gearing.open .gr-sum { display: none; }
.gr-body { display: grid; gap: 16px; padding-bottom: 4px; }

/* setup cards */
.setups { display: grid; gap: 10px; }
.setup { position: relative; display: grid; gap: 10px 12px; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px;
  grid-template-columns: 30px minmax(0, 1.7fr) minmax(0, .9fr) minmax(0, 1.3fr) 36px;
  grid-template-areas: "tag trans axle tire rm" "tag custom custom custom rm"; }
.s-tag { grid-area: tag; align-self: start; margin-top: 18px; }
.f-trans { grid-area: trans; } .f-custom { grid-area: custom; } .f-axle { grid-area: axle; } .f-tire { grid-area: tire; }
.rm-b { grid-area: rm; align-self: start; margin-top: 18px; }
.f { display: grid; gap: 6px; min-width: 0; align-content: start; }
.f .label { display: flex; align-items: center; gap: 6px; }
.f .label .ico { width: 16px; height: 16px; color: var(--text); }
.input.mono { font-family: var(--f-mono); font-size: 15px; letter-spacing: .01em; }
.f-msg { min-height: 14px; font: 500 11.5px/1.25 var(--f-mono); color: var(--muted); }
.f-msg.bad { color: var(--red); }
.tag { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-ctl); font: 700 12px/1 var(--f-mono);
  background: var(--text); color: var(--bg); border: 1.5px solid var(--text); }
.s-b .tag, .tag.b { background: transparent; color: var(--text); border-style: dashed; }
.rm-b { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: none; color: var(--muted); border: 1px solid var(--control); border-radius: var(--r-pill); cursor: pointer; }
.rm-b:hover { color: var(--text); border-color: var(--text); }
.rm-b .ico { width: 16px; height: 16px; }
.add-b { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; background: none; color: var(--text); text-align: left;
  border: 1px dashed var(--control); border-radius: 10px; cursor: pointer; }
.add-b:hover { border-color: var(--text); }
.add-b .ico { flex: none; width: 18px; height: 18px; }
.add-b span { display: grid; gap: 2px; }
.add-b b { font: 600 15px/1.2 var(--f-body); }
.add-b small { font: 500 13px/1.3 var(--f-body); color: var(--muted); }

/* road speed — a neutral control on purpose: red is the power slider's, and only the power slider's */
.speed { display: grid; gap: 4px; }
.speed.idle { opacity: .5; }
.spd-top { display: flex; align-items: center; gap: 14px; }
.spd-v { display: flex; align-items: baseline; gap: 5px; }
.spd-v output { font: 700 40px/0.95 var(--f-display); min-width: 2.2ch; text-align: right; }
.spd-v small { font: 600 15px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.spd-btns { margin-left: auto; display: flex; gap: 6px; }
.step { min-width: 52px; min-height: 44px; font: 600 14px/1 var(--f-mono); color: var(--text); background: var(--raised); border: 1px solid var(--control); border-radius: var(--r-pill); cursor: pointer; }
.step:hover { border-color: var(--text); }
.spd-range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.spd-range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.spd-range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.spd-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -11px; border-radius: 50%; background: var(--text); border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--text); }
.spd-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--text); border: 4px solid var(--surface); }
.spd-range:focus-visible { outline: none; }
.spd-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.spd-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus); }
.spd-scale { position: relative; height: 14px; margin: 0 13px; font: 500 10.5px/14px var(--f-mono); color: var(--muted); }
.spd-scale span { position: absolute; transform: translateX(-50%); }

/* the verdict: the comparison in one glance — an instrument slip, inset darker than the panel */
.verdict { padding: 14px 16px 16px; border: 1px solid var(--line-2); border-radius: var(--r-panel); background: var(--bg); }
.vd-k { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font: 600 11px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.vd-k .ico { width: 18px; height: 18px; color: var(--text); }
.vd-row { display: grid; column-gap: 20px; row-gap: 2px; align-items: end; padding: 10px 0 2px;
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  grid-template-areas: "tag nm rpm hp tq" "tag where rpm hp tq" ". tach tach tach tach"; }
.vd-row + .vd-row { border-top: 1px dashed var(--line-2); }
.vd-row .tag { grid-area: tag; align-self: center; }
.vd-nm { grid-area: nm; font: 600 15px/1.25 var(--f-body); min-width: 0; }
.vd-nm small { margin-left: 8px; font: 500 12px var(--f-mono); color: var(--muted); }
.vd-where { grid-area: where; font: 500 12px/1.3 var(--f-mono); color: var(--muted); }
.vd-where.over { color: var(--red); }
.vd-rpm { grid-area: rpm; } .vd-hp { grid-area: hp; } .vd-tq { grid-area: tq; }
.vd-rpm, .vd-hp, .vd-tq { display: flex; align-items: baseline; gap: 4px; justify-content: flex-end; min-width: 64px; }
.vd-row b { font: 700 34px/1 var(--f-display); letter-spacing: -.005em; }
.vd-row small { font: 500 11px/1 var(--f-mono); color: var(--muted); }
.vd-hp b { color: var(--red); } .vd-tq b { color: var(--blue); }
.vd-row b.na { color: var(--muted); }
.tach { grid-area: tach; display: block; width: 100%; height: 22px; margin-top: 10px; }
.t-base { fill: var(--line-2); }
.t-band { fill: var(--text); opacity: .22; }
.t-hatch { stroke: var(--red); stroke-width: 2; }
.t-redl { stroke: var(--red); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.t-needle { stroke: var(--text); stroke-width: 3; vector-effect: non-scaling-stroke; }
.t-needle.n-b { stroke-dasharray: 4 2; }
.t-needle.off { opacity: .45; }
.t-scale { position: relative; height: 16px; margin: 4px 0 0 48px; font: 500 10.5px/16px var(--f-mono); color: var(--muted); }
.t-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.t-scale .a-l { transform: none; } .t-scale .a-r { transform: translateX(-100%); } .t-scale .red { color: var(--red); }
.vd-say { margin: 12px 0 0; font: 500 16px/1.45 var(--f-body); }
.vd-say b { font-weight: 700; }
.gr-empty { display: flex; gap: 12px; align-items: flex-start; }
.gr-empty .ico { flex: none; width: 28px; height: 28px; color: var(--muted); }
.gr-empty p { margin: 0; font-size: 14.5px; color: var(--muted); }
.gr-empty b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 600; }

/* every gear */
.gstrip + .gstrip { margin-top: 14px; }
.gs-h { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 600 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gs-h .tag { width: 20px; height: 20px; font-size: 11px; }
.gs-u { margin-left: auto; letter-spacing: .04em; text-transform: none; }
.gcells { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.gcell { display: grid; gap: 3px; padding: 8px 10px 9px; min-height: 66px; text-align: left; color: var(--text); background: var(--raised); border: 1px solid var(--control); border-radius: 6px; cursor: pointer; }
.gcell:hover { border-color: var(--muted); }
.gcell[aria-pressed="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.s-b .gcell[aria-pressed="true"] { border-style: dashed; box-shadow: none; border-width: 2px; padding: 7px 9px 8px; }
.g-n { display: flex; align-items: baseline; gap: 4px; font: 600 11px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.g-n .g-r { margin-left: auto; letter-spacing: 0; }
.gcell[aria-pressed="true"] .g-n { color: var(--text); }
.g-rpm { font: 700 22px/1 var(--f-display); }
.g-rpm small { font: 500 10.5px var(--f-mono); color: var(--muted); }
.g-pw { font: 500 12px/1.2 var(--f-mono); color: var(--muted); }
.g-pw .hp { color: var(--red); } .g-pw .tq { color: var(--blue); }
.warn-t { color: var(--red); }
.gcell.over .g-rpm, .gcell.under .g-rpm { color: var(--muted); }

.gr-line { margin: 0; padding: 10px 12px; font: 400 13px/1.5 var(--f-body); color: var(--muted); border: 1px solid var(--line-2); border-left: 3px solid var(--control); border-radius: 6px; }
.gr-line strong, .gr-line b { color: var(--text); font-weight: 600; }
.mono { font-family: var(--f-mono); font-size: .92em; }

/* chart overlay */
.gearing-on .dyno { height: 310px; }
.gb-band { fill: var(--text); opacity: .05; }
.gb-redzone { fill: var(--red); opacity: .06; }
.gb-hatch { stroke: var(--red); stroke-width: 2; }
.gb-redline { stroke: var(--red); stroke-width: 1.25; stroke-dasharray: 4 3; }
.gs-spd { font: 600 11px var(--f-mono); letter-spacing: .14em; fill: var(--muted); }
.gl { stroke: var(--line-2); stroke-width: 1; }
.gl.sel { stroke: var(--text); stroke-width: 1.5; }
.gl-b { stroke-dasharray: 3 3; }
.gl.over { stroke: var(--red); opacity: .6; }
.gd { stroke-width: 2; }
.gd-a { fill: var(--text); stroke: var(--surface); }
.gd-b { fill: var(--surface); stroke: var(--text); }
.gc { cursor: ew-resize; }
.gc rect { fill: var(--raised); stroke: var(--control); stroke-width: 1; }
.gc text { font: 600 11px var(--f-mono); fill: var(--muted); pointer-events: none; }
.gc-b rect { stroke-dasharray: 3 2; }
.gc-a.sel rect { fill: var(--text); stroke: var(--text); }
.gc-a.sel text { fill: var(--bg); }
.gc-b.sel rect { stroke: var(--text); stroke-width: 2; }
.gc-b.sel text { fill: var(--text); }
.gc.over rect { stroke: var(--red); } .gc.over text { fill: var(--red); }
.gc.off rect { fill: var(--bg); }
.gc-row { font: 700 11px var(--f-mono); fill: var(--muted); }
.gsel-t { font: 600 11.5px var(--f-mono); fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; pointer-events: none; }
.tip .gr-t { color: var(--text); }
.tip .gr-t:first-of-type { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line-2); }
.lg-gear { display: inline-flex; align-items: center; gap: 6px 16px; }
.lg-band { display: inline-block; width: 14px; height: 10px; margin-right: -10px; background: rgba(237, 235, 230, .14); }
.lg-red { display: inline-block; width: 14px; height: 10px; margin-right: -10px; background: repeating-linear-gradient(45deg, var(--red) 0 2px, transparent 2px 5px); }

@media (min-width: 960px) {
  .gearing-on .dyno { height: 440px; }
}
@media (max-width: 959px) {
  .setup { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-areas: "tag rm" "trans trans" "custom custom" "axle tire"; padding: 10px; gap: 8px 10px; }
  .s-tag, .rm-b { margin-top: 0; }
  .rm-b { justify-self: end; width: 32px; height: 32px; }
  .spd-v output { font-size: 36px; }
  .verdict { padding: 12px 12px 14px; }
  .vd-row { column-gap: 10px; grid-template-columns: 24px repeat(3, minmax(0, 1fr));
    grid-template-areas: "tag nm nm nm" "tag rpm hp tq" "tag where where where" "tag tach tach tach"; }
  .vd-row .tag { align-self: start; margin-top: 1px; width: 22px; height: 22px; font-size: 11px; }
  .vd-nm { font-size: 14px; margin-bottom: 4px; }
  .vd-rpm, .vd-hp, .vd-tq { justify-content: flex-start; min-width: 0; }
  .vd-row b { font-size: 28px; }
  .vd-where { margin-top: 2px; }
  .tach { margin-top: 6px; }
  .t-scale { margin-left: 34px; }
  .vd-say { font-size: 15px; }
  .gcells { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .gcell { padding: 7px 7px 8px; min-height: 62px; }
  .g-rpm { font-size: 19px; }
  .g-rpm small { display: none; }
  .g-n .g-r { display: none; }
  .gs-u { font-size: 10px; }
  .g-pw { display: grid; } .g-pw .dot { display: none; }

  /* while the gearing panel is on screen the dock slims to hp + price; tap it to get the slider back */
  body.dock-slim .rig-dock .track, body.dock-slim .rig-dock .hint, body.dock-slim .rig-dock .change, body.dock-slim .ticket .t-d { display: none; }
  body.dock-slim .rig-dock { padding-top: 14px; cursor: pointer; }
  body.dock-slim .hp-v output { font-size: 34px; }
  body.dock-slim .ticket { padding: 6px 16px 7px 14px; min-width: 0; }
  body.dock-slim .ticket .t-v { font-size: 22px; }
  body.dock-slim .readouts::after { content: "Tap for\A slider"; white-space: pre; order: 1; align-self: center; font: 500 11px/1.2 var(--f-mono); color: var(--muted); text-align: center; flex: 1; }
  body.dock-slim .ticket { order: 2; }
}

/* ============================================================================
   MOC-10 production additions: what the prototype didn't have to carry.
   ============================================================================ */
.sheet-intro { font: 600 15px/1.35 var(--f-body); color: var(--muted); margin: 0; letter-spacing: 0; }
/* MOC-75: hold the space of what sheet.js fills in, so the first render doesn't shove the page around (CLS) */
.pick-row .select { text-overflow: ellipsis; } /* a clipped generation reads "1997–2000 Co…", not "1997–2000 Cc" at 360px */
.chart-panel .panel-h:has(#sheet-title:empty) { min-height: 56px; }
.hp-sub:empty::before { content: "\00a0"; }
@media (max-width: 959px) { .rig-setup > .more-opts { display: none; } }
@media (max-width: 959px) { html { scroll-padding-bottom: calc(var(--dock-h, 0px) + 12px); } } /* focus never lands behind the dock (2.4.11) */ /* sheet.js moves it below the chart on phones */
/* MOC-64: the owner couldn't tell "More options" opened. Same anatomy as the Gearing row (icon tile,
   title, what's inside, chevron that turns on open), on a bordered surface so it reads as a control
   before it is touched. --control border: the row's only boundary, so it needs the 3:1 non-text contrast. */
.more-opts { display: grid; gap: 14px; }
.mo-toggle { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--control); border-radius: var(--r-panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mo-toggle:hover { border-color: var(--text); }
.mo-toggle:hover .gr-chev { border-color: var(--text); }
.mo-toggle .gr-h { font-size: 19px; }
.mo-toggle .gr-sum > span { display: inline; }
.mo-n { margin-left: 4px; font: 500 12px/1 var(--f-mono); letter-spacing: 0; color: var(--muted); }
.more-opts.open .gr-chev { transform: rotate(225deg) translateY(-3px); }
.mo-body { display: grid; gap: 14px; }
@media (prefers-reduced-motion: reduce) { .gr-chev { transition: none; } }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet-error { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-2); border-left: 3px solid var(--red); border-radius: var(--r-panel); background: var(--surface); }
.sheet-error .ico { flex: none; width: 22px; height: 22px; color: var(--red); }
.sheet-error p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
body.sheet-failed .chart-panel, body.sheet-failed .parts-panel, body.sheet-failed .rig-dock { display: none; }
.parts-empty { margin: 4px 0 8px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--muted); font-size: 14px; }
.lg-crank { margin-left: auto; font: 600 10.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.affiliate-note { margin-top: -4px; }
.parts-panel .math { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.parts-panel .math summary { cursor: pointer; font: 600 14px var(--f-body); min-height: 32px; }
.math-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.math-label { font-weight: 600; }
.math-formula { grid-column: 1; color: var(--muted); font: 500 12px/1.4 var(--f-mono); overflow-wrap: anywhere; }
.math-value { grid-row: 1 / span 2; grid-column: 2; align-self: center; font: 600 13px var(--f-mono); color: var(--cream); }
.math-foot { font-size: 12.5px; color: var(--muted); }
.sheet-foot { padding: 0 4px; }
.sheet-foot p { margin: 0 0 6px; font-size: 13px; color: var(--muted); max-width: 100ch; }
.f-msg a { color: var(--muted); }

/* MOC-26/34 review fixes ------------------------------------------------- */
/* a solve is pending: the tapped control has already repainted as pressed.
   brightness, not opacity, so the fixed phone dock stays opaque over the chart */
body.solving .rig-dock > *, body.solving .chart-panel, body.solving .parts-panel { filter: brightness(.6); transition: filter .12s; }
body.solving .rig-setup .seg button { pointer-events: none; }
.affiliate-top { margin: 0 0 12px; }
.pick-row { display: grid; gap: 14px; }
/* on a short desktop screen the intro pushed the dock's hint line off the bottom.
   Visually hidden, not removed: it is the page's only h1. */
@media (max-height: 959px) { .sheet-intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
@media (max-width: 959px) {
  .sheet-intro { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* the stats row repeats the dock's readout */
  .chart-panel .stats { display: none; }
  .rig-setup { gap: 10px; }
  .rig-setup .field .label { margin-bottom: 4px; }
  /* engine + generation side by side */
  .pick-row:has(#variant-wrap:not([hidden])) { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; }
  /* the rig flattens so the dock and setup fields are grid items; "More options" is moved by
     js/sheet.js to between the chart and the parts (MOC-40), so the chart still comes up the screen */
  .rig, .rig-setup { display: contents; }
  .results { order: 1; }
  .more-opts { padding-top: 4px; }
  /* MOC-64: the owner saw the phone layout as "left centered, gaps on the right". Nothing overflows
     (checked at 360/375/390/414, all 92 engines); the gap was the Fuel and Induction pills, full-width
     but with their buttons packed to the left (Induction left ~45% of its pill empty on the right).
     The buttons now share the pill's width equally; min-width stays auto, so a label never squeezes below its text and Fuel still scrolls if it must. */
  .rig-setup .seg { display: flex; }
  .rig-setup .seg button { flex: 1 1 0; }
  .sheet { gap: 10px; }
  .chart-panel .panel-h { margin-bottom: 4px; }
  /* the change line floats just above the dock instead of growing it over the chart's peak */
  .rig-dock .change { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 8px); margin: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    animation: none; transition: opacity .6s var(--ease-out), visibility 0s linear 0s; }
  /* left-anchored, content-width pill: the peak sits at high rpm, toward the chart's right, so the
     pill clears it (MOC-48). Text only: the hp is in the readout directly below, and the row of system
     icons made the pill up to 299 px wide, enough to reach the peak on 6 engines at 360 px */
  .rig-dock .change { right: auto; width: max-content; max-width: calc(100% - 32px); }
  .rig-dock .change.gone { opacity: 0; visibility: hidden; transition: opacity .6s var(--ease-out), visibility 0s linear .6s; }
}

/* MOC-36: on a laptop under ~960px tall the sticky rig was taller than the screen, so the
   slider track and the hint line (with its "Switch to E85" button) sat below the fold however
   you scrolled. Tighten the rig instead of hiding anything: engine + generation side by side,
   smaller gaps and readout, the phone-height cost profile. As a safety net the rig is capped
   at the screen height and the dock sticks to its bottom, so if the change list grows it the
   setup scrolls under the dock rather than pushing the slider off screen. */
@media (min-width: 960px) and (max-height: 959px) {
  .sheet { padding-top: 16px; }
  .rig { top: 72px; max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; gap: 10px; }
  .rig-setup { gap: 10px; padding: 14px 16px; }
  .rig-setup .field .label { margin-bottom: 4px; }
  .pick-row:has(#variant-wrap:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .rig-dock { position: sticky; bottom: 0; z-index: 1; padding: 14px 16px 10px; }
  .hp-v output { font-size: 48px; }
  .track { margin-top: 6px; }
  .profile { height: 46px; }
  .hint { margin-top: 4px; }
}

/* MOC-40 F1: short phones (iPhone SE 2/3, iPhone 8 at 375x667) lost the whole curve under the dock.
   Tighten only what a short screen can spare; 360x780 / 390x844 and up are untouched. */
@media (max-width: 959px) and (max-height: 720px) {
  .sheet { gap: 8px; padding-top: 12px; }
  .chart-panel { padding-top: 12px; }
  .rig-dock { padding-top: 10px; }
  .hp-v output { font-size: 38px; }
  .ticket { padding-top: 6px; padding-bottom: 7px; }
  .ticket .t-v { font-size: 24px; }
  .track { margin-top: 6px; }
  .profile { height: 32px; }
  /* MOC-71: at 375x667 the stock peak still sat 1-11px under the dock on 5 engines. The plain
     "Next cliff" line goes: the cliff tags on the track already mark it, and every hp from stock
     up gets the line's ~40px of chart. The over-a-cliff warning and the fuel switch stay. */
  .rig-dock .hint.next { display: none; }
}

/* MOC-50: a landscape phone (844x390, 800x360) gave the fixed dock half the screen. Under 450px tall
   the dock stays docked but collapses to one row of at most 64px: what it makes, the slider, what it
   costs. The cost profile stays as the slider's backdrop; the cliff tags, scale labels, hp sub-line,
   price delta and hint line drop out (the fuel switch the hint offers is the Fuel row up the page). */
@media (max-width: 959px) and (max-height: 450px) {
  .sheet { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .rig-dock { display: flex; align-items: center; gap: 14px; height: calc(64px + env(safe-area-inset-bottom)); padding: 0 16px env(safe-area-inset-bottom); border-radius: 0; }
  .rig-dock::before, .hp-sub, .ticket .t-d, .rig-dock .hint, .cliff-tags, .ghost-l, .scale { display: none; }
  .readouts { display: contents; }
  .readout-hp { order: 0; flex: none; gap: 0; }
  .readout-hp .label { font-size: 10.5px; }
  .hp-v output { font-size: 30px; }
  .hp-v small { font-size: 13px; }
  .rig-dock .track { order: 1; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; }
  .profile { height: 30px; }
  .range { bottom: -7px; }
  .ticket { order: 2; min-width: 0; padding: 5px 16px 6px 14px; }
  .ticket .t-v { font-size: 20px; }
  .dyno, .gearing-on .dyno { height: calc(100vh - 136px); min-height: 220px; } /* the whole chart fits between the sticky nav and the dock */
  body.dock-slim .readouts::after { display: none; }
}

/* ---------------------------------------------------------------------------
   Stock card (replaces the one-line spec run-on). Label line, three figures,
   then provenance on the left and the wiki page on the right.
   --------------------------------------------------------------------------- */
.spec { display: grid; gap: 10px; padding: 12px 14px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-ctl); }
.spec:empty { min-height: 118px; } /* holds the card's space before sheet.js fills it (MOC-75) */
.sp-h { margin: 0; font: 600 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sp-id { letter-spacing: .04em; text-transform: none; font-weight: 500; }
.sp-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sp-fig { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 4px; min-width: 0; }
.sp-fig + .sp-fig { padding-left: 10px; border-left: 1px solid var(--line-2); }
.sp-fig b { font: 700 24px/1 var(--f-display); color: var(--text); }
.sp-u { font: 500 12px/1 var(--f-body); color: var(--muted); }
.sp-s { grid-column: 1 / -1; margin-top: 4px; font: 500 11.5px/1 var(--f-mono); color: var(--muted); white-space: nowrap; }
.sp-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--line); }
.sp-wiki { margin-left: auto; font: 600 13px/1 var(--f-body); color: var(--text); text-decoration: none; white-space: nowrap; padding: 6px 0; }
.sp-wiki:hover { color: var(--red); }
/* provenance: label + hosts only; the research note lives on the wiki page (MOC-43) */
.spec .rating-src { display: block; margin: 0; min-width: 0; font-size: 12px; }
.spec .rs-note, .spec .rs-note-h { display: none; }
.spec .rs-unverified .rs-flag { cursor: help; }
.spec .rs-unverified .rs-links { margin-left: 6px; }

/* run conditions on the dyno: chips instead of a dotted sentence */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font: 600 11px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 5px 7px 4px; white-space: nowrap; }
.chips:empty { display: none; }

@media (max-width: 959px) {
  /* phone: the chart has to come up the screen (MOC-34/40), so the card keeps the three figures,
     the provenance and the wiki link, and drops the engine id and the @rpm lines (both on the wiki page) */
  .spec { padding: 10px 12px; gap: 6px; }
  .spec:empty { min-height: 92px; }
  .sp-id, .sp-s { display: none; }
  .sp-fig b { font-size: 21px; }
  .sp-foot { padding-top: 8px; }
  .sp-wiki { padding: 8px 0; } /* 32px tall tap target with the line-height */
  /* fuel + induction sit right above the chart on a phone; only the non-obvious conditions stay */
  .chip-dup { display: none; }
  .chips { margin-top: 6px; }
}

/* phone parts rows: the price + "find it" column squeezed every description into ~60% of the
   width. The name sits beside price/link; the description runs the full row underneath. */
@media (max-width: 959px) {
  .prow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm pp" "nm pl" "why why"; padding-left: 14px; }
  .prow.is-new::before { left: 2px; }
  .prow .pn { display: contents; }
  .prow .nm { grid-area: nm; }
  .prow .why { grid-area: why; margin-top: 4px; }
}
