/* =================================================================
   KLYRA CHARACTER SELECT - AAA PREMIUM DESIGN
   Complete creative overhaul for maximum awesomeness
   ================================================================= */

/* Characters Button - TOP LEFT - DOMINANT STYLE */
#charactersBtn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, rgba(252, 15, 192, 0.98), rgba(107, 79, 255, 0.98));
    border: 4px solid #FFD700;
    padding: 18px 36px;
    border-radius: 12px;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #FFFFFF;
    cursor: pointer;
    z-index: 10000;
    box-shadow:
        0 0 40px rgba(252, 15, 192, 0.8),
        0 0 80px rgba(107, 79, 255, 0.5),
        6px 6px 0px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    image-rendering: pixelated;
    display: block;
    opacity: 1;
    pointer-events: all;
    text-shadow: 3px 3px 0px #000;
    letter-spacing: 2px;
    animation: characterBtnPulse 2.5s ease-in-out infinite;
}

@keyframes characterBtnPulse {
    0%, 100% {
        box-shadow:
            0 0 40px rgba(252, 15, 192, 0.8),
            0 0 80px rgba(107, 79, 255, 0.5),
            6px 6px 0px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow:
            0 0 60px rgba(252, 15, 192, 1),
            0 0 120px rgba(107, 79, 255, 0.7),
            6px 6px 0px rgba(0, 0, 0, 0.5);
    }
}

/* Hide buttons when game is active or lobby is hidden */
body.game-active #charactersBtn,
body.game-active #settingsBtn,
#lobbyScreen.hidden ~ #charactersBtn,
#lobbyScreen.hidden ~ #settingsBtn {
    display: none !important;
}

#charactersBtn:hover {
    background: linear-gradient(135deg, rgba(252, 15, 192, 1), rgba(107, 79, 255, 1));
    transform: translateY(-5px) scale(1.05);
    box-shadow:
        0 0 60px rgba(252, 15, 192, 1),
        0 0 120px rgba(107, 79, 255, 0.8),
        8px 8px 0px rgba(0, 0, 0, 0.6);
    animation: none;
}

#charactersBtn:active {
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 0 40px rgba(252, 15, 192, 0.8),
        0 0 80px rgba(107, 79, 255, 0.5),
        4px 4px 0px rgba(0, 0, 0, 0.5);
}

/* Settings Button - Simple Cog Icon */
#settingsBtn {
    position: fixed;
    top: 20px;
    right: 280px;
    background: linear-gradient(135deg, rgba(107, 79, 255, 0.95), rgba(252, 15, 192, 0.95));
    border: 3px solid #FFD700;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    font-size: 24px;
    color: #FFFFFF;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(107, 79, 255, 0.5), 4px 4px 0px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    pointer-events: all;
}

#settingsBtn:hover {
    background: linear-gradient(135deg, rgba(107, 79, 255, 1), rgba(252, 15, 192, 1));
    transform: translateY(-2px) rotate(90deg);
    box-shadow: 0 0 30px rgba(252, 15, 192, 0.8), 6px 6px 0px rgba(0, 0, 0, 0.4);
}

#settingsBtn:active {
    transform: translateY(0px) rotate(90deg);
    box-shadow: 0 0 15px rgba(107, 79, 255, 0.4), 2px 2px 0px rgba(0, 0, 0, 0.3);
}

/* Character Select Modal Overlay */
#characterSelectModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(30, 15, 50, 0.95) 0%, rgba(0, 0, 0, 0.98) 100%);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: fadeIn 0.4s ease;
}

#characterSelectModal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Settings Modal */
#settingsModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

#settingsModal.active {
    display: flex;
}

/* Fullscreen button active state */
#fullscreenToggle.active {
    background: #4AE290;
}

/* Character Select Container - EPIC AAA Design */
.character-select-container {
    width: 95%;
    max-width: 1400px;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: 
        linear-gradient(135deg, 
            rgba(15, 10, 30, 0.97) 0%, 
            rgba(25, 15, 45, 0.97) 50%,
            rgba(10, 10, 25, 0.97) 100%
        );
    border: 6px solid #000000;
    box-shadow: 
        inset 0 0 0 2px rgba(107, 79, 255, 0.6),
        inset 0 0 0 4px #000000,
        0 0 80px rgba(107, 79, 255, 0.5),
        0 30px 120px rgba(0, 0, 0, 0.9);
    padding: 60px 50px;
    position: relative;
    animation: containerPulse 4s ease-in-out infinite;
}

@keyframes containerPulse {
    0%, 100% { 
        box-shadow: 
            inset 0 0 0 2px rgba(107, 79, 255, 0.6),
            inset 0 0 0 4px #000000,
            0 0 80px rgba(107, 79, 255, 0.5),
            0 30px 120px rgba(0, 0, 0, 0.9);
    }
    50% { 
        box-shadow: 
            inset 0 0 0 2px rgba(252, 15, 192, 0.7),
            inset 0 0 0 4px #000000,
            0 0 100px rgba(252, 15, 192, 0.6),
            0 30px 120px rgba(0, 0, 0, 0.9);
    }
}

/* Subtle animated scanlines */
.character-select-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(107, 79, 255, 0.02) 3px,
        rgba(107, 79, 255, 0.02) 6px
    );
    pointer-events: none;
    animation: scanlines 10s linear infinite;
    z-index: 1;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(30px); }
}

/* Corner glow accents */
.character-select-container::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px solid rgba(252, 15, 192, 0.15);
    pointer-events: none;
    z-index: 1;
}

/* Custom Scrollbar */
.character-select-container::-webkit-scrollbar {
    width: 12px;
}

.character-select-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-left: 2px solid rgba(107, 79, 255, 0.3);
}

.character-select-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6B4FFF, #FC0FC0);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(252, 15, 192, 0.5);
}

.character-select-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #8B6FFF, #FF2FDC);
}

/* Title - EPIC Typography */
.character-select-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 36px;
    color: #FC0FC0;
    text-align: center;
    margin-bottom: 40px;
    text-shadow: 
        0 0 20px rgba(252, 15, 192, 0.8),
        0 0 40px rgba(107, 79, 255, 0.6),
        4px 4px 0px #000,
        0 6px 30px rgba(0, 0, 0, 0.7);
    letter-spacing: 6px;
    animation: titleGlow 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 
            0 0 20px rgba(252, 15, 192, 0.8),
            0 0 40px rgba(107, 79, 255, 0.6),
            4px 4px 0px #000,
            0 6px 30px rgba(0, 0, 0, 0.7);
    }
    50% {
        text-shadow: 
            0 0 30px rgba(252, 15, 192, 1),
            0 0 60px rgba(107, 79, 255, 0.8),
            4px 4px 0px #000,
            0 6px 40px rgba(0, 0, 0, 0.8);
    }
}

/* Close Button - Stylish X */
.character-select-close {
    position: absolute;
    top: 25px;
    right: 25px;
    background: linear-gradient(135deg, #FF4444, #CC0000);
    border: 3px solid #000000;
    color: #FFFFFF;
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    width: 55px;
    height: 55px;
    cursor: pointer;
    box-shadow: 
        0 0 20px rgba(255, 68, 68, 0.5),
        4px 4px 0px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    z-index: 10;
}

.character-select-close:hover {
    background: linear-gradient(135deg, #FF6666, #FF0000);
    transform: translateY(-3px) rotate(90deg);
    box-shadow: 
        0 0 30px rgba(255, 68, 68, 0.8),
        6px 6px 0px rgba(0, 0, 0, 0.7);
}

.character-select-close:active {
    transform: translateY(0px) rotate(90deg);
    box-shadow: 
        0 0 15px rgba(255, 68, 68, 0.6),
        2px 2px 0px rgba(0, 0, 0, 0.5);
}

/* Character Grid - Perfect Spacing */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 35px;
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

/* ================================================================
   CHARACTER CARDS - THE MASTERPIECE
   ================================================================ */

.character-card {
    background: linear-gradient(145deg, rgba(20, 15, 35, 0.9), rgba(15, 10, 25, 0.9));
    border: 4px solid rgba(107, 79, 255, 0.4);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: center;
}

/* Animated border gradient on hover */
.character-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        #6B4FFF, 
        #FC0FC0, 
        #FFD700, 
        #6B4FFF
    );
    border-radius: 8px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.character-card:hover::before {
    opacity: 1;
}

.character-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: transparent;
    box-shadow: 
        0 15px 50px rgba(107, 79, 255, 0.6),
        0 0 40px rgba(252, 15, 192, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Selected State - GLORIOUS */
.character-card.selected {
    border-color: #FFD700;
    background: linear-gradient(145deg, rgba(40, 30, 60, 0.95), rgba(30, 20, 45, 0.95));
    box-shadow: 
        0 0 50px rgba(255, 215, 0, 1),
        0 0 100px rgba(255, 215, 0, 0.5),
        inset 0 2px 20px rgba(255, 215, 0, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.8);
    transform: translateY(-10px) scale(1.05);
    animation: selectedPulse 2s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 
            0 0 50px rgba(255, 215, 0, 1),
            0 0 100px rgba(255, 215, 0, 0.5),
            inset 0 2px 20px rgba(255, 215, 0, 0.2),
            0 20px 60px rgba(0, 0, 0, 0.8);
    }
    50% {
        box-shadow: 
            0 0 70px rgba(255, 215, 0, 1),
            0 0 140px rgba(255, 215, 0, 0.7),
            inset 0 2px 30px rgba(255, 215, 0, 0.3),
            0 25px 70px rgba(0, 0, 0, 0.8);
    }
}

.character-card.selected::before {
    opacity: 0;
}

/* Selected Badge - Premium Look */
.character-card.selected::after {
    content: '✓ SELECTED';
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    padding: 10px 16px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    border-radius: 6px;
    z-index: 10;
    box-shadow: 
        0 4px 15px rgba(255, 215, 0, 0.6),
        0 2px 0px #000;
    animation: badgeFloat 2s ease-in-out infinite;
}

@keyframes badgeFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
}

