:root{color-scheme:dark;--blue:#008bdb;--sky:#38b6ff;--black:#030406;--surface:#10151c;--line:#26313d;--muted:#9aa9b9;--white:#fff;--green:#69e6ab;--amber:#ffd27b;font-family:Arial,Helvetica,sans-serif;font-synthesis:none;background:var(--black);color:var(--white)}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 75% 0,rgba(0,139,219,.09),transparent 50%),var(--black)}button,a,summary{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer}button:disabled{cursor:wait;opacity:.55}button:focus-visible,a:focus-visible,summary:focus-visible{outline:3px solid var(--sky);outline-offset:5px}button svg,.card-top svg{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}button svg{width:22px;height:22px}button[hidden],[hidden]{display:none!important}.dash{max-width:1440px;margin:auto;padding:28px 36px 18px;padding-left:max(28px,env(safe-area-inset-left));padding-right:max(28px,env(safe-area-inset-right));padding-top:max(24px,env(safe-area-inset-top));padding-bottom:max(18px,env(safe-area-inset-bottom))}.topbar{display:flex;justify-content:space-between;align-items:center;padding-bottom:24px;border-bottom:1px solid var(--line);gap:20px}.brand{display:flex;align-items:center;gap:24px;text-decoration:none;color:white}.brand img{width:161px;height:auto;display:block;background:var(--blue);padding:11px 14px;box-sizing:content-box}.brand span{font-size:13px;letter-spacing:.22em;font-weight:700;border-left:1px solid #34414e;padding-left:24px}.header-right{display:flex;align-items:center;gap:24px}.connection-badge{display:flex;align-items:center;gap:9px;font-size:11px;letter-spacing:.12em;font-weight:bold;color:var(--muted)}.connection-badge i{width:7px;height:7px;background:#7d8d9c;border-radius:50%}.connection-badge.live{color:var(--green)}.connection-badge.live i{background:var(--green);box-shadow:0 0 12px #69e6ab66}.connection-badge.demo{color:var(--amber)}.connection-badge.demo i{background:var(--amber)}.connection-badge.error{color:var(--amber)}.connection-badge.error i{background:var(--amber)}.icon-button{background:transparent;border:1px solid var(--line);width:42px;height:42px;border-radius:7px;color:#c5d1dd;display:flex;align-items:center;justify-content:center}.notice{font-size:14px;line-height:1.5;color:#b5c2cf;padding:17px 0;min-height:55px}.notice.error{color:var(--amber)}.demo-banner{background:#35291a;color:var(--amber);border:1px solid #6a5030;text-align:center;font-size:12px;font-weight:700;letter-spacing:.1em;padding:11px;border-radius:8px;margin-bottom:14px}.instruments{display:grid;grid-template-columns:1fr 1fr;gap:16px}.instrument{position:relative;overflow:hidden;border:1px solid var(--line);border-radius:12px;background:linear-gradient(120deg,#131b24,#0b1016);padding:24px 28px 18px;min-width:0;display:flex;flex-direction:column;min-height:240px}.instrument:before{content:'';position:absolute;left:0;top:22px;width:3px;height:22px;background:var(--blue)}.card-top{display:flex;align-items:center;justify-content:space-between;gap:12px}.card-top h1,.card-top h2{font-size:14px;font-weight:700;letter-spacing:.09em;margin:0;color:#d6e0e9}.card-top svg{width:27px;height:27px;color:#63829b;flex-shrink:0}.reading{display:flex;align-items:baseline;gap:12px;margin:20px 0 14px;line-height:1;white-space:nowrap;flex:1}.reading output{font-weight:700;font-size:clamp(70px,7.7vw,116px);font-variant-numeric:tabular-nums;letter-spacing:-.055em}.rpm .reading output{color:var(--sky)}.unit{font-size:24px;font-weight:600;letter-spacing:-.02em;color:#8d9eaf}.card-bottom{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;line-height:1.4;color:var(--muted)}.channel{font-family:monospace;color:#526373;font-size:11px}.controls{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:24px;padding:0 0 24px;border-bottom:1px solid var(--line)}.session{display:flex;flex-direction:column;gap:5px;min-width:0}.eyebrow{font-size:10px;font-weight:700;letter-spacing:.13em;color:#7d91a4}.session strong{font-size:18px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:32vw}.refresh{font-size:11px;color:var(--muted)}.actions{display:flex;gap:10px}.button{border:1px solid transparent;border-radius:7px;min-height:54px;padding:14px 22px;display:flex;align-items:center;justify-content:center;gap:8px;font-size:15px;font-weight:700}.primary{background:var(--blue);color:white;box-shadow:0 4px 20px #008bdb18}.primary:hover{background:#079de9}.secondary{border-color:#344251;background:transparent;color:#d9e2eb}.secondary:hover{background:#17212c}.help{padding-top:19px;color:var(--muted);font-size:13px}.help summary{cursor:pointer;list-style:none;display:flex;align-items:center;justify-content:space-between}.help summary::-webkit-details-marker{display:none}.help summary span{font-size:20px;color:#688198;line-height:1}.help[open] summary span{transform:rotate(45deg)}.help-content{max-width:890px;font-size:14px;line-height:1.65;color:#b6c3d0;padding:6px 0}.help-content strong{color:#f3f6fa}.bottom-line{display:flex;align-items:center;justify-content:space-between;gap:15px;color:#5e7183;font-size:9px;letter-spacing:.12em;margin-top:24px}.dash.race .help,.dash.race .bottom-line{display:none}
@media(min-width:1200px){.instrument{min-height:260px}.reading{margin-top:24px}}
@media(max-width:650px){.dash{padding-left:max(16px,env(safe-area-inset-left));padding-right:max(16px,env(safe-area-inset-right));padding-top:max(18px,env(safe-area-inset-top))}.topbar{padding-bottom:18px;gap:10px}.brand{gap:12px}.brand img{width:116px;padding:9px 10px}.brand span{font-size:9px;padding-left:12px;letter-spacing:.12em}.header-right{gap:10px}.connection-badge{font-size:9px;gap:6px}.icon-button{width:34px;height:34px}.icon-button svg{width:18px;height:18px}.notice{font-size:12px;padding:13px 0;min-height:47px}.instruments{gap:10px}.instrument{min-height:186px;padding:17px 15px 13px;border-radius:9px}.card-top h1,.card-top h2{font-size:10px;letter-spacing:.04em;line-height:1.5}.card-top svg{width:19px;height:19px}.reading{margin:23px 0 19px;gap:5px}.reading output{font-size:clamp(41px,11.9vw,76px)}.rpm .reading output{font-size:clamp(36px,10.4vw,66px)}.unit{font-size:15px}.rpm .unit{font-size:10px}.card-bottom{font-size:10px;gap:5px}.channel{display:none}.controls{flex-direction:column;align-items:stretch;margin-top:20px;gap:17px;padding-bottom:20px}.session{display:grid;grid-template-columns:1fr 1fr;gap:5px}.eyebrow{grid-column:1;align-self:end}.session strong{grid-column:1;max-width:100%;font-size:15px}.refresh{grid-column:2;grid-row:1/3;align-self:center;text-align:right;line-height:1.5;font-size:10px}.actions{display:grid;grid-template-columns:.8fr 1.2fr;gap:8px}.button{padding:13px 9px;font-size:12px;min-height:50px}.button svg{width:17px;height:17px}.help{font-size:12px}.bottom-line{font-size:7px;letter-spacing:.06em;margin-top:22px}.help-content{font-size:13px}}
@media(orientation:landscape) and (max-height:550px){.dash{padding-top:max(10px,env(safe-area-inset-top));padding-bottom:max(10px,env(safe-area-inset-bottom));padding-left:max(20px,env(safe-area-inset-left));padding-right:max(20px,env(safe-area-inset-right))}.topbar{padding-bottom:9px}.brand img{width:109px;padding:5px 10px}.brand span{font-size:10px}.icon-button{height:30px;width:34px}.notice{min-height:31px;padding:8px 0;font-size:11px}.instruments{gap:9px}.instrument{min-height:0;height:calc((100svh - 157px)/2);padding:11px 18px 9px;border-radius:8px}.card-top h1,.card-top h2{font-size:11px}.card-top svg{width:19px;height:19px}.reading{margin:4px 0;gap:9px;align-items:baseline}.reading output{font-size:clamp(38px,12vh,75px)}.unit{font-size:17px}.card-bottom{font-size:9px}.channel{font-size:9px}.controls{margin-top:10px;padding-bottom:0;border:0;gap:12px;flex-direction:row}.session{gap:2px}.eyebrow{display:none}.session strong{font-size:13px;max-width:30vw}.refresh{font-size:9px}.button{min-height:36px;padding:8px 15px;font-size:12px}.button svg{width:17px;height:17px}.help,.bottom-line{display:none}.demo-banner{font-size:10px;padding:5px;margin-bottom:7px}.dash:has(.demo-banner:not([hidden])) .instrument{height:calc((100svh - 187px)/2)}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

/* Keep the pedal travel prominent in portrait and mounted landscape views. */
.instruments { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.throttle {
  grid-column: 1 / -1;
  min-height: 0;
  padding-block: 18px 14px;
  --pedal-green: #31e884;
  --marker-width: clamp(24px, 4vw, 54px);
}
.throttle::before { display: none; }
.throttle-heading, .throttle-scale {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.throttle-heading h1 {
  margin: 0;
  font-size: clamp(.875rem, 2vw, 1.125rem);
  letter-spacing: .075em;
}
.throttle-value {
  font-size: clamp(2rem, 5vw, 4.25rem);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.throttle-value .unit { margin-left: .25em; font-size: .42em; }
.throttle-track {
  position: relative;
  isolation: isolate;
  margin-block: 12px 7px;
  height: clamp(46px, 6.5vw, 80px);
  border: 1px solid #41515c;
  border-radius: 6px;
  background: #19232c;
  overflow: hidden;
}
.throttle-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), #b2c5cf40 calc(25% - 1px) 25%);
  pointer-events: none;
}
.throttle-travel {
  position: absolute;
  inset: 0 var(--marker-width) 0 0;
}
.pedal { position: relative; width: 100%; height: 100%; }
.pedal::before {
  content: "";
  position: absolute;
  inset: 0 100% 0 auto;
  width: 100%;
  background: #1faf69;
}
.throttle-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--marker-width);
  background: var(--pedal-green);
  border: 1px solid #a7f7c7;
  border-radius: 4px;
}
.throttle-marker::after {
  content: "";
  position: absolute;
  top: 27%;
  bottom: 27%;
  left: 50%;
  border-left: 2px solid #075535;
}
.throttle-scale { position: relative; font-size: .75rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.throttle-scale span:nth-child(2), .throttle-scale span:nth-child(3), .throttle-scale span:nth-child(4) { position: absolute; transform: translateX(-50%); }
.throttle-scale span:nth-child(2) { left: 25%; }
.throttle-scale span:nth-child(3) { left: 50%; }
.throttle-scale span:nth-child(4) { left: 75%; }
.voltage[data-charge=high] { --charge: #63e89b; }
.voltage[data-charge=medium] { --charge: #ffa64d; }
.voltage[data-charge=low] { --charge: #ff6969; }
.voltage[data-charge] .reading, .voltage[data-charge] .unit, .voltage[data-charge] .card-bottom { color: var(--charge); }
.voltage[data-charge]::before { background: var(--charge); }

@media (max-width: 900px) and (min-height: 551px), (max-width: 650px) and (orientation: portrait) {
  .instruments { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument { min-height: 145px; }
  .voltage { grid-column: 1 / -1; min-height: 0; }
  .voltage .reading { margin: 10px 0; }
  .throttle { min-height: 0; }
  .card-top h2 { font-size: .75rem; }
  .card-bottom { font-size: .75rem; }
}
@media (orientation: landscape) and (max-height: 550px) {
  .instruments { grid-template-rows: auto auto; }
  .throttle, .dash:has(.demo-banner:not([hidden])) .throttle { height: auto; padding-block: 7px; }
  .throttle-value { font-size: 26px; }
  .throttle-track { height: clamp(26px, 8vh, 42px); margin-block: 4px 3px; }
  .throttle-scale { font-size: .65rem; }
  .instruments .instrument:not(.throttle) { height: auto; min-height: 0; }
}

@media (min-width: 901px) { .rpm .reading output { font-size: clamp(52px, 5.2vw, 78px); } .rpm .unit { font-size: 1.125rem; } }

.limit-label, .over-limit .normal-label { display: none; }
.over-limit .limit-label { display: inline; }
.instrument.over-limit .reading output,
.instrument.over-limit .unit,
.over-limit .limit-label { color: #ff6969; }
.over-limit::before { background: #ff6969; }

@keyframes rpm-flash {
  50% { opacity: .5; }
}
@media (prefers-reduced-motion: no-preference) {
  .rpm.over-limit .reading { animation: rpm-flash 1s ease-in-out infinite; }
}

.offline-setup { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .8rem; margin:1rem 0; font-size:.9rem; }
.offline-setup button { width:auto; min-height:40px; padding:.5rem .9rem; border:1px solid currentColor; border-radius:.4rem; background:transparent; color:inherit; font:inherit; cursor:pointer; }
.offline-setup button[hidden] { display:none; }
.offline-setup button:disabled { opacity:.65; cursor:wait; }
.offline-setup [role=status]:empty { display:none; }
