@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    /* -------------------------------------------------------------------------
       Motorsport Telemetry & Cockpit Engineering Palette
       Warm-tinted obsidian base, tactile 1px physical borders, functional telemetry accents
       ------------------------------------------------------------------------- */
    --bg-base: #0e1113;
    --bg-surface-1: #13171a;
    --bg-surface-2: #181d22;
    --bg-surface-3: #1f252c;
    --bg-surface-elevated: #273038;
    --bg-input: #0a0c0e;

    /* Tactile 1px Physical Borders & Micro-Bevels */
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-highlight: rgba(255, 255, 255, 0.20);
    --border-active: rgba(255, 255, 255, 0.35);

    /* Telemetry Accents: High-Visibility Functional Colors */
    /* Competition Amber / Signal Orange (Active states / Horn / Team 2 / Warnings) */
    --color-orange: #ea580c;
    --color-orange-bright: #fb923c;
    --color-orange-dim: rgba(251, 146, 60, 0.08);
    --color-orange-border: rgba(251, 146, 60, 0.28);
    --color-amber: #d97706;
    --color-amber-bright: #fbbf24;
    --color-amber-dim: rgba(251, 191, 36, 0.08);
    --color-amber-border: rgba(251, 191, 36, 0.28);

    /* Luminous Electric Emerald (Connected Bots / Telemetry Online / Calibrated Lock) */
    --color-emerald: #10b981;
    --color-emerald-bright: #34d399;
    --color-emerald-dim: rgba(52, 211, 153, 0.08);
    --color-emerald-border: rgba(52, 211, 153, 0.28);
    --color-emerald-glow: rgba(52, 211, 153, 0.25);

    /* Muted Crimson (Reverse / Brake / Disconnections / Failsafe Stop) */
    --color-crimson: #dc2626;
    --color-crimson-bright: #f87171;
    --color-crimson-dim: rgba(248, 113, 113, 0.08);
    --color-crimson-border: rgba(248, 113, 113, 0.28);

    /* Competition Azure / Gas Propulsion (Team 1 / Throttle) */
    --color-blue: #0284c7;
    --color-blue-bright: #38bdf8;
    --color-blue-dim: rgba(56, 189, 248, 0.08);
    --color-blue-border: rgba(56, 189, 248, 0.28);
    --color-blue-solid: #0ea5e9;

    /* Typographic Contrast Scale */
    --text-primary: #f4f5f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-dim: #4b5563;
    --text-inverse: #0e1113;

    /* Backward-Compatibility Aliases */
    --bg-dark: var(--bg-base);
    --card-bg: var(--bg-surface-1);
    --card-border: var(--border-subtle);
    --blue-neon: var(--color-blue-bright);
    --blue-glow: rgba(56, 189, 248, 0.12);
    --orange-neon: var(--color-orange-bright);
    --orange-glow: rgba(251, 146, 60, 0.12);
    --text-main: var(--text-primary);

    /* Typography */
    --font-heading: 'Chakra Petch', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Physical Hardware Depth: Inset Rims & Recessed Wells (No Floating Drops) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
    --shadow-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
    --shadow-recessed: inset 0 2px 4px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(0, 0, 0, 0.45);
    --shadow-pressed: inset 0 2px 6px rgba(0, 0, 0, 0.85);

    /* Radii: Disciplined hardware radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-pill: 9999px;

    /* Emil Kowalski Mechanical Spring Return Curves (< 160ms) */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-press: cubic-bezier(0.2, 0, 0, 1);
    --timing-fast: 90ms;
    --timing-base: 130ms;
    --timing-quick: 110ms;
}

/* -------------------------------------------------------------------------
   Global Telemetry Baseline & Hardware Resets
   ------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--bg-base);
    font-family: var(--font-body);
    color: var(--text-primary);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior: none;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

#login-screen,
#gamepad-container,
#rotate-device-overlay,
#sensor-permission-modal,
.controller-arena,
.thumb-drive-zone,
.cockpit-hud,
button {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Tabular numbers for all telemetry readouts & data grids */
.telemetry-value,
.tilt-angle-deg,
#steering-val-pct,
.mac-text,
.badge-tag,
.slot-tag,
.team-mac-select,
.car-table td,
.car-table th {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1;
}

