body {
    margin: 0;
    overflow: hidden;
    background-color: #222;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
    user-select: none;
}       

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

#roadCanvas {
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    background-color: #3a5c1e;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none;
}

/* BUTTONS */
#back-to-vehicles-btn {
    position: absolute;
    top: 20px;
    left: 60px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-family: inherit; /* Inherits Segoe UI */
    font-weight: bold;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

#back-to-vehicles-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
    transform: scale(1.05);
}
/* VEHICLE SELECT BTN */

.select-screen-menu-btn-right {
    position: fixed;
    top: 20px;
    right: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
}

.select-screen-menu-btn-right:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
    transform: scale(1.05);
}

.select-screen-menu-btn-left {
    position: fixed;
    top: 20px;
    left: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;

    /* 👇 glow effect */
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

.select-screen-menu-btn-left:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #fff;
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255,255,255,0.5);
}

.btn-back-mode {
    top: 20px;
}

.btn-back-vehicle {
    top: 70px;
}
        
#title-layer {
    position: absolute;
    top: 20px;
    right: 20px;
    pointer-events: none;
    text-align: right;
}

#center-hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    text-align: center;
}

.hud-text {
    font-size: 18px;
    text-shadow: 1px 1px 2px black;
    margin-bottom: 5px;
    font-weight: bold;
}

#crash-msg, #pause-msg, #stage-msg, #start-msg, #busted-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    text-align: center;
    text-shadow: 4px 4px 8px black; 
    font-weight: bold;
    display: none;
}

#crash-msg { color: #ff3333; font-size: 72px; animation: pulse 1s infinite; }
#busted-msg { color: #3333ff; font-size: 72px; animation: pulse 0.5s infinite; }
#pause-msg { color: #ffffff; font-size: 72px; }
#stage-msg { color: #ffffff; font-size: 72px; }
#start-msg { color: #ffffff; font-size: 72px; }

.class-card {
    width: 180px;
}

.class-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 10px; /* Even tighter */
    width: 145px; /* Even smaller */
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}

/* VEHICLE SELECT SCREEN */
#vehicle-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 1);
    z-index: 20;
    overflow-y: auto;
    padding: 20px; /* or 20px 20px 40px 20px */

}

.vehicle-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    max-width: 900px;
    margin: 20px auto;
    position: relative;
}

/* Add extra scrollable space at the bottom */
.vehicle-content::after {
    content: "";
    display: block;
    height: 150px; /* same as your previous spacer */
}

.vehicle-row {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    justify-content: center;
    max-width: 100%;
    margin-bottom: 15px;       /* adds space below the label */
}

.vehicle-row-label {
    font-size: 20px;
    font-weight: bold;
    color: #FFC107;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: 2px;
}

.vehicle-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.classes-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    align-items: center;
    width: 100%;
}

.class-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 12px;
    width: 170px;
    text-align: center;
    transition: transform 0.2s, background 0.2s;
}

.class-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-5px);
}


/* VEHICLE SELECT OBVIOUS SELECTED CARD */
.class-card.selected {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}
.class-card.selected:hover {
    transform: translateY(-8px); /* same as selected */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}
        .class-card.selected .class-name {
            text-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
        }
        .class-card:not(.selected):hover {
            transform: translateY(-15px) scale(1.05);
        }
        .class-card.selected {
            cursor: default;
        }
        .class-card.selected {
            transition: transform 0.15s ease-out;
        }

/* MODE SELECT ENHANCEMENTS */
#mode-select {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 1);
    z-index: 21;
    overflow-y: auto;
    padding: 40px 20px;
}

.mode-subtitle {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 35px;
    letter-spacing: 1px;
}

.mode-cards-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto;
}

