/*
 * GPS Speedometer: the tool's own components, styled in the site's design language (13 Nov 2026, on the UltraCompress Pro
 * template, after CompassPro, whose shared block the first part of this file copies; it came from the Clock, Prana Breathing
 * Exercises, the Decision Maker, the Employee ID Card Generator, SpinForge and EngCalc). Base: /libs/site-pages.css (tokens,
 * Inter and Space Grotesk, buttons, theme toggle, focus rings) and /libs/shared-nav.css (the site's header and footer). The
 * second part is the original's components (the dial, the strip, the trip computer, charts, trips, tools, settings, the
 * windows, big digits, the windscreen and camera views) on the site's tokens, each part of a screen a card; the instrument
 * keeps its own colours and road-sign numerals (Barlow Semi Condensed, SIL Open Font License, fonts/OFL.txt). The original's
 * class names stay (app.js sets them), styled as the site's pills. Light is the default; dark applies when <html> has no
 * data-theme. Assembled once from CompassPro's file and the original's style.css, then edited by hand: this file is the source.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden], .session [hidden] { display: none !important; } /* the script hides parts that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }


/* ===== GPS Speedometer components ===== */

/* ----- The site's text rules (p, ul, li, headings) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.dialog) p, :where(.dialog) li, :where(.hud, .cam) p { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.app-shell) h4, :where(.dialog) h3 { margin: 0; line-height: 1.25; }
:where(.app-shell) dl, :where(.app-shell) dd { margin: 0; }

/* ----- Road-sign numerals for the instrument (Barlow Semi Condensed, SIL Open Font License, fonts/OFL.txt) ----- */
@font-face { font-family: "Barlow Semi Condensed"; src: url("fonts/barlow-semi-condensed-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("fonts/barlow-semi-condensed-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("fonts/barlow-semi-condensed-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* ----- The tool's names for the site's colours (app.js reads them for its drawings), and the instrument's own ----- */
:root {
    --font-ui: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-num: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --good: var(--ok);
    --face: #ffffff;
    --ink: #16191f;
    --ink-2: #5b6270;
    --needle: #d9480f;
    --zone: #c8232c;
    --tell: #7c838f;
    --drum: #16191f;
    --drum-ink: #f4f5f7;
    --drum-last: #ffffff;
    --drum-last-ink: #c0262f;
    --lamp-off: #c3c8d0;
    --lamp-green: #1d8a4e;
    --lamp-amber: #c47a00;
    --lamp-red: #d0262f;
    --lamp-blue: #1f63d6;
    --series: #2a78d6;
    --series-wash: rgba(42, 120, 214, 0.1);
    --crit: #c8232c;
    --grid: #e5e7eb;
    --axis: #c3c8d0;
}
:root:not([data-theme="light"]) {
    /* the dial is true black at night, so an OLED screen gives off nothing but the markings */
    --face: #000000;
    --ink: #eceef1;
    --ink-2: #9aa2ae;
    --needle: #ff6a24;
    --zone: #ff4b55;
    --tell: #7c838f;
    --drum: #0f1114;
    --drum-ink: #eceef1;
    --drum-last: #eceef1;
    --drum-last-ink: #c0262f;
    --lamp-off: #3c424c;
    --lamp-green: #3fd47f;
    --lamp-amber: #ffb22e;
    --lamp-red: #ff4b55;
    --lamp-blue: #5aa2ff;
    --series: #5aa2ff;
    --series-wash: rgba(90, 162, 255, 0.12);
    --crit: #ff6b6b;
    --grid: rgba(255, 255, 255, 0.08);
    --axis: rgba(255, 255, 255, 0.2);
}

/* ----- Buttons: the original's names on the site's pills ----- */
.btn { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn.primary { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.btn.stop { background: var(--danger-strong); color: #fff; border-color: transparent; }
.btn.stop:hover:not(:disabled) { color: #fff; }
.btn.danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; }
.btn.big { padding: 14px 20px; font-size: 1rem; }
.small-btn, .btn.small-btn { font-size: 0.85rem; padding: 8px 15px; }
.btn:focus-visible, .switch:focus-visible, .limit-sign:focus-visible, .profile-chip:focus-visible, .drum-hit:focus-visible, .trip-row:focus-visible, .swatch:focus-visible, .limit-pick:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg-sm button { padding: 5px 12px; font-size: 0.8rem; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chip[aria-pressed="true"] .ico, .chip[aria-checked="true"] .ico { color: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.switch { width: 48px; height: 28px; border-radius: 14px; flex: none; padding: 0; position: relative; border: 0; background: var(--line-strong); cursor: pointer; transition: background 0.2s ease; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.switch[aria-checked="true"] { background: var(--gradient-brand); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.empty { color: var(--text-2); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; }
.table-wrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--text); background: transparent; }
.data-table th { font-size: 0.8rem; color: var(--text-2); font-weight: 600; }
.data-table tr.best td { font-weight: 700; }
.data-table tr.best td:first-child::after { content: " fastest"; font-weight: 500; color: var(--text-2); font-size: 0.78rem; }
.data-table tr.mine td { background: var(--tint-brand); }
.data-table tbody tr[tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ----- Toolbar and screens ----- */
.view-tab { display: inline-flex; align-items: center; gap: 6px; }
.view-tab .ico { width: 16px; height: 16px; }
.screen { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.view-head h2 { font-size: 1.5rem; color: var(--text-strong); }
.lead { margin-top: 4px; color: var(--text-2); max-width: 72ch; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 20px; min-width: 0; }
.block { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 34px; }
.block-head h3, .block-head h4 { font-size: 1.1rem; color: var(--text-strong); }
.shell-hint { margin-top: 18px; color: var(--text-3); font-size: 0.85rem; }
.num { font-variant-numeric: tabular-nums; }
.sub-line { display: block; }

/* ----- Drive ----- */
.banner { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 16px; border-radius: 14px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); font-size: 0.9rem; color: var(--text); }
.banner-text { flex: 1 1 200px; font-weight: 600; }
.drive { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) {
    .drive { grid-template-columns: minmax(380px, 0.92fr) minmax(0, 1.08fr); }
    .cluster-col { position: sticky; top: 97px; }
}
.cluster-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.computer-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.status { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; min-height: 28px; font-size: 0.85rem; color: var(--text-2); }
.status-right { margin-left: auto; display: inline-flex; gap: 14px; font-family: var(--font-num); font-weight: 600; font-size: 1.05rem; color: var(--text-strong); }
.lamp-item { display: inline-flex; align-items: center; gap: 7px; }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--lamp-off); flex: none; }
.lamp.green { background: var(--lamp-green); box-shadow: 0 0 8px var(--lamp-green); }
.lamp.amber { background: var(--lamp-amber); box-shadow: 0 0 8px var(--lamp-amber); }
.lamp.red { background: var(--lamp-red); box-shadow: 0 0 8px var(--lamp-red); }
.lamp.blue { background: var(--lamp-blue); box-shadow: 0 0 8px var(--lamp-blue); }
.lamp.blink { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* the cluster: a square holding the dial, with the limit sign and the vehicle in its top corners */
.cluster { position: relative; width: min(100%, 560px, calc(100svh - 300px)); min-width: min(100%, 280px); aspect-ratio: 1 / 1; margin: 0 auto; }
.dial { width: 100%; height: 100%; display: block; overflow: visible; max-width: none; }
.dial .face { fill: var(--face); stroke: var(--line); stroke-width: 1.5; }
.dial .tick { stroke: var(--ink); stroke-linecap: butt; }
.dial .tick.minor { stroke: var(--ink-2); }
.dial .tick.over { stroke: var(--zone); }
.dial .lbl { fill: var(--ink); font-family: var(--font-num); font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.dial .zone { fill: none; stroke: var(--zone); stroke-linecap: butt; }
.dial .track { fill: none; stroke: var(--line); stroke-width: 3; }
.dial .progress { fill: none; stroke: var(--needle); stroke-width: 3; stroke-linecap: round; }
.dial .needle { fill: var(--needle); }
.dial .tell { stroke: var(--tell); stroke-width: 2.5; stroke-linecap: round; }
.dial .tell-tip { fill: var(--tell); }
.dial .digits { fill: var(--ink); font-family: var(--font-num); font-weight: 700; text-anchor: middle; font-size: 108px; letter-spacing: -1px; }
.dial .digits.dim { fill: var(--ink-2); }
.dial .unit { fill: var(--ink-2); font-family: var(--font-ui); font-size: 17px; font-weight: 600; text-anchor: middle; }
.dial .sub { fill: var(--ink-2); font-family: var(--font-num); font-size: 19px; font-weight: 600; text-anchor: middle; }
.dial .drum-bg { fill: var(--drum); }
.dial .drum-last-bg { fill: var(--drum-last); stroke: var(--drum); stroke-width: 1.5; }
.dial .drum-d { fill: var(--drum-ink); font-family: var(--font-num); font-weight: 600; font-size: 22px; text-anchor: middle; dominant-baseline: central; }
.dial .drum-last .drum-d { fill: var(--drum-last-ink); }
.dial .drum-unit { fill: var(--ink-2); font-family: var(--font-ui); font-size: 12px; font-weight: 600; dominant-baseline: central; }
.dial .drum-name { fill: var(--ink-2); font-family: var(--font-ui); font-size: 12.5px; font-weight: 600; text-anchor: middle; }
.cluster.over .digits { fill: var(--zone); }
.cluster.over .zone { animation: zonepulse 0.9s ease-in-out infinite alternate; }
@keyframes zonepulse { from { stroke-opacity: 1; } to { stroke-opacity: 0.35; } }
.cluster.weak .digits { fill: var(--ink-2); }
.limit-sign { position: absolute; left: 0; top: 0; width: clamp(50px, 15%, 76px); aspect-ratio: 1 / 1; padding: 0; border-radius: 50%; background: #ffffff; border: clamp(5px, 1.5vw, 8px) solid #d0262f; display: grid; place-items: center; color: #111317; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); cursor: pointer; font-family: inherit; }
.limit-sign .limit-num { font-family: var(--font-num); font-weight: 700; font-size: clamp(1.15rem, 4.2vw, 1.75rem); line-height: 1; letter-spacing: -0.5px; }
.limit-sign.off { border-color: var(--lamp-off); color: var(--text-2); background: var(--surface-2); box-shadow: none; }
.limit-sign.off .limit-num { text-decoration: line-through; }
.cluster.over .limit-sign { animation: signflash 0.9s ease-in-out infinite alternate; }
@keyframes signflash { from { transform: scale(1); } to { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(208, 38, 47, 0.25); } }
.profile-chip { position: absolute; right: 0; top: 0; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); display: grid; place-items: center; padding: 0; cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease; }
.profile-chip .ico { width: 24px; height: 24px; }
.profile-chip:hover { border-color: var(--brand); color: var(--link); }
.drum-hit { position: absolute; left: 30%; width: 40%; top: 76.5%; height: 18%; border: 0; background: transparent; border-radius: 10px; padding: 0; cursor: pointer; }
.drum-hit:hover { background: rgba(127, 127, 127, 0.08); }
/* the heading strip, read like an aircraft compass tape */
.tape { position: relative; height: 44px; width: min(100%, 560px); margin: 0 auto; overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); }
.tape svg { display: block; width: 100%; height: 44px; max-width: none; }
.tape .t-tick { stroke: var(--ink-2); stroke-width: 1.5; }
.tape .t-tick.major { stroke: var(--ink); stroke-width: 2; }
.tape .t-lbl { fill: var(--ink-2); font-family: var(--font-num); font-weight: 600; font-size: 13px; text-anchor: middle; }
.tape .t-lbl.card { fill: var(--ink); font-size: 15px; font-weight: 700; }
.tape .t-box { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.tape .t-val { fill: var(--ink); font-family: var(--font-num); font-weight: 700; font-size: 16px; text-anchor: middle; dominant-baseline: central; }
.tape .t-ptr { fill: var(--needle); }
/* before a heading is known the strip is grey, never faded (faded text falls below 4.5:1) */
.tape.unknown .t-tick.major { stroke: var(--ink-2); }
.tape.unknown .t-lbl.card { fill: var(--ink-2); }
.drive-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(100%, 560px); margin: 4px auto 0; }
.drive-actions.trip { grid-template-columns: 1.4fr 1fr 1fr; }
.mode-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 560px); margin: 0 auto; }
.drive-actions .btn, .mode-actions .btn { white-space: normal; padding-left: 10px; padding-right: 10px; min-width: 0; }
.mode-actions .btn { font-size: 0.875rem; }
/* the trip computer */
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; border-top: 1px solid var(--line); }
@media (min-width: 560px) { .readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.readout { display: flex; flex-direction: column; padding: 10px 0 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.r-label { font-size: 0.82rem; color: var(--text-2); font-weight: 600; }
.r-value { font-family: var(--font-num); font-weight: 600; font-size: 1.85rem; line-height: 1.15; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-strong); }
.r-value small { font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-left: 4px; letter-spacing: 0; }
.r-sub { font-size: 0.8rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-value.alert { color: var(--zone); }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 20px; }
.meter { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.meter-name { font-size: 0.82rem; color: var(--text-2); font-weight: 600; }
.meter-val { font-family: var(--font-num); font-weight: 600; font-size: 1.3rem; line-height: 1.2; white-space: nowrap; color: var(--text-strong); }
.meter .link { align-self: flex-start; font-size: 0.82rem; }
.meter .hint { font-size: 0.78rem; }

/* ----- Charts ----- */
.chart { position: relative; width: 100%; min-width: 0; height: 180px; touch-action: pan-y; }
.chart canvas { display: block; width: 100%; height: 100%; }
.chart.short { height: 120px; }
.live-chart { height: 170px; }
.perf-chart { height: 150px; }
.chart-tip { position: absolute; pointer-events: none; z-index: 2; top: 4px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 10px; font-size: 0.82rem; line-height: 1.35; white-space: nowrap; box-shadow: var(--surface-shadow); }
.chart-tip b { font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.chart-tip i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--series); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--text-2); font-size: 0.9rem; padding: 0 8px; margin: 0; }
.ramp-legend { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ramp-legend .ramp { width: 120px; height: 8px; border-radius: 4px; }

/* ----- Trips ----- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding: 10px 0 12px; min-width: 0; }
.card.tiles .tile { border-top: 0; padding: 4px 0; }
.tile .r-value { font-size: 1.6rem; }
.list-card { padding: 4px 20px; }
.trip-list { display: flex; flex-direction: column; }
.trip-list > li:last-child .trip-row { border-bottom: 0; }
.trip-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; border-radius: 0; color: var(--text); font-family: inherit; font-size: 1rem; cursor: pointer; }
.trip-row:hover .trip-name > span { color: var(--link); }
.trip-row canvas { width: 64px; height: 64px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.trip-name { font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-strong); }
.trip-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-name .ico { width: 16px; height: 16px; color: var(--text-2); }
.trip-when { font-size: 0.82rem; color: var(--text-2); }
.trip-facts { display: flex; flex-wrap: wrap; gap: 2px 16px; font-family: var(--font-num); font-weight: 600; font-size: 1.05rem; }
.trip-facts small { font-family: var(--font-ui); color: var(--text-2); font-size: 0.75rem; margin-left: 3px; font-weight: 600; }
.badge { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); flex: none; }
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.empty-state > .ico { width: 34px; height: 34px; color: var(--link); }
.empty-state h3 { font-size: 1.15rem; color: var(--text-strong); }
.empty-state p { color: var(--text-2); max-width: 64ch; }

/* ----- One trip in detail ----- */
.dialog.trip-dialog { width: min(1180px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: hidden; }
.dialog.trip-dialog[open] { display: flex; flex-direction: column; }
.td { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.td-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--surface-border); }
.td-title { min-width: 0; flex: 1; }
.td-name { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 10px; padding: 2px 8px; margin-left: -8px; font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.25rem; font-weight: 700; color: var(--text-strong); }
.td-name:hover { border-color: var(--line); }
.td-name:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.td-body { overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 24px; flex: 1; min-height: 0; }
.td-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.td-sec h3 { font-size: 1.05rem; color: var(--text-strong); }
.td-sub { margin-top: 6px; }
.td-two { display: grid; gap: 24px 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .td-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.td-chart { height: 200px; }
.route { position: relative; height: clamp(260px, 46vh, 460px); width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; touch-action: none; }
.route canvas { width: 100%; height: 100%; display: block; }
.td-foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--surface-border); }
.td-foot .push { margin-left: auto; }
.td-foot .btn { padding: 9px 16px; font-size: 0.85rem; }

/* ----- Tools ----- */
.tool { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tool-head { display: flex; align-items: center; gap: 10px; }
.tool-head h3 { font-size: 1.15rem; color: var(--text-strong); }
.tool-head .ico { width: 22px; height: 22px; color: var(--link); }
.tool-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.warnline { display: flex; gap: 8px; align-items: center; color: var(--warn); font-weight: 600; font-size: 0.9rem; }
.perf { display: grid; gap: 24px 48px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .perf { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.perf-main, .perf-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.perf-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.perf-controls .select { min-width: 220px; }
.pair { display: flex; align-items: center; gap: 8px; }
.pair .input { width: 88px; }
.perf-board { display: flex; flex-direction: column; gap: 2px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.perf-state { font-weight: 700; font-size: 1.05rem; min-height: 1.6em; color: var(--text-strong); }
.perf-state.go { color: var(--ok); }
.perf-state.bad { color: var(--bad); }
.perf-time { font-family: var(--font-num); font-weight: 700; font-size: clamp(3.4rem, 12vw, 5.4rem); line-height: 1; letter-spacing: -1px; color: var(--text-strong); }
.perf-time small { font-size: 0.35em; color: var(--text-2); margin-left: 6px; font-family: var(--font-ui); letter-spacing: 0; }
.perf-now { font-family: var(--font-num); font-weight: 600; font-size: 1.3rem; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; color: var(--text); }
.perf-now .muted { font-family: var(--font-ui); font-size: 0.82rem; font-weight: 500; margin-left: 10px; }
.check-now { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; align-items: end; }
.check-now > div { display: flex; flex-direction: column; }
.check-now .btn { grid-column: 1 / -1; }
@media (min-width: 560px) { .check-now { grid-template-columns: auto minmax(120px, 180px) auto; } .check-now .btn { grid-column: auto; } }
.verdict { font-weight: 600; color: var(--text-strong); }
.verdict:empty { display: none; }
.zone-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px 16px; }
.zone-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.zone-board > div { display: flex; flex-direction: column; min-width: 0; }
.zone-board .r-value { font-size: 1.6rem; }
.g-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.g-ball { width: min(220px, 60vw); height: auto; aspect-ratio: 1 / 1; flex: none; }
.g-ball .g-ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.g-ball .g-ring.major { stroke: var(--ink-2); }
.g-ball .g-axis { stroke: var(--line-strong); stroke-width: 1; }
.g-ball .g-lbl { fill: var(--text-2); font-family: var(--font-ui); font-size: 10px; text-anchor: middle; }
.g-ball .g-trail { fill: var(--series); opacity: 0.25; }
.g-ball .g-dot { fill: var(--needle); stroke: var(--surface); stroke-width: 2; }
.g-ball .g-peak { fill: none; stroke: var(--series); stroke-width: 2; }
.g-read { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.g-read > div { display: flex; flex-direction: column; }
.g-read .r-value { font-size: 1.5rem; }
.where { display: grid; gap: 0; border-top: 1px solid var(--line); }
.where > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.where dt { color: var(--text-2); font-size: 0.875rem; font-weight: 600; }
.where dd { font-family: var(--font-num); font-weight: 600; font-size: 1.15rem; color: var(--text-strong); overflow-wrap: anywhere; }
#wPlus { font-size: 1.4rem; letter-spacing: 0.5px; }

/* ----- Settings ----- */
.set-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1360px) { .set-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.set { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.set h3 { margin-bottom: 4px; font-size: 1.15rem; color: var(--text-strong); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.set-row.col { flex-direction: column; align-items: flex-start; }
.set-row:not(.col) > span { min-width: 0; flex: 1 1 200px; }
.set-row.col > * { max-width: 100%; }
.set .hint { display: block; }
.vehicles { display: flex; flex-wrap: wrap; gap: 6px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper .icon-btn { border-color: var(--chip-border); background: var(--chip); }
.stepper-val { font-family: var(--font-num); font-weight: 700; font-size: 1.8rem; min-width: 3ch; text-align: center; color: var(--text-strong); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line-strong); padding: 0; background: #000; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; font-size: 1rem; cursor: pointer; }
.swatch[aria-checked="true"] { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.examples { padding-left: 1.2em; list-style: disc; display: flex; flex-direction: column; gap: 6px; font-size: 0.925rem; color: var(--text-2); }
.limit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; justify-items: center; }
.limit-pick { width: 64px; height: 64px; border-radius: 50%; background: #ffffff; border: 6px solid #d0262f; color: #111317; font-family: var(--font-num); font-weight: 700; font-size: 1.45rem; padding: 0; display: grid; place-items: center; cursor: pointer; }
.limit-pick[aria-checked="true"] { outline: 3px solid var(--brand); outline-offset: 3px; }
.finish-sum { font-family: var(--font-num); font-weight: 600; font-size: 1.15rem; color: var(--text-strong); }
.dialog .set-row { border-bottom: 0; padding-bottom: 0; }
#finishForm { display: contents; }

/* ----- Big digits and windscreen: full screen above the whole page, black whatever the theme ----- */
.hud[hidden], .cam[hidden] { display: none !important; }
.hud { position: fixed; inset: 0; z-index: 10050; background: #000000; color: var(--hud, #3dff8f); display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.hud-stage { display: flex; flex-direction: column; align-items: center; gap: 0.5vmin; opacity: var(--hud-dim, 1); transition: transform 0.3s; }
.hud.mirror-y .hud-stage { transform: scaleY(-1); }
.hud.mirror-x .hud-stage { transform: scaleX(-1); }
.hud-speed { font-family: var(--font-num); font-weight: 700; font-size: min(52vmin, 34vw); line-height: 0.86; letter-spacing: -0.02em; text-shadow: 0 0 2.5vmin currentColor; }
.hud-unit { font-family: var(--font-ui); font-weight: 700; font-size: min(6vmin, 40px); opacity: 0.8; }
.hud-bar { position: relative; width: min(70vw, 90vmin); height: 1.6vmin; min-height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); margin-top: 2vmin; }
.hud-bar span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: currentColor; transition: width 0.25s linear; }
.hud-bar i { position: absolute; top: -1vmin; bottom: -1vmin; width: 3px; background: #ff4b55; display: none; }
.hud-line { display: flex; gap: 6vmin; font-family: var(--font-num); font-weight: 600; font-size: min(6vmin, 44px); opacity: 0.75; margin-top: 1vmin; }
.hud-limit { margin-bottom: 2vmin; width: min(16vmin, 110px); height: min(16vmin, 110px); border-radius: 50%; background: #ffffff; border: min(2vmin, 12px) solid #d0262f; color: #111317; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; font-size: min(6vmin, 44px); }
.hud.over .hud-speed { color: #ff4b55; animation: hudflash 0.6s steps(2, start) infinite; }
@keyframes hudflash { to { opacity: 0.35; } }
.hud-controls { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: max(16px, env(safe-area-inset-top)) 16px 16px; background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0)); transition: opacity 0.25s; }
.hud.quiet .hud-controls { opacity: 0; pointer-events: none; }
.hud-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 9999px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.55); color: #ffffff; font-family: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.hud-btn:hover { background: rgba(40, 40, 40, 0.75); }
.hud-btn:focus-visible, .cam-shutter:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.hud-btn[aria-pressed="true"] { background: #ffffff; color: #111317; }
.hud-tip { position: absolute; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; right: 16px; text-align: center; color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; transition: opacity 0.25s; }
.hud.quiet .hud-tip { opacity: 0; }
.cam { position: fixed; inset: 0; z-index: 10050; background: #000000; overflow: hidden; }
.cam video, .cam canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam video { object-fit: cover; }
.cam-top, .cam-bottom { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 16px; }
.cam-top { top: 0; justify-content: space-between; padding-top: max(16px, env(safe-area-inset-top)); }
.cam-top .hud-btn { margin-left: auto; }
.cam-bottom { bottom: 0; justify-content: center; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.cam-rec { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #ffffff; font-family: var(--font-num); font-weight: 600; font-size: 1.1rem; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #ffffff; background: transparent; display: grid; place-items: center; padding: 0; margin: 0 6px; cursor: pointer; }
.cam-shutter span { width: 54px; height: 54px; border-radius: 50%; background: #ff3b45; transition: border-radius 0.2s, width 0.2s, height 0.2s; }
.cam-shutter.on span { width: 28px; height: 28px; border-radius: 6px; }

/* ----- A phone on its side in a car mount: the dial and the numbers side by side ----- */
@media (orientation: landscape) and (max-height: 520px) {
    .drive { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; }
    .cluster-col { position: static; gap: 6px; }
    .status { min-height: 22px; font-size: 0.8rem; flex-wrap: nowrap; white-space: nowrap; }
    #wakeLamp > span:last-child { display: none; }
    /* app.js sets the exact size so the dial and its buttons fit under the site's header */
    .cluster { width: min(100%, calc(100svh - 190px)); min-width: 0; }
    .tape { display: none; }
    .drive-actions { margin-top: 0; }
    .drive-actions .btn.big { padding-top: 8px; padding-bottom: 8px; font-size: 0.92rem; }
    .mode-actions .btn { padding-top: 6px; padding-bottom: 6px; font-size: 0.8rem; gap: 5px; }
}

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .app-toolbar .view-tabs { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-radius: 24px; }
    .view-tab { justify-content: center; padding: 8px 4px; gap: 5px; min-width: 0; }
    .toolbar-right { width: 100%; padding-right: 52px; } /* the site's round theme button sits at the right */
    .toolbar-right .btn { flex: 1 1 auto; }
    .card { padding: 16px; }
    .list-card { padding: 2px 16px; }
    .cluster { width: min(100%, calc(100svh - 280px)); }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions, .td-head, .td-body, .td-foot { padding-left: 16px; padding-right: 16px; }
    .dialog.trip-dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; border: 0; }
    .td-foot .btn { flex: 1 1 auto; }
    .td-foot .push { margin-left: 0; }
    .zone-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}
@media (max-width: 459px) {
    .view-tab .ico { display: none; }
    .mode-actions .btn .ico { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .dialog, .dialog[open], .toast, .seg button, .chip, .view-tab, .switch, .switch::after, .hud-stage, .hud-bar span { transition: none; animation: none; }
    .lamp.blink, .cluster.over .zone, .cluster.over .limit-sign, .hud.over .hud-speed { animation: none; }
}
@media (forced-colors: active) {
    .lamp { border: 2px solid CanvasText; }
    .dial .needle { fill: Highlight; }
}
@media print {
    .app-toolbar, .drive-actions, .mode-actions, .actions, .td-foot, .shell-hint { display: none !important; }
}
/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The dial, the strip, charts and the g-ball are
   drawings; the numbers in the trip computer are display figures. */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .seg button, main .view-tab, main .chip, main .btn { min-height: 44px; }
    main .icon-btn { width: 44px; height: 44px; min-width: 44px; }
    main .switch { width: 56px; height: 44px; border-radius: 22px; }
    main .switch::after { top: 8px; left: 6px; width: 28px; height: 28px; }
    main .switch[aria-checked="true"]::after { transform: translateX(16px); }
    main .swatch { width: 44px; height: 44px; }
    main .link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
    main #playSeg button { min-width: 44px; }
    main .check { min-height: 44px; align-items: center; }
    main .drum-hit, main .limit-sign { min-height: 0; }
    main .profile-chip { width: 44px; height: 44px; }
    main :is(p:not(.perf-time):not(.perf-now):not(.perf-state), li, .hint, .label, .input, .select, kbd, .seg button, .chip, .muted, .lead, .r-label, .r-sub, .meter-name,
        .status, .view-tab, .shell-hint, .banner, .trip-when, .badge, .data-table th, .data-table td, .where dt, .warnline,
        .check, .empty, .btn, .link, .trip-facts small, .r-value small, .meter .hint, .perf-now .muted) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog select, .dialog input:not([type="checkbox"]):not([type="range"]), .dialog summary { min-height: 44px; }
    .dialog .dialog-close, .dialog .icon-btn { width: 44px; height: 44px; }
    .dialog .switch { width: 56px; height: 44px; border-radius: 22px; }
    .dialog .switch::after { top: 8px; left: 6px; width: 28px; height: 28px; }
    .dialog .switch[aria-checked="true"]::after { transform: translateX(16px); }
    .dialog :is(p:not(.finish-sum), .hint, .label, .input, li, kbd, small, h3, .data-table th, .data-table td, .r-label, .r-sub, .link, .btn, .seg button) { font-size: 1rem; }
    .dialog .td-name { font-size: 1.15rem; }
    .dialog .link { min-height: 44px; display: inline-flex; align-items: center; }
    .hud-btn, .hud-tip { font-size: 1rem; }
}
