/* ==========================================
   CONSTRUCTOR LIVERIES (THEMES)
   ========================================== */
/* Default: Red Bull Racing */
:root {
    --team-base: #06122d;
    --team-primary: #1b3dff;     /* Updated to RBR Racing Blue */
    --team-accent: #f2a900;
    --surface-dark: #0f1c3f;
    --surface-inset: #0a132e;
    --surface-input: #1a2956;
    --border-color: #2e3b66;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
}

/* Scuderia Ferrari */
body.theme-ferrari {
    --team-base: #1a0000;
    --team-primary: #ef1a2d;     /* Rosso Corsa Red */
    --team-accent: #fff200;      
    --surface-dark: #2d0000;
    --surface-inset: #1a0000;
    --surface-input: #3a0000;
    --border-color: #5a0000;
}

/* Aston Martin Racing */
body.theme-amr {
    --team-base: #001a15;
    --team-primary: #00665e;     /* AMR Emerald Green */
    --team-accent: #edff21;      
    --surface-dark: #002b23;
    --surface-inset: #001f19;
    --surface-input: #003b30;
    --border-color: #005244;
}

/* --- THE GLOBAL FIXES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    /* THE FIX: This permanently kills the "yellow shape" overflow bug on mobile screens */
    overflow-x: hidden; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--team-base);
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    padding-bottom: 40px;
    transition: background-color 0.3s ease; 
}

/* F1 Timing Vertical Side-Blocks */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    /* Creates dashed vertical blocks using the specific team's primary color */
    background-image: repeating-linear-gradient(to bottom, var(--team-primary) 0, var(--team-primary) 35px, transparent 35px, transparent 45px);
    z-index: 50;
    opacity: 0.8;
}

/* --- PIT WALL HEADER --- */
.pit-wall-header {
    position: relative;
    background: linear-gradient(135deg, var(--team-base) 0%, var(--surface-dark) 100%);
    padding: 35px 20px 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.pit-wall-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--team-primary) 50%, var(--team-accent) 50%);
}

.champion-badge {
    display: inline-block;
    background-color: var(--team-accent);
    color: var(--team-base);
    font-family: 'Racing Sans One', cursive;
    padding: 4px 16px;
    border-radius: 2px;
    font-size: 1rem;
    margin-bottom: 12px;
    transform: skewX(-15deg);
    box-shadow: 2px 2px 0px var(--team-primary);
}

.pit-wall-header h1 {
    font-family: 'Racing Sans One', cursive;
    font-size: 2.2rem;
    letter-spacing: 2px;
    margin-bottom: 5px;
    font-style: italic;
}

.pit-wall-header h1 span {
    color: var(--team-primary);
}

.pit-wall-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* --- MAIN PANEL --- */
main {
    max-width: 600px;
    margin: 30px auto;
    /* Added extra left padding so it clears the new vertical side-blocks perfectly */
    padding: 0 15px 0 20px; 
}

.form-panel {
    background-color: var(--surface-dark);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    overflow: hidden;
}

.panel-header {
    background-color: var(--team-primary);
    padding: 15px 20px;
    text-align: center;
}

.panel-header h2 {
    font-family: 'Racing Sans One', cursive;
    font-size: 1.3rem;
    letter-spacing: 1.5px;
    color: var(--text-main);
}

/* --- SECTORS & FORM GRID --- */
form {
    padding: 20px;
}

.telemetry-sector {
    background-color: var(--surface-inset);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px 15px 15px;
    margin-bottom: 20px;
}

.telemetry-sector legend {
    font-family: 'Racing Sans One', cursive;
    color: var(--team-accent);
    font-size: 1rem;
    letter-spacing: 1px;
    padding: 0 10px;
    text-transform: uppercase;
    transform: skewX(-10deg);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    font-size: 0.80rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 12px;
    background-color: var(--surface-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
}

.form-group input:focus, 
.form-group select:focus {
    outline: none;
    border-color: var(--team-accent);
    box-shadow: 0 0 0 2px rgba(242, 169, 0, 0.2);
}

/* --- SUBMIT BUTTON --- */
.submit-btn {
    width: 100%;
    background-color: var(--team-primary);
    color: var(--text-main);
    border: none;
    padding: 18px;
    font-family: 'Racing Sans One', cursive;
    font-size: 1.3rem;
    letter-spacing: 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}

.submit-btn:active {
    transform: scale(0.98);
}

/* --- MOBILE SPECIFIC FIXES --- */
@media (max-width: 480px) {
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
}

/* ==========================================
   THE PADDOCK & TRANSITION ANIMATIONS
   ========================================== */

.paddock-splash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #020617;
    z-index: 100;
    display: flex;
    justify-content: center;
    overflow-y: auto; 
    padding: 40px 0; 
}

.paddock-content {
    width: 100%; max-width: 500px; padding: 20px; margin: auto; 
}