.mode-card {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.mode-card:hover::before {
    opacity: 1;
}

.mode-card:hover {
    transform: translateY(-15px) scale(1.05);
    border-color: #fff;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6),
                0 0 50px rgba(255, 255, 255, 0.3);
}

.mode-card:active {
    transform: translateY(-10px) scale(0.98);
}

.mode-icon {
    font-size: 56px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.mode-card:hover .mode-icon {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.mode-card-title {
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

.mode-card-description {
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
    margin-bottom: 20px;
    min-height: 50px;
}

.mode-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-feature {
    font-size: 14px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-card-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.mode-card:hover .mode-card-button {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
    transform: scale(1.05);
}

.back-button {
    margin-top: 30px;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(-5px);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .mode-cards-container {
        flex-direction: column;
        gap: 30px;
    }
    
    .mode-card {
        min-width: 280px;
    }
    
    .mode-icon {
        font-size: 56px;
    }
    
    .mode-card-title {
        font-size: 24px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .mode-cards-container {
        flex-direction: column;
        gap: 30px;
    }
    
    .mode-card {
        min-width: 280px;
    }
    
    .mode-icon {
        font-size: 56px;
    }
    
    .mode-card-title {
        font-size: 24px;
    }
}

/* STAGE SELECT SCREEN */
#stage-select {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 21;
    overflow-y: auto;
    padding: 40px 20px;
}

.select-title {
    font-size: 44px;
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 16px;
    color: #fff;
    position: relative;

    text-shadow:
        2px 2px 0 #ff3333,
        6px 6px 18px rgba(255, 0, 0, 0.8);
}

.select-title {
    font-family: 'Orbitron', sans-serif;
}

.select-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, #ff3333, transparent);
}

.select-title::after {
    animation: underlineSweep 3s ease-in-out infinite;
}
        

@keyframes underlineSweep {
    0% {
        width: 0%;
        opacity: 0;
    }
    10% {
        width: 20%;
        opacity: 1;
    }
    75% {
        width: 105%;
        opacity: 1;      /* solid for most of the animation */
    }
    100% {
        width: 105%;
        opacity: 0;      /* fade out at the very end */
    }
}

.tagline { 
    font-size: 18px; 
    font-style: italic; 
    color: #efeded; /* softer gray tone */ 
    margin-bottom: 20px; 
}

        .campaign-subtitle {
            font-size: 20px;
            color: #aaa;
            margin-bottom: 40px;
        }

        /* SECTION CONTAINERS */
        .section-container {
            width: 90%;
            max-width: 1200px;
            margin-bottom: 50px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 20px;
            padding: 30px;
            border: 2px solid rgba(255, 255, 255, 0.1);
        }

        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid rgba(255, 255, 255, 0.2);
        }

        .section-name {
            font-size: 32px;
            font-weight: bold;
            color: #FFC107;
            text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
        }

        .section-score {
            font-size: 16px;
            color: #4CAF50;
            text-align: right;
        }

        .section-score-label {
            font-size: 12px;
            color: #888;
            margin-bottom: 5px;
        }

        /* STAGE MAP STYLES */
        .stages-grid {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .stage-row {
            display: flex;
            align-items: center;
            gap: 15px;
            padding: 15px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
            transition: all 0.3s ease;
        }

        .stage-row:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        /* CAMPAIGN NODES */
        .stage-node {
            min-width: 60px;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
            border: 4px solid #444;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            font-weight: bold;
            color: #666;
            position: relative;
            transition: all 0.3s ease;
            flex-shrink: 0;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
        }

        .stage-node.unlocked {
            background: linear-gradient(145deg, #FFC107, #FF9800);
            border-color: #FFD54F;
            color: #000;
            cursor: pointer;
            box-shadow: 0 0 20px rgba(255, 193, 7, 0.4), inset 0 2px 4px rgba(255,255,255,0.3);
        }

        .stage-node.unlocked:hover {
            transform: scale(1.15);
            background: linear-gradient(145deg, #FFD54F, #FFC107);
            box-shadow: 0 0 30px rgba(255, 193, 7, 0.8), inset 0 2px 4px rgba(255,255,255,0.5);
            border-color: #fff;
        }

        .stage-node.completed {
            background: linear-gradient(145deg, #4CAF50, #388E3C);
            border-color: #66BB6A;
            color: #fff;
            cursor: pointer;
            box-shadow: 0 0 15px rgba(76, 175, 80, 0.3), inset 0 2px 4px rgba(255,255,255,0.2);
        }

        .stage-node.completed:hover {
            background: linear-gradient(145deg, #66BB6A, #4CAF50);
            box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), inset 0 2px 4px rgba(255,255,255,0.4);
            transform: scale(1.15);
            border-color: #81C784;
        }

        .stage-node.completed::after {
            content: '✓';
            position: absolute;
            bottom: -5px;
            right: -5px;
            background: linear-gradient(145deg, #fff, #e0e0e0);
            color: #4CAF50;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            border: 2px solid #4CAF50;
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        .stage-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .stage-route {
            font-size: 18px;
            font-weight: bold;
            color: #fff;
        }

        .stage-details {
            font-size: 14px;
            color: #aaa;
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .stage-stat {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .stage-best-time {
            font-size: 16px;
            color: #4CAF50;
            font-weight: bold;
            text-align: right;
            min-width: 100px;
        }

        .stage-best-time.no-score {
            color: #666;
            font-style: italic;
        }

        /* OVERALL STATS PANEL */
        .overall-stats {
            width: 90%;
            max-width: 1200px;
            /* Changed margins to fit the top position better */
            margin-top: 0px; 
            margin-bottom: 40px;
            
            padding: 20px;
            background: rgba(33, 150, 243, 0.1);
            border: 2px solid rgba(33, 150, 243, 0.3);
            
            border-radius: 50px;  /* This will create the dumbbell/pill shape */
            flex-shrink: 0; /* Prevents it from getting squashed on small screens */
        }

        .overall-stats-title {
            font-size: 28px;
            font-weight: bold;
            color: #2196F3;
            margin-bottom: 15px;
            text-align: center;
        }

        .overall-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 5px;
        }

        .overall-stat-item {
            text-align: center;
            padding: 5px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 40px;
            max-width: 180px;  /* Add this line - adjust the number as you like */
        }

        .overall-stat-label {
            font-size: 14px;
            color: #aaa;
            margin-bottom: 5px;
        }

        .overall-stat-value {
            font-size: 20px;
            font-weight: bold;
            color: #2196F3;
        }

        /* RESPONSIVE */
        @media (max-width: 768px) {
            .section-container {
                width: 95%;
                padding: 20px;
            }

            .section-name {
                font-size: 24px;
            }

            .stage-route {
                font-size: 16px;
            }

            .stage-details {
                font-size: 12px;
            }

            .stage-node {
                min-width: 50px;
                width: 50px;
                height: 50px;
                font-size: 20px;
            }
        }



        .class-card {
            background: rgba(255, 255, 255, 0.1);
            border: 2px solid rgba(255, 255, 255, 0.2);
            border-radius: 16px;
            padding: 15px;
            width: 200px;
            text-align: center;
            transition: transform 0.2s, background 0.2s;
        }

        .class-card:hover {
            background: rgba(255, 255, 255, 0.15);
            border-color: rgba(255, 255, 255, 0.5);
            transform: translateY(-5px);
        }

        .class-name {
            font-size: 22px;
            font-weight: bold;
            margin-bottom: 5px;
            color: #fff;
        }

        .vehicle-preview {
            margin-bottom: 15px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 10px;
        }

        .class-stats {
            margin-bottom: 20px;
            text-align: left;
        }

        .stat-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 14px;
            color: #ccc;
        }

        .stat-value {
            font-weight: bold;
            font-size: 16px;
        }

        .color-options {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 15px;
        }

        .color-btn {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid rgba(255,255,255,0.3);
            transition: transform 0.2s;
        }

        .color-btn:hover {
            transform: scale(1.2);
            border-color: white;
            box-shadow: 0 0 10px rgba(255,255,255,0.5);
        }

        .stage-sub {
            font-size: 24px;
            color: white;
            margin-top: 10px;
        }

        .controls-hint {
            position: absolute;
            bottom: 20px;
            width: 100%;
            text-align: center;
            color: rgba(255, 255, 255, 0.7);
            font-size: 14px;
            pointer-events: none;
        }

        .vehicle-group {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
        }

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