/* ============================================
   MAX VERSTAPPEN - MINIMALIST LANDING PAGE
   Inspired by Lando Norris's Clean Design
   ============================================ */

/* ===== CSS VARIABLES - DESIGN TOKEN SYSTEM ===== */
:root {
    /* Red Bull Racing Brand Colors */
    --redbull-navy: #001e3c;
    --redbull-red: #ff1e1e;
    --redbull-blue: #0090ff;
    --redbull-yellow: #ffc700;

    /* Semantic Colors */
    --color-primary: var(--redbull-red);
    --color-primary-hover: #e01a1a;
    --color-secondary: var(--redbull-blue);
    --color-accent: var(--redbull-yellow);

    /* Neutral Palette */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #0a0a0a;

    /* Surface Colors */
    --surface-primary: #ffffff;
    --surface-secondary: #fafafa;
    --surface-elevated: #ffffff;
    --surface-canvas: #0a0e14;

    /* Border Colors */
    --border-light: #e5e7eb;
    --border-mid: #d1d5db;
    --border-dark: #9ca3af;

    /* Text Colors */
    --text-primary: #0a0a0a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-on-dark: #ffffff;

    /* Spacing Scale (8px base) */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-7: 1.75rem;  /* 28px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
    --space-20: 5rem;    /* 80px */

    /* Shadow System */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 80px;
    --container-max-width: 1400px;
    --dashboard-gap: var(--space-5);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--white);
    color: var(--black);
    overflow-x: hidden;
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
}

.loading-content {
    text-align: center;
}

.driver-name-container {
    margin-bottom: 20px;
}

.driver-name {
    font-size: 72px;
    font-weight: 900;
    letter-spacing: 4px;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.name-red {
    background: linear-gradient(90deg, var(--redbull-red) 0%, var(--redbull-red) 100%);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    background-position: left center;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fillWidth 1.5s linear forwards;
}

.name-blue {
    background: linear-gradient(90deg, var(--redbull-blue) 0%, var(--redbull-blue) 100%);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    background-position: left center;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fillWidth 1.5s linear 1.5s forwards;
}

.loading-message {
    font-size: 14px;
    color: var(--black);
    opacity: 0.7;
    font-weight: 600;
}

.loading-bar {
    display: none;
}

.loading-progress {
    display: none;
}

.redbull-logo {
    display: none;
}

@keyframes fillWidth {
    from { background-size: 0% 100%; }
    to { background-size: 100% 100%; }
}

/* ===== HEADER ===== */
.main-header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    z-index: 9000 !important;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
    transition: all 0.3s ease;
    pointer-events: none;
}

.main-header > * {
    pointer-events: auto;
}

.main-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.logo h1 {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 1px;
    color: var(--white);
    opacity: 0.5;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.store-btn {
    padding: 12px 30px;
    background: var(--redbull-red);
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-radius: 0;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.store-btn:hover {
    background: var(--black);
    transform: translateY(-2px);
}

.menu-btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.menu-btn span {
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.menu-btn:hover span {
    background: var(--white);
}

/* ===== NAVIGATION MENU OVERLAY ===== */
.menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 30, 60, 0.98) 0%, rgba(10, 14, 20, 0.98) 100%);
    backdrop-filter: blur(20px);
    z-index: 9999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
}

.menu-overlay.active {
    right: 0;
}

.menu-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-8);
}

.menu-close {
    position: absolute;
    top: var(--space-6);
    right: var(--space-6);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 32px;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: 100px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-6);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: var(--white);
    text-decoration: none;
    font-size: 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.menu-item:hover {
    background: rgba(255, 30, 30, 0.2);
    border-color: var(--redbull-red);
    transform: translateX(-10px);
}

.menu-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.menu-item:hover .menu-icon {
    background: var(--redbull-red);
    transform: scale(1.1);
}

.menu-text {
    flex: 1;
}

/* Menu backdrop */
.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.menu-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* ===== DECORATIVE BACKGROUND CURVES ===== */
.bg-curves {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
}

.bg-curves svg {
    width: 100%;
    height: 100%;
}

/* ===== HERO SECTION - MINIMALIST ===== */
.hero-minimal {
    position: relative;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 1;
}

.hero-portrait {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.portrait-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: grayscale(0%);
    transition: all 1s ease;
}

.hero-portrait:hover .portrait-image {
    transform: scale(1.05);
}

