/* Crank Shed. A test-cell control panel: near-black steel, one loud colour, hard edges, no glow, no gradients that read as gradients. */
@font-face { font-family: "Poster"; src: url("fonts/poster.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Label"; src: url("fonts/display.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plain"; src: url("fonts/text-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plain"; src: url("fonts/text-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0c0c0b; --plate: #161614; --plate-2: #1f1f1c; --well: #070706; --ink: #f5f3ea; --dim: #b3b0a4; --mute: #7d7a70; --line: #3a3934;
  --loud: #c8ff00; --on-loud: #0c0c0b;
  --hazard: repeating-linear-gradient(-45deg, var(--loud) 0 10px, var(--bg) 10px 20px);
}

* { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.5 "Plain", ui-sans-serif, sans-serif; }
a { color: inherit; text-underline-offset: .18em; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--loud); outline-offset: 2px; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.label { font: 800 .8rem/1 "Label", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

/* The rig fills exactly one screen on a phone */
.rig { display: grid; height: 100vh; height: 100svh; min-height: 560px; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-areas: "top" "cluster" "panel" "tabs"; }
.top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.brand { font: 400 1.05rem/1 "Poster", sans-serif; letter-spacing: -.01em; white-space: nowrap; }
.brand b { font-weight: 400; background: var(--loud); color: var(--on-loud); padding: 0 4px 1px; }
.brand span { display: block; font: 800 .68rem/1 "Label", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-top: 5px; }
.top nav { display: flex; align-items: center; gap: 10px; }
.top nav a { font: 800 .85rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); text-decoration: none; }
.chip { font: 800 .85rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px; border: 2px solid var(--line); background: transparent; cursor: pointer; }
.chip.on { background: var(--loud); color: var(--on-loud); border-color: var(--loud); }

/* Instrument cluster */
.cluster { grid-area: cluster; background: var(--plate); border-block: 3px solid var(--ink); padding: 6px 10px 8px; min-width: 0; }
.plate { display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px; }
.pick { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; text-align: left; background: var(--well); border: 2px solid var(--line); padding: 6px 8px; cursor: pointer; }
.pick b { font: 900 1.2rem/1.05 "Label", sans-serif; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick i { font: 700 .8rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-style: normal; white-space: nowrap; }
.pick::after { content: "\25BC"; margin-left: auto; font-size: .7rem; color: var(--loud); align-self: center; }
.share { background: var(--ink); color: var(--bg); border: 0; font: 900 .95rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; padding: 0 12px; cursor: pointer; }
.shared-note { font-size: .85rem; color: var(--dim); margin: -2px 0 6px; }
.shared-note b { color: var(--loud); }

.gauge { position: relative; background: var(--well); border: 2px solid var(--line); }
.gauge canvas { display: block; width: 100%; }
#tach { height: 74px; }
.gauge.hot { background: var(--loud); border-color: var(--loud); }
.read { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 6px; }
.nums { background: var(--well); border: 2px solid var(--line); padding: 4px 8px 5px; display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 2px 8px; align-items: end; min-width: 0; }
.num { min-width: 0; }
.num b { display: block; font: 900 1.45rem/1 "Label", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.num.rpm b { font-size: 2.5rem; color: var(--loud); }
.num span { font: 800 .68rem/1.1 "Label", sans-serif; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.gear { width: 76px; background: var(--loud); color: var(--on-loud); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gear b { font: 400 2.6rem/1 "Poster", sans-serif; }
.gear span { font: 800 .62rem/1 "Label", sans-serif; letter-spacing: .1em; text-transform: uppercase; }
#scope { height: 62px; }
.scopebox { margin-top: 6px; }
.scopebox .label { position: absolute; left: 6px; bottom: 4px; font-size: .62rem; color: var(--dim); background: var(--well); padding: 1px 3px; }
#status { position: absolute; right: 6px; bottom: 4px; font: 800 .72rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); background: var(--well); padding: 1px 3px; }

/* Panels */
.panel { grid-area: panel; min-height: 0; overflow-y: auto; padding: 8px 10px; }
.drive { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; overflow: hidden; }
.stick { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 6px; min-height: 0; }
.key { display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--plate-2); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); font: 900 1.05rem/1 "Label", sans-serif; letter-spacing: .07em; text-transform: uppercase; cursor: pointer; min-height: 44px; padding: 4px 6px; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.key small { font: 700 .68rem/1 "Label", sans-serif; color: var(--mute); letter-spacing: .05em; }
.key:active, .key.down { transform: translate(3px, 3px); box-shadow: none; background: var(--ink); color: var(--bg); }
.key:active small, .key.down small { color: var(--bg); }
.key.go { background: var(--loud); color: var(--on-loud); border-color: var(--loud); box-shadow: 3px 3px 0 var(--ink); font-size: 1.3rem; min-height: 50px; }
.key.go small { color: var(--on-loud); }
.key.off { background: var(--plate-2); color: var(--ink); border-color: var(--ink); }
.key.off small { color: var(--mute); }
.key.stop-now { background: var(--bg); }
.shifter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-height: 0; }
.shifter .key { font-size: 1.35rem; min-height: 60px; flex-direction: column; }
.row3 { display: grid; grid-template-columns: .7fr 1.15fr 1.15fr; gap: 6px; }
.opts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.opt { background: none; border: 2px solid var(--line); font: 800 .72rem/1.05 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; padding: 5px 2px; min-height: 34px; cursor: pointer; color: var(--dim); }
.opt b { display: block; color: var(--ink); font-weight: 900; }

/* Throttle: a lever in a slot */
.lever { position: relative; background: var(--well); border: 2px solid var(--ink); touch-action: none; cursor: ns-resize; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; min-height: 150px; overflow: hidden; }
.lever .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--loud); }
.lever .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(to top, transparent 0 calc(10% - 2px), var(--line) calc(10% - 2px) 10%); pointer-events: none; }
.lever .handle { position: absolute; left: -2px; right: -2px; height: 34px; bottom: 0; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; font: 900 .78rem/1 "Label", sans-serif; letter-spacing: .08em; pointer-events: none; border-block: 3px solid var(--bg); }
.lever .tag { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font: 800 .7rem/1 "Label", sans-serif; letter-spacing: .09em; color: var(--dim); pointer-events: none; mix-blend-mode: difference; }

/* Tabs */
.tabs { grid-area: tabs; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 3px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: 0; border-left: 2px solid var(--line); font: 900 1rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 13px 0; cursor: pointer; }
.tabs button:first-child { border-left: 0; }
.tabs button[aria-selected="true"] { background: var(--loud); color: var(--on-loud); }

/* Dyno */
.dyno-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.dyno-top .key { min-width: 112px; }
.peaks { display: flex; gap: 12px; }
.peaks .num b { font-size: 1.3rem; }
.chart { background: var(--well); border: 2px solid var(--line); position: relative; }
.chart canvas { display: block; width: 100%; height: 250px; touch-action: pan-y; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 700 .78rem/1.2 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-top: 6px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--loud); vertical-align: middle; margin-right: 5px; }
.legend i.prev { border-top: 3px dashed var(--dim); }
.tablebox { margin-top: 6px; font-size: .85rem; }
.tablebox summary { cursor: pointer; font: 800 .8rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); padding: 6px 0; }
.tablebox table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tablebox th, .tablebox td { text-align: right; padding: 3px 6px; border-bottom: 1px solid var(--line); }

/* Builder */
.lock { background: var(--hazard); padding: 4px; margin-bottom: 8px; }
.lock div { background: var(--bg); padding: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lock p { font-size: .92rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] .field { opacity: .55; }
.field { margin-bottom: 10px; }
.field > label, .field > .label { display: flex; justify-content: space-between; gap: 8px; font: 800 .8rem/1.1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.field output { color: var(--loud); font-variant-numeric: tabular-nums; }
.field input[type="text"] { width: 100%; font-size: 1rem; padding: 8px; background: var(--well); border: 2px solid var(--line); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 8px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 30px; margin-top: -11px; background: var(--loud); border: 2px solid var(--bg); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 28px; background: var(--loud); border: 2px solid var(--bg); border-radius: 0; }
.seg { display: flex; flex-wrap: wrap; }
.seg button { flex: 1 1 auto; background: none; border: 2px solid var(--line); margin-left: -2px; padding: 8px 6px; font: 800 .85rem/1 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; color: var(--dim); }
.seg button:first-child { margin-left: 0; }
.seg button[aria-pressed="true"] { background: var(--loud); color: var(--on-loud); border-color: var(--loud); position: relative; }
.seg button:disabled { cursor: not-allowed; }
.orderbox { display: flex; flex-wrap: wrap; gap: 4px; }
.orderbox button { width: 36px; height: 36px; background: var(--well); border: 2px solid var(--line); font: 900 1rem/1 "Label", sans-serif; cursor: pointer; }
.orderbox button.sel { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.orderbox button.b1 { border-style: dashed; }
.hint { font-size: .82rem; color: var(--dim); margin-top: 3px; }
.tools { display: flex; gap: 6px; margin-top: 5px; }
.tools .opt { flex: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.est { background: var(--well); border: 2px solid var(--line); padding: 8px; margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.est .num b { font-size: 1.3rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: sticky; bottom: -8px; background: var(--bg); padding: 8px 0; }

/* Saved */
.saved { display: grid; gap: 6px; }
.saved li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; background: var(--plate); border: 2px solid var(--line); padding: 8px; }
.saved b { display: block; font: 900 1.1rem/1.1 "Label", sans-serif; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved span { font-size: .82rem; color: var(--dim); }
.saved .btns { display: flex; gap: 4px; }
.saved .opt { padding: 5px 8px; }
.h2 { font: 900 1.2rem/1.1 "Label", sans-serif; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.gap { margin-top: 14px; }

/* Sheets */
dialog { background: var(--bg); color: var(--ink); border: 3px solid var(--ink); padding: 0; width: min(760px, calc(100vw - 16px)); max-height: calc(100svh - 16px); box-shadow: 8px 8px 0 var(--loud); }
dialog::backdrop { background: rgb(7 7 6 / .8); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--ink); color: var(--bg); padding: 8px 10px; }
.sheet-head h2 { font: 900 1.25rem/1 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.sheet-head button { background: var(--bg); color: var(--ink); border: 0; font: 900 .9rem/1 "Label", sans-serif; letter-spacing: .08em; padding: 8px 10px; cursor: pointer; }
.sheet-body { padding: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px; }
.card { position: relative; text-align: left; background: var(--plate); border: 2px solid var(--line); padding: 8px 9px 9px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-height: 84px; }
.card b { font: 900 1.2rem/1 "Label", sans-serif; text-transform: uppercase; }
.card i { font: 800 .75rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--loud); font-style: normal; }
.card span { font-size: .84rem; line-height: 1.25; color: var(--dim); }
.card.now { border-color: var(--loud); }
.card:hover { background: var(--plate-2); }
.card .pro { position: absolute; right: 6px; top: 6px; background: var(--loud); color: var(--on-loud); font: 900 .68rem/1 "Label", sans-serif; letter-spacing: .08em; padding: 3px 5px; }
.bigbuy { display: block; text-align: center; text-decoration: none; background: var(--loud); color: var(--on-loud); font: 900 1.4rem/1 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; padding: 15px 8px; box-shadow: 4px 4px 0 var(--ink); margin: 10px 0 6px; }
.bigbuy:active { transform: translate(4px, 4px); box-shadow: none; }
.perks { display: grid; gap: 4px; margin: 6px 0; }
.perks li { padding-left: 16px; position: relative; font-size: .98rem; }
.perks li::before { content: ""; position: absolute; left: 0; top: .5em; width: 9px; height: 9px; background: var(--loud); }
.keybox { display: flex; gap: 6px; margin-top: 4px; }
.keybox input { flex: 1; min-width: 0; padding: 9px; background: var(--well); border: 2px solid var(--line); font-size: 1rem; }
.keybox button, .linkbox button { flex: none; }
.msg { min-height: 1.4em; font-size: .9rem; color: var(--dim); margin-top: 5px; }
.msg.good { color: var(--loud); }
.small { font-size: .85rem; color: var(--dim); }
.linkbox { display: flex; gap: 6px; }
.linkbox input { flex: 1; min-width: 0; padding: 9px; background: var(--well); border: 2px solid var(--line); font-size: .92rem; }

/* Written pages and the text under the rig */
.copy { max-width: 46rem; margin: 0 auto; padding: 28px 16px 8px; }
.copy h1 { font: 400 clamp(1.9rem, 7vw, 3rem)/1.02 "Poster", sans-serif; letter-spacing: -.02em; margin-bottom: 12px; }
.copy h2 { font: 900 1.55rem/1.1 "Label", sans-serif; letter-spacing: .03em; text-transform: uppercase; margin: 26px 0 8px; }
.copy h3 { font: 900 1.15rem/1.15 "Label", sans-serif; letter-spacing: .03em; text-transform: uppercase; margin: 16px 0 4px; }
.copy p, .copy ul, .copy ol, .copy table, .copy figure { margin-bottom: 11px; }
.copy ul { list-style: square; padding-left: 20px; }
.copy ol { list-style: decimal; padding-left: 22px; }
.copy li { margin-bottom: 4px; }
.copy li::marker { color: var(--loud); }
.lede { font-size: 1.16rem; color: var(--dim); }
.copy table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.copy th { text-align: left; font: 800 .8rem/1.1 "Label", sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.copy th, .copy td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.copy td:last-child { white-space: normal; }
.copy figure { margin-inline: 0; background: var(--plate); border: 2px solid var(--line); padding: 10px; }
.copy figcaption { font-size: .85rem; color: var(--dim); margin-top: 6px; }
.copy svg { display: block; width: 100%; height: auto; }
.cta { display: inline-block; background: var(--loud); color: var(--on-loud); font: 900 1.15rem/1 "Label", sans-serif; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; padding: 12px 16px; box-shadow: 4px 4px 0 var(--ink); margin: 6px 0 12px; }
.pagebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 3px solid var(--ink); }
.pagebar a { text-decoration: none; }
.pagebar .brand { display: block; }
.pagebar nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; font: 800 .9rem/1 "Label", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.foot { max-width: 46rem; margin: 22px auto 0; padding: 14px 16px 28px; border-top: 3px solid var(--line); font-size: .85rem; color: var(--dim); }
.foot p { margin-bottom: 8px; }

@media (max-height: 640px) and (max-width: 979px) and (orientation: portrait) {
  #tach { height: 54px; } #scope { height: 44px; }
  .num.rpm b { font-size: 2rem; } .num b { font-size: 1.2rem; } .gear { width: 64px; } .gear b { font-size: 2.1rem; }
}
/* On a phone the other tabs need the room, so the cluster shrinks to the numbers */
@media (max-width: 979px) and (orientation: portrait) {
  .rig:not([data-tab="drive"]) .scopebox { display: none; }
  .rig:not([data-tab="drive"]) #tach { height: 40px; }
  .rig:not([data-tab="drive"]) .num.rpm b { font-size: 1.5rem; }
  .rig:not([data-tab="drive"]) .num b { font-size: 1.1rem; }
  .rig:not([data-tab="drive"]) .gear { width: 48px; }
  .rig:not([data-tab="drive"]) .gear b { font-size: 1.5rem; }
  .rig:not([data-tab="drive"]) .gear span { display: none; }
}
/* Phone on its side: cluster left, controls right */
@media (orientation: landscape) and (max-height: 520px) {
  .rig { min-height: 320px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top panel" "cluster panel" "cluster tabs"; }
  .top { padding: 3px 8px; } .cluster { border-block: 0; border-top: 2px solid var(--ink); overflow: hidden; display: flex; flex-direction: column; }
  #tach { height: 50px; } .scopebox { flex: 1; min-height: 34px; } #scope { position: absolute; inset: 0; height: 100%; } .num.rpm b { font-size: 1.8rem; } .num b { font-size: 1.1rem; } .gear { width: 60px; } .gear b { font-size: 1.9rem; }
  .tabs button { padding: 7px 0; } .opts { display: none; } .stick { grid-template-rows: auto minmax(0, 1fr) auto; } .key { min-height: 36px; } .shifter .key { min-height: 44px; }
}
/* Desk: cluster large on the left, the controls in a rack on the right */
@media (min-width: 980px) {
  .rig { height: min(100vh, 900px); min-height: 640px; grid-template-columns: minmax(0, 1fr) 450px; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top top" "cluster tabs" "cluster panel"; }
  .top { padding: 10px 18px; } .brand { font-size: 1.5rem; } .brand span { font-size: .8rem; }
  .cluster { border-block: 3px solid var(--ink); border-right: 3px solid var(--ink); padding: 14px 18px; display: flex; flex-direction: column; }
  .pick b { font-size: 1.8rem; } .pick i { font-size: 1rem; }
  #tach { height: 180px; }
  .read { grid-template-columns: 1fr 150px; margin-top: 10px; gap: 10px; }
  .nums { padding: 10px 14px; } .num b { font-size: 2.3rem; } .num.rpm b { font-size: 4.6rem; } .num span { font-size: .85rem; }
  .gear { width: auto; } .gear b { font-size: 5.2rem; } .gear span { font-size: .8rem; }
  .scopebox { margin-top: 10px; flex: 1; min-height: 120px; }
  #scope { height: 100%; position: absolute; inset: 0; }
  .tabs { border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
  .panel { padding: 12px 14px; }
  .drive { grid-template-columns: minmax(0, 1fr) 130px; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .key:active, .key.down, .bigbuy:active { transform: none; }
}
