:root {
    --primary: #00f2ff;
    --secondary: #ff0055;
    --accent: #00ffa2;
    --bg-dark: #02020a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Orbitron', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.home-link {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    left: calc(14px + env(safe-area-inset-left));
    z-index: 120;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 1px;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    pointer-events: all;
}
.home-link:hover {
    border-color: rgba(0, 242, 255, 0.45);
}

.site-footer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 120;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.35);
    color: rgba(255,255,255,0.78);
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    pointer-events: all;
}
.site-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}
.site-footer a:hover {
    text-decoration: underline;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a3a 0%, #02020a 100%);
}

#parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    opacity: 0.4;
    z-index: 0;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#ui-overlay {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.menu-screen {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    pointer-events: all;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

.menu-screen.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.9);
}

.logo {
    font-family: var(--font-heading);
    font-size: 3rem;
    letter-spacing: 5px;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px var(--primary);
}

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

.input-group {
    margin-bottom: 2rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    color: white;
    border-radius: 10px;
    font-size: 1.2rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.car-selection {
    margin-bottom: 1.5rem;
}

.car-selection h3 {
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    color: #666;
}

#car-carousel {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.car-option {
    flex: 1;
    cursor: pointer;
    padding: 1rem;
    border-radius: 15px;
    border: 2px solid transparent;
    transition: all 0.3s;
    background: rgba(0,0,0,0.2);
}

.car-option img {
    height: 80px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
}

.car-option span {
    display: block;
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.car-option.selected {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.1);
    transform: translateY(-5px);
}

.controls-info {
    margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.3);
    padding: 1rem;
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--primary);
    text-align: center;
    border: 1px solid var(--glass-border);
}

.controls-info p {
    margin: 0.3rem 0;
    letter-spacing: 1px;
}

.primary-btn {
    width: 100%;
    padding: 1.2rem;
    background: linear-gradient(45deg, var(--primary), #0077ff);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: var(--font-heading);
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 242, 255, 0.4);
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 242, 255, 0.6);
}

#hud {
    position: absolute;
    top: 2rem;
    left: 2rem;
    right: 2rem;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.hud-item {
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--primary);
}

.hud-item span {
    color: white;
    margin-left: 5px;
}

#controls-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 1px;
    z-index: 5;
}

.hidden {
    display: none !important;
}

/* NOS Indicator Styles */
#nos-container {
    position: fixed;
    top: 7rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

#nos-icon {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 5px var(--primary));
}

.nos-bar-bg {
    width: 150px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.2);
}

#nos-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00f2ff, #0077ff);
    box-shadow: 0 0 10px #00f2ff;
    transition: width 0.1s linear;
}

#nos-container.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

#nos-container.cooldown #nos-bar-fill {
    background: linear-gradient(90deg, #555, #222);
    box-shadow: none;
}

/* Mobile Controls Styling */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    display: none;
    z-index: 100;
    pointer-events: none;
    flex-direction: row;
    justify-content: space-between;
}

#left-ctrl-area {
    width: 45%;
    height: 100%;
    pointer-events: all;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 5rem;
    background: linear-gradient(to right, rgba(0, 242, 255, 0.05), transparent);
}

.steering-hint {
    color: var(--primary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 3px;
    opacity: 0.5;
    pointer-events: none;
    text-shadow: 0 0 10px var(--primary);
}

#right-ctrl-area {
    width: 45%;
    height: 100%;
    pointer-events: all;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 0 2rem 2rem 0;
    background: linear-gradient(to left, rgba(255, 0, 85, 0.05), transparent);
}

.touch-btn {
    width: 120px;
    height: 120px;
    background: var(--glass);
    border: 2px solid var(--glass-border);
    backdrop-filter: blur(15px);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    font-family: var(--font-heading);
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#ctrl-nos {
    border-color: var(--primary);
    color: var(--primary);
}

#ctrl-nos:active {
    background: var(--primary);
    color: black !important;
    transform: scale(1.15);
    box-shadow: 0 0 40px var(--primary);
}

/* Leaderboard Styles */
.trophy-emoji {
    font-size: 5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px #ffd700);
    animation: floating 3s ease-in-out infinite;
}

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

#leaderboard {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rank-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 1rem;
    border: 1px solid transparent;
}

.rank-item.first {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
}

.rank-item.second {
    border-color: #c0c0c0;
    background: rgba(192, 192, 192, 0.1);
    color: #c0c0c0;
}

.rank-item.third {
    border-color: #cd7f32;
    background: rgba(205, 127, 50, 0.1);
    color: #cd7f32;
}

.rank-item .name { flex: 1; text-align: left; margin-left: 1rem; }
.rank-item .time { color: white; opacity: 0.8; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    #mobile-controls:not(.hidden) { display: flex !important; }
    #controls-hint { display: none; }
    .hud-item { font-size: 0.7rem; padding: 0.5rem 1rem; }
    #nos-container { top: 5rem; right: 1rem; scale: 0.8; }
    
    /* Mobile Performance Boost: Disable heavy blur effects */
    .menu-screen, .touch-btn, .hud-item, #nos-container {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(0, 0, 0, 0.8) !important; /* Solid background instead of blur */
    }
    
    #parallax-bg {
        animation: none !important; /* Stop background pulse to save CPU */
    }
}

@media (max-width: 600px) {
    .menu-screen { padding: 1.5rem; width: 95%; }
    .logo { font-size: 1.8rem; margin-top: 0.5rem; }
    #car-carousel { flex-direction: row; gap: 0.5rem; }
    .car-option { padding: 0.5rem; }
    .car-option img { height: 50px; }
    .primary-btn { padding: 1rem; font-size: 1rem; }
}
