/* ═══════════════════════════════════════════════════════════════════════════
   StintEngine v2 — Premium F1 Dashboard CSS
   Glassmorphism · Micro-animations · 3-column grid · SVG Gauges
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --red: #E8002D;
    --red-dim: #7a0018;
    --red-glow: rgba(232,0,45,0.15);
    --black: #050505;
    --dark: #0c0c0c;
    --card: rgba(18,18,18,0.7);
    --card-solid: #121212;
    --card-hover: rgba(26,26,26,0.8);
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --text: #e0e0e0;
    --text-dim: #888;
    --muted: #555;
    --green: #00e676;
    --green-dim: rgba(0,230,118,0.12);
    --yellow: #FFD600;
    --yellow-dim: rgba(255,214,0,0.10);
    --blue: #2979FF;
    --blue-dim: rgba(41,121,255,0.12);
    --purple: #aa00ff;
    --purple-dim: rgba(170,0,255,0.12);
    --orange: #FF6D00;
    --orange-dim: rgba(255,109,0,0.12);
    --white: #ffffff;
    --soft-color: #FF3333;
    --medium-color: #FFD700;
    --hard-color: #FFFFFF;
    --inter-color: #00e676;
    --wet-color: #2979FF;
    --glass-bg: rgba(16,16,16,0.65);
    --glass-border: rgba(255,255,255,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--black);
    color: var(--text);
    font-family: 'IBM Plex Sans', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle noise + scanline overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.006) 2px, rgba(255,255,255,0.006) 4px);
    pointer-events: none;
    z-index: 999;
}

/* Ambient glow */
body::after {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(232,0,45,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Header ──────────────────────────────────────────────────────────── */
.header {
    border-bottom: 1px solid var(--border);
    padding: 24px 32px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
}

.header::after {
    content: 'F1';
    position: absolute;
    right: -10px;
    top: -20px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 160px;
    color: rgba(232,0,45,0.025);
    pointer-events: none;
    line-height: 1;
}

.header-left { display: flex; align-items: center; gap: 20px; }

.logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 2px;
    color: var(--white);
    text-shadow: 0 0 30px rgba(232,0,45,0.2);
}

.logo span { color: var(--red); }

.tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--red);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

.header-right { display: flex; align-items: center; gap: 12px; z-index: 1; }

/* ─── Badges ──────────────────────────────────────────────────────────── */
.device-badge, .weather-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
}

.device-cuda { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.device-mps { background: rgba(0, 204, 255, 0.15); color: #00CCFF; border: 1px solid rgba(0, 204, 255, 0.3); }
.device-cpu { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,214,0,0.3); }

.weather-dry { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,214,0,0.2); }
.weather-light { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(41,121,255,0.3); animation: rainPulse 2s infinite; }
.weather-heavy { background: rgba(41,121,255,0.2); color: #64B5F6; border: 1px solid rgba(41,121,255,0.5); animation: rainPulse 1s infinite; }

@keyframes rainPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
}

.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--muted);
    transition: background 0.3s;
}

.status-dot.active { background: var(--green); box-shadow: 0 0 8px rgba(0,230,118,0.5); animation: pulse 1.5s infinite; }
.status-dot.training { background: var(--yellow); box-shadow: 0 0 8px rgba(255,214,0,0.5); animation: pulse 0.8s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── Grid Layout (3-column) ──────────────────────────────────────────── */
.dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.03);
    min-height: calc(100vh - 80px);
}

.panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 5;
}

.panel-full { grid-column: 1 / -1; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--white);
}

.panel-title .accent { color: var(--red); margin-right: 4px; }

.panel-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 3px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.badge-red { background: var(--red-glow); color: var(--red); border: 1px solid rgba(232,0,45,0.3); }
.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.badge-blue { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(41,121,255,0.3); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,214,0,0.3); }
.badge-purple { background: var(--purple-dim); color: #ce93d8; border: 1px solid rgba(170,0,255,0.3); }
.badge-orange { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,109,0,0.3); }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    background: var(--card);
    color: var(--text);
    backdrop-filter: blur(8px);
}

