/* SIDER NEXUS - Advanced Game Styling */

/* Game Container */
.nexus-game {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0a0a0f, #1a1a2e, #16213e, #0f0f23);
    background-size: 400% 400%;
    animation: backgroundShift 20s ease infinite;
    z-index: 15000;
    display: none;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.nexus-game.active {
    display: flex;
    opacity: 1;
}

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

/* Game Menu */
.game-menu {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.menu-bg-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 170, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 107, 53, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(253, 121, 168, 0.05) 0%, transparent 50%);
    animation: menuEffects 15s ease infinite;
}

@keyframes menuEffects {
    0%, 100% { transform: rotate(0deg) scale(1); }
    33% { transform: rotate(1deg) scale(1.02); }
    66% { transform: rotate(-1deg) scale(0.98); }
}

.menu-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 2px solid rgba(0, 212, 170, 0.3);
    box-shadow: 
        0 0 50px rgba(0, 212, 170, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.game-logo h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    color: #00d4aa;
    text-shadow: 
        0 0 20px #00d4aa,
        0 0 40px #00d4aa,
        0 0 60px #00d4aa;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { 
        text-shadow: 
            0 0 20px #00d4aa,
            0 0 40px #00d4aa,
            0 0 60px #00d4aa;
    }
    to { 
        text-shadow: 
            0 0 30px #00d4aa,
            0 0 60px #00d4aa,
            0 0 90px #00d4aa;
    }
}

.game-tagline {
    font-size: 1.2rem;
    color: #a29bfe;
    margin-bottom: 3rem;
    font-style: italic;
    opacity: 0.9;
}

/* Character Selection */
.character-selection {
    margin: 3rem 0;
}

.character-selection h3 {
    color: #ddd6fe;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.character-card {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #636e72;
    border-radius: 15px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.character-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 170, 0.1), transparent);
    transition: left 0.5s ease;
}

.character-card:hover {
    border-color: #00d4aa;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 212, 170, 0.3);
}

.character-card:hover::before {
    left: 100%;
}

.character-card.selected {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.1);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.4);
}

.char-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px currentColor);
}

.character-card h4 {
    color: #00d4aa;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.character-card p {
    color: #a29bfe;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.char-stats {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #ddd6fe;
}

.char-stats span {
    text-align: left;
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.nexus-btn {
    padding: 1rem 2rem;
    border: 2px solid;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

.nexus-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.nexus-btn:hover::before {
    left: 100%;
}

.nexus-btn.primary {
    border-color: #00d4aa;
    color: #00d4aa;
    box-shadow: 0 0 20px rgba(0, 212, 170, 0.2);
}

.nexus-btn.primary:hover {
    background: #00d4aa;
    color: #000;
    box-shadow: 0 0 40px rgba(0, 212, 170, 0.6);
    transform: translateY(-3px);
}

.nexus-btn.secondary {
    border-color: #a29bfe;
    color: #a29bfe;
}

.nexus-btn.secondary:hover {
    background: #a29bfe;
    color: #000;
    transform: translateY(-2px);
}

.nexus-btn.danger {
    border-color: #ff6b35;
    color: #ff6b35;
}

.nexus-btn.danger:hover {
    background: #ff6b35;
    color: #000;
    transform: translateY(-2px);
}

/* Game Interface */
.game-interface {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* HUD */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #00d4aa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1001;
}

.hud-left, .hud-right {
    flex: 1;
}

.hud-center {
    flex: 2;
    text-align: center;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.health-bar, .energy-bar {
    width: 150px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #636e72;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757, #ff6b35);
    border-radius: 8px;
    width: 100%;
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #00d4aa);
    border-radius: 8px;
    width: 100%;
    transition: width 0.3s ease;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.health-text, .energy-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
    font-weight: 600;
}

.level-info {
    color: #00d4aa;
    font-weight: 600;
}

#current-level {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px #00d4aa;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4aa, #00e6c4);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.5);
}

.game-stats-live {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #a29bfe;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #00d4aa;
    text-shadow: 0 0 5px #00d4aa;
}

.pause-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff6b35;
    color: #ff6b35;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.pause-btn:hover {
    background: #ff6b35;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 20px #ff6b35;
}

/* Main Game Canvas */
.nexus-canvas {
    width: 100%;
    height: calc(100vh - 160px); /* Account for HUD and ability bar */
    max-height: 600px;
    background: #000;
    border: none;
    margin-top: 80px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Mobile Controls */
.mobile-controls {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    height: 120px;
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
}

@media (max-width: 768px), (hover: none) {
    .mobile-controls {
        display: flex;
    }
    
    .nexus-canvas {
        height: calc(100vh - 280px);
    }
}

.control-section {
    display: flex;
    align-items: center;
}

.movement-pad {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    gap: 5px;
    width: 120px;
    height: 120px;
}

.movement-pad .move-btn:nth-child(1) { /* Up */
    grid-column: 2;
    grid-row: 1;
}

.middle-row {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
}

.movement-pad .move-btn:nth-child(3) { /* Down */
    grid-column: 2;
    grid-row: 3;
}

.move-btn {
    width: 35px;
    height: 35px;
    background: rgba(0, 212, 170, 0.2);
    border: 2px solid #00d4aa;
    border-radius: 8px;
    color: #00d4aa;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.move-btn:active {
    background: rgba(0, 212, 170, 0.4);
    transform: scale(0.95);
    box-shadow: inset 0 0 10px rgba(0, 212, 170, 0.3);
}

.control-section.right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-btn {
    width: 60px;
    height: 60px;
    border: 2px solid;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.action-btn.primary {
    background: rgba(255, 107, 53, 0.2);
    border-color: #ff6b35;
    color: #ff6b35;
}

.action-btn.secondary {
    background: rgba(0, 212, 170, 0.2);
    border-color: #00d4aa;
    color: #00d4aa;
}

.action-btn.utility {
    background: rgba(162, 155, 254, 0.2);
    border-color: #a29bfe;
    color: #a29bfe;
}

.action-btn:active {
    transform: scale(0.9);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
}

/* Ability Bar */
.ability-bar {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px 15px 0 0;
    border: 2px solid #00d4aa;
    border-bottom: none;
    backdrop-filter: blur(10px);
}

.ability-slot {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #636e72;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ability-slot:hover {
    border-color: #00d4aa;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 212, 170, 0.3);
}

.ability-slot.ready {
    border-color: #00d4aa;
    box-shadow: 0 0 15px rgba(0, 212, 170, 0.4);
}

.ability-slot.cooldown {
    border-color: #ff4757;
    opacity: 0.6;
}

.ability-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 5px currentColor);
}

.cooldown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 71, 87, 0.3);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.1s linear;
}

.hotkey {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: #00d4aa;
    color: #000;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced Game Modals */
.game-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) rotateX(15deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateX(0deg);
    }
}

.game-modal .modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f23);
    border: 3px solid #00d4aa;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    max-width: 600px;
    width: 90%;
    box-shadow: 
        0 0 50px rgba(0, 212, 170, 0.4),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.game-modal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 20%, rgba(0, 212, 170, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 107, 53, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.game-modal h2 {
    color: #00d4aa;
    font-size: 2.5rem;
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 20px #00d4aa;
    letter-spacing: 0.1em;
    position: relative;
    z-index: 1;
}

/* Level Up Modal */
.upgrade-selection h3 {
    color: #ddd6fe;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.upgrade-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.upgrade-option {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #636e72;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.upgrade-option:hover {
    border-color: #00d4aa;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

.upgrade-option.selected {
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.2);
}

/* Death Modal */
.death-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-row {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid #636e72;
    color: #ddd6fe;
}

.stat-row span {
    color: #00d4aa;
    font-weight: 600;
    text-shadow: 0 0 5px #00d4aa;
}

.progression-rewards {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid #00d4aa;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    min-height: 60px;
}

.reward-item {
    color: #00d4aa;
    font-size: 0.9rem;
    margin: 0.3rem 0;
    animation: rewardAppear 0.5s ease-out;
}

@keyframes rewardAppear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Achievement Popup */
.achievement-popup {
    position: absolute;
    top: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ff6b35;
    border-radius: 10px;
    padding: 1rem;
    max-width: 300px;
    z-index: 2001;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.4);
}

.achievement-popup.show {
    transform: translateX(0);
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.achievement-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px currentColor);
}

.achievement-text h4 {
    color: #ff6b35;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    font-family: 'Orbitron', sans-serif;
}

.achievement-text p {
    color: #ddd6fe;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.3;
}

/* Responsive Design for NEXUS Game */
@media (max-width: 1200px) {
    .nexus-canvas {
        height: calc(100vh - 180px);
    }
    
    .game-hud {
        padding: 0 1rem;
    }
    
    .game-stats-live {
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .game-hud {
        height: 60px;
        flex-direction: column;
        padding: 0.5rem 1rem;
    }
    
    .hud-left, .hud-center, .hud-right {
        flex: none;
    }
    
    .player-info {
        flex-direction: row;
        gap: 1rem;
        align-items: center;
    }
    
    .health-bar, .energy-bar {
        width: 100px;
        height: 15px;
    }
    
    .game-stats-live {
        justify-content: center;
    }
    
    .level-info {
        margin: 0 1rem;
    }
    
    #current-level {
        font-size: 0.9rem;
    }
    
    .progress-bar {
        width: 120px;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .character-card {
        padding: 1rem;
    }
    
    .menu-buttons {
        max-width: 250px;
    }
    
    .nexus-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .mobile-controls {
        height: 100px;
        padding: 0.5rem 1rem;
    }
    
    .movement-pad {
        width: 90px;
        height: 90px;
    }
    
    .move-btn {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }
    
    .action-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .ability-bar {
        padding: 0.5rem;
        gap: 0.3rem;
    }
    
    .ability-slot {
        width: 45px;
        height: 45px;
    }
    
    .ability-icon {
        font-size: 1.3rem;
    }
    
    .hotkey {
        width: 15px;
        height: 15px;
        font-size: 0.6rem;
    }
    
    .achievement-popup {
        top: 70px;
        right: 10px;
        max-width: 250px;
        padding: 0.8rem;
    }
}

/* Special Effects */
.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-10px); }
    20% { transform: translateX(10px); }
    30% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    50% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    70% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    90% { transform: translateX(-2px); }
}

.damage-flash {
    animation: damageFlash 0.3s ease-out;
}

@keyframes damageFlash {
    0% { filter: brightness(1); }
    50% { filter: brightness(2) hue-rotate(0deg) saturate(2); }
    100% { filter: brightness(1); }
}

/* Loading Screen */
.game-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 212, 170, 0.2);
    border-top: 4px solid #00d4aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: #00d4aa;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}