/* Phantom — cockpit UI.
   Identity (Jack, 2026-11-02): stealth monochrome. Graphite, white and
   grey, one red for the needle, the redline and anything live: a modern
   sports-car cluster, not a sci-fi HUD. Barlow throughout, light for the
   big numbers. Hairline rules, no glow, no gradients.
   Four themes share one set of tokens on html[data-theme]; the tach reads
   the same tokens, so nothing else hard-codes a colour. */

@font-face { font-family: "Barlow"; src: url(../fonts/barlow-300.woff2) format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(../fonts/barlow-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

/* ------------------------------------------------------------ themes */
:root, [data-theme="stealth"] {
  --bg: #0B0B0C; --surface: #141416; --surface-2: #1C1C1F;
  --line: #232326; --line-2: #34343A;
  --text: #F2F2F0; --text-2: #8A8A8E; --text-3: #5C5C61;
  --accent: #E5322D; --on-accent: #FFFFFF; --hot: #E5322D; --live: #E5322D; --warn: #D9A13B;
  --arc: #F2F2F0;
  --shift-1: #F2F2F0; --shift-2: #F2F2F0; --shift-3: #E5322D;
  --scrim: rgba(6, 6, 7, .88);
  color-scheme: dark;
}
[data-theme="amber"] {
  --bg: #0E0A06; --surface: #18120B; --surface-2: #211910;
  --line: #2A2015; --line-2: #3D2F1F;
  --text: #F5E6CC; --text-2: #9C8566; --text-3: #6A5A44;
  --accent: #FF9A1F; --on-accent: #1A0F02; --hot: #FF4A1C; --live: #FF9A1F; --warn: #FF9A1F;
  --arc: #FF9A1F;
  --shift-1: #FF9A1F; --shift-2: #FF9A1F; --shift-3: #FF4A1C;
  --scrim: rgba(10, 7, 4, .88);
  color-scheme: dark;
}
[data-theme="racing"] {
  --bg: #070707; --surface: #121212; --surface-2: #1A1A1A;
  --line: #222222; --line-2: #343434;
  --text: #FFFFFF; --text-2: #9A9A9A; --text-3: #616161;
  --accent: #FF1E1E; --on-accent: #FFFFFF; --hot: #FF1E1E; --live: #2BD96B; --warn: #FFD400;
  --arc: #FFD400;
  --shift-1: #2BD96B; --shift-2: #FFD400; --shift-3: #FF1E1E;
  --scrim: rgba(4, 4, 4, .9);
  color-scheme: dark;
}
[data-theme="daylight"] {
  --bg: #EEF0F2; --surface: #FFFFFF; --surface-2: #E4E7EA;
  --line: #D9DDE1; --line-2: #C2C8CE;
  --text: #111316; --text-2: #5A6068; --text-3: #8C939B;
  --accent: #0A5BFF; --on-accent: #FFFFFF; --hot: #E5322D; --live: #0A5BFF; --warn: #B87500;
  --arc: #111316;
  --shift-1: #0A5BFF; --shift-2: #0A5BFF; --shift-3: #E5322D;
  --scrim: rgba(230, 233, 236, .9);
  color-scheme: light;
}

:root {
  --f-ui: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-read: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* type scale, ratio 1.25, set on a root that grows with the screen */
  --t-xs: .75rem;   /* 12 */
  --t-s: .875rem;   /* 14 */
  --t-m: 1rem;      /* 16 */
  --t-l: 1.25rem;   /* 20 */
  --t-xl: 1.5625rem;/* 25 */
  --t-2xl: 1.953rem;/* 31 */
  --t-3xl: 2.441rem;/* 39 */

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --tap: 3rem;            /* 48px at the phone root size */
  --radius: 10px;
  --radius-s: 6px;
}

/* Root size follows the viewport so a 1920px car screen gets 20px type
   and a phone gets 16px, without a pile of per-breakpoint font rules. */
html { font-size: clamp(16px, calc(.45vw + 11px), 20px); }
html, body { height: 100%; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 500 var(--t-m)/1.4 var(--f-ui); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
#i-play path, #i-stop path { fill: currentColor; stroke: none; }
.label { font-size: var(--t-xs); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }

/* Show/hide from Customize: .app[data-hide~="x"] hides every [data-show="x"]. */
.app[data-hide~="shift"] [data-show="shift"],
.app[data-hide~="gearrpm"] [data-show="gearrpm"],
.app[data-hide~="engine"] [data-show="engine"],
.app[data-hide~="clock"] [data-show="clock"],
.app[data-hide~="place"] [data-show="place"],
.app[data-hide~="calls"] [data-show="calls"],
.app[data-hide~="links"] [data-show="links"] { display: none !important; }

/* ------------------------------------------------------------ app frame */
.app {
  height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.bar {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s5);
  min-height: calc(var(--tap) + var(--s4));
}
.brand { display: flex; align-items: center; gap: var(--s2); }
.mark { width: 1.5rem; height: 1.5rem; fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.wordmark { font-weight: 600; font-size: var(--t-s); letter-spacing: .28em; text-transform: uppercase; }
.status { display: flex; gap: var(--s2); min-width: 0; flex: 1; }
.bar-end { display: flex; align-items: center; gap: var(--s2); }
.clock { font-size: var(--t-l); font-weight: 300; color: var(--text); padding: 0 var(--s3); }

.chip {
  display: inline-flex; align-items: center; gap: var(--s2); min-width: 0;
  height: 2.25rem; padding: 0 var(--s3); background: var(--surface); border-radius: 999px;
  font-size: var(--t-s); color: var(--text-2); white-space: nowrap;
}
.chip span { overflow: hidden; text-overflow: ellipsis; }
.chip .ic { width: 1rem; height: 1rem; color: var(--text-3); }
.led { width: .5rem; height: .5rem; border-radius: 50%; background: var(--text-3); flex: none; }
#src[data-state="live"] { color: var(--text); }
#src[data-state="live"] .led { background: var(--live); }
#src[data-state="hold"] .led, #src[data-state="waiting"] .led { background: var(--warn); }
#src[data-state="demo"] .led { background: var(--text); }
#src[data-state="denied"] .led, #src[data-state="unavailable"] .led { background: var(--hot); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: var(--t-s); font-weight: 600; letter-spacing: .06em;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.btn.icon { padding: 0; }
.btn:active { background: var(--surface-2); }
.btn:focus-visible, .seg:focus-visible, .opt:focus-visible, .feed:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[aria-pressed="true"] { border-color: var(--text); color: var(--text); background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:active { filter: brightness(1.15); }
.btn:disabled { opacity: .35; cursor: default; }
.mute[aria-pressed="true"] { border-color: var(--hot); color: var(--hot); }

/* ------------------------------------------------------------ deck */
.deck {
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 1fr);
  gap: var(--s4); padding: 0 var(--s5); min-height: 0;
}
.app[data-layout="cluster"] .deck { grid-template-columns: minmax(0, 1fr); }
.app[data-layout="cluster"] .dispatch { display: none; }
.app[data-layout="scanner"] .deck { grid-template-columns: minmax(16rem, .8fr) minmax(0, 1.4fr); }

.cluster {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; align-items: center; justify-items: center;
  padding: var(--s3) var(--s5) var(--s4); min-height: 0; min-width: 0;
  background: var(--surface); border-radius: var(--radius);
}

/* shift lights: a row of LEDs that fill from ~70% of redline */
.shift { display: flex; gap: .4rem; justify-content: center; padding: var(--s2) 0 0; }
.shift i { width: 1.6rem; height: .5rem; border-radius: 2px; background: var(--line); transition: background .05s; }
.shift i.on.z1 { background: var(--shift-1); }
.shift i.on.z2 { background: var(--shift-2); }
.shift i.on.z3 { background: var(--shift-3); }
.shift.flash i { background: var(--hot); animation: flash .16s steps(1) infinite; }
@keyframes flash { 50% { background: var(--line); } }

.gauge {
  position: relative; width: 100%; height: 100%; max-width: 62rem;
  container-type: size;
}
#tach { position: absolute; inset: 0; width: 100%; height: 100%; }
.readout {
  position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
}
.speed { font: 300 min(36cqh, 24cqw)/.9 var(--f-ui); letter-spacing: -.03em; color: var(--text); }
.unit { font-size: max(var(--t-s), 3.2cqh); font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--text-2); margin-top: .35em; padding-left: .3em; }
.gearbox, .rpmbox {
  position: absolute; bottom: 4%; display: flex; flex-direction: column; align-items: center; gap: .1rem;
}
/* side by side in the gap at the bottom of the 270° dial, clear of the 0 and redline labels */
.gearbox { left: 50%; transform: translateX(calc(-100% - 2.5cqw)); } .rpmbox { left: 50%; transform: translateX(2.5cqw); }
.gearbox .k, .rpmbox .k, .load .k { font-size: var(--t-xs); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); }
.gearbox .v { font: 500 clamp(var(--t-l), 9cqh, 6rem)/1 var(--f-ui); color: var(--accent); }
.rpmbox .v { font: 300 clamp(var(--t-m), 5.5cqh, 4rem)/1.2 var(--f-ui); color: var(--text-2); min-width: 4ch; text-align: center; }

/* digital gauge: the bar sits across the top, speed fills the middle */
.app[data-gauge="digital"] .readout { top: 52%; }
.app[data-gauge="digital"] .speed { font-size: min(46cqh, 30cqw); }
.app[data-gauge="digital"] .gearbox, .app[data-gauge="digital"] .rpmbox { bottom: 3%; }
.app[data-gauge="digital"] .gearbox { left: 4%; transform: none; align-items: flex-start; }
.app[data-gauge="digital"] .rpmbox { left: auto; right: 4%; transform: none; align-items: flex-end; }

.engine-line {
  display: flex; align-items: baseline; gap: var(--s4); width: 100%; max-width: 62rem;
  padding-top: var(--s3); border-top: 1px solid var(--line);
}
.engine-name { font-weight: 600; font-size: var(--t-l); letter-spacing: .04em; }
.engine-detail { color: var(--text-2); font-size: var(--t-s); flex: 1; }
.load { display: flex; align-items: center; gap: var(--s3); }
.loadbar { width: 9rem; height: 3px; background: var(--line); position: relative; border-radius: 2px; overflow: hidden; }
.loadbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--text); }

