@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Rajdhani', sans-serif;
    touch-action: none;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: #05050f;
}

/* ===== HUD ===== */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 12px 16px;
    pointer-events: none;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

#hud > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 3px;
    color: #4af0ff80;
    text-transform: uppercase;
}

.hud-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #4af0ff;
    text-shadow: 0 0 10px #4af0ff80, 0 0 30px #4af0ff40;
}

#comboDisplay .hud-value {
    color: #ff6a4a;
    text-shadow: 0 0 10px #ff6a4a80, 0 0 30px #ff6a4a40;
    transition: transform 0.15s ease;
}

#comboDisplay .hud-value.pulse {
    transform: scale(1.4);
}

/* ===== MOBILE CONTROLS ===== */
#mobileControls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 16px 24px 28px;
    z-index: 20;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.ctrl-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid #4af0ff60;
    background: rgba(74, 240, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4af0ff;
    cursor: pointer;
    transition: all 0.1s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ctrl-btn:active, .ctrl-btn.active {
    background: rgba(74, 240, 255, 0.25);
    border-color: #4af0ff;
    box-shadow: 0 0 20px #4af0ff60, inset 0 0 15px #4af0ff30;
    transform: scale(0.92);
}

.ctrl-btn svg {
    width: 28px;
    height: 28px;
}

.fire-btn {
    width: 85px;
    height: 85px;
    border-color: #ff6a4a60;
    background: rgba(255, 106, 74, 0.08);
    color: #ff6a4a;
}

.fire-btn:active, .fire-btn.active {
    background: rgba(255, 106, 74, 0.3);
    border-color: #ff6a4a;
    box-shadow: 0 0 25px #ff6a4a60, inset 0 0 20px #ff6a4a30;
}

.fire-btn svg {
    width: 36px;
    height: 36px;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: radial-gradient(ellipse at center, rgba(5,5,20,0.85) 0%, rgba(0,0,0,0.95) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    max-width: 500px;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(42px, 10vw, 72px);
    font-weight: 900;
    line-height: 1.1;
    color: #fff;
    text-shadow:
        0 0 20px #4af0ff,
        0 0 60px #4af0ff80,
        0 0 120px #4af0ff40;
    margin-bottom: 16px;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 20px #4af0ff, 0 0 60px #4af0ff80, 0 0 120px #4af0ff40; }
    to   { text-shadow: 0 0 30px #ff6a4a, 0 0 80px #ff6a4a80, 0 0 140px #ff6a4a40; }
}

.game-subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 300;
    color: #4af0ff99;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

.controls-info {
    margin-bottom: 36px;
    padding: 16px 20px;
    border: 1px solid #4af0ff20;
    border-radius: 8px;
    background: rgba(74,240,255,0.03);
}

.controls-info p {
    font-size: 14px;
    color: #4af0ff80;
    line-height: 1.8;
    letter-spacing: 1px;
}

.neon-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 16px 48px;
    border: 2px solid #4af0ff;
    border-radius: 4px;
    background: transparent;
    color: #4af0ff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.neon-btn:hover, .neon-btn:active {
    background: rgba(74, 240, 255, 0.15);
    box-shadow: 0 0 30px #4af0ff60, inset 0 0 30px #4af0ff20;
    transform: scale(1.04);
}

.neon-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(74,240,255,0.1) 50%, transparent 60%);
    animation: btnShine 3s infinite;
}

@keyframes btnShine {
    0%   { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.game-over-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(28px, 7vw, 48px);
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 20px #ff444480, 0 0 60px #ff444440;
    margin-bottom: 24px;
    animation: overPulse 1.5s ease-in-out infinite alternate;
}

@keyframes overPulse {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

.final-score, .final-wave, .high-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    color: #ffffffcc;
    margin-bottom: 8px;
}

.high-score {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd70080;
    margin-bottom: 32px;
    font-size: 20px;
}

/* ===== WAVE ANNOUNCEMENT ===== */
#waveAnnounce {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

#waveAnnounce span:first-child {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    letter-spacing: 12px;
    color: #4af0ff80;
}

#waveAnnounce span:last-child {
    font-family: 'Orbitron', sans-serif;
    font-size: 80px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 40px #4af0ff, 0 0 100px #4af0ff80;
}

#waveAnnounce.show {
    animation: waveIn 2s ease forwards;
}

@keyframes waveIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    40%  { transform: translate(-50%, -50%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #mobileControls {
        display: flex;
    }

    .hud-label {
        font-size: 7px;
        letter-spacing: 2px;
    }

    .hud-value {
        font-size: 16px;
    }
}

@media (max-height: 500px) {
    .ctrl-btn {
        width: 55px;
        height: 55px;
    }
    .fire-btn {
        width: 68px;
        height: 68px;
    }
    #mobileControls {
        padding: 8px 20px 14px;
    }
}

/* ===== SCREEN SHAKE ===== */
#gameContainer.shake {
    animation: shakeAnim 0.3s ease;
}

@keyframes shakeAnim {
    0%, 100% { transform: translate(0,0); }
    10%  { transform: translate(-4px, 2px); }
    20%  { transform: translate(4px, -2px); }
    30%  { transform: translate(-3px, 3px); }
    40%  { transform: translate(3px, -1px); }
    50%  { transform: translate(-2px, 2px); }
    60%  { transform: translate(2px, -2px); }
    70%  { transform: translate(-1px, 1px); }
}