.hero-number {
    position: absolute;
    top: 50%;
    right: 10%;
    transform: translateY(-50%);
    font-size: 300px;
    font-weight: 900;
    color: rgba(0, 30, 60, 0.03);
    z-index: 2;
    pointer-events: none;
    line-height: 1;
}

/* ===== NEXT RACE WIDGET ===== */
.next-race-widget {
    position: fixed !important;
    bottom: 40px;
    left: 40px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    padding: 25px 15px;
    width: 120px;
    z-index: 9000 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.next-race-widget:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.4);
}

.widget-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--gray-mid);
    margin-bottom: 15px;
}

.widget-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    color: var(--black);
}

.widget-icon svg {
    width: 40px;
    height: 28px;
}

.widget-race {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    color: var(--black);
}

.widget-team {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-light);
}

.widget-team svg {
    width: 30px;
    height: 22px;
}

.widget-team span {
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--gray-mid);
    line-height: 1.3;
}

/* ===== DATA SECTION ===== */
.data-section {
    position: relative;
    background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
    padding: 60px 0;
    min-height: 100vh;
    z-index: 10;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ===== DATA HEADER ===== */
.data-header {
    text-align: center;
    margin-bottom: 40px;
}

.data-header h1 {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #0a0a0a;
    margin-bottom: 8px;
}

.data-header p {
    font-size: 15px;
    color: #6b7280;
    font-weight: 400;
}

/* ===== UNIFIED DASHBOARD - OPTIMIZED LAYOUT ===== */
.dashboard {
    display: grid;
    gap: var(--dashboard-gap);
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
}

/* Tablet and Desktop Layout - Full Width Track */
@media (min-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "track"
            "stats";
        gap: var(--space-5);
    }

    .dashboard-controls {
        grid-area: controls;
    }

    .dashboard-quali {
        display: none; /* Hide qualification card */
    }

    .dashboard-track {
        grid-area: track;
    }

    .dashboard-stats {
        grid-area: stats;
    }
}

/* Large Desktop - Optimize for wider screens */
@media (min-width: 1200px) {
    .dashboard {
        gap: var(--space-6);
    }
}

@media (min-width: 1440px) {
    .dashboard {
        gap: var(--space-8);
    }
}

/* ===== DASHBOARD CONTROLS - COMPACT HORIZONTAL TOOLBAR ===== */
.dashboard-controls {
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
}

/* Mobile: Stack everything vertically */
@media (max-width: 639px) {
    .dashboard-controls {
        grid-template-columns: 1fr;
    }
}

/* Tablet and up: Horizontal row of 3 dropdowns, then buttons below */
@media (min-width: 640px) {
    .dashboard-controls {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto auto;
        padding: var(--space-4);
    }

    .control-group:nth-child(1) { grid-column: 1; grid-row: 1; }
    .control-group:nth-child(2) { grid-column: 2; grid-row: 1; }
    .control-group:nth-child(3) { grid-column: 3; grid-row: 1; }
    .control-buttons { grid-column: 1 / -1; grid-row: 2; }
}

/* Toolbar layout: dropdowns + buttons in single row */
@media (min-width: 900px) {
    .dashboard-controls {
        grid-template-columns: repeat(3, minmax(140px, 1fr)) auto;
        grid-template-rows: auto;
        padding: var(--space-4);
        align-items: end;
    }

    .control-group:nth-child(1) { grid-column: 1; grid-row: 1; }
    .control-group:nth-child(2) { grid-column: 2; grid-row: 1; }
    .control-group:nth-child(3) { grid-column: 3; grid-row: 1; }
    .control-buttons {
        grid-column: 4;
        grid-row: 1;
        margin-top: 0;
        margin-left: var(--space-4);
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: stretch;
}

.control-group label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    text-transform: none;
    margin-bottom: var(--space-1);
}

.control-group select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    background: var(--surface-primary);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.control-group select:hover {
    border-color: var(--border-dark);
}

.control-group select:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 30, 30, 0.1);
}

.control-buttons {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-2);
}

.btn-primary,
.btn-secondary {
    padding: var(--space-3) var(--space-7);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--text-on-dark);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-50);
    color: var(--text-secondary);
    border-color: var(--border-light);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-100);
    border-color: var(--border-mid);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== DASHBOARD QUALIFICATION - ENHANCED CARDS ===== */
.dashboard-quali {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-5);
}