/* ------------------------------------------------------------ dispatch */
.dispatch {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--surface); border-radius: var(--radius);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5) var(--s2); }
.panel-head h2 { display: flex; align-items: center; gap: var(--s2); margin: 0; font-size: var(--t-s); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.panel-head h2 .ic { color: var(--accent); }
.where { font-size: var(--t-s); color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feedbox { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--s5); }
.group { padding: var(--s2) 0 var(--s4); }
.group + .group { border-top: 1px solid var(--line); padding-top: var(--s3); }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 2.5rem; }
.group-head h3 { margin: 0; font-size: var(--t-xs); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); }
.group-hint, .group-sub { font-size: var(--t-xs); color: var(--text-3); }
.group-sub { margin: 0 0 var(--s2); }
.btn.small { min-height: 2.5rem; padding: 0 var(--s3); font-size: var(--t-xs); }

/* Listen: one big card for the best feed here, the rest underneath */
.listen-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s4);
  width: 100%; padding: var(--s4); margin: var(--s1) 0 var(--s2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; cursor: pointer; text-align: left;
}
.listen-card .play {
  display: grid; place-items: center; width: calc(var(--tap) + .5rem); height: calc(var(--tap) + .5rem);
  border-radius: 50%; background: var(--accent); color: var(--on-accent);
}
.listen-card .play .ic { width: 1.4rem; height: 1.4rem; }
.listen-card b { display: block; font-size: var(--t-l); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listen-card small { display: block; font-size: var(--t-s); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listen-card .go { color: var(--text-3); }
.listen-card[data-playing="true"] { border-color: var(--accent); }
.listen-card[data-playing="true"] .play { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.35); } }
.now { font-size: var(--t-s); color: var(--text-2); margin: 0 0 var(--s2); min-height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now b { color: var(--text); font-weight: 600; }

.calls { list-style: none; margin: 0; padding: 0; }
.calls li { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); gap: var(--s3); padding: var(--s3) var(--s3); border-radius: var(--radius-s); }
.calls li + li { border-top: 1px solid var(--line); border-radius: 0; }
.calls li.newest { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: var(--radius-s); }
.calls li.newest + li { border-top: 0; }
.call-when { font-size: var(--t-s); color: var(--text-2); padding-top: .1rem; }
.calls li.newest .call-when { color: var(--accent); font-weight: 600; }
.call-what { display: flex; flex-direction: column; min-width: 0; }
.call-what b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-what span { font-size: var(--t-s); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calls .empty { display: block; }
.feeds { list-style: none; margin: 0; padding: 0; }
.is-locked a, .is-locked .listen-card { pointer-events: none; opacity: .45; }
.feeds li + li { border-top: 1px solid var(--line); }
.feed {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s3);
  width: 100%; min-height: calc(var(--tap) + var(--s3)); padding: var(--s2) 0;
  background: none; border: 0; text-align: left; cursor: pointer; text-decoration: none; color: inherit;
}
.feed-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta { display: block; font-size: var(--t-xs); color: var(--text-2); margin-top: .1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-act { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); color: var(--text-3); }
.feed:active .feed-act { color: var(--accent); }
.feed-act .ic { width: 1.1rem; height: 1.1rem; }
.feeds .empty, .calls .empty { padding: var(--s4) 0; color: var(--text-2); font: 400 var(--t-s)/1.5 var(--f-read); }
.fineprint { margin: 0; padding: var(--s3) var(--s5) var(--s4); font: 400 var(--t-xs)/1.5 var(--f-read); color: var(--text-3); }
.fineprint a { color: var(--text-2); }

