:root {
    --primary: #00f0ff;
    --primary-glow: rgba(0, 240, 255, 0.4);
    --secondary: #ff003c;
    --dark: #0a0a0c;
    --dark-panel: rgba(20, 20, 25, 0.8);
    --text-main: #e0e0e0;
    --text-muted: #888899;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(10, 10, 12, 0.9), transparent);
    z-index: 10;
    pointer-events: none;
    opacity: 0.5;
}

.hud-header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--primary-glow);
    margin-bottom: 5px;
}

.hud-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-stats {
    display: flex;
    gap: 30px;
}

.stat-box {
    background: var(--dark-panel);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.stat-box .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-box .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-box .value.hp {
    color: var(--secondary);
    text-shadow: 0 0 8px rgba(255, 0, 60, 0.5);
}

.bomb-progress-container {
    width: 60px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary);
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.bomb-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
}

.bomb-progress-bar.ready {
    background: #00ff64;
    box-shadow: 0 0 15px rgba(0, 255, 100, 0.8);
}

.bomb-progress-bar.cooldown {
    background: var(--secondary);
    box-shadow: none;
}

.map-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    background: radial-gradient(circle at center, #111115 0%, #050508 100%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

#phaser-game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    display: none;
}

/* Tactical scanline effect */
.scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 240, 255, 0.05) 50%,
            rgba(0, 240, 255, 0.05));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
}

#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
    /* Below HUD, above map */
    background: radial-gradient(circle, transparent 40%, rgba(255, 0, 60, 0.4) 100%);
    box-shadow: inset 0 0 50px rgba(255, 0, 60, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

@keyframes pulse-damage {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 0.3;
    }
}

#damage-overlay.active {
    animation: pulse-damage 1s infinite alternate;
}


#tooltip {
    position: absolute;
    top: -100px;
    left: -100px;
    background: var(--dark-panel);
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s;
    backdrop-filter: blur(5px);
}

#ranking-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--dark-panel);
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    padding: 30px 40px;
    border-radius: 8px;
    z-index: 10000;
    text-align: center;
    backdrop-filter: blur(10px);
}

#name-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--dark-panel);
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px var(--primary-glow);
    padding: 20px 30px;
    /* Reduced padding slightly to save vertical space */
    border-radius: 8px;
    z-index: 10001;
    text-align: center;
    backdrop-filter: blur(10px);
    display: none;
    max-height: 90vh;
    /* Prevent overflow off screen */
    overflow-y: auto;
    /* Add scroll if content is too tall */
    width: 90%;
    max-width: 500px;
    /* Added max-width to ensure it's not too wide on mobiles while scrolling */
}

/* Custom scrollbar for overlay */
#name-overlay::-webkit-scrollbar {
    width: 8px;
}

#name-overlay::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#name-overlay::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

#name-overlay h2 {
    color: var(--primary);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

#name-overlay p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

#name-overlay input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 12px 20px;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    border-radius: 4px;
    width: 100%;
    margin-bottom: 25px;
    outline: none;
}

#name-overlay input:focus {
    box-shadow: 0 0 10px var(--primary-glow);
}

#name-overlay button {
    background: var(--primary);
    color: var(--dark);
    border: none;
    padding: 12px 30px;
    font-family: 'Outfit', sans-serif;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
}

#name-overlay button:hover {
    background: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}

#ranking-overlay h2 {
    color: var(--primary);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

#ranking-list {
    margin-bottom: 20px;
    text-align: left;
}

.ranking-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    gap: 30px;
}

.ranking-item:first-child {
    color: var(--primary);
    font-weight: bold;
}

#ranking-overlay button {
    background: var(--primary);
    color: var(--dark);
    border: none;
    padding: 10px 20px;
    font-family: 'Outfit', sans-serif;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

#ranking-overlay button:hover {
    background: #fff;
    box-shadow: 0 0 15px var(--primary-glow);
}