/* Locked State */
.character-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8) brightness(0.6);
}

.character-card.locked:hover {
    transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    border-color: rgba(107, 79, 255, 0.4);
}

.character-card.locked::before {
    opacity: 0;
}

/* ================================================================
   CHARACTER AVATAR - Perfect Balance at 200px
   ================================================================ */

.character-visual {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    border-bottom: 3px solid rgba(0, 0, 0, 0.5);
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
}

/* Subtle vignette on avatar */
.character-visual::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
}

.character-card:hover .character-visual {
    filter: brightness(1.2) contrast(1.1);
    transform: scale(1.05);
}

.character-card.selected .character-visual {
    border-bottom-color: #FFD700;
    filter: brightness(1.3) contrast(1.15);
    box-shadow: inset 0 0 50px rgba(255, 215, 0, 0.3);
}

/* Lock Overlay */
.character-card.locked .character-visual::after {
    content: '🔒 LOCKED';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-family: 'Press Start 2P', monospace;
    background: rgba(0, 0, 0, 0.95);
    color: #FFD700;
    padding: 20px 30px;
    border: 4px solid #FFD700;
    border-radius: 8px;
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.8),
        4px 4px 0px #000;
    z-index: 5;
}

/* ================================================================
   CHARACTER INFO - Clean & Modern
   ================================================================ */

.character-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: #FC0FC0;
    text-align: center;
    padding: 20px 15px 12px 15px;
    text-shadow: 
        0 0 15px rgba(252, 15, 192, 0.8),
        3px 3px 0px #000;
    letter-spacing: 2px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.character-card:hover .character-name {
    color: #FFD700;
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.9),
        3px 3px 0px #000;
}

.character-card.selected .character-name {
    color: #FFD700;
    text-shadow: 
        0 0 25px rgba(255, 215, 0, 1),
        3px 3px 0px #000;
}

.character-description {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #AAA;
    text-align: center;
    line-height: 1.6;
    padding: 0 20px 18px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
}

/* Stats Bar - Sleek Horizontal Design */
.character-stats {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    display: flex;
    justify-content: space-around;
    padding: 18px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-top: 2px solid rgba(107, 79, 255, 0.3);
    border-bottom: 2px solid rgba(107, 79, 255, 0.3);
}

.character-stat-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: #6B4FFF;
    font-size: 7px;
    letter-spacing: 1px;
}

.stat-value {
    color: #FFD700;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.6),
        2px 2px 0px #000;
}

/* Weapon Display - Bottom Accent */
.character-weapon {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #FC0FC0;
    text-align: center;
    padding: 15px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.9));
    border-top: 2px solid rgba(252, 15, 192, 0.3);
    text-shadow: 
        0 0 10px rgba(252, 15, 192, 0.5),
        2px 2px 0px #000;
    letter-spacing: 1px;
}

/* Selected Character Display on Main Menu */
#selectedCharacterDisplay {
    text-align: center;
    margin-top: 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #6B4FFF;
    text-shadow: 
        0 0 15px rgba(107, 79, 255, 0.6),
        2px 2px 0px rgba(0, 0, 0, 0.5);
}

/* ================================================================
   RESPONSIVE DESIGN - Mobile Optimized
   ================================================================ */

@media (max-width: 768px) {
    #charactersBtn {
        top: 80px;
        left: 20px;
        font-size: 11px;
        padding: 14px 28px;
        border: 3px solid #FFD700;
    }

    #settingsBtn {
        top: 80px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }

    .character-select-container {
        padding: 40px 25px;
    }

    .character-select-title {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .character-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .character-visual {
        height: 180px;
    }

    .character-name {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .character-select-title {
        font-size: 18px;
        letter-spacing: 3px;
    }

    .character-visual {
        height: 160px;
    }
}

/* ================================================================
   SMOOTH ENTRANCE ANIMATION
   ================================================================ */

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-card {
    animation: cardSlideIn 0.5s ease-out backwards;
}

.character-card:nth-child(1) { animation-delay: 0.05s; }
.character-card:nth-child(2) { animation-delay: 0.10s; }
.character-card:nth-child(3) { animation-delay: 0.15s; }
.character-card:nth-child(4) { animation-delay: 0.20s; }
.character-card:nth-child(5) { animation-delay: 0.25s; }
.character-card:nth-child(6) { animation-delay: 0.30s; }