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

body {
    overflow: hidden;
    background: #0a0a1a;
    font-family: 'Exo 2', sans-serif;
    touch-action: none;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#scene-container canvas {
    display: block;
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud * {
    pointer-events: auto;
}

.hud-world {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, rgba(88, 28, 180, 0.85), rgba(30, 60, 180, 0.85));
    padding: 6px 14px;
    border-radius: 12px;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    border: 1px solid rgba(150, 120, 255, 0.5);
    backdrop-filter: blur(8px);
    text-shadow: 0 0 8px rgba(150, 120, 255, 0.8);
}

.hud-level {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8), 0 0 12px rgba(255,255,255,0.3);
}

.hud-stats {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-stat {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    background: rgba(0,0,0,0.5);
    padding: 4px 10px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}

.hud-stat-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.hud-stat-val {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.hud-weapon {
    position: absolute;
    right: 12px;
    top: 110px;
    background: rgba(0,0,0,0.6);
    border: 2px solid #888;
    border-radius: 12px;
    padding: 8px;
    width: 64px;
    text-align: center;
    backdrop-filter: blur(4px);
}

.hud-weapon-label {
    color: #aaa;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-weapon-icon {
    font-size: 24px;
    margin: 4px 0;
}

.hud-weapon-level {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 900;
}

.hud-progress {
    position: absolute;
    left: 12px;
    top: 60px;
    width: 24px;
    height: 200px;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}

.hud-progress-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(0deg, #00ff88, #00cc66);
    border-radius: 12px;
    transition: height 0.3s;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.hud-swipe {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 300;
    animation: pulse-swipe 2s ease-in-out infinite;
    transition: opacity 0.5s;
}

@keyframes pulse-swipe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

.gate-popup {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 0 20px currentColor, 0 2px 4px rgba(0,0,0,0.8);
    animation: popup-anim 1.2s ease-out forwards;
    white-space: nowrap;
    pointer-events: none;
}

@keyframes popup-anim {
    0% { transform: translateX(-50%) scale(0.5) translateY(0); opacity: 0; }
    20% { transform: translateX(-50%) scale(1.3) translateY(-10px); opacity: 1; }
    40% { transform: translateX(-50%) scale(1) translateY(-20px); opacity: 1; }
    100% { transform: translateX(-50%) scale(0.8) translateY(-60px); opacity: 0; }
}

/* Title Screen */
.title-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(10,10,30,0.95) 0%, rgba(30,15,60,0.95) 100%);
    z-index: 100;
    pointer-events: auto;
}

.title-logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b35, #ffd700, #ff6b35);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.5));
    margin-bottom: 4px;
}

.title-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
    letter-spacing: 8px;
    margin-bottom: 40px;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.title-world-select {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 20px;
}

.world-btn {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.world-btn.active {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: scale(1.1);
}

.world-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.world-btn-num {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
}

.world-btn-lock {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 14px;
}

.tap-start {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 14px 40px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    animation: pulse-btn 1.5s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.5);
    letter-spacing: 2px;
    margin-bottom: 30px;
}

@keyframes pulse-btn {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.title-stats {
    display: flex;
    gap: 20px;
    color: rgba(255,255,255,0.4);
    font-size: 11px;
}

.title-stats span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.title-stats .val {
    color: rgba(255,255,255,0.8);
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
}

.title-footer {
    position: absolute;
    bottom: 16px;
    color: rgba(255,255,255,0.25);
    font-size: 11px;
}

.title-footer a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
}

/* Death Screen */
.death-screen, .win-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
}

.death-screen {
    background: radial-gradient(circle, rgba(120,10,10,0.95), rgba(20,5,5,0.98));
}

.win-screen {
    background: radial-gradient(circle, rgba(10,60,120,0.95), rgba(5,10,30,0.98));
}

.death-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    font-weight: 900;
    color: #ff3333;
    text-shadow: 0 0 30px rgba(255,50,50,0.6);
    margin-bottom: 20px;
}

.win-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.6);
    margin-bottom: 20px;
}

.screen-info {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
    padding: 0 30px;
}

.retry-btn, .continue-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 14px 36px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    letter-spacing: 2px;
    color: #fff;
}

.retry-btn {
    background: linear-gradient(135deg, #cc3333, #ff5555);
    box-shadow: 0 4px 20px rgba(204,51,51,0.5);
}

.continue-btn {
    background: linear-gradient(135deg, #2266cc, #44aaff);
    box-shadow: 0 4px 20px rgba(34,102,204,0.5);
}

/* Damage numbers */
.dmg-number {
    position: fixed;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    color: #ffdd00;
    text-shadow: 0 0 6px rgba(255,221,0,0.8), 0 2px 2px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 50;
    animation: dmg-float 0.8s ease-out forwards;
}

@keyframes dmg-float {
    0% { transform: translateY(0) scale(1.2); opacity: 1; }
    100% { transform: translateY(-40px) scale(0.7); opacity: 0; }
}

/* Screen effects */
.screen-flash {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 90;
    animation: flash-anim 0.3s ease-out forwards;
}

@keyframes flash-anim {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

.screen-shake {
    animation: shake-anim 0.3s ease-out;
}

@keyframes shake-anim {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-5px, 3px); }
    40% { transform: translate(5px, -3px); }
    60% { transform: translate(-3px, 5px); }
    80% { transform: translate(3px, -5px); }
}