body {
    background: radial-gradient(circle at top, #0a0a0a, #000);
    color: #fff;
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

#gameArea {
    position: relative;
    width: 320px;
    height: 550px;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0,255,255,0.2);
}

#hud {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    font-size: 12px;
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
    z-index: 5;
}

.hud-item {
    white-space: nowrap;
}

/* Barra de energía */
#energyBar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 14px;
    border-radius: 10px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    padding: 2px 6px;
    box-sizing: border-box;
    gap: 8px;
    z-index: 5;
}

#energyBarInner {
    flex: 1;
    height: 8px;
    border-radius: 6px;
    background: linear-gradient(90deg, #00e676, #ffea00);
    transition: width 0.15s linear;
}

#energyText {
    font-size: 10px;
}

/* Capa de partículas */
#particlesLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

/* Carro */
#car {
    position: absolute;
    bottom: 20px;
    left: 140px;
    width: 45px;
    height: 80px;
    border-radius: 10px;
    transition: left 0.15s ease-out, transform 0.2s ease-out, opacity 0.3s ease-out;
}

.skin-blue {
    background: linear-gradient(135deg, #00ffea, #0077ff);
    box-shadow: 0 0 20px #00eaff;
}

.skin-green {
    background: linear-gradient(135deg, #00ff8c, #00c853);
    box-shadow: 0 0 20px #00ff8c;
}

.skin-red {
    background: linear-gradient(135deg, #ff1744, #ff9100);
    box-shadow: 0 0 20px #ff1744;
}

/* Obstáculos */
.obstacle {
    position: absolute;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #ff004c, #ff7b00);
    border-radius: 10px;
    box-shadow: 0 0 20px #ff004c;
}

/* Power-ups */
.powerup {
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.powerup-shield {
    background: linear-gradient(135deg, #00e5ff, #2979ff);
}

.powerup-turbo {
    background: linear-gradient(135deg, #ffea00, #ffab00);
}

.powerup-slow {
    background: linear-gradient(135deg, #b388ff, #7c4dff);
}

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(0,0,0,0.9), #000);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.start-content {
    text-align: center;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 20px 30px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(12px);
}

.title-anim {
    font-size: 24px;
    margin-bottom: 16px;
    animation: floatTitle 3s infinite ease-in-out;
}

@keyframes floatTitle {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

.skin-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    margin-bottom: 10px;
}

button {
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, #00e5ff, #2979ff);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0,229,255,0.6);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(0,229,255,0.9);
}

.hint {
    font-size: 12px;
    margin-top: 6px;
    opacity: 0.8;
}

/* Misiones */
#missionsPanel {
    margin: 10px 0;
    font-size: 12px;
}

/* Efecto daño */
.hit-effect {
    animation: hitFlash 0.4s ease-out;
}

@keyframes hitFlash {
    0% { box-shadow: 0 0 0 rgba(255,0,0,0.8); }
    50% { box-shadow: 0 0 40px rgba(255,0,0,1); }
    100% { box-shadow: 0 0 0 rgba(255,0,0,0); }
}

/* Respawn */
.respawn {
    animation: respawnAnim 1s ease-out;
}

@keyframes respawnAnim {
    0% { opacity: 0; transform: scale(0.6); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* Invencible */
.invincible {
    animation: invincibleBlink 0.3s linear infinite;
}

@keyframes invincibleBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Controles táctiles inferiores */
#bottomControls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 20;
}

.ctrl-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, #222, #000);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 12px rgba(0,229,255,0.4);
    user-select: none;
}

.ctrl-btn:active {
    transform: scale(0.92);
    box-shadow: 0 0 20px rgba(0,229,255,0.9);
}

.ctrl-btn.jump {
    background: linear-gradient(135deg, #ffea00, #ffab00);
    color: #000;
}

.ctrl-btn.brake {
    background: linear-gradient(135deg, #ff5252, #d50000);
    color: #fff;
}

/* Modo zurdo: controles a la izquierda */
.left-handed #bottomControls {
    left: 20px;
    transform: none;
}

/* Partículas */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.9;
    animation: particleFade 0.6s ease-out forwards;
}

@keyframes particleFade {
    0% { transform: translate(0,0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0.4); opacity: 0; }
}

/* HUD compacto móvil */
@media (max-width: 600px) {
    #hud {
        font-size: 10px;
        gap: 4px;
        padding: 2px 6px;
    }

    #gameArea {
        width: 90vw;
        height: 70vh;
    }

    #bottomControls {
        bottom: 10px;
        gap: 10px;
    }

    .ctrl-btn {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }

    #energyText {
        display: none;
    }
}

/* HUD ultra compacto para pantallas muy pequeñas */
@media (max-width: 420px) {
    #hud {
        font-size: 8px;
        gap: 2px;
        padding: 1px 4px;
    }
}