/* scanner focus: the calls are the point, so make them readable at a glance */
.app[data-layout="scanner"] .calls li { padding: var(--s4) var(--s3); }
.app[data-layout="scanner"] .call-what b { font-size: var(--t-xl); white-space: normal; }
.app[data-layout="scanner"] .call-what span { font-size: var(--t-m); white-space: normal; }
.app[data-layout="scanner"] .call-when { font-size: var(--t-m); }
.app[data-layout="scanner"] .engine-detail, .app[data-layout="scanner"] .load .k { display: none; }

/* ------------------------------------------------------------ dock */
.dock {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s3) var(--s5); background: var(--bg);
}
.profiles { display: flex; gap: var(--s2); flex: 1; min-width: 0; }
.seg {
  flex: 1; min-width: 0; min-height: calc(var(--tap) + var(--s3)); padding: var(--s2) var(--s3);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left;
}
.seg b { font-weight: 600; font-size: var(--t-m); }
.seg small { font-size: var(--t-xs); color: var(--text-3); }
.seg[aria-checked="true"] { border-color: var(--text); background: var(--surface-2); }
.seg[aria-checked="true"] small { color: var(--accent); }
.dock-tools { display: flex; align-items: center; gap: var(--s2); }
.vol { display: flex; align-items: center; gap: var(--s2); height: var(--tap); padding: 0 var(--s3); color: var(--text-2); }
.vol input { width: 9rem; accent-color: var(--accent); height: var(--tap); }
#revBtn.active { border-color: var(--hot); color: var(--hot); }