/* Custom Cockpit Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.10);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.20);
}

::selection {
    background: rgba(56, 189, 248, 0.25);
    color: #ffffff;
}

/* -------------------------------------------------------------------------
   Portrait Warning Overlay
   ------------------------------------------------------------------------- */
#rotate-device-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-base);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 24px;
}

#rotate-device-overlay .rotate-icon {
    font-size: 34px;
    margin-bottom: 16px;
    opacity: 0.85;
    animation: rotateCockpit 3s infinite var(--ease-out);
}

#rotate-device-overlay h2 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 6px;
}

#rotate-device-overlay p {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@keyframes rotateCockpit {
    0%, 20% { transform: rotate(0deg); }
    45%, 70% { transform: rotate(-90deg); }
    90%, 100% { transform: rotate(0deg); }
}

@media (orientation: portrait) {
    #rotate-device-overlay {
        display: flex;
    }
    #gamepad-container {
        display: none !important;
    }
}

/* -------------------------------------------------------------------------
   Main Gamepad Container
   ------------------------------------------------------------------------- */
#gamepad-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    position: relative;
    overflow: hidden;
}

/* Precision Telemetry Calibration Grid (24px interval) */
#gamepad-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 1;
}

/* Faint telemetry corner marks simulating hardware bezels */
#gamepad-container::after {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    pointer-events: none;
    z-index: 1;
}

/* -------------------------------------------------------------------------
   Top Header Bar - MoTeC / F1 Timing Status Bar
   ------------------------------------------------------------------------- */
.top-bar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: #0b0d10;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    box-shadow: 
        0 1px 0 rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    background: var(--color-orange-dim);
    border: 1px solid var(--color-orange-border);
    color: var(--color-orange-bright);
    box-shadow: var(--shadow-bevel);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Micro-Tag Status Indicators (Replacing Huge Pill Badges) */
.badge-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-bevel);
}

/* Micro-Dot with Faint Pulsing Glow Ring */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-crimson-bright);
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
    transition: background-color var(--timing-base) var(--ease-out), box-shadow var(--timing-base) var(--ease-out);
}

.status-dot.connected {
    background: var(--color-emerald-bright);
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2), 0 0 6px var(--color-emerald-glow);
    animation: microDotPulse 2.2s infinite ease-in-out;
}

@keyframes microDotPulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2), 0 0 6px var(--color-emerald-glow);
    }
    50% {
        box-shadow: 0 0 0 3.5px rgba(52, 211, 153, 0.1), 0 0 9px var(--color-emerald-glow);
    }
}

.slot-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: var(--shadow-bevel);
}

.slot-blue {
    background: var(--color-blue-dim);
    border: 1px solid var(--color-blue-border);
    color: var(--color-blue-bright);
}

.slot-orange {
    background: var(--color-orange-dim);
    border: 1px solid var(--color-orange-border);
    color: var(--color-orange-bright);
}

