:root {
  color-scheme: dark;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6f5e9;
  background: #141914;
  --text: #f6f5e9;
  --muted: #cbcebe;
  --lime: #e3ff88;
  --line: rgba(244, 247, 228, .19);
  --glass: rgba(25, 30, 23, .83);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, #bike-preview:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}
#app { min-height: 100svh; position: relative; overflow: hidden; isolation: isolate; }
#world, .scrim { position: absolute; inset: 0; z-index: -2; }
#world { background: linear-gradient(#546369, #a8aa8e 48%, #485341 62%, #262c23); touch-action: none; cursor: grab; }
#world:active { cursor: grabbing; }
#world canvas:not(.rain):not(.speed-blur) { display: block; width: 100%; height: 100%; }
.rain, .speed-blur { display: block; position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }
.rain[hidden], .speed-blur[hidden] { display: none; }
.park-preview-fade { position: absolute; inset: 0; z-index: 2; background: #151e19; opacity: 0; pointer-events: none; }
.driver-speech { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.driver-shout {
  position: absolute; top: 0; left: 0; margin: 0; width: max-content; max-width: min(13rem, 55vw);
  padding: 6px 10px; border: 1px solid #eed1a0; border-radius: 10px;
  color: #291f17; background: #fff5df; box-shadow: 0 3px 12px #1b170b77;
  font-size: clamp(.81rem, 1.2vw, 1rem); font-weight: 740; line-height: 1.23; text-align: center;
}
.driver-shout::after {
  content: ''; position: absolute; top: 100%; left: var(--tail-x, 50%); transform: translateX(-50%);
  border: 7px solid transparent; border-top: 11px solid #fff5df; border-bottom: 0;
}
.driver-shout:is([data-edge="left"], [data-edge="right"])::after {
  top: 50%; transform: translateY(-50%); border: 7px solid transparent;
}
.driver-shout[data-edge="left"]::after { left: auto; right: 100%; border-left: 0; border-right: 10px solid #fff5df; }
.driver-shout[data-edge="right"]::after { left: 100%; border-right: 0; border-left: 10px solid #fff5df; }
.driver-shout[data-kind="rider-name"] {
  padding: 3px 8px; border-color: #ede1bd8a; border-radius: 6px;
  background: #212a25eb; color: #fff5df; font-size: .76rem;
}
.driver-shout[data-kind="rider-name"]::after {
  border-width: 4px 4px 0; border-top-color: #212a25eb;
}
.driver-shout[data-kind="tourist"] {
  max-width: min(17rem, 62vw);
  border-color: #7cc4ff; background: #f2f9ff; color: #16283a;
  box-shadow: 0 4px 16px rgba(10, 28, 48, 0.42);
}
.driver-shout[data-kind="tourist"]::after {
  border-top-color: #f2f9ff;
}
.driver-shout[data-kind="campervan"] {
  max-width: min(17rem, 62vw);
  border-color: #f2a93b; background: #fff6e0; color: #362009;
  box-shadow: 0 4px 16px rgba(42, 24, 6, 0.45);
}
.driver-shout[data-kind="campervan"]::after {
  border-top-color: #fff6e0;
}
.driver-shout[data-kind="police"] {
  max-width: min(18rem, 64vw);
  border-color: #e6ef28; background: #0f3a7a; color: #f6fbff;
  box-shadow: 0 4px 18px rgba(4, 24, 64, 0.58);
}
.driver-shout[data-kind="police"]::after {
  border-top-color: #0f3a7a;
}
.driver-shout[data-kind="rider-rage"] {
  max-width: min(15rem, 58vw);
  border-color: var(--lime); background: #19241a; color: var(--lime);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .55);
}
.driver-shout[data-kind="rider-rage"]::after {
  border-top-color: #19241a;
}
.scrim {
  z-index: -1;
  background: linear-gradient(180deg, rgba(16,22,20,.67), transparent 23%, transparent 56%, rgba(14,18,15,.64));
  pointer-events: none;
}
.loading-overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 42%, rgba(28, 38, 30, .58), rgba(14, 19, 15, .88) 72%);
  backdrop-filter: blur(8px);
  transition: opacity .36s ease, visibility .36s ease;
}
.loading-overlay.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-overlay[hidden] { display: none; }
.loading-card {
  width: min(440px, 100%); padding: 30px 28px 26px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  background: rgba(20, 27, 22, .92);
  border: 1px solid rgba(227, 255, 136, .24);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}
.loading-emblem { position: relative; width: 78px; height: 78px; display: grid; place-items: center; margin-bottom: 2px; }
.loading-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(244, 247, 228, .12);
  border-top-color: var(--lime);
  border-right-color: rgba(227, 255, 136, .45);
  animation: slaps-spin 1.05s cubic-bezier(.45, .15, .55, .85) infinite;
}
.loading-emblem .brand-logo {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid rgba(227, 255, 136, .42);
  box-shadow: 0 6px 22px rgba(227, 255, 136, .24);
}
.loading-eyebrow { font-size: .72rem; font-weight: 780; letter-spacing: .2em; color: var(--lime); }
.loading-title { margin: 0; font-size: clamp(1.42rem, 3.2vw, 1.82rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.08; }
.loading-bar-wrap { width: 100%; display: grid; gap: 8px; margin-top: 6px; }
.loading-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: .84rem; color: var(--muted); }
#loading-stage { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#loading-pct { font-weight: 780; color: var(--text); font-variant-numeric: tabular-nums; flex: none; }
.loading-track {
  position: relative; height: 8px; width: 100%; border-radius: 999px;
  background: rgba(244, 247, 228, .12); overflow: hidden;
}
.loading-fill {
  display: block; height: 100%; width: 5%; border-radius: inherit;
  background: linear-gradient(90deg, #b6e861, var(--lime), #f4ffb8);
  box-shadow: 0 0 12px rgba(227, 255, 136, .45);
  transition: width .22s ease-out;
}
.loading-hint { margin: 4px 0 0; font-size: .78rem; color: var(--muted); opacity: .84; }
.loading-retry { margin-top: 6px; padding: 10px 20px; border-radius: 10px; font-weight: 760; }
.loading-overlay[data-error="true"] .loading-ring { animation: none; border-color: rgba(255, 128, 128, .45); }
.loading-overlay[data-error="true"] .loading-fill { background: #ff7c7c; box-shadow: none; }
@keyframes slaps-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-ring { animation-duration: 2.8s; } }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(15px); box-shadow: 0 6px 25px #0d150e24; }
#app:is([data-graphics="balanced"], [data-graphics="performance"]) .glass { backdrop-filter: none; }
.topbar {
  height: 76px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 0 clamp(16px, 3vw, 48px); border-bottom: 1px solid #f4f7e42e;
  background: #15201b36;
}
.brand { display: flex; gap: 11px; align-items: center; text-decoration: none; color: inherit; justify-self: start; }
.brand .brand-logo {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  border: 1px solid rgba(227, 255, 136, .38);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.brand > span { font-weight: 830; letter-spacing: .15em; display: grid; line-height: 1.02; font-size: 1.06rem; }
.brand small { font-size: .68rem; font-weight: 660; letter-spacing: .2em; margin-top: 5px; color: var(--muted); }
.top-route { font-size: .81rem; font-weight: 700; letter-spacing: .125em; text-shadow: 0 1px 3px #17201a; justify-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.top-route span { color: var(--lime); padding: 0 8px; }
.top-actions { display: flex; gap: 10px; justify-self: end; }
.icon-button, .connect, .secondary {
  border: 1px solid var(--line); background: #17221dd1; border-radius: 9px; min-height: 42px;
}
.icon-button { display: grid; place-items: center; width: 42px; padding: 0; }
.camera-button { display: flex; align-items: center; gap: 6px; width: auto; padding: 0 11px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.voice-split { display: flex; align-items: stretch; }
.voice-split[hidden] { display: none; }
.beta-pill {
  display: inline-block; vertical-align: middle; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; font-size: .62rem; font-weight: 800; letter-spacing: .08em;
  color: #91e5ee; background: rgba(145, 229, 238, .14); border: 1px solid rgba(145, 229, 238, .36);
}
.voice-button { display: flex; align-items: center; gap: 6px; width: auto; padding: 0 9px 0 11px; font-size: .78rem; font-weight: 700; white-space: nowrap; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.voice-caret { width: 26px; padding: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--muted); }
.voice-caret svg { width: 15px; height: 15px; transition: transform .18s ease; }
.voice-caret[aria-expanded="true"] { color: var(--lime); border-color: rgba(227, 255, 136, .45); }
.voice-caret[aria-expanded="true"] svg { transform: rotate(180deg); }
.voice-button svg { width: 16px; height: 16px; flex: none; }
.voice-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: rgba(203, 206, 190, .38); transition: background .2s ease, box-shadow .2s ease;
}
.voice-button[data-status="listening"] { border-color: rgba(227, 255, 136, .55); color: var(--lime); }
.voice-button[data-status="listening"] .voice-dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.voice-button[data-status="hearing"] { border-color: #91e5ee; color: #91e5ee; background: rgba(145, 229, 238, .15); }
.voice-button[data-status="hearing"] .voice-dot { background: #91e5ee; box-shadow: 0 0 10px #91e5ee; animation: voice-pulse .7s ease-in-out infinite alternate; }
.voice-button[data-status="thinking"] { border-color: #ffd166; color: #ffd166; background: rgba(255, 209, 102, .14); }
.voice-button[data-status="thinking"] .voice-dot { background: #ffd166; box-shadow: 0 0 10px #ffd166; animation: voice-pulse .45s ease-in-out infinite alternate; }
.voice-button[data-status="speaking"] { border-color: var(--lime); color: var(--lime); background: rgba(227, 255, 136, .16); }
.voice-button[data-status="speaking"] .voice-dot { background: var(--lime); box-shadow: 0 0 10px var(--lime); }
@keyframes voice-pulse { from { transform: scale(.85); opacity: .65; } to { transform: scale(1.25); opacity: 1; } }
.voice-engine-badge {
  margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; font-size: .76rem; font-weight: 660;
  background: rgba(20, 29, 22, .85); border: 1px solid var(--line); color: var(--muted);
}
.voice-engine-badge[data-engine="gemini"] {
  border-color: rgba(145, 229, 238, .45); color: #91e5ee; background: rgba(18, 34, 38, .65);
}
.voice-overlay {
  position: absolute; z-index: 4; top: 152px; left: 50%; transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px)); padding: 11px 14px 12px; border-radius: 14px;
  background: rgba(16, 22, 18, .56);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(227, 255, 136, .34);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .34);
  pointer-events: auto;
  animation: voice-sheet-in .18s ease-out;
}
.voice-overlay[hidden] { display: none; }
@keyframes voice-sheet-in {
  from { opacity: 0; transform: translate(-50%, -8px) scale(.98); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.voice-overlay-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.voice-overlay-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.voice-overlay-title strong { font-size: .88rem; letter-spacing: -.01em; color: var(--lime); }
.voice-overlay-pulse {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #4ade80; box-shadow: 0 0 10px #4ade80;
  animation: voice-pulse .85s ease-in-out infinite alternate;
}
.voice-overlay[data-status="hearing"] .voice-overlay-pulse { background: #91e5ee; box-shadow: 0 0 12px #91e5ee; }
.voice-overlay[data-status="thinking"] .voice-overlay-pulse { background: #ffd166; box-shadow: 0 0 12px #ffd166; }
.voice-overlay-engine {
  margin-left: auto; font-size: .68rem; font-weight: 720; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; color: #91e5ee;
  background: rgba(145, 229, 238, .14); border: 1px solid rgba(145, 229, 238, .30);
}
.voice-overlay-close {
  width: 24px; height: 24px; border-radius: 6px; padding: 0; border: 1px solid rgba(244, 247, 228, .2);
  background: rgba(20, 28, 22, .5); color: var(--text); font-size: 1rem; line-height: 1;
}
.voice-overlay-close:hover { border-color: var(--lime); color: var(--lime); }
.voice-overlay-heard {
  margin: 0 0 8px; padding: 5px 9px; border-radius: 8px; font-size: .78rem; font-weight: 640;
  color: #f6f8ec; background: rgba(227, 255, 136, .12); border: 1px solid rgba(227, 255, 136, .24);
}
.voice-overlay-heard[hidden] { display: none; }
.voice-command-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px;
}
.voice-cmd {
  display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-radius: 8px;
  background: rgba(14, 20, 16, .48); border: 1px solid rgba(244, 247, 228, .12);
}
.voice-cmd strong { font-size: .75rem; font-weight: 740; color: #f6f8ec; }
.voice-cmd span { font-size: .67rem; color: var(--muted); }
@media (max-width: 590px) {
  .voice-overlay { top: 112px; padding: 9px 10px; }
  .voice-command-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
.icon-button svg, .connect svg { width: 19px; height: 19px; }
.connect { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; font-size: .9rem; font-weight: 720; white-space: nowrap; }
.connect svg { color: var(--lime); }
.icon-button:hover, .connect:hover, .secondary:hover, .key-controls button:hover { background: #384636; }
.ride-title { position: absolute; top: 116px; left: clamp(16px, 4vw, 64px); text-shadow: 0 2px 18px #182219aa, 0 1px 4px #19231b9e; pointer-events: none; }
.route-kicker { display: flex; align-items: center; gap: 8px; color: var(--lime); font-size: .82rem; font-weight: 790; letter-spacing: .16em; }
.route-kicker > span:first-child { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ride-title h1 { font-size: clamp(2.45rem, 5.6vw, 5.4rem); line-height: .98; letter-spacing: -.071em; margin: 12px 0; font-weight: 790; }
.ride-title p { margin: 0; font-size: 1rem; font-weight: 570; color: #f1f3e6; }
.riding .ride-title h1 { font-size: clamp(1.4rem, 3vw, 2.5rem); margin: 8px 0; letter-spacing: -.05em; }
.riding .ride-title p, .riding .landing-actions { display: none; }
.landing-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
  pointer-events: auto;
}
.landing-chip {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 8px 13px; border-radius: 999px; font-size: .82rem; font-weight: 740;
  color: var(--text); border: 1px solid rgba(244, 247, 228, .24);
  background: rgba(18, 26, 20, .72);
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.route-switch-chip { border-color: rgba(215, 240, 118, .48); color: var(--lime); }
.route-switch-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: .84rem;
}
.landing-chip:hover {
  transform: translateY(-1px);
  border-color: var(--lime);
  background: rgba(34, 46, 30, .86);
  color: var(--lime);
}
#open-guide-tour { border-color: rgba(227, 255, 136, .45); color: var(--lime); }
.view-tools { position: absolute; top: 98px; right: clamp(16px, 3vw, 48px); display: flex; gap: 6px; z-index: 1; }
.view-tools [hidden] { display: none; }
#preview-toggle .preview-play, #preview-toggle[data-paused="true"] .preview-pause { display: none; }
#preview-toggle[data-paused="true"] .preview-play { display: inline; }
.view-tools [aria-pressed="true"], .view-tools .ringing { color: var(--lime); background: #303e25; }
.clean .scrim, .clean .topbar, .clean .ride-title, .clean .map-card, .clean .ride-deck, .clean .segment-banner { visibility: hidden; }
.clean .view-tools { top: 16px; visibility: visible; }
.map-card { position: absolute; bottom: 220px; right: clamp(16px, 3vw, 48px); padding: 14px; width: 226px; border-radius: 13px; }
.map-heading, .profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-heading h2, .profile-heading h2, .metric > span { font-size: .8rem; letter-spacing: .12em; font-weight: 740; color: var(--muted); margin: 0; }
.map-heading > span { font-size: .72rem; font-weight: 760; letter-spacing: .08em; color: var(--lime); }
.map-card canvas { display: block; width: 100%; height: 122px; margin-top: 5px; }
.map-card p { margin: 4px 0 0; font-size: .85rem; color: #eff2df; }
.map-card #companion-status { color: #e8bce4; }
.map-card #pace-status { color: var(--pace-color, #60a5fa); font-weight: 640; }
.map-card #weather-live-status { color: var(--muted); font-size: .74rem; }
.map-card #peloton-legend, .map-card #challenge-status { color: #ffca7b; }
.map-card #draft-status { color: #d4f59b; display: flex; flex-direction: column; gap: 4px; }
.map-card #draft-status[hidden] { display: none; }
.meter-track { display: block; height: 4px; border-radius: 99px; background: rgba(244, 247, 228, .15); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0%; border-radius: inherit; background: var(--lime); transition: width .16s ease, background-color .2s ease; }
.workout-hud { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); font-size: .83rem; }
.workout-hud strong { color: var(--lime); }
.workout-track { margin-top: 5px; }
.workout-hud[data-compliance="low"] .meter-fill { background: #78d2f0; }
.workout-hud[data-compliance="ok"] .meter-fill { background: var(--lime); }
.workout-hud[data-compliance="high"] .meter-fill { background: #ff9b59; }
.workout-overlay {
  position: absolute; top: 86px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 380px)); min-width: 340px;
  padding: 9px 12px 8px; border-radius: 13px; z-index: 2;
  background: rgba(18, 25, 20, .58);
  border: 1px solid rgba(244, 247, 228, .22);
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 6px;
}
.workout-overlay[hidden] { display: none; }
.clean .workout-overlay { visibility: hidden; }
#app.has-workout .rage-hud { top: 202px; }
.workout-overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.workout-overlay-info { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.workout-erg-pill {
  flex: none; font-size: .64rem; font-weight: 820; letter-spacing: .1em;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(227, 255, 136, .20); color: var(--lime);
}
.workout-erg-pill[hidden] { display: none; }
#workout-overlay-block { font-size: .84rem; font-weight: 760; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-overlay-next { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-overlay-metrics { display: flex; align-items: baseline; gap: 8px; flex: none; font-variant-numeric: tabular-nums; }
.workout-overlay-watts { font-size: 1.02rem; font-weight: 820; color: var(--lime); }
.workout-overlay-time { font-size: .86rem; font-weight: 760; color: var(--text); }
.workout-overlay-total { font-size: .72rem; color: var(--muted); }
.workout-overlay-controls { display: flex; align-items: center; gap: 4px; flex: none; }
.workout-bias-btn {
  width: 24px; height: 24px; border-radius: 6px; padding: 0;
  display: grid; place-items: center; font-size: .82rem; font-weight: 760;
  border: 1px solid var(--line); background: rgba(24, 34, 26, .75); color: var(--text);
}
.workout-bias-btn:hover { background: #384636; border-color: var(--text); }
.workout-bias-val { font-size: .72rem; font-weight: 740; color: var(--muted); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.workout-stop-btn { margin-left: 2px; color: #fca5a5; }
#workout-chart { display: block; width: 100%; height: 56px; }
.workout-preview-box {
  margin: 10px 0 8px; padding: 8px 10px 6px; border-radius: 10px;
  background: rgba(15, 21, 16, .72); border: 1px solid var(--line);
}
.workout-preview-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .72rem; font-weight: 740; color: var(--lime); margin-bottom: 4px;
}
#workout-duration-label { color: var(--muted); }
#workout-preview-chart { display: block; width: 100%; height: 64px; }
@media (max-width: 960px) {
  .workout-overlay { width: calc(100vw - 32px); min-width: 0; top: 82px; }
  .workout-overlay-next, .workout-overlay-total { display: none; }
}
#peloton-legend::before { content: ''; display: inline-block; width: .42em; height: .42em; margin-right: .5em; background: currentColor; transform: translateY(-.1em) rotate(45deg); }
.segments { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-size: .82rem; }
.segments summary { width: fit-content; font-weight: 720; cursor: pointer; }
.segments summary::marker { color: var(--lime); }
#segment-pace { margin-left: 4px; color: #ffcf93; font-size: .71rem; font-variant-numeric: tabular-nums; }
#segment-pace.ahead { color: #91e5ee; }
.map-card #segment-category { color: var(--muted); font-size: .68rem; margin-top: 7px; }
.segment-times { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.segment-times section { padding-top: 8px; }
.segment-times section + section { margin-top: 8px; border-top: 1px solid var(--line); }
.segment-times header { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; }
.segment-times h3 { margin: 0; font-size: inherit; }
.segment-times header span { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.segment-times dl { display: flex; gap: 5px; margin: 5px 0 0; }
.segment-times dl div { flex: 1; min-width: fit-content; }
.segment-times dt { color: var(--muted); font-size: .67rem; }
.segment-times dd { margin: 0; font-weight: 720; font-variant-numeric: tabular-nums; }
.segment-times [data-live], .segment-times [data-best] { color: var(--lime); }
.segment-times [data-delta] { color: #ffcf93; }
.segment-times [data-delta].ahead { color: #91e5ee; }
.segment-times dl { flex-wrap: wrap; }
.ride-deck { position: absolute; bottom: 12px; left: clamp(16px, 3vw, 48px); right: clamp(16px, 3vw, 48px); display: grid; gap: 5px; }
.telemetry-wrap { position: relative; }
.telemetry { display: grid; grid-template-columns: repeat(var(--hud-cols, 6), minmax(0, 1fr)); border-radius: 11px; }
.telemetry-edit-btn {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; padding: 0;
  display: grid; place-items: center; border-radius: 6px;
  border: 1px solid transparent; background: rgba(20, 26, 21, .55); color: var(--muted);
  opacity: .38; transition: opacity .18s ease, border-color .18s ease, color .18s ease, background .18s ease;
}
.telemetry-wrap:hover .telemetry-edit-btn, .telemetry-edit-btn:focus-visible {
  opacity: 1; color: var(--lime); border-color: rgba(227, 255, 136, .32); background: rgba(20, 28, 22, .9);
}
.telemetry-edit-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.metric { padding: 7px clamp(8px, 1.3vw, 18px) 6px; position: relative; min-width: 0; }
.metric[hidden] { display: none; }
.metric-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; font-size: .64rem; letter-spacing: .09em; color: var(--muted); white-space: nowrap; overflow: hidden; }
.metric-head em, #wkg { font-style: normal; font-size: .66rem; font-weight: 700; letter-spacing: .02em; color: var(--zone-color, var(--muted)); font-variant-numeric: tabular-nums; }
.metric[data-accent="zone"], .power-metric { box-shadow: inset 0 -2px 0 0 var(--zone-color, transparent); transition: box-shadow .25s ease; }
.metric[data-accent="zone"][data-zone] strong, .power-metric[data-zone] strong { color: var(--zone-color, var(--text)); }
.metric[data-accent="hr"] strong, .hr-metric strong { color: #ff8e96; }
.metric[data-accent="lap"] strong { color: #91e5ee; }
.metric[data-accent="lap"] .metric-head em { color: #91e5ee; }
.metric[data-accent="lime"] strong, .metric[data-accent="grade"] strong.up, #grade.up { color: var(--lime); }
.metric + .metric { border-left: 1px solid var(--line); }
.metric div { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric strong { font-size: clamp(1.32rem, 2.25vw, 2.08rem); letter-spacing: -.045em; line-height: 1.04; }
.telemetry[data-dense="true"] .metric { padding-inline: clamp(6px, 1vw, 13px); }
.telemetry[data-dense="true"] .metric strong { font-size: clamp(1.12rem, 1.85vw, 1.76rem); }
.metric small { font-size: .74rem; color: var(--muted); }
.metric small:empty { display: none; }
.lower-deck { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; }
.profile { min-width: 0; border-radius: 11px; padding: 5px 12px 5px; }
.profile-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.profile-heading span { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lap-live-pill {
  color: #91e5ee !important; font-weight: 760; letter-spacing: .01em;
  padding: 1px 8px; border-radius: 999px; background: rgba(145, 229, 238, .12);
  border: 1px solid rgba(145, 229, 238, .28); white-space: nowrap;
}
.lap-live-pill[hidden] { display: none; }
.lap-btn { white-space: nowrap; color: #91e5ee; border-color: rgba(145, 229, 238, .35); }
.lap-btn:hover { background: rgba(145, 229, 238, .16); border-color: #91e5ee; }
.hud-custom-note { margin: 0 0 8px; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.hud-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.hud-preset-pill {
  padding: 5px 10px; border-radius: 999px; font-size: .75rem; font-weight: 680;
  border: 1px solid var(--line); background: rgba(24, 32, 25, .75); color: var(--text);
}
.hud-preset-pill:hover { border-color: var(--lime); }
.hud-preset-pill[aria-pressed="true"] {
  background: rgba(227, 255, 136, .16); border-color: var(--lime); color: var(--lime);
}
.hud-field-slots {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  margin: 8px 0 14px;
}
.hud-slot-row { display: grid; gap: 3px; }
.hud-slot-row label { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hud-slot-row select { margin: 0; padding: 6px 8px; font-size: .8rem; }
.profile canvas { display: block; width: 100%; height: 28px; margin-top: 2px; }
.ride-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 11px; }
.ride-actions { display: flex; gap: 6px; margin-left: auto; }
#end-ride { white-space: nowrap; }
.key-controls { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.key-controls[hidden] { display: none; }
.key-controls span { font-size: .84rem; font-variant-numeric: tabular-nums; font-weight: 700; min-width: 54px; }
.key-controls button { width: 30px; height: 33px; border: none; background: transparent; font-size: 1.08rem; border-radius: 7px; }
.primary { background: var(--lime); color: #212a18; border: 0; border-radius: 8px; min-height: 36px; padding: 0 15px; font-weight: 790; white-space: nowrap; }
.primary:hover { background: #f0ffb5; }
#ride-toggle { min-width: 126px; }
#ride-symbol { margin-right: 8px; font-size: .75rem; }
.secondary { padding: 0 12px; }
.toast { position: absolute; bottom: 146px; left: clamp(16px, 3vw, 48px); max-width: min(420px, 45vw); border-radius: 9px; padding: 10px 14px; font-size: .88rem; }
.rage-hud {
  position: absolute; z-index: 1; top: 88px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; width: max-content; max-width: min(350px, 54vw);
  padding: 10px 14px; border-radius: 9px; border-left: 3px solid #eabb70; pointer-events: none;
}
.rage-hud[hidden], #rage-value:empty { display: none; }
.rage-hud strong, #rage-detail { display: block; }
.rage-hud strong { color: #ffd892; font-size: .88rem; }
#rage-detail { margin-top: 3px; font-size: .77rem; color: var(--muted); }
.rage-hud output { color: var(--text); font-size: 1.14rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rage-hud button { pointer-events: auto; min-height: 34px; padding: 0 8px; font-size: .76rem; white-space: nowrap; }
.rear-view-icon { display: none; }
.rage-hud[data-phase="recovery"] { border-left-color: #ff9d7c; }
.rage-hud[data-phase="escaped"], .rage-hud[data-phase="recovered"] { border-left-color: var(--lime); }
.segment-banner {
  position: absolute; z-index: 1; top: 184px; left: clamp(16px, 4vw, 64px);
  width: min(268px, 34vw); padding: 10px 13px; border-radius: 10px;
  border-left: 3px solid #9bf0a8; pointer-events: none;
}
.segment-banner[hidden] { display: none; }
.segment-banner[data-target="pb"] { border-left-color: #80e7f1; }
.segment-banner[data-mode="approach"] { border-left-color: var(--lime); }
.segment-banner-head, .segment-banner-stats { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.segment-banner-head strong { font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--lime); }
.segment-banner-head span { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.segment-banner-stats { margin-top: 4px; }
.segment-banner-stats output { font-size: 1.24rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.segment-banner-stats span { font-size: .78rem; font-weight: 740; font-variant-numeric: tabular-nums; color: #ffcf93; white-space: nowrap; }
.segment-banner-stats span.ahead { color: #91e5ee; }
.segment-banner[data-target="starter"] .segment-banner-stats span.ahead { color: #9bf0a8; }
.segment-banner-track {
  position: relative; height: 5px; margin-top: 7px; border-radius: 99px;
  background: rgba(244, 247, 228, .16);
}
.segment-banner-track[hidden] { display: none; }
.segment-banner-fill {
  display: block; height: 100%; width: 0%; border-radius: inherit;
  background: var(--lime); transition: width .14s linear;
}
.segment-banner-ghost {
  position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #9bf0a8;
  border: 1.5px solid #152019; box-shadow: 0 0 6px rgba(155, 240, 168, .65);
}
.segment-banner[data-target="pb"] .segment-banner-ghost { background: #80e7f1; box-shadow: 0 0 6px rgba(128, 231, 241, .65); }
dialog { color: var(--text); width: min(440px, calc(100% - 25px)); border-radius: 15px; padding: 22px; max-height: 90svh; }
dialog::backdrop { background: #10191394; }
.dialog-header, .dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-header h2 { font-size: 1.45rem; margin: 0; letter-spacing: -.04em; }
.dialog-header .icon-button { font-size: 1.45rem; }
dialog label { display: flex; justify-content: space-between; gap: 8px; margin: 18px 0 7px; font-weight: 700; }
dialog select, dialog input { width: 100%; accent-color: var(--lime); }
dialog select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 34px 9px 10px; appearance: none;
  background: linear-gradient(45deg,transparent 50%,var(--muted) 50%) right 15px center / 5px 5px no-repeat,
    linear-gradient(135deg,var(--muted) 50%,transparent 50%) right 10px center / 5px 5px no-repeat, #212920;
}
dialog p { color: var(--muted); line-height: 1.5; font-size: .91rem; }
#ride-history-label[hidden], #ride-history[hidden] { display: none; }
.ride-totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-block: 13px 18px; }
.ride-totals div { padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.ride-totals dt { color: var(--muted); font-size: .76rem; }
.ride-totals dd { margin: 3px 0 0; font-size: 1.18rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.rage-summary { margin: 0 0 14px; padding: 9px 11px; border: 1px solid var(--line); border-left: 3px solid #eabb70; border-radius: 8px; }
.rage-summary[hidden] { display: none; }
.rage-summary h3 { margin: 0 0 4px; font-size: .86rem; color: #ffd892; }
.rage-summary p { margin: 0; font-size: .82rem; color: var(--text); }
#ride-summary h3 { margin: 0; font-size: .95rem; }
#summary-laps { margin: 8px 0 16px; padding-left: 22px; max-height: 150px; overflow: auto; }
#summary-laps li { padding: 4px 0; font-variant-numeric: tabular-nums; }
.bike-settings { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 14px; }
.settings-tabs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  margin: 14px 0 12px; padding: 4px; border-radius: 10px;
  background: rgba(16, 22, 17, .55); border: 1px solid var(--line);
}
.settings-tabs button {
  padding: 7px 4px; border-radius: 7px; font-size: .78rem; font-weight: 700;
  color: var(--muted); background: transparent; border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.settings-tabs button:hover { color: var(--text); }
.settings-tabs button[aria-selected="true"] {
  background: rgba(215, 240, 118, .16); color: var(--lime); border-color: rgba(215, 240, 118, .35);
}
.settings-body { max-height: 58svh; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.settings-panel[hidden] { display: none; }
.ideas-intro { margin: 4px 0 10px; font-size: .83rem; }
.ideas-composer label { margin: 10px 0 5px; font-size: .80rem; }
.ideas-composer input[type="text"],
.ideas-composer textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #1c241d; color: var(--text);
  font: inherit; font-size: .86rem; resize: vertical;
}
.ideas-composer input[type="text"]:focus,
.ideas-composer textarea:focus { outline: none; border-color: var(--lime); }
.ideas-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ideas-submit-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ideas-submit-row .primary { min-height: 36px; padding: 7px 14px; font-size: .84rem; flex: none; }
#idea-status { font-size: .79rem; color: var(--lime); line-height: 1.3; }
#idea-status[data-error="true"] { color: #fca5a5; }
.ideas-list-head { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.ideas-list-head .settings-group-title { margin: 0; }
.ideas-count { font-size: .74rem; color: var(--muted); }
.ideas-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ideas-empty { margin: 0; font-size: .82rem; color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line); border-radius: 9px; }
.idea-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 9px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.idea-vote-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 6px 4px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(24, 32, 24, .75); color: var(--muted); font-size: .76rem; font-weight: 760;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.idea-vote-btn:hover { border-color: var(--text); color: var(--text); }
.idea-vote-btn[aria-pressed="true"] {
  background: rgba(215, 240, 118, .18); border-color: var(--lime); color: var(--lime);
}
.idea-body { min-width: 0; }
.idea-head { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.idea-title { font-size: .86rem; font-weight: 740; color: var(--text); word-break: break-word; }
.idea-badge {
  font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--muted);
}
.idea-badge.planned { background: rgba(88, 180, 255, .18); color: #93c5fd; }
.idea-badge.shipped { background: rgba(215, 240, 118, .20); color: var(--lime); }
.idea-details { margin: 4px 0 0; font-size: .79rem; color: var(--muted); line-height: 1.38; word-break: break-word; }
.idea-meta { margin-top: 5px; font-size: .71rem; color: var(--muted); opacity: .82; }
.settings-group-title {
  margin: 14px 0 6px; font-size: .72rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--lime);
}
.settings-panel > .settings-group-title:first-child,
.kit-settings > .settings-group-title:first-child { margin-top: 4px; }
.settings-panel label:first-of-type { margin-top: 8px; }
#settings .dialog-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.kit-style-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.kit-style-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  color: var(--text); background: #212920; border: 1px solid var(--line);
}
.kit-style-pill:hover { border-color: var(--text); }
.kit-style-pill[aria-pressed="true"] {
  background: rgba(215, 240, 118, .18); border-color: var(--lime); color: var(--lime);
}
.kit-style-dot {
  width: 11px; height: 11px; border-radius: 50%; flex: none;
  border: 1px solid rgba(255, 255, 255, .35);
}
.kit-select-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.kit-select-row label { margin: 4px 0 5px; font-size: .82rem; }
.kit-color-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px;
  margin-top: 8px;
}
dialog .kit-color-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin: 0; padding: 6px 4px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(24, 32, 24, .65);
  font-size: .72rem; font-weight: 650; color: var(--muted);
}
dialog .kit-color-item:hover { border-color: var(--text); color: var(--text); }
.kit-color-item input[type="color"] {
  width: 34px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.kit-color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 1px; }
.kit-color-item input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(255, 255, 255, .28); border-radius: 4px; }
.kit-color-item input[type="color"]::-moz-color-swatch { border: 1px solid rgba(255, 255, 255, .28); border-radius: 4px; }
.bike-stage {
  position: relative; margin-top: 10px; height: clamp(154px, 26vh, 225px); overflow: hidden;
  border: 1px solid #d2e3d519; border-radius: 9px;
  background: radial-gradient(ellipse at 50% 42%, #e3e3dc, #b7bcb5 90%);
}
.bike-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.bike-stage canvas[hidden] { display: none; }
.bike-stage canvas:active { cursor: grabbing; }
.bike-stage canvas:focus-visible { outline-offset: -3px; }
.bike-stage span { position: absolute; left: 9px; bottom: 7px; pointer-events: none; font-size: .68rem; color: #29352d; }
.bike-stage p { color: #29352d; margin: 0; padding: 12px; }
.paint-heading { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 8px; }
.paint-heading label { margin: 0; }
.paint-heading output { color: var(--muted); font-family: ui-monospace, monospace; font-size: .74rem; }
.paint-controls, #bike-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.paint-chip { width: 25px; height: 25px; border-radius: 100%; background: var(--paint); border: 1px solid #dae3d84a; }
.paint-chip:hover { border-color: var(--text); }
.paint-chip[aria-pressed="true"] { outline: 1px solid var(--lime); outline-offset: 2px; }
dialog .paint-custom {
  display: flex; align-items: center; margin: 0 0 0 auto; padding: 3px 8px 3px 5px;
  font-size: .76rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.paint-custom input { width: 25px; height: 21px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.paint-custom input::-webkit-color-swatch-wrapper { padding: 2px; }
.paint-custom input::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 3px; }
.paint-custom input::-moz-color-swatch { border: 1px solid var(--line); border-radius: 3px; }
dialog .mode-toggle { align-items: center; padding-block: 10px; border-top: 1px solid var(--line); margin-bottom: 0; }
.mode-toggle input { inline-size: 20px; block-size: 20px; margin: 0; flex: 0 0 auto; cursor: pointer; }
.ride-options { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 14px; }
.device-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 10px; padding-block: 12px; border-block: 1px solid var(--line); }
.device-metrics [hidden] { display: none; }
.device-metrics dt { color: var(--muted); font-size: .82rem; }
.device-metrics dd { margin: 4px 0 0; font-weight: 700; }
.device-tip { font-size: .78rem; color: var(--muted); line-height: 1.4; margin: 10px 0 4px; }
#workout-ftp, #challenge-url, #rider-name-input, #coffee-group-input, #strava-title {
  color: var(--text); background: #1c261b; border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 10px; font: inherit;
}
.strava-profile-section {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.strava-profile-section[hidden], .strava-connected-row[hidden], .strava-box[hidden], .strava-button[hidden], .strava-view-link[hidden] { display: none; }
.strava-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 0;
  background: #fc4c02; color: #ffffff; font-weight: 760; font-size: .86rem;
  text-decoration: none; cursor: pointer;
}
.strava-button:hover { background: #e34402; }
.strava-button:disabled { opacity: .6; cursor: wait; }
.strava-button svg { width: 18px; height: 18px; flex: none; }
.strava-connected-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; background: rgba(252, 76, 2, .14);
  border: 1px solid rgba(252, 76, 2, .38); font-size: .82rem; font-weight: 700;
}
.strava-disconnect-btn { min-height: 30px; padding: 4px 10px; font-size: .74rem; }
.strava-caption { margin: 0; font-size: .75rem; color: var(--muted); }
.strava-box {
  margin: 14px 0 4px; padding: 11px 12px; border-radius: 10px;
  background: rgba(252, 76, 2, .08); border: 1px solid rgba(252, 76, 2, .32);
  display: flex; flex-direction: column; gap: 8px;
}
.strava-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .76rem; color: var(--muted); }
.strava-wordmark { font-weight: 850; letter-spacing: .12em; color: #fc4c02; font-size: .78rem; }
.strava-box label { margin: 2px 0 0; font-size: .78rem; }
.strava-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.strava-view-link { color: #fc4c02; font-weight: 760; font-size: .86rem; text-decoration: underline; }
.pill-button {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 11px;
  border-radius: 9px; border: 1px solid var(--line); background: rgba(20, 27, 21, .74);
  color: var(--text); font-size: .82rem; font-weight: 700; backdrop-filter: blur(10px);
}
.pill-button:hover { border-color: var(--text); }
.rider-pill { max-width: 230px; }
#rider-name-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-count {
  flex: none; font-size: .70rem; font-weight: 750; line-height: 1;
  padding: 3px 6px; border-radius: 999px; font-variant-numeric: tabular-nums;
  background: rgba(74, 222, 128, .15); color: #86efac;
}
.online-count[hidden] { display: none; }
.online-count[data-state="riders"] { background: rgba(192, 132, 252, .22); color: #e9d5ff; }
.online-count[data-state="offline"] { background: rgba(148, 163, 152, .16); color: var(--muted); }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #6b766c; transition: background .2s, box-shadow .2s;
}
.live-dot[data-state="online"] { background: #4ade80; box-shadow: 0 0 7px rgba(74, 222, 128, .75); }
.live-dot[data-state="riders"] { background: #c084fc; box-shadow: 0 0 8px rgba(192, 132, 252, .85); }
.coffee-pill { max-width: 210px; }
.coffee-pill[data-phase="social"] { border-color: rgba(227, 255, 136, .55); background: rgba(42, 54, 34, .82); }
.coffee-pill[data-phase="climb"] { border-color: rgba(251, 146, 60, .7); background: rgba(62, 34, 20, .85); }
.coffee-pill[data-phase="regroup"] { border-color: rgba(192, 132, 252, .7); background: rgba(44, 28, 60, .85); }
#coffee-pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coffee-live-badge {
  flex: none; font-size: .68rem; font-weight: 760; line-height: 1;
  padding: 3px 6px; border-radius: 999px;
  background: rgba(251, 191, 36, .20); color: #fde68a;
}
.coffee-live-badge[hidden] { display: none; }

.coffee-hud {
  position: absolute; top: 244px; left: clamp(16px, 4vw, 64px);
  width: min(296px, calc(100vw - 32px)); padding: 11px 13px; border-radius: 12px;
  display: flex; flex-direction: column; gap: 7px; pointer-events: auto;
}
.riding .coffee-hud { top: 186px; }
.clean .coffee-hud { visibility: hidden; }
.coffee-hud[hidden] { display: none; }
.coffee-hud-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coffee-hud-head strong { font-size: .86rem; font-weight: 780; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coffee-phase-badge {
  flex: none; font-size: .66rem; font-weight: 800; letter-spacing: .1em;
  padding: 3px 7px; border-radius: 999px; background: rgba(227, 255, 136, .18); color: var(--lime);
}
.coffee-hud[data-phase="climb"] .coffee-phase-badge { background: rgba(251, 146, 60, .24); color: #fdba74; }
.coffee-hud[data-phase="regroup"] .coffee-phase-badge { background: rgba(192, 132, 252, .24); color: #e9d5ff; }
.coffee-hud-note { margin: 0; font-size: .78rem; color: var(--muted); line-height: 1.3; }
.coffee-hud-list {
  list-style: none; margin: 0; padding: 6px 0 0; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; max-height: 168px; overflow-y: auto;
}
.coffee-hud-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 6px;
  font-size: .78rem; padding: 3px 6px; border-radius: 6px; font-variant-numeric: tabular-nums;
}
.coffee-hud-row.me { background: rgba(227, 255, 136, .14); color: var(--lime); font-weight: 740; }
.coffee-hud-row.idle { opacity: .55; }
.coffee-hud-pos { font-weight: 760; color: var(--muted); }
.coffee-hud-row.me .coffee-hud-pos { color: var(--lime); }
.coffee-hud-rider { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coffee-hud-stat { color: var(--muted); font-size: .74rem; white-space: nowrap; }
.coffee-hud-row.me .coffee-hud-stat { color: #f4ffb8; }
.coffee-hud-actions { display: flex; gap: 6px; margin-top: 2px; }
.coffee-hud-btn { min-height: 30px; padding: 4px 10px; font-size: .75rem; border-radius: 7px; flex: 1; }
.coffee-hud-row.speaking { background: rgba(215, 240, 118, .20); box-shadow: inset 0 0 0 1px rgba(215, 240, 118, .45); }
.coffee-voice {
  padding-top: 7px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.coffee-voice-join { width: 100%; }
.coffee-voice-panel { display: flex; flex-direction: column; gap: 6px; }
.coffee-voice-panel[hidden], .coffee-voice-join[hidden], .coffee-voice-error[hidden] { display: none; }
.coffee-voice-meter-row {
  display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted);
}
.coffee-voice-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: #6b766c; transition: background .15s, box-shadow .15s;
}
.coffee-voice-dot[data-state="live"] { background: #4ade80; box-shadow: 0 0 7px rgba(74, 222, 128, .85); }
.coffee-voice-dot[data-state="speaking"] { background: var(--lime); box-shadow: 0 0 9px var(--lime); }
.coffee-voice-dot[data-state="filtered"] { background: #fbbf24; box-shadow: 0 0 7px rgba(251, 191, 36, .75); }
.coffee-voice-dot[data-state="muted"] { background: #f87171; }
.coffee-voice-label { white-space: nowrap; font-weight: 700; color: var(--text); font-size: .72rem; }
.coffee-voice-meter {
  flex: 1; height: 5px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .10); min-width: 34px;
}
#coffee-voice-meter-fill {
  display: block; height: 100%; width: 0%; border-radius: inherit;
  background: var(--lime); transition: width 60ms linear;
}
.coffee-voice-chip {
  flex: none; padding: 2px 7px; border-radius: 999px; font-size: .66rem; font-weight: 760;
  background: rgba(215, 240, 118, .14); border: 1px solid rgba(215, 240, 118, .35); color: var(--lime);
  cursor: pointer;
}
.coffee-voice-chip:hover { background: rgba(215, 240, 118, .24); }
.coffee-voice-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.coffee-voice-btn {
  min-height: 28px; padding: 3px 6px; font-size: .71rem; border-radius: 7px;
}
.coffee-voice-btn[aria-pressed="true"] {
  background: rgba(215, 240, 118, .18); border-color: var(--lime); color: var(--lime);
}
#coffee-voice-mute[aria-pressed="true"] {
  background: rgba(248, 113, 113, .18); border-color: #f87171; color: #fca5a5;
}
.coffee-voice-leave { color: #fca5a5; }
.coffee-voice-vol {
  display: flex; align-items: center; gap: 8px; font-size: .70rem; color: var(--muted);
}
.coffee-voice-vol input { flex: 1; accent-color: var(--lime); height: 4px; }
.coffee-voice-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .70rem; color: var(--muted); cursor: pointer;
}
.coffee-voice-toggle input { width: auto; accent-color: var(--lime); margin: 0; }
.coffee-voice-error { margin: 0; font-size: .72rem; color: #fca5a5; line-height: 1.3; }

.coffee-intro { font-size: .86rem; color: var(--muted); margin: 6px 0 12px; line-height: 1.4; }
.coffee-section { margin: 10px 0; }
.coffee-live-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; max-height: 190px; overflow-y: auto; }
.coffee-empty { margin: 0; font-size: .82rem; color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line); border-radius: 9px; }
.coffee-group-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.coffee-group-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.coffee-group-meta strong { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coffee-group-meta span { font-size: .76rem; color: var(--muted); }
.coffee-group-join { flex: none; min-height: 34px; padding: 6px 12px; font-size: .80rem; border-radius: 8px; }
#coffee-dialog-status { min-height: 1.2em; font-size: .82rem; color: var(--lime); margin: 8px 0 0; }
#live-riders-status { color: #d8b4fe; font-weight: 700; }
#live-riders-status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px;
  border-radius: 50%; background: #c084fc; vertical-align: 1px;
}
.changelog-list {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 54svh; overflow-y: auto; margin: 10px 0 16px; padding-right: 2px;
}
.guide-dialog { width: min(680px, calc(100vw - 24px)); max-width: 680px; }
.guide-eyebrow {
  display: block; font-size: .68rem; font-weight: 800; letter-spacing: .18em;
  color: var(--lime); margin-bottom: 3px;
}
.guide-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guide-body { max-height: min(58svh, 470px); overflow-y: auto; padding-right: 2px; }
.guide-lead { margin: 4px 0 14px; font-size: .86rem; color: var(--muted); line-height: 1.45; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.guide-card {
  display: flex; flex-direction: column; gap: 8px; padding: 13px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.guide-card-head { display: flex; align-items: center; gap: 8px; }
.guide-icon {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: rgba(227, 255, 136, .14); font-size: .95rem;
}
.guide-card h3 { margin: 0; font-size: .92rem; font-weight: 780; }
.guide-card p { margin: 0; font-size: .79rem; color: var(--muted); line-height: 1.42; flex: 1; }
.guide-cta { min-height: 34px; padding: 6px 11px; font-size: .78rem; align-self: flex-start; border-radius: 8px; }
.guide-shortcuts {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-top: 12px; padding: 9px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  font-size: .76rem; color: var(--muted);
}
.guide-shortcuts strong { color: var(--text); }
.device-compat-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  margin: 0 0 13px;
}
.compat-card {
  padding: 9px 11px; border-radius: 10px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.compat-card.compat-best { border-color: rgba(215, 240, 118, .38); background: rgba(215, 240, 118, .06); }
.compat-card.compat-ok { border-color: rgba(88, 180, 255, .32); background: rgba(88, 180, 255, .05); }
.compat-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.compat-head strong { font-size: .80rem; }
.compat-pill {
  flex: none; font-size: .64rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px;
}
.compat-pill.best { background: rgba(215, 240, 118, .20); color: var(--lime); }
.compat-pill.ok { background: rgba(88, 180, 255, .20); color: #93c5fd; }
.compat-pill.warn { background: rgba(251, 191, 36, .18); color: #fde68a; }
.compat-card p { margin: 0; font-size: .74rem; color: var(--muted); line-height: 1.38; }
.compat-card p strong { color: var(--text); font-weight: 700; }
.trainer-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trainer-step {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; align-items: start;
  padding: 11px 12px; border-radius: 11px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
}
.trainer-step[data-state="done"] { border-color: rgba(74, 222, 128, .45); background: rgba(74, 222, 128, .08); }
.trainer-step[data-state="warn"] { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .08); }
.step-badge {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: .80rem; font-weight: 800; background: rgba(244, 247, 228, .12); color: var(--text);
}
.trainer-step[data-state="done"] .step-badge { background: #22c55e; color: #0e1710; }
.trainer-step[data-state="warn"] .step-badge { background: #f59e0b; color: #191305; }
.step-body > strong { display: block; font-size: .88rem; margin-bottom: 3px; }
.step-body p { margin: 0; font-size: .79rem; color: var(--muted); line-height: 1.4; }
.step-body p strong { color: var(--text); font-weight: 740; }
.step-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.step-actions button { min-height: 34px; padding: 6px 12px; font-size: .80rem; }
.guide-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .guide-grid, .device-compat-grid { grid-template-columns: minmax(0, 1fr); }
  .landing-actions { gap: 5px; margin-top: 8px; }
  .landing-chip { padding: 6px 9px; font-size: .71rem; }
}
.changelog-entry {
  padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: rgba(20, 28, 21, .65);
}
.changelog-entry-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.changelog-version {
  font-size: .82rem; font-weight: 800; color: var(--lime);
  padding: 2px 7px; border-radius: 999px; background: rgba(215, 240, 118, .14);
}
.changelog-meta { font-size: .74rem; color: var(--muted); }
.changelog-summary { margin: 7px 0 6px; font-size: .86rem; font-weight: 650; color: var(--text); }
.changelog-entry ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .80rem; line-height: 1.45; }
.changelog-entry li { margin: 3px 0; }
#road-rage-help { margin-top: 0; }
.attribution { margin: 17px 0 0; font-size: .75rem; }
.attribution a { color: var(--muted); }
kbd { background: #344133; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; height: 64px; }
  .top-route { display: none; }
  .ride-title { top: 95px; }
  .view-tools { top: 81px; }
  .rage-hud { top: 76px; }
  .map-card { width: 180px; }
  .map-card canvas { height: 98px; }
  .metric { padding-inline: 9px; }
}
@media (max-width: 1180px) {
  .top-route { display: none; }
}
@media (max-width: 590px) {
  .paint-controls, #bike-swatches { gap: 6px; }
}
@media (max-height: 610px) and (min-width: 591px) {
  .ride-title { top: 92px; }
  .ride-title h1 { font-size: 3.3rem; }
  .map-card { bottom: 176px; }
  .ride-deck { bottom: 12px; }
  .metric { padding-block: 7px; }
  .profile canvas { height: 24px; }
  .toast { bottom: 178px; }
}

@media (orientation: portrait) and (max-width: 590px), (orientation: landscape) and (max-height: 500px) {
  #app {
    --hud-left: max(10px, env(safe-area-inset-left));
    --hud-right: max(10px, env(safe-area-inset-right));
    --hud-bottom: max(7px, env(safe-area-inset-bottom));
    min-height: 100dvh;
  }
  .top-route { display: none; }
  .brand { gap: 7px; }
  .brand .brand-logo { width: 32px; height: 32px; border-radius: 8px; }
  .brand > span { font-size: .87rem; }
  .brand small { font-size: .54rem; margin-top: 3px; }
  .top-actions, .view-tools { gap: 4px; }
  .clean .view-tools { top: calc(8px + env(safe-area-inset-top)); }
  .topbar .icon-button { width: 36px; min-height: 36px; }
  .pill-button { height: 36px; padding: 0 7px; font-size: .73rem; }
  .rider-pill { max-width: 146px; }
  .online-count { font-size: .64rem; padding: 2px 5px; }
  #changelog-open { padding: 0 6px; font-size: .70rem; }
  .camera-button, .voice-button { width: 36px; padding: 0; justify-content: center; }
  #camera-label, #voice-copilot-label, .voice-dot { display: none; }
  .topbar .icon-button svg, .topbar .connect svg { width: 17px; height: 17px; flex: none; }
  .topbar .connect { min-height: 36px; max-width: 132px; gap: 5px; padding-inline: 7px; font-size: .77rem; }
  #connect-label { overflow: hidden; text-overflow: ellipsis; }

  .ride-context {
    position: absolute; top: var(--hud-top); left: var(--hud-left);
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    pointer-events: none;
  }
  .ride-title, .rage-hud, .segment-banner, .coffee-hud { position: static; }
  .coffee-pill { max-width: 120px; }
  .segment-banner { width: 100%; padding: 6px 8px; border-radius: 7px; }
  .segment-banner-head strong { font-size: .65rem; }
  .segment-banner-head span, .segment-banner-stats span { font-size: .66rem; }
  .segment-banner-stats output { font-size: .95rem; }
  .segment-banner-track { height: 4px; margin-top: 4px; }
  .ride-title h1, .riding .ride-title h1 { margin: 3px 0; }
  #app:is(.riding, :has(#end-ride:not([hidden]))) .ride-title h1 { font-size: 1.1rem; }
  #app:has(#end-ride:not([hidden])) .ride-title p { display: none; }
  .route-kicker { font-size: .65rem; letter-spacing: .1em; gap: 5px; }
  .ride-title p { font-size: .73rem; }
  .rage-hud { transform: none; max-width: 100%; gap: 5px; padding: 4px 5px 4px 7px; border-radius: 7px; }
  .rage-hud strong, .rage-hud button { font-size: .71rem; }
  .rage-hud output { font-size: .82rem; }
  #rage-detail { margin-top: 2px; font-size: .66rem; line-height: 1.15; }
  .rage-hud[data-phase="ready"]:not([data-cue]) #rage-detail, .rage-hud:is([data-phase="recovered"], [data-phase="escaped"]) #rage-detail { display: none; }
  .rage-hud button { min-height: 32px; padding-inline: 5px; }
  .rage-hud[data-phase="chase"]:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 0;
    grid-template-areas: "status gap look" "detail detail detail";
  }
  .rage-hud[data-phase="chase"] > div { display: contents; }
  .rage-hud[data-phase="chase"] #rage-status { grid-area: status; }
  .rage-hud[data-phase="chase"] #rage-value { grid-area: gap; }
  .rage-hud[data-phase="chase"] #rage-detail { grid-area: detail; }
  .rage-hud[data-phase="chase"] #rage-look { grid-area: look; }

  .map-card {
    right: var(--hud-right); display: flex; flex-direction: column;
    max-height: var(--hud-map-space); padding: 7px; border-radius: 9px;
  }
  .map-heading, .map-card canvas { flex: none; }
  .map-heading h2, .map-heading > span { font-size: .65rem; }
  .map-card canvas { margin-top: 3px; }
  .map-details { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .map-card p, .workout-hud, .segments { font-size: .71rem; line-height: 1.2; }
  .map-card p { margin-top: 3px; }
  .segments { margin-top: 5px; padding-top: 4px; }
  .segments summary { padding-block: 4px; }
  .workout-hud { margin-top: 4px; padding-top: 3px; }

  .ride-deck { left: var(--hud-left); right: var(--hud-right); bottom: var(--hud-bottom); gap: 4px; }
  .telemetry { border-radius: 9px; }
  .metric { padding: 2px 6px 3px; }
  .metric > span { display: block; font-size: .62rem; letter-spacing: .07em; line-height: 1.25; }
  .metric > .metric-head { display: flex; gap: 3px; }
  #wkg { font-size: .56rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .metric div { gap: 3px; }
  .metric small { font-size: .66rem; }
  .lower-deck { gap: 4px; }
  .profile { padding: 4px 7px; border-radius: 8px; }
  .profile-heading h2, .profile-heading span { font-size: .63rem; }
  .profile-heading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile canvas { height: 19px; margin-top: 2px; }
  .ride-controls { gap: 6px; padding: 3px; border-radius: 8px; }
  .ride-actions { gap: 4px; }
  .key-controls span { min-width: 44px; font-size: .74rem; }
  .key-controls button { width: 30px; height: 34px; }
  .ride-actions #ride-toggle, #end-ride { min-width: 0; min-height: 36px; padding-inline: 8px; font-size: .78rem; }
  #ride-symbol { margin-right: 5px; }
  .toast { bottom: var(--hud-deck-top); left: var(--hud-left); padding: 6px 8px; font-size: .73rem; }
}

@media (orientation: portrait) and (max-width: 590px) {
  #app {
    --hud-top: calc(103px + env(safe-area-inset-top));
    --hud-map-width: clamp(131px, 38vw, 164px);
    /* Leave room for the ride deck and expanded Road Rage prompts on short screens. */
    --hud-map-space: clamp(104px, calc(100dvh - var(--hud-top) - var(--hud-bottom) - 282px), 226px);
    display: grid; grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
    padding: 0 var(--hud-right) var(--hud-bottom) var(--hud-left);
  }
  .topbar {
    position: absolute; inset: 0 0 auto;
    height: calc(53px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--hud-right) 0 var(--hud-left);
  }
  .topbar .icon-button, .topbar .connect { min-height: 39px; }
  .topbar .icon-button { width: 39px; }
  .view-tools { top: calc(59px + env(safe-area-inset-top)); right: var(--hud-right); }
  .ride-context { width: min(235px, calc(100% - var(--hud-left) - var(--hud-right))); gap: 5px; }
  .ride-title h1 { font-size: clamp(1.65rem, 7.6vw, 2.18rem); }

  .map-card, .toast { position: relative; inset: auto; grid-area: 1 / 1; align-self: end; margin-bottom: 7px; }
  .map-card { justify-self: end; width: var(--hud-map-width); }
  .map-card canvas { height: clamp(54px, calc(var(--hud-map-space) - 70px), 105px); }
  .ride-deck { position: relative; inset: auto; grid-area: 2 / 1; }
  .telemetry { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric { padding: 2px 8px; }
  .metric strong { font-size: clamp(1.18rem, 5.3vw, 1.48rem); }
  .metric:nth-child(4), .metric:nth-child(7) { border-left: 0; }
  .metric:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .lower-deck { grid-template-columns: minmax(0, 1fr); }
  .profile { padding-block: 3px; }
  .profile canvas { height: 15px; }
  .ride-actions #ride-toggle, #end-ride, #lap-btn { min-height: 40px; padding-inline: 10px; }
  .key-controls button { height: 38px; }
  .toast { justify-self: start; max-width: calc(100% - var(--hud-map-width) - 7px); }
}

@media (orientation: landscape) and (max-height: 500px) {
  #app {
    --hud-top: calc(54px + env(safe-area-inset-top));
    --hud-deck-top: calc(var(--hud-bottom) + 98px);
    --hud-map-space: calc(100dvh - var(--hud-top) - var(--hud-deck-top));
  }
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    height: calc(47px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--hud-right) 0 var(--hud-left);
  }
  .view-tools { position: static; justify-self: center; }
  .ride-context { width: min(230px, 34vw); }
  .ride-title h1, .riding .ride-title h1 { font-size: clamp(1.15rem, 3vw, 1.8rem); }
  .map-card { top: var(--hud-top); bottom: auto; width: clamp(134px, 19vw, 184px); }
  .map-card canvas { height: clamp(49px, calc(var(--hud-map-space) - 60px), 112px); }
  .metric strong { font-size: clamp(1.03rem, 2.8vw, 1.35rem); }
  .toast { max-width: min(300px, 47vw); }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 620px) {
  #rage-look:not([hidden]) { display: grid; place-items: center; width: 34px; }
  #rage-look-label { display: none; }
  .rear-view-icon { display: block; width: 17px; height: 17px; }
  #rage-look[aria-pressed="true"] .rear-view-icon { transform: scaleX(-1); }
}

@media (orientation: landscape) and (max-height: 500px) and (max-width: 520px) {
  .topbar { gap: 4px; }
  .topbar .icon-button { width: 34px; }
  .topbar .view-tools { gap: 3px; }
  .topbar .connect { max-width: 118px; gap: 4px; padding-inline: 6px; font-size: .72rem; }
}