.locked { display: none; align-items: center; gap: var(--s3); flex: 1; color: var(--text-2); font: 400 var(--t-m)/1.4 var(--f-read); min-height: calc(var(--tap) + var(--s3)); }
.locked .ic { color: var(--warn); width: 1.5rem; height: 1.5rem; }
.locked b { color: var(--text); font-weight: 600; }

/* moving: setup controls step aside, only Mute stays */
.app[data-moving="true"] .profiles,
.app[data-moving="true"] .dock-tools { display: none; }
.app[data-moving="true"] .locked { display: flex; }

/* ------------------------------------------------------------ sheets */
.sheet {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: var(--s4);
  background: var(--scrim);
}
.sheet-card {
  position: relative; width: min(40rem, 100%); max-height: 100%; overflow-y: auto;
  padding: var(--s6); background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  user-select: text; -webkit-user-select: text;
}
.sheet-card.wide { width: min(48rem, 100%); }
.sheet-card h1 { margin: var(--s4) 0 var(--s4); font-size: var(--t-2xl); font-weight: 600; line-height: 1.15; }
.sheet-card h3 { margin: var(--s5) 0 var(--s2); font-size: var(--t-xs); font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); }
.sheet-card p { margin: 0 0 var(--s2); font: 400 var(--t-m)/1.55 var(--f-read); color: var(--text-2); }
.sheet-card .fineprint { padding: var(--s3) 0 0; }
.mark.big { width: 2.5rem; height: 2.5rem; }
.rules { list-style: none; margin: 0 0 var(--s5); padding: 0; }
.rules li { padding: var(--s3) 0; border-top: 1px solid var(--line); font: 400 var(--t-m)/1.5 var(--f-read); color: var(--text-2); }
.rules b { color: var(--text); font-weight: 600; }
.sheet-actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
.sheet-actions .btn { min-height: calc(var(--tap) + var(--s3)); flex: 1 1 14rem; }
.close { position: absolute; top: var(--s4); right: var(--s4); }

/* Customize: option rows of equal buttons */
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--s2); }
.opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1);
  min-height: calc(var(--tap) + var(--s2)); padding: var(--s3); text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.opt b { font-weight: 600; }