/* Tactile Header Action Buttons */
.btn-header {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: 600;
    box-shadow: var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        background-color var(--timing-base) var(--ease-out),
        color var(--timing-base) var(--ease-out),
        border-color var(--timing-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .btn-header:hover {
        background: var(--bg-surface-3);
        color: var(--text-primary);
        border-color: var(--border-medium);
    }
}

.btn-header:active {
    transform: translateY(1px);
    filter: brightness(0.95);
    background: var(--bg-surface-1);
    box-shadow: var(--shadow-pressed);
}

/* Mode pill: ultra-crisp wide uppercase */
.hud-mode-pill {
    font-size: 8.5px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-left: 2px;
}

.btn-calibrate {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    font-size: 10.5px;
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        background-color var(--timing-base) var(--ease-out),
        color var(--timing-base) var(--ease-out),
        border-color var(--timing-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .btn-calibrate:hover {
        background: var(--bg-surface-3);
        border-color: var(--border-medium);
        color: var(--text-primary);
    }
}

.btn-calibrate:active {
    transform: translateY(1px);
    filter: brightness(0.95);
    background: var(--bg-surface-1);
    box-shadow: var(--shadow-pressed);
}

.btn-calibrate.calibrated {
    border-color: var(--color-emerald-border);
    color: var(--color-emerald-bright);
    background: var(--color-emerald-dim);
}

/* -------------------------------------------------------------------------
   Controller Arena: 3-column Layout (Physical Machined Console)
   ------------------------------------------------------------------------- */
.controller-arena {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
    gap: 10px;
    position: relative;
    overflow: hidden;
    z-index: 2;
}

/* -------------------------------------------------------------------------
   Dual Thumb Drive Zones (Pedal Bays with Machined Bevels)
   ------------------------------------------------------------------------- */
.thumb-drive-zone {
    flex: 1;
    max-width: 35%;
    background: linear-gradient(180deg, #15191d 0%, #101316 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 
        var(--shadow-sm),
        var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        border-color var(--timing-quick) var(--ease-out),
        background var(--timing-quick) var(--ease-out),
        box-shadow var(--timing-quick) var(--ease-out);
    overflow: hidden;
}

/* Hardware Channel Labels */
.thumb-drive-zone::before {
    position: absolute;
    top: 9px;
    left: 12px;
    font-family: var(--font-mono);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    opacity: 0.75;
    pointer-events: none;
    text-transform: uppercase;
}

.zone-brake::before {
    content: "// CH-01 : REV-BRAKE";
}

.zone-gas::before {
    content: "// CH-02 : ACCEL-FWD";
}

/* Emil Kowalski Pressed Mechanical Sensation */
.thumb-drive-zone:active, .thumb-drive-zone.active {
    transform: translateY(1.5px) scale(0.988);
    filter: brightness(0.96);
}

.zone-watermark {
    position: absolute;
    font-family: var(--font-heading);
    font-size: 48px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.02);
    letter-spacing: 0.12em;
    pointer-events: none;
    user-select: none;
    text-transform: uppercase;
}

.drive-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2;
    pointer-events: none;
}

.pedal-icon {
    font-size: 24px;
    margin-bottom: 2px;
    opacity: 0.85;
    transition: transform var(--timing-fast) var(--ease-press);
}

.zone-title {
    font-family: var(--font-heading);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.zone-subtext {
    font-family: var(--font-mono);
    font-size: 8.5px;
    color: var(--text-muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* Recessed Telemetry Progress Meter Bar */
.pedal-meter {
    width: 110px;
    height: 4px;
    background: #080a0c;
    border-radius: 2px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    margin-top: 8px;
    box-shadow: var(--shadow-recessed);
}

.pedal-fill {
    height: 100%;
    width: 0%;
    transition: width 0.04s linear;
}

/* Brake / Reverse Specifics */
.zone-brake {
    border-color: var(--border-subtle);
}

.zone-brake .zone-title {
    color: var(--color-crimson-bright);
}

.zone-brake:active, .zone-brake.active {
    border-color: var(--color-crimson-border);
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.12) 0%, #101316 100%);
    box-shadow: 
        var(--shadow-pressed),
        inset 0 1px 0 rgba(248, 113, 113, 0.3);
}

.zone-brake:active .pedal-icon, .zone-brake.active .pedal-icon {
    transform: scale(0.92);
}

.fill-brake {
    background: linear-gradient(90deg, #991b1b, var(--color-crimson-bright));
}

/* Gas / Accelerate Specifics */
.zone-gas {
    border-color: var(--border-subtle);
}

.zone-gas .zone-title {
    color: var(--color-blue-bright);
}

.zone-gas:active, .zone-gas.active {
    border-color: var(--color-blue-border);
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.12) 0%, #101316 100%);
    box-shadow: 
        var(--shadow-pressed),
        inset 0 1px 0 rgba(56, 189, 248, 0.3);
}

.zone-gas:active .pedal-icon, .zone-gas.active .pedal-icon {
    transform: scale(0.92);
}

.fill-gas {
    background: linear-gradient(90deg, #0369a1, var(--color-blue-bright));
}

/* -------------------------------------------------------------------------
   Center Cockpit HUD - MoTeC / Teenage Engineering Style Console
   ------------------------------------------------------------------------- */
.cockpit-hud {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    padding: 0;
    gap: 8px;
}

/* Gyro Horizon Tilt Gauge */
.tilt-display-box {
    width: 100%;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 7px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm), var(--shadow-bevel);
}

.tilt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.tilt-title {
    color: var(--text-muted);
    font-weight: 600;
}

.tilt-angle-deg {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.tilt-horizon-track {
    width: 100%;
    height: 22px;
    background: #080a0c;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-recessed);
}

/* Machined Graduation Ticks */
.tilt-horizon-track::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(10% - 1px),
        rgba(255, 255, 255, 0.05) calc(10% - 1px),
        rgba(255, 255, 255, 0.05) 10%
    );
    pointer-events: none;
}

.tilt-deadzone-box {
    position: absolute;
    left: calc(50% - 10px);
    width: 20px;
    height: 100%;
    background: rgba(255, 255, 255, 0.015);
    border-left: 1px dashed rgba(255, 255, 255, 0.12);
    border-right: 1px dashed rgba(255, 255, 255, 0.12);
}

.tilt-center-mark {
    position: absolute;
    left: calc(50% - 1px);
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.22);
    z-index: 2;
}

.tilt-horizon-cursor {
    position: absolute;
    left: calc(50% - 4px);
    width: 8px;
    height: 14px;
    border-radius: 1px;
    background: var(--color-orange-bright);
    border: 1px solid #ffffff;
    box-shadow: 0 0 6px rgba(251, 146, 60, 0.5);
    transition: transform 0.04s linear;
    z-index: 3;
}

.tilt-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 8.5px;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#steering-val-pct {
    color: var(--text-primary);
    font-weight: 700;
}

