#lex-drift-screen {
    background: #05010a;
    /* Darker, near black purple */
    /* Unified vibrant background */
    color: #fff;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

#lex-drift-screen .screen-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.sunburst-text {
    background: linear-gradient(135deg, #FF8C00 0%, #FF1493 50%, #FFD700 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    text-shadow: none !important;
    font-weight: 900;
}

/* Selection Screen */
.drift-selection-container {
    padding: 0;
    /* Remove padding to reach edges */
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Disable horizontal swipe/scroll */
    text-align: center;
    background: transparent;
    /* Inherit from parent */
}

.selection-title {
    font-size: 1.6rem;
    margin: 10px 0 20px 0;
    /* Reduced top margin to move it up */
    font-weight: 900;
    background: linear-gradient(135deg, #FF8C00 0%, #FF1493 50%, #FFD700 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.drift-selection-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Minimal gap for seamless look */
    padding: 0;
    /* Full width */
    align-items: center;
    width: 100%;
}

.car-option {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
    /* Take full width for centering */
    max-width: none;
    /* Expand to full width */
    /* Larger size */
    display: flex;
    justify-content: center;
}

.car-option:hover {
    transform: scale(1.05);
}

.car-poster-wrapper {
    width: auto;
    height: auto;
    border-radius: 0;
    overflow: visible;
    margin-bottom: 0;
    background: transparent;
    border: none;
}

.car-preview-img {
    width: 100%;
    /* Use 100% for better container fitting */
    height: auto;
    object-fit: contain;
    display: block;
    border: none;
    /* Remove borders separating images */
    border-radius: 0;
    /* Square edges to fit screen */
    box-shadow:
        0 0 10px #fff,
        0 0 20px rgba(255, 255, 255, 0.4);
    /* Reduced spread to avoid overlap */
    /* Vibrant glow without borders */
    position: relative;
    z-index: 1;
    /* Slight roundness for the frame */
}

.car-name {
    display: none;
    /* User doesn't want names */
}

/* Race Track */
.drift-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    /* Cover the header too if needed */
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    /* White background to match car videos */
}

/* When racing, ensure container stays clean */
#lex-drift-screen.is-racing {
    background: #fff !important;
}

.track-half {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    /* Center car vertically */
    justify-content: center;
    padding-bottom: 0;
}

/* Race Progress Track (Replaced divider) */
.race-track-progress {
    height: 30px;
    background: #000;
    width: 100%;
    position: relative;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    display: flex;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 200;
}

/* Starter Lights */
.drift-starter-lights {
    position: absolute;
    bottom: calc(50% + 20px);
    /* Positioned above the track strip */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 300;
}

.drift-starter-lights .light {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #222;
    border: 3px solid #111;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.drift-starter-lights .light.red {
    background: #ff4444;
    box-shadow: 0 0 20px #ff4444, inset 0 0 15px rgba(0, 0, 0, 0.3);
}

.drift-starter-lights .light.green {
    background: #00E676;
    box-shadow: 0 0 20px #00E676, inset 0 0 15px rgba(0, 0, 0, 0.3);
}

/* Gear Indicator */
.gear-display {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 10px;
    border-radius: 5px;
    border: 1px solid #444;
}

/* Shift Ready Pulse */
@keyframes shift-pulse {
    0% {
        box-shadow: 0 0 10px rgba(0, 230, 118, 0.5);
        border-color: #00E676;
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 230, 118, 1);
        border-color: #fff;
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 10px rgba(0, 230, 118, 0.5);
        border-color: #00E676;
    }
}

.drift-btn.gas.shift-ready {
    animation: shift-pulse 0.8s infinite;
    border-color: #00E676 !important;
}

.progress-track-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
}

.progress-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: left 0.1s linear;
}

.progress-marker.opponent {
    background: #FF4444;
    box-shadow: 0 0 10px #FF4444;
    margin-top: -6px;
    /* Offset to be slightly above center */
}

.progress-marker.player {
    background: #00E676;
    box-shadow: 0 0 10px #00E676;
    margin-top: 6px;
    /* Offset to be slightly below center */
}

.finish-line-marker {
    position: absolute;
    right: 0;
    top: -10px;
    bottom: -10px;
    width: 4px;
    background: repeating-linear-gradient(0deg,
            #fff,
            #fff 5px,
            #000 5px,
            #000 10px);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Custom Result Overlays */
.drift-result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.result-content {
    text-align: center;
    animation: stickerPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-sticker {
    padding: 30px 60px;
    border-radius: 20px;
    margin-bottom: 30px;
    transform: rotate(-3deg);
}

.result-sticker.win {
    background: linear-gradient(135deg, #00E676, #00C853);
    box-shadow: 0 10px 30px rgba(0, 230, 118, 0.4);
}

.result-sticker.lose {
    background: linear-gradient(135deg, #FF4444, #CC0000);
    box-shadow: 0 10px 30px rgba(255, 68, 68, 0.4);
}

.sticker-text {
    font-size: 3rem;
    color: #fff;
    font-weight: 900;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.result-close-btn {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

@keyframes stickerPop {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(-3deg);
        opacity: 1;
    }
}

.car-video {
    width: 250px;
    height: auto;
    transition: transform 0.8s ease-in-out;
}

/* Game Overlays */
.drift-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    pointer-events: none;
}

.countdown-text {
    font-size: 8rem;
    font-weight: 900;
    color: #000;
}

.race-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #000;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px 15px;
    border-radius: 10px;
}

/* Game Controls */
.drift-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 30px;
    z-index: 1000;
    /* Ensure it stays above everything */
    pointer-events: none;
}

.drift-control-btn {
    width: 110px;
    height: 110px;
    background: transparent !important;
    border: none !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
    /* Clickable */
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

.drift-control-btn:active,
.drift-control-btn.pressed {
    transform: scale(0.8);
    filter: brightness(1.2);
}

/* Analog Speedometer Styling */
.drift-speedometer-analog {
    width: 160px;
    height: 100px;
    background: rgba(0, 0, 0, 0.85);
    /* Black theme */
    border-radius: 80px 80px 10px 10px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 230, 118, 0.1);
    margin-bottom: 20px;
    pointer-events: none;
}

.gauge-svg {
    width: 100%;
    height: 100%;
}

.speed-text-digital {
    fill: #00e676;
    font-size: 32px;
    font-weight: 900;
    font-family: 'Courier New', Courier, monospace;
}

.speed-unit-text {
    fill: #888;
    font-size: 10px;
    font-weight: bold;
}

#gauge-needle {
    transition: transform 0.1s linear;
    /* Smooth analog movement */
}

.control-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Acceleration Speed Lines - Lane Specific */
.speed-lines-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    /* Behind cars */
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

.speed-lines-container.active {
    opacity: 1;
}

.speed-line {
    position: absolute;
    background: #000;
    height: 1.2px;
    /* Super thin but visible */
    /* Ultra-thin as requested */
    border-radius: 1px;
    pointer-events: none;
    animation: speedMove var(--line-duration, 0.4s) linear;
    will-change: transform;
}

@keyframes speedMove {
    0% {
        transform: translateX(120vw);
    }

    100% {
        transform: translateX(-150vw);
    }
}

.drift-transition-video {
    position: fixed; /* Use fixed for guaranteed fullscreen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10000; /* Extremely high */
    background: #000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out;
}

.drift-transition-video.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.drift-transition-video.fade-out {
    opacity: 0;
}