:root {
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent-red: #da3633;
    --accent-green: #238636;
    --border-color: #30363d;

    /* F1 Team Colors (Approx) */
    --color-mercedes: #00d2be;
    --color-ferrari: #dc0000;
    --color-redbull: #0600ef;
    --color-mclaren: #ff8700;
    --color-alpine: #0090ff;
    --color-aston: #006f62;
    --color-haas: #ffffff;
    --color-williams: #005aff;

    /* Day/Night Transition */
    --day-bg: #0d1117;
    --night-bg: #050505;
    --day-track: #333;
    --night-track: #1a1a1a;

    /* Current State (JS toggles these) */
    --current-bg: var(--day-bg);
    --current-track: var(--day-track);
}

body.night-mode {
    --current-bg: var(--night-bg);
    --current-track: var(--night-track);
}

/* Rain Effect */
/* Rain Effect */
#weather-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s;
    background: transparent;
    overflow: hidden;
}

body.rain-mode #weather-overlay {
    opacity: 1;
}

/* Rain Layers */
body.rain-mode #weather-overlay::before,
body.rain-mode #weather-overlay::after {
    content: "";
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.25) 100%) repeat-y;
    background-size: 1px 40px;
    animation: rain-fall 0.8s linear infinite;
    mix-blend-mode: overlay;
}

/* Second Layer (Parallax - Faster & Closer) */
body.rain-mode #weather-overlay::after {
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4) 100%) repeat-y;
    background-size: 2px 60px;
    animation: rain-fall 0.5s linear infinite;
    opacity: 0.6;
}

@keyframes rain-fall {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(50%);
    }
}

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

body {
    background-color: var(--current-bg);
    transition: background-color 2s ease;
    color: var(--text-primary);
    font-family: 'Rajdhani', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

header {
    height: 60px;
    background: var(--panel-bg);
    border-bottom: 2px solid var(--accent-red);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-style: italic;
    letter-spacing: 2px;
}

.race-view {
    flex: 1;
    display: flex;
    position: relative;
}

.track-container {
    flex: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1b2028 0%, #0d1117 100%);
    position: relative;
}

#circuit-svg {
    width: 90%;
    height: 90%;
    max-height: 800px;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
}

#track-surface {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.1));
}

.car-marker {
    transition: transform 0.1s linear;
    cursor: pointer;
}

.car-circle {
    stroke: #fff;
    stroke-width: 1px;
}

.car-label {
    fill: #fff;
    font-size: 8px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.sidebar {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    background: var(--panel-bg);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.leaderboard-panel {
    flex: 1;
    overflow-y: auto;
}

.leaderboard-panel h2 {
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    text-align: center;
}

.table-header {
    display: grid;
    grid-template-columns: 30px 1fr 50px 70px 70px 50px;
    padding: 0.5rem;
    font-weight: bold;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.driver-row {
    display: grid;
    grid-template-columns: 30px 1fr 50px 70px 70px 50px;
    padding: 0.8rem 0.5rem;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s, transform 0.3s ease;
}

.driver-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pos {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent-red);
}

.driver-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-indicator {
    width: 4px;
    height: 16px;
    display: inline-block;
    border-radius: 2px;
}

.speed-val {
    font-family: 'Orbitron', sans-serif;
    color: var(--color-mercedes);
}

.laps-val {
    font-weight: bold;
    text-align: right;
}

.controls {
    margin-top: auto;
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
}

button {
    flex: 1;
    padding: 1rem;
    background: var(--accent-red);
    color: white;
    border: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: filter 0.2s;
}

button:hover {
    filter: brightness(1.2);
}

#reset-btn {
    background: var(--border-color);
}