/* Telemetry Stats: Recessed High-Contrast Instrumentation */
.hud-telemetry-panel {
    display: flex;
    width: 100%;
    gap: 8px;
}

.telemetry-block {
    flex: 1;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    text-align: center;
    box-shadow: var(--shadow-sm), var(--shadow-bevel);
}

.telemetry-label {
    font-family: var(--font-heading);
    font-size: 8.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.telemetry-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1px;
    letter-spacing: 0.04em;
}

.text-accent {
    color: var(--color-emerald-bright) !important;
}

/* Telemetry Fullscreen Action Button (Inside Cockpit HUD) */
.telemetry-btn-fullscreen {
    flex: 1;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    touch-action: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm), var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        border-color var(--timing-base) var(--ease-out),
        background-color var(--timing-base) var(--ease-out);
}

.telemetry-btn-fullscreen .fs-label {
    font-family: var(--font-heading);
    font-size: 8.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.telemetry-btn-fullscreen .fs-content {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--color-blue-bright);
    letter-spacing: 0.04em;
    margin-top: 1px;
}

@media (hover: hover) and (pointer: fine) {
    .telemetry-btn-fullscreen:hover {
        background: var(--bg-surface-2);
        border-color: var(--border-medium);
    }
}

.telemetry-btn-fullscreen:active,
.telemetry-btn-fullscreen.active {
    transform: translateY(1px);
    filter: brightness(0.95);
    background: var(--bg-surface-2);
    border-color: var(--color-blue-border);
    box-shadow: var(--shadow-pressed);
}

.telemetry-btn-fullscreen.active .fs-content {
    color: var(--color-emerald-bright);
}