.quali-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.quali-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-mid);
}

.quali-card.verstappen {
    border-left: 3px solid var(--color-primary);
}

.quali-card.verstappen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.driver-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

.quali-time {
    font-size: 40px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--space-3);
    font-feature-settings: 'tnum';
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.quali-position {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    font-weight: 500;
}

.sector-times {
    display: flex;
    gap: var(--space-3);
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    font-feature-settings: 'tnum';
}

.time-diff {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.time-diff.faster {
    color: #10b981;
}

.time-diff.slower {
    color: #ef4444;
}

/* ===== DASHBOARD TRACK - ENHANCED VISUALIZATION ===== */
.dashboard-track {
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.track-header {
    text-align: center;
    margin-bottom: var(--space-5);
}

.track-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.2px;
}

.track-header p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

#track-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--surface-canvas);
}

@media (min-width: 1024px) {
    #track-canvas {
        min-height: 400px;
    }
}

@media (min-width: 1440px) {
    #track-canvas {
        min-height: 500px;
    }
}

/* ===== DASHBOARD STATISTICS - ENHANCED CARDS ===== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-5);
}

@media (min-width: 768px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-stats {
        grid-template-columns: repeat(5, 1fr);
    }
}

.stat-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-5);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-mid);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.stat-card:hover::before {
    transform: scaleX(1);
}

.stat-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-size: 30px;
    font-weight: 700;
    color: var(--color-primary);
    font-feature-settings: 'tnum';
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 40px 20px;
    background: transparent;
    border-top: 1px solid #e5e7eb;
    margin-top: 60px;
}

footer p {
    font-size: 13px;
    color: #9ca3af;
    font-weight: 400;
}

/* ===== RESPONSIVE DESIGN - MOBILE-FIRST ENHANCED ===== */

/* Tablet Landscape (1024px and below) */
@media (max-width: 1024px) {
    :root {
        --dashboard-gap: var(--space-4);
    }

    .hero-portrait {
        width: 100%;
        height: 100%;
    }

    .hero-number {
        font-size: 200px;
    }

    .next-race-widget {
        bottom: var(--space-8);
        left: var(--space-8);
        width: 110px;
        padding: var(--space-5) var(--space-3);
    }

    .dashboard {
        gap: var(--space-5);
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --dashboard-gap: var(--space-4);
    }

    .main-header {
        padding: 0 var(--space-5);
    }

    .logo h1 {
        font-size: 20px;
    }

    .store-btn {
        padding: var(--space-3) var(--space-5);
        font-size: 12px;
    }

    .menu-btn {
        width: 45px;
        height: 45px;
    }

    .hero-portrait {
        width: 100%;
        height: 100%;
    }

    .hero-number {
        font-size: 120px;
        right: 5%;
    }

    .next-race-widget {
        bottom: var(--space-5);
        left: var(--space-5);
        width: 100px;
        padding: var(--space-5) var(--space-3);
    }

    .widget-race {
        font-size: 12px;
    }

    .container {
        padding: 0 var(--space-5);
    }

    .data-header h1 {
        font-size: 32px;
    }

    .dashboard {
        gap: var(--space-4);
    }

    .dashboard-controls {
        grid-template-columns: 1fr;
        padding: var(--space-5);
    }

    .control-buttons {
        flex-direction: column;
        gap: var(--space-3);
    }

    .dashboard-quali {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-4);
    }

    .dashboard-track {
        padding: var(--space-5);
    }

    #track-canvas {
        width: 100%;
    }

    .quali-card,
    .stat-card {
        padding: var(--space-5);
    }
}

/* Small Mobile (480px and below) - Touch Optimized */
@media (max-width: 480px) {
    :root {
        --dashboard-gap: var(--space-3);
    }

    .hero-number {
        font-size: 80px;
    }

    .data-header h1 {
        font-size: 24px;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .dashboard {
        gap: var(--space-3);
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .dashboard-controls {
        padding: var(--space-4);
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: var(--space-4);
        font-size: 15px;
        min-height: 48px; /* Touch-friendly size */
    }

    .quali-card {
        padding: var(--space-4);
    }

    .quali-time {
        font-size: 32px;
    }

    .stat-card {
        padding: var(--space-4) var(--space-3);
    }

    .stat-value {
        font-size: 24px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-minimal,
.next-race-widget {
    animation: fadeIn 0.8s ease;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.5;
    pointer-events: none;
}