.paddock-title {
    font-family: 'Racing Sans One', cursive;
    color: #ffffff;
    font-size: 2rem;
    letter-spacing: 3px;
    margin-bottom: 30px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.scanlines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none; 
    opacity: 0.6;
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(-30px); }
    100% { opacity: 1; transform: translateX(0); }
}

.garage-grid {
    display: flex; flex-direction: column; gap: 18px; 
}

.telemetry-card {
    position: relative;
    height: 130px;
    background: linear-gradient(135deg, rgba(15, 20, 40, 0.95), rgba(5, 10, 20, 0.98));
    clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
    display: flex; align-items: center; padding: 0 25px;
    cursor: pointer; overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0; transform: translateX(-30px);
    animation: slideInRight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transition: transform 0.15s ease-out;
}

.telemetry-card:active { transform: scale(0.97); }

.watermark {
    position: absolute; right: -10px; bottom: -25px;
    font-family: 'Racing Sans One', cursive; font-size: 7rem;
    color: rgba(255, 255, 255, 0.03); z-index: 1; pointer-events: none; line-height: 1;
}

.card-content {
    position: relative; z-index: 2; display: flex; flex-direction: column; width: 100%; text-align: left;
}

.chassis-code { font-family: monospace; color: #94a3b8; font-size: 0.75rem; margin-bottom: 6px; letter-spacing: 2px; }
.team-name { font-family: 'Racing Sans One', cursive; font-size: 1.6rem; letter-spacing: 3px; color: #ffffff; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.data-bars { display: flex; gap: 5px; margin-top: 12px; }
.bar { height: 4px; width: 12px; background-color: rgba(255, 255, 255, 0.15); border-radius: 2px; }

/* --- TEAM SPECIFIC HUD STYLING (UPDATED TO PRIMARY COLORS) --- */

/* Red Bull Racing (Blue) */
.rbr-card { border-left: 4px solid #1b3dff; }
.rbr-card .card-glow {
    position: absolute; left: 0; top: 0; width: 60px; height: 100%;
    background: linear-gradient(90deg, rgba(27, 61, 255, 0.2), transparent);
}
.rbr-card .active-bar { background-color: #1b3dff; width: 35px; box-shadow: 0 0 8px #1b3dff; }

/* Scuderia Ferrari (Red) */
.fer-card { border-left: 4px solid #ef1a2d; }
.fer-card .card-glow {
    position: absolute; left: 0; top: 0; width: 60px; height: 100%;
    background: linear-gradient(90deg, rgba(239, 26, 45, 0.15), transparent);
}
.fer-card .active-bar { background-color: #ef1a2d; width: 35px; box-shadow: 0 0 8px #ef1a2d; }

/* Aston Martin (Emerald) */
.amr-card { border-left: 4px solid #00665e; }
.amr-card .card-glow {
    position: absolute; left: 0; top: 0; width: 60px; height: 100%;
    background: linear-gradient(90deg, rgba(0, 102, 94, 0.15), transparent);
}
.amr-card .active-bar { background-color: #00665e; width: 35px; box-shadow: 0 0 8px #00665e; }

/* The High-Speed Car Blur Transition */
/* 3. The High-Speed Car Blur Transition */
.transition-streak {
    position: fixed; 
    top: 0; 
    /* Pushed WAY further back so the skew doesn't bleed onto the screen */
    left: -200vw; 
    width: 200vw; 
    height: 100%;
    z-index: 200; 
    transform: skewX(-20deg); 
    pointer-events: none; /* Ensures it never accidentally blocks a tap */
    transition: left 0.6s cubic-bezier(0.7, 0, 0.3, 1); 
}

/* ==========================================
   FULL-SCREEN SUCCESS MODAL
   ========================================== */
.telemetry-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(2, 6, 23, 0.85); backdrop-filter: blur(6px);
    z-index: 10000; display: flex; justify-content: center; align-items: center;
    cursor: pointer; animation: fadeInModal 0.3s ease forwards;
}

.modal-content {
    background: linear-gradient(135deg, #0f1c3f, #06122d);
    border: 2px solid #10b981; box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
    border-radius: 12px; padding: 40px 30px; text-align: center; width: 90%; max-width: 400px;
    animation: popInModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.modal-icon { font-size: 3.5rem; margin-bottom: 15px; }
.modal-content h2 { font-family: 'Racing Sans One', cursive; color: #10b981; font-size: 1.8rem; letter-spacing: 2px; margin-bottom: 10px; }
.modal-text { color: #ffffff; font-size: 1.1rem; font-weight: 600; margin-bottom: 25px; }
.modal-instruction { font-family: monospace; color: rgba(255, 255, 255, 0.4); font-size: 0.85rem; letter-spacing: 1px; animation: pulseText 1.5s infinite; }

@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }
@keyframes popInModal { from { opacity: 0; transform: scale(0.8) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulseText { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }