/* Racer Game Styles */
.racer-container {
    position: relative;
    /* Spans full width on desktop if it's the last child in a 2-col grid */
    grid-column: span 2;
    background: linear-gradient(to bottom, #050505, #000);
    border: 1px solid rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.racer-container .game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 1.5rem;
    background: linear-gradient(to right, transparent, rgba(0, 255, 136, 0.05), transparent);
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
    margin-bottom: 0;
}

.racer-container .game-header h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.8), 0 0 30px rgba(0, 255, 136, 0.4);
    margin: 0;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.racer-container .game-header h3 i {
    color: #00ff88;
    filter: drop-shadow(0 0 5px #00ff88);
}

.racer-container .game-controls {
    position: absolute;
    right: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: #00d4ff;
    text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 4px;
}

.relative-game {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#racer-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
}

/* Updated Message Style */
.game-message {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ff88;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 20;
    text-align: center;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.game-message.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

.game-message .msg-title {
    display: block;
    font-weight: bold;
    color: #00ff88;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(10, 10, 10, 0.95);
    padding: 3rem;
    border-radius: 16px;
    border: 2px solid #00ff88;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.2);
    width: 90%;
    max-width: 450px;
    z-index: 10;
}

.game-overlay h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    color: #ff0055;
    text-shadow: 0 0 15px rgba(255, 0, 85, 0.6);
    margin-bottom: 0.5rem;
}

.game-overlay p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: #ccc;
}

#racer-final-score {
    color: #00ff88;
    font-weight: bold;
    font-size: 1.4rem;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .racer-container {
        grid-column: span 1;
    }
}

@media (max-width: 600px) {
    .racer-container .game-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .racer-container .game-controls {
        position: static;
        width: 100%;
        text-align: center;
    }

    .racer-container .game-header h3 {
        font-size: 1.5rem;
    }
}