:root {
    --primary: #00f3ff;
    --secondary: #ff007b;
    --bg-dark: #0a0a16;
    --border-glow: rgba(0, 243, 255, 0.3);
}
* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; touch-action: none; }
body { background-color: var(--bg-dark); color: #fff; display: flex; justify-content: center; align-items: center; min-height: 100vh; overflow: hidden; }

#game-wrapper {
    position: relative; width: 100vw; height: 100vh; max-width: 450px; max-height: 800px; 
    background: #000; overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.8);
}

@media (min-width: 450px) and (min-height: 800px) {
    #game-wrapper { border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.1); }
}

#canvas-container { width: 100%; height: 100%; position: absolute; top:0; left:0; }
canvas { display: block; width: 100%; height: 100%; }

.ui-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 20, 0.88); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 20px; z-index: 20; transition: opacity 0.3s ease, transform 0.3s ease;
}
.hidden { opacity: 0; pointer-events: none; transform: scale(1.05); }

h1 {
    font-size: 2.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 2px;
    text-align: center; margin-bottom: 5px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0, 243, 255, 0.5));
}
.subtitle { font-size: 0.9rem; color: #8fa0dd; margin-bottom: 30px; letter-spacing: 4px; text-transform: uppercase; }

.btn {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(255, 0, 123, 0.2));
    border: 2px solid var(--primary); color: #fff; padding: 14px 40px;
    font-size: 1.1rem; font-weight: 800; border-radius: 30px; cursor: pointer;
    transition: all 0.2s ease; box-shadow: 0 0 15px var(--border-glow); letter-spacing: 1px;
    margin: 8px 0; width: 85%; max-width: 300px; text-align: center; text-transform: uppercase;
}
.btn:hover { background: linear-gradient(135deg, var(--primary), var(--secondary)); box-shadow: 0 0 25px rgba(0, 243, 255, 0.6); transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }

.btn-share {
    background: linear-gradient(135deg, rgba(0, 255, 68, 0.2), rgba(0, 136, 255, 0.2));
    border: 2px solid #00ff44; box-shadow: 0 0 15px rgba(0,255,68,0.2);
}
.btn-share:hover { background: linear-gradient(135deg, #00ff44, #0088ff); box-shadow: 0 0 25px rgba(0,255,68,0.6); }

.shop-container { width: 100%; max-width: 380px; background: rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 15px; margin-bottom: 25px; border: 1px solid rgba(255,255,255,0.1); }
.currency-display { font-size: 1.2rem; color: #ffd700; font-weight: bold; margin-bottom: 15px; text-align: center; text-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
.shop-item { display: flex; justify-content: space-between; align-items: center; background: rgba(0, 0, 0, 0.6); padding: 12px; border-radius: 8px; margin-bottom: 10px; border-left: 4px solid var(--primary); }
.shop-item.purchased { border-left-color: #4caf50; }
.item-info { text-align: left; padding-right: 10px; }
.item-name { font-weight: 800; font-size: 0.9rem; color: #fff; text-transform: uppercase; }
.item-desc { font-size: 0.7rem; color: #aaa; margin-top: 3px; line-height: 1.3; }
.btn-sm { background: #1a1a3a; border: 1px solid var(--primary); color: #fff; padding: 8px 12px; font-size: 0.85rem; font-weight: bold; border-radius: 6px; cursor: pointer; min-width: 75px; text-align: center; }
.btn-sm:hover:not(:disabled) { background: var(--primary); color: #000; box-shadow: 0 0 10px var(--primary); }
.btn-sm:disabled { background: #222; border-color: #444; color: #666; cursor: not-allowed; box-shadow: none; }

#hud { position: absolute; top: 0; left: 0; width: 100%; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 5; pointer-events: none; }
.hud-metric { font-weight: 900; font-size: 1rem; text-shadow: 0 2px 4px rgba(0,0,0,1); }
.score-val { color: var(--primary); } .coin-val { color: #ffd700; }
.lives-val { color: #ff0055; font-size: 1.2rem; }
.level-val { font-size: 1.2rem; color: #fff; text-shadow: 0 0 10px var(--primary); }

#pause-btn {
    pointer-events: auto; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px; padding: 4px 10px; font-size: 0.9rem; color: #fff;
    cursor: pointer; backdrop-filter: blur(4px); transition: all 0.2s;
}
#pause-btn:active { transform: scale(0.9); }

#weapon-display {
    position: absolute; top: 45px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 380px; display: flex; gap: 8px; z-index: 5; pointer-events: none;
    align-items: flex-start;
}
.weapon-card {
    background: linear-gradient(180deg, rgba(20,20,30,0.8) 0%, rgba(5,5,10,0.9) 100%);
    border: 1px solid rgba(255,255,255,0.15); border-top: 2px solid #555;
    border-radius: 8px; padding: 6px 10px; box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}
#card-primary { flex: 1; min-width: 120px; }
#secondary-weapons-container { flex: 1.5; display: flex; flex-direction: column; gap: 4px; }

.active-primary { border-top-color: var(--primary); box-shadow: 0 0 15px rgba(0,243,255,0.2); }
.active-secondary { border-top-color: #00ff44; box-shadow: 0 0 10px rgba(0,255,68,0.2); }

.w-title { font-size: 0.6rem; color: #8fa0dd; font-weight: 800; letter-spacing: 1px; margin-bottom: 2px; }
.w-name { font-size: 0.9rem; font-weight: 900; color: #fff; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-bar-bg { width: 100%; height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.w-bar-fill { width: 100%; height: 100%; background: #00ff44; box-shadow: 0 0 5px #00ff44; }

#boss-warning {
    position: absolute; top: 35%; width: 100%; text-align: center;
    color: #ff0055; font-size: 1.8rem; font-weight: 900; letter-spacing: 2px;
    text-shadow: 0 0 20px #ff0055, 0 0 10px #ff0055; z-index: 8;
    animation: flashWarning 0.5s infinite; pointer-events: none; display: none;
}
@keyframes flashWarning { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.2; transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }

#boss-ui {
    position: absolute; top: 110px; left: 10%; width: 80%; z-index: 6;
    display: none; pointer-events: none; flex-direction: column; align-items: center;
}
#boss-name { font-size: 0.9rem; font-weight: 900; color: #fff; text-shadow: 0 0 8px #ff0055; margin-bottom: 6px; letter-spacing: 2px; text-transform: uppercase; }
.boss-hp-bg { width: 100%; height: 14px; background: rgba(0, 0, 0, 0.5); border: 2px solid #ff0055; border-radius: 8px; overflow: hidden; box-shadow: 0 0 15px rgba(255,0,85,0.6); }
#boss-hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff0055, #ffaa00); transition: width 0.1s linear; }

#level-clear {
    position: absolute; top: 40%; width: 100%; text-align: center;
    color: var(--primary); font-size: 2.2rem; font-weight: 900; letter-spacing: 3px;
    text-shadow: 0 0 20px var(--primary); z-index: 8; pointer-events: none;
    opacity: 0; transition: opacity 0.5s, transform 0.5s; transform: translateY(20px);
}
#level-clear.show { opacity: 1; transform: translateY(0); }

#skill-bar { position: absolute; bottom: 25px; right: 20px; display: flex; flex-direction: column; gap: 15px; z-index: 5; }
.skill-slot {
    width: 55px; height: 55px; border-radius: 50%; background: rgba(10, 10, 26, 0.9);
    border: 2px solid #555; display: flex; justify-content: center; align-items: center;
    font-size: 0.7rem; font-weight: 900; color: #aaa; cursor: pointer; position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6); pointer-events: auto; transition: all 0.2s; text-transform: uppercase;
}
.skill-slot.unlocked { border-color: var(--primary); color: #fff; box-shadow: 0 0 15px rgba(0, 243, 255, 0.5); background: rgba(0, 40, 60, 0.8); }
.skill-slot:active { transform: scale(0.85); }
.skill-badge {
    position: absolute; top: -5px; right: -5px; background: #ff0055; color: #fff;
    border-radius: 50%; width: 24px; height: 24px; font-size: 0.8rem; font-weight: bold;
    display: flex; justify-content: center; align-items: center; border: 2px solid #111;
    box-shadow: 0 0 8px rgba(255,0,85,0.8); display: none;
}

#skill-drop-btn {
    border-color: #ff0055; color: #ff0055; background: rgba(40, 0, 10, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4); display: none;
}
#skill-drop-btn.active { display: flex; animation: pulseRed 2s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 10px rgba(255,0,85,0.4); } 50% { box-shadow: 0 0 25px rgba(255,0,85,0.8); } 100% { box-shadow: 0 0 10px rgba(255,0,85,0.4); } }

.reload-notice { font-size: 0.85rem; color: #8fa0dd; margin-top: 10px; font-weight: bold; letter-spacing: 1px; }

.leaderboard {
    width: 100%; max-width: 320px; background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    padding: 10px; margin: 15px 0; font-size: 0.85rem;
}
.leaderboard-title { color: #ffd700; font-weight: bold; text-align: center; margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.leaderboard-row { display: flex; justify-content: space-between; padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.leaderboard-row.player-row { background: rgba(0, 243, 255, 0.15); font-weight: bold; color: var(--primary); border-radius: 4px; }

#toast-notice {
    position: absolute; top: 15px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 255, 68, 0.9); color: #000; padding: 8px 20px;
    border-radius: 20px; font-weight: bold; font-size: 0.9rem; z-index: 99;
    box-shadow: 0 0 15px #00ff44; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}