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

:root {
    --primary-glow: #ff4757;
    --secondary-glow: #5352ed;
    --background-dark: #0a0a10;
    --background-light: #1e1e2d;
    --text-color: #f0f0f0;
    --accent-color: #00f6ff;
}

body, html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    background-color: var(--background-dark);
    font-family: 'Orbitron', sans-serif;
    color: var(--text-color);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
    background-image: url('https://www.transparenttextures.com/patterns/stardust.png');
}

#game-canvas, #background-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#game-canvas {
    z-index: 10;
}

#background-canvas {
    z-index: 1;
}

#character-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 10, 16, 0.9), rgba(30, 30, 45, 0.95));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

#character-selection-modal {
    background-color: var(--background-light);
    padding: 2rem 3rem;
    border-radius: 16px;
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(0, 246, 255, 0.2);
}

#character-selection-modal h1 {
    font-size: 4rem;
    color: var(--accent-color);
    text-shadow: 0 0 15px var(--accent-color);
    margin-bottom: 0.5rem;
}

#character-selection-modal p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

#faction-filters {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: transparent;
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.filter-btn:hover {
    background-color: var(--accent-color);
    color: var(--background-dark);
    box-shadow: 0 0 15px var(--accent-color);
}

.filter-btn.active {
    background-color: var(--accent-color);
    color: var(--background-dark);
    box-shadow: 0 0 20px var(--accent-color);
}

#character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin-bottom: 2rem;
}

.character-card {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    overflow: hidden;
    border: 2px solid transparent;
    position: relative;
}

.character-card[data-faction="hero"] {
    border-color: rgba(0, 123, 255, 0.5);
}

.character-card[data-faction="villain"] {
    border-color: rgba(220, 53, 69, 0.5);
}

.character-card:hover {
    transform: translateY(-10px);
}

.character-card[data-faction="hero"]:hover {
    box-shadow: 0 0 25px rgba(0, 123, 255, 0.8);
    border-color: rgba(0, 123, 255, 1);
}

.character-card[data-faction="villain"]:hover {
    box-shadow: 0 0 25px rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 1);
}

.character-card.selected {
    transform: translateY(-10px) scale(1.05);
}

.character-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.character-info {
    padding: 1rem;
    text-align: center;
}

.character-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.character-faction {
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
}

.character-faction.hero {
    color: #00aaff;
}

.character-faction.villain {
    color: #ff4757;
}

@media (max-width: 768px) {
    #character-selection-modal {
        padding: 1.5rem;
        max-height: 95vh;
    }

    #character-selection-modal h1 {
        font-size: 3rem;
    }

    #faction-filters {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    #character-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }

    .character-card img {
        height: 120px;
    }

    .character-info {
        padding: 0.75rem;
    }

    .character-name {
        font-size: 1rem;
    }
}

#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 16, 0.85);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#game-over-overlay.visible {
    display: flex;
    opacity: 1;
}

#game-over-title {
    font-size: 6rem;
    font-weight: 700;
    color: var(--primary-glow);
    text-shadow: 0 0 20px var(--primary-glow);
    margin-bottom: 1rem;
}

#play-again-btn {
    padding: 1rem 2.5rem;
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-glow), #ff7987);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

#play-again-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-glow);
}

#score-display {
    position: absolute;
    top: 30px;
    left: 30px;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--accent-color);
    background-color: rgba(30, 30, 45, 0.7);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--accent-color);
}

#leaderboard {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 250px;
    background-color: rgba(30, 30, 45, 0.7);
    color: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--accent-color);
    backdrop-filter: blur(5px);
}

#leaderboard h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    text-shadow: 0 0 5px var(--accent-color);
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.25rem;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

#player-count-display {
    position: fixed;
    bottom: 180px;
    left: 20px;
    width: 150px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    text-shadow: 0 0 5px var(--accent-color);
}

#minimap-canvas {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 150px;
    height: 150px;
    background-color: rgba(10, 10, 16, 0.7);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

#boss-notification {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: #ff4757;
    font-size: 4rem;
    font-weight: 700;
    text-shadow: 0 0 20px #ff4757;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    z-index: 1000;
    pointer-events: none; /* So it doesn't block mouse events */
    text-align: center;
}

#boss-notification.visible {
    opacity: 1;
}

#how-to-play {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(0, 246, 255, 0.2);
    text-align: left;
}

#how-to-play h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--accent-color);
    text-align: center;
}

#how-to-play p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    font-family: 'Roboto', sans-serif;
}

#how-to-play strong {
    color: var(--primary-glow);
    font-weight: 700;
}