.btn:hover { background: var(--card-hover); border-color: rgba(255,255,255,0.15); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--red); border-color: var(--red); color: white; box-shadow: 0 0 20px rgba(232,0,45,0.2); }
.btn-primary:hover { background: #cc0028; box-shadow: 0 0 30px rgba(232,0,45,0.3); }
.btn-primary:disabled { background: var(--red-dim); border-color: var(--red-dim); cursor: not-allowed; opacity: 0.5; box-shadow: none; transform: none; }

.btn-green { background: rgba(0,230,118,0.12); border-color: rgba(0,230,118,0.3); color: var(--green); }
.btn-green:hover { background: rgba(0,230,118,0.2); box-shadow: 0 0 20px rgba(0,230,118,0.15); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Controls ────────────────────────────────────────────────────────── */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.input-group { display: flex; align-items: center; gap: 4px; }

.input-group label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.input-field {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
    background: rgba(20,20,20,0.8);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    width: 100px;
    text-align: right;
    transition: border-color 0.2s;
}

.input-field:focus { outline: none; border-color: var(--red); box-shadow: 0 0 12px rgba(232,0,45,0.15); }

/* ─── Metrics ─────────────────────────────────────────────────────────── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.metric-card {
    background: rgba(20,20,20,0.6);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: 6px;
    transition: border-color 0.3s;
}

.metric-card:hover { border-color: var(--border-light); }

.metric-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.metric-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    color: var(--white);
    letter-spacing: 1px;
}

.metric-value.green { color: var(--green); }
.metric-value.yellow { color: var(--yellow); }
.metric-value.red { color: var(--red); }
.metric-value.blue { color: var(--blue); }

/* ─── Charts ──────────────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: rgba(14,14,14,0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
}

.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ─── SVG Gauges ──────────────────────────────────────────────────────── */
.gauge-row {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.gauge-item { width: 120px; height: 120px; }

.gauge-svg { width: 100%; height: 100%; }

.gauge-bg {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
    stroke-dasharray: 314;
}

.gauge-fill {
    fill: none;
    stroke: var(--green);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 314;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.8s ease;
}

.gauge-tyre { stroke: var(--red); }

.gauge-text {
    fill: var(--white);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    text-anchor: middle;
    dominant-baseline: central;
}

.gauge-label {
    fill: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    text-anchor: middle;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.gauge-info {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--border);
}

.gauge-info-item { text-align: center; }

.gauge-info-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.gauge-info-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
}

/* ─── Race Summary ────────────────────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.summary-stat {
    background: rgba(20,20,20,0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    transition: transform 0.2s;
}

.summary-stat:hover { transform: scale(1.02); }

.summary-stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 30px;
    color: var(--white);
    line-height: 1;
}

.summary-stat-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 4px;
}

.summary-stat.positive .summary-stat-value { color: var(--green); }
.summary-stat.negative .summary-stat-value { color: var(--red); }

/* ─── Strategy Timeline ───────────────────────────────────────────────── */
.strategy-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.strategy-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}

.strategy-bar {
    flex: 1;
    height: 30px;
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(20,20,20,0.5);
    border: 1px solid var(--border);
}

.stint-block {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    position: relative;
    transition: opacity 0.2s;
    min-width: 16px;
}

.stint-block:hover { opacity: 0.8; }

.stint-soft { background: var(--soft-color); color: #fff; }
.stint-medium { background: var(--medium-color); color: #000; }
.stint-hard { background: #ccc; color: #000; }
.stint-inter { background: var(--inter-color); color: #000; }
.stint-wet { background: var(--wet-color); color: #fff; }

/* Rain overlay on strategy bar */
.rain-marker {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(41,121,255,0.15);
    border-left: 2px solid rgba(41,121,255,0.4);
    pointer-events: none;
}

/* ─── Telemetry Table ─────────────────────────────────────────────────── */
.telemetry-container {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.telemetry-container::-webkit-scrollbar { width: 4px; }
.telemetry-container::-webkit-scrollbar-track { background: transparent; }
.telemetry-container::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.telem-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
}

.telem-table thead { position: sticky; top: 0; z-index: 1; }

.telem-table th {
    background: var(--card-solid);
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

.telem-table td {
    padding: 5px 8px;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255,255,255,0.02);
    transition: background 0.4s;
}

.telem-table tr:hover td { background: rgba(255,255,255,0.02); }

.telem-table .pit-row td { color: var(--yellow); background: var(--yellow-dim); }
.telem-table .sc-row td { color: var(--yellow); background: rgba(255,214,0,0.04); }
.telem-table .rain-row td { color: var(--blue); background: rgba(41,121,255,0.06); }

.compound-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* ─── Tyre Legend ─────────────────────────────────────────────────────── */
.tyre-legend { display: flex; gap: 16px; margin-top: 10px; }

.tyre-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: var(--text-dim);
}

.tyre-legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ─── Race History ────────────────────────────────────────────────────── */
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
}

.history-table th {
    color: var(--muted);
    font-size: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
}

.history-table td {
    padding: 6px 8px;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.history-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--muted);
    text-align: center;
}

.empty-state-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.3; }

.empty-state-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
}

/* ─── Progress Bar ────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(20,20,20,0.5);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--yellow));
    border-radius: 2px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(232,0,45,0.3);
}

/* ─── Toast ───────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-solid);
    border: 1px solid var(--border);
    border-left: 3px solid var(--green);
    padding: 12px 20px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--text);
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.toast.show { transform: translateX(0); }
.toast.error { border-left-color: var(--red); }

/* ─── Settings Panel (Slide-out) ────────────────────────────────────────── */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-overlay.show {
    display: block;
    opacity: 1;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 400px;
    height: 100vh;
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    z-index: 2001;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

.settings-panel.show {
    right: 0;
}

.settings-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-section-title {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.settings-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.range-field {
    width: 100%;
    margin-top: 8px;
    accent-color: var(--primary);
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-grid label {
    font-size: 10px;
    color: var(--muted);
}

.settings-grid .input-field {
    width: 100%;
    margin-top: 5px;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .dashboard { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .header { padding: 16px; flex-wrap: wrap; gap: 10px; }
    .panel { padding: 16px; }
    .metrics-row { grid-template-columns: repeat(2, 1fr); }
    .gauge-row { gap: 12px; }
    .gauge-item { width: 100px; height: 100px; }
}

/* ─── Race Loading Overlay ────────────────────────────────────────────── */
.race-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 5, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.race-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Ambient red glow behind animation */
.race-loading-overlay::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,0,45,0.1) 0%, transparent 70%);
    animation: raceGlow 3s ease-in-out infinite;
}

@keyframes raceGlow {
    0%, 100% { transform: scale(0.9); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* Track line */
.race-track {
    position: relative;
    width: 320px;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    margin-bottom: 40px;
    overflow: visible;
}

.race-track::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--red), transparent);
    animation: trackSweep 2s ease-in-out infinite;
}

@keyframes trackSweep {
    0% { opacity: 0; transform: translateX(-100%); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translateX(100%); }
}

/* Car silhouette */
.race-car {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    filter: drop-shadow(0 0 12px rgba(232,0,45,0.6));
    animation: carMove 2.5s ease-in-out infinite;
    z-index: 2;
}

@keyframes carMove {
    0% { left: -10%; opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { left: 105%; opacity: 0; }
}

/* Text elements */
.race-loading-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    letter-spacing: 6px;
    color: var(--white);
    margin-bottom: 8px;
    text-shadow: 0 0 30px rgba(232,0,45,0.3);
}

.race-loading-sub {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 32px;
}

/* Pulsing dots */
.race-dots {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.race-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.race-dots span:nth-child(2) { animation-delay: 0.2s; }
.race-dots span:nth-child(3) { animation-delay: 0.4s; }
.race-dots span:nth-child(4) { animation-delay: 0.6s; }
.race-dots span:nth-child(5) { animation-delay: 0.8s; }

@keyframes dotPulse {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* Lap counter during race */
.race-loading-lap {
    font-family: 'IBP Plex Mono', monospace;
    font-size: 12px;
    color: var(--muted);
    margin-top: 16px;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.race-loading-lap .lap-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: var(--white);
    margin: 0 2px;
}

/* ─── Track Visualization ─────────────────────────────────────────────── */
.track-viz-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    gap: 16px;
}

.track-canvas-container {
    flex: 1;
    position: relative;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    min-height: 380px;
}

.track-canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Subtle glow behind the track */
.track-canvas-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,0,45,0.04) 0%, transparent 70%);
    pointer-events: none;
}

.track-sidebar {
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

.track-info-card {
    background: rgba(20,20,20,0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
}

.track-info-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 8px;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.track-info-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: var(--white);
    letter-spacing: 1px;
}

.track-driver-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.track-driver-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: var(--text-dim);
}

.track-driver-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.track-driver-pos {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    color: var(--white);
    width: 24px;
    text-align: center;
}

.track-driver-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-driver-compound {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.track-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.track-controls .btn {
    font-size: 10px;
    padding: 6px 12px;
}

.track-lap-badge {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 3px;
    background: rgba(232,0,45,0.1);
    border: 1px solid rgba(232,0,45,0.3);
    color: var(--red);
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .track-viz-wrapper { flex-direction: column; }
    .track-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .track-canvas-container { min-height: 280px; }
}