/* Horn Button: Knurled Physical Push-Switch */
.btn-horn-large {
    width: 100%;
    height: 38px;
    background: linear-gradient(180deg, #1b2027 0%, #14181d 100%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 12px;
    letter-spacing: 0.14em;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    touch-action: none;
    box-shadow: var(--shadow-sm), var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        border-color var(--timing-base) var(--ease-out),
        background var(--timing-base) var(--ease-out),
        color var(--timing-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .btn-horn-large:hover {
        border-color: var(--border-medium);
        background: #1f252c;
    }
}

.btn-horn-large:active, .btn-horn-large.active {
    background: linear-gradient(180deg, rgba(234, 88, 12, 0.18) 0%, #14181d 100%);
    border-color: var(--color-orange-border);
    color: var(--color-orange-bright);
    transform: translateY(1px);
    filter: brightness(0.95);
    box-shadow: 
        var(--shadow-pressed),
        inset 0 1px 0 rgba(251, 146, 60, 0.3);
}

/* HUD System Toast (e.g. iOS Fullscreen Hint) */
.hud-toast {
    position: fixed;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(19, 23, 26, 0.95);
    border: 1px solid var(--color-blue-border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    z-index: 9999;
    box-shadow: var(--shadow-lg), var(--shadow-bevel);
    pointer-events: none;
    animation: toastIn 0.2s var(--ease-out);
    text-align: center;
    max-width: 90vw;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* -------------------------------------------------------------------------
   Modals: Sensor Permission & Calibration
   ------------------------------------------------------------------------- */
.sensor-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 12, 14, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.sensor-modal-box {
    max-width: 380px;
    width: 100%;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 24px 22px;
    text-align: center;
    box-shadow: var(--shadow-lg), var(--shadow-bevel);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sensor-modal-box .modal-icon {
    font-size: 28px;
    margin-bottom: 2px;
    opacity: 0.9;
}

.sensor-modal-box h2 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sensor-modal-box p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.btn-modal-start {
    background: var(--color-blue);
    border: 1px solid var(--border-highlight);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    padding: 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm), var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        background-color var(--timing-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .btn-modal-start:hover {
        background: #0284c7;
    }
}

.btn-modal-start:active {
    transform: translateY(1px);
    filter: brightness(0.95);
    box-shadow: var(--shadow-pressed);
}

/* -------------------------------------------------------------------------
   Slot Selection Modal
   ------------------------------------------------------------------------- */
#slot-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 14, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-content {
    max-width: 440px;
    width: 100%;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow-lg), var(--shadow-bevel);
}

.modal-content h1 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 14px;
}

.slots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.slot-card {
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    box-shadow: var(--shadow-bevel);
    transition: 
        transform var(--timing-fast) var(--ease-press),
        filter var(--timing-fast) var(--ease-press),
        background-color var(--timing-base) var(--ease-out),
        border-color var(--timing-base) var(--ease-out);
}

.slot-card.blue {
    border-color: rgba(56, 189, 248, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    .slot-card.blue:not(.taken):hover {
        background: var(--color-blue-dim);
        border-color: var(--color-blue-bright);
    }
}

.slot-card.blue:not(.taken):active {
    transform: translateY(1px);
    filter: brightness(0.95);
    box-shadow: var(--shadow-pressed);
}

.slot-card.orange {
    border-color: rgba(251, 146, 60, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    .slot-card.orange:not(.taken):hover {
        background: var(--color-orange-dim);
        border-color: var(--color-orange-bright);
    }
}

.slot-card.orange:not(.taken):active {
    transform: translateY(1px);
    filter: brightness(0.95);
    box-shadow: var(--shadow-pressed);
}

.slot-card.taken {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.04);
}

.slot-card-title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.slot-card.blue .slot-card-title { color: var(--color-blue-bright); }
.slot-card.orange .slot-card-title { color: var(--color-orange-bright); }

.slot-card-status {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}