.opt small { font: 400 var(--t-xs)/1.35 var(--f-read); color: var(--text-2); }
.opt[aria-checked="true"], .opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opts.toggles { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.toggles .opt { flex-direction: row; align-items: center; justify-content: space-between; }
.toggles .opt::after { content: ""; width: 2.25rem; height: 1.25rem; border-radius: 999px; flex: none; background: radial-gradient(circle at .625rem 50%, var(--text-3) .42rem, var(--line-2) .47rem); }
.toggles .opt[aria-pressed="true"]::after { background: radial-gradient(circle at 1.625rem 50%, var(--on-accent) .42rem, var(--accent) .47rem); }
.toggles .opt[aria-pressed="true"] { box-shadow: none; border-color: var(--line); }
/* theme swatches show the theme's own colours, whatever theme is active */
.swatch { display: flex; gap: 3px; margin-bottom: var(--s1); }
.swatch i { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid var(--line-2); }
.sw-stealth i:nth-child(1) { background: #0B0B0C; } .sw-stealth i:nth-child(2) { background: #F2F2F0; } .sw-stealth i:nth-child(3) { background: #E5322D; }
.sw-amber i:nth-child(1) { background: #0E0A06; } .sw-amber i:nth-child(2) { background: #F5E6CC; } .sw-amber i:nth-child(3) { background: #FF9A1F; }
.sw-racing i:nth-child(1) { background: #070707; } .sw-racing i:nth-child(2) { background: #FFD400; } .sw-racing i:nth-child(3) { background: #FF1E1E; }
.sw-daylight i:nth-child(1) { background: #EEF0F2; } .sw-daylight i:nth-child(2) { background: #111316; } .sw-daylight i:nth-child(3) { background: #0A5BFF; }

/* ============================================================ RESPONSIVE
   Kept at the end on purpose: media queries add no specificity. */

/* Car screens and tablets: a fingertip at arm's length, often moving. */
@media (pointer: coarse) and (min-width: 900px) {
  :root { --tap: 4rem; }
  .vol input { width: 12rem; }
}

/* Portrait phones and narrow windows: one column, dock pinned. */
@media (max-width: 899px) {
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto auto; }
  .deck, .app[data-layout] .deck { grid-template-columns: minmax(0, 1fr); padding: 0 var(--s3); gap: var(--s3); }
  .app[data-layout="scanner"] .cluster { order: 2; }
  .bar { padding: var(--s2) var(--s4); flex-wrap: wrap; }
  .status { order: 3; flex-basis: 100%; }
  .clock { display: none; }
  .bar-end { margin-left: auto; }
  .mute span { display: none; }
  .cluster { padding: var(--s2) var(--s3) var(--s3); }
  .gauge { height: auto; aspect-ratio: 1.3; }
  .shift i { width: 1.1rem; }
  .engine-line { flex-wrap: wrap; gap: var(--s2) var(--s4); }
  .load { flex-basis: 100%; } .loadbar { flex: 1; }
  .feedbox { overflow: visible; padding: 0 var(--s4); }
  .panel-head { padding: var(--s4) var(--s4) var(--s2); }
  .dock { position: sticky; bottom: 0; z-index: 2; padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom)); }
  .profiles { flex-basis: 100%; }
  .seg small { display: none; }
  .seg { align-items: center; padding: var(--s2) var(--s1); }
  .seg b { font-size: .8125rem; white-space: nowrap; }
  .dock-tools { flex: 1; justify-content: space-between; }
  .vol { flex: 1; padding: 0; } .vol input { width: 100%; }
  #demoBtn span, #revBtn span { display: none; }
  .sheet-card { padding: var(--s5); }
  .app[data-layout="scanner"] .call-what b { font-size: var(--t-l); }
}

/* Phone on its side in a mount: keep two columns, shrink the chrome. */
@media (max-height: 520px) and (min-width: 600px) {
  .app { height: 100dvh; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
  .deck, .app[data-layout] .deck { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); padding: 0 var(--s3); gap: var(--s2); }
  .app[data-layout="cluster"] .deck { grid-template-columns: minmax(0, 1fr); }
  .app[data-layout="scanner"] .deck { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
  .app[data-layout="scanner"] .cluster { order: 0; }
  .bar { padding: var(--s1) var(--s4); flex-wrap: nowrap; min-height: 0; }
  .status { order: 0; flex-basis: auto; }
  .place { display: none; }
  .cluster { padding: var(--s1) var(--s3) var(--s2); }
  .shift { padding-top: var(--s1); }
  .gauge { height: 100%; aspect-ratio: auto; }
  .engine-line { padding-top: var(--s2); }
  .engine-detail, .load .k { display: none; }
  .panel-head { padding: var(--s3) var(--s4) var(--s2); }
  .feedbox { overflow-y: auto; padding: 0 var(--s4); }
  .listen-card { padding: var(--s2) var(--s3); }
  .dock { position: static; order: 0; padding: var(--s1) var(--s3); flex-wrap: nowrap; }
  .profiles { flex-basis: auto; }
  .seg { min-height: var(--tap); }
  .dock-tools { flex: none; }
  .vol { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Short dials (phone in a landscape mount): drop the small captions so gear and rpm clear the speed. */
@container (max-height: 300px) {
  .gearbox .k, .rpmbox .k { display: none; }
  .readout { top: 50%; }
  .unit { margin-top: 0; }
}
