/* styles.css para Helicopter Strike 3D */

body, html {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Evitar scroll en 3D */
    background-color: #000;
    font-family: 'Outfit', sans-serif;
}

:root {
    --heli-bottom-ad-height: 98px;
    --heli-bottom-ad-gap: 12px;
}

#gameUI {
    position: relative;
    width: 100%;
    height: 100%;
}

#canvasContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - var(--heli-bottom-ad-height)); /* Reservar espacio estable para el anuncio */
    z-index: 1;
}

.game-bottom-ad {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: var(--heli-bottom-ad-height);
    max-height: var(--heli-bottom-ad-height);
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.62) 40%, rgba(0, 0, 0, 0.78) 100%);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-sizing: border-box;
}

.game-ad-slot {
    display: block;
    width: min(100%, 728px);
    max-width: 728px;
    height: 90px;
    margin: 0 auto;
    pointer-events: auto;
    overflow: hidden;
    border-radius: 12px;
}

/* HUD Header */
.hidden {
    display: none !important;
}

.hud-header {
    position: absolute;
    top: 90px; /* Incrementado para pantallas con header alto */
    left: 0;
    width: 100%;
    padding: 15px 20px;
    z-index: 10; /* Arriba del canvas */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none; /* Dejar pasar clics al canvas si es necesario */
}

.hud-header > * {
    pointer-events: auto; /* Restaurar clic en botones */
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    font-weight: bold;
    transition: 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hud-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 0.7rem;
    color: #ffd700;
    font-weight: 800;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.health-bar-container {
    width: 150px;
    height: 12px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    margin-top: 5px;
    overflow: hidden;
}

.health-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff4e50, #f9d423);
    transition: width 0.3s;
}

/* Level Up Banner */
#levelUpBanner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    pointer-events: none;
    text-align: center;
    /* animation applied via JS only, to allow reliable restarts */
}

#levelUpText {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    color: #ffd700;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow:
        0 0 30px rgba(255, 215, 0, 0.9),
        0 0 60px rgba(255, 180, 0, 0.6),
        2px 2px 8px rgba(0,0,0,0.9);
    white-space: nowrap;
    /* animate the text element so we avoid transform conflicts with parent positioning */
    opacity: 0;
}

@keyframes levelUpAnim {
    0%   { opacity: 0; transform: scale(0.4); }
    18%  { opacity: 1; transform: scale(1.1); }
    30%  { transform: scale(1.0); }
    70%  { opacity: 1; transform: scale(1.0); }
    100% { opacity: 0; transform: scale(1.0); }
}

/* Botón Start UI */
#startBtn {
    position: absolute;
    top: 50vh;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    padding: 15px 30px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, hsl(231, 76%, 66%) 0%, hsl(280, 56%, 46%) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

#startBtn:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Mobile Controls */
.mobile-controls {
    position: absolute;
    bottom: calc(var(--heli-bottom-ad-height) + var(--heli-bottom-ad-gap));
    left: 0;
    width: 100%;
    height: 150px;
    z-index: 10;
    display: none; /* Oculto por defecto en PC */
    pointer-events: none;
    justify-content: space-between;
    padding: 0 20px;
}

/* Mostrar controles en móviles */
@media (max-width: 768px) {
    :root {
        --heli-bottom-ad-height: 70px;
        --heli-bottom-ad-gap: 8px;
    }

    .mobile-controls {
        display: flex;
    }

    .game-ad-slot {
        width: min(100%, 320px);
        max-width: 320px;
        height: 50px;
        border-radius: 10px;
    }
}

@media (max-height: 700px), (max-width: 480px) {
    :root {
        --heli-bottom-ad-height: 0px;
        --heli-bottom-ad-gap: 0px;
    }

    .game-bottom-ad {
        display: none;
    }
}

.joystick-zone {
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    position: relative;
    pointer-events: auto;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-end;
    gap: 10px;
    width: 150px;
    pointer-events: auto;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    font-size: 1.5rem;
    color: white;
    backdrop-filter: blur(5px);
    cursor: pointer;
}

.red-btn { background: rgba(255, 50, 50, 0.5); width: 100%; height: 70px; border-radius: 20px;}
.blue-btn { background: rgba(50, 150, 255, 0.5); flex: 1; }

.action-btn:active {
    background: rgba(255,255,255,0.8);
    transform: scale(0.9);
}

/* Game Over Modal Enhancements */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Much darker overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30,15,15,0.95), rgba(10,5,5,0.95)); /* Dark red tint */
    padding: 40px 30px;
    border-radius: 20px;
    border: 2px solid rgba(255, 50, 50, 0.4); /* Red border warning */
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.3); /* Red glow */
    color: white;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: #ff4e50;
    text-transform: uppercase;
    font-size: 2.2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 2px;
}

.stats-grid {
    background: rgba(0,0,0,0.5);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin: 5px 0;
}

.highlight {
    color: #ffd700;
    font-weight: 900;
    font-size: 1.4rem;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-btn.primary {
    background: linear-gradient(135deg, #ff4e50 0%, #f9d423 100%);
    border: none;
    color: white;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 78, 80, 0.4);
    transition: transform 0.2s;
}

.game-btn.secondary {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 12px;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-btn:hover {
    transform: scale(1.05);
}

.game-btn.secondary:hover {
    background: rgba(255,255,255,0.2);
}
