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

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

body {
    font-family: 'Orbitron', monospace;
    background: #000;
    color: #00FFFF;
    overflow: hidden;
    user-select: none;
    cursor: crosshair;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#canvas {
    display: block;
    background: #000;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

#hud {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.hud-element {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #00FFFF;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    animation: glitch-flicker 0.15s infinite;
    backdrop-filter: blur(3px);
}

.label {
    min-width: 50px;
    font-size: 11px;
    color: #FF00FF;
    text-shadow: 0 0 5px #FF00FF;
}

.bar {
    width: 80px;
    height: 8px;
    background: #222;
    border: 1px solid #00FFFF;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 255, 255, 0.3);
}

.fill {
    height: 100%;
    transition: width 0.4s ease;
    animation: pulse 0.6s infinite alternate;
}

#viral-fill {
    background: linear-gradient(90deg, #00FFFF, #0088FF);
}

#depth-fill {
    background: linear-gradient(90deg, #FFFF00, #FF8800);
}

#solidarity-fill {
    background: linear-gradient(90deg, #00FF00, #88FF00);
}

#momentum-fill {
    background: linear-gradient(90deg, #FF00FF, #FF0080);
}

#score-value, #fragment-count {
    font-family: 'Courier New', monospace;
    color: #00FF00;
    font-weight: bold;
    text-shadow: 0 0 8px #00FF00;
    font-size: 12px;
}

#character-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.selector-content {
    background: #000;
    border: 4px solid #FF00FF;
    padding: 40px;
    text-align: center;
    max-width: 600px;
}

.selector-content h2 {
    color: #FF00FF;
    margin-bottom: 30px;
    font-size: 20px;
    letter-spacing: 3px;
}

.character-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.character-btn {
    padding: 15px;
    background: #000;
    color: #00FFFF;
    border: 2px solid #00FFFF;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.character-btn:hover {
    background: #00FFFF;
    color: #000;
    box-shadow: 0 0 20px #00FFFF;
    transform: scale(1.05);
}

#controls {
    position: fixed;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #FF00FF;
    padding: 12px;
    font-size: 10px;
    line-height: 1.6;
    z-index: 100;
    backdrop-filter: blur(3px);
}

.glitch-text {
    animation: text-glitch 0.3s infinite;
    text-shadow: 
        2px 0 #FF0000,
        -2px 0 #00FFFF,
        0 2px #00FF00;
}

#manifesto-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #FF00FF;
    padding: 30px;
    max-width: 600px;
    text-align: center;
    z-index: 200;
    animation: manifesto-appear 0.6s ease;
    backdrop-filter: blur(5px);
}

.manifesto-content h2 {
    color: #FF00FF;
    margin-bottom: 20px;
    font-size: 16px;
    letter-spacing: 2px;
}

.manifesto-content p {
    color: #00FFFF;
    margin-bottom: 15px;
    font-size: 12px;
}

#manifesto-text {
    color: #00FF00;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    animation: text-corruption 1.2s infinite;
    margin-bottom: 15px;
}

#philosopher-quote {
    color: #FFFF00;
    font-size: 11px;
    font-style: italic;
    opacity: 0.9;
}

#network-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #00FF00;
    padding: 20px;
    text-align: center;
    z-index: 150;
    min-width: 300px;
}

.network-content h3 {
    color: #00FF00;
    margin-bottom: 15px;
    font-size: 16px;
}

.network-content div {
    margin: 8px 0;
    font-size: 12px;
}

.network-content button {
    margin-top: 15px;
    padding: 8px 15px;
    background: #000;
    color: #00FF00;
    border: 2px solid #00FF00;
    font-family: 'Orbitron', monospace;
    cursor: pointer;
}

#exhibition-takeover {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #FFFF00;
    padding: 20px;
    text-align: center;
    z-index: 200;
    min-width: 250px;
}

.takeover-content h2 {
    color: #FFFF00;
    margin-bottom: 15px;
    font-size: 14px;
}

.takeover-content p {
    color: #FFFFFF;
    margin-bottom: 10px;
    font-size: 11px;
}

#exhibition-timer, #collaboration-count {
    color: #00FFFF;
    font-size: 12px;
    font-weight: bold;
    margin: 5px 0;
}

#pause-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.menu-content {
    background: #000;
    border: 4px solid #00FFFF;
    padding: 40px;
    text-align: center;
    min-width: 400px;
}

.menu-content h2 {
    color: #FF00FF;
    margin-bottom: 25px;
    font-size: 22px;
    letter-spacing: 3px;
}

.menu-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    margin: 20px 0;
    border: 1px solid #444;
}

.menu-stats div {
    margin: 8px 0;
    font-size: 12px;
    color: #CCCCCC;
}

.menu-content button {
    display: block;
    width: 100%;
    margin: 12px 0;
    padding: 12px;
    background: #000;
    color: #00FFFF;
    border: 2px solid #00FFFF;
    font-family: 'Orbitron', monospace;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.menu-content button:hover {
    background: #00FFFF;
    color: #000;
    box-shadow: 0 0 15px #00FFFF;
}

#level-transition {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 4px solid #FF0080;
    padding: 40px;
    text-align: center;
    z-index: 250;
    min-width: 500px;
    animation: level-zoom 0.8s ease;
}

.transition-content h2 {
    color: #FF0080;
    margin-bottom: 20px;
    font-size: 24px;
    letter-spacing: 4px;
}

.transition-content p {
    color: #FFFFFF;
    margin-bottom: 20px;
    font-size: 14px;
}

#level-objectives {
    text-align: left;
    color: #00FFFF;
    font-size: 12px;
    line-height: 1.6;
}

#level-objectives div {
    margin: 5px 0;
}

.hidden {
    display: none !important;
}

/* Enhanced Animations */
@keyframes glitch-flicker {
    0% { opacity: 1; }
    96% { opacity: 1; }
    97% { opacity: 0.7; }
    98% { opacity: 0.9; }
    99% { opacity: 0.6; }
    100% { opacity: 1; }
}

@keyframes pulse {
    0% { filter: brightness(100%); }
    100% { filter: brightness(130%) saturate(120%); }
}

@keyframes text-glitch {
    0% { 
        text-shadow: 2px 0 #FF0000, -2px 0 #00FFFF, 0 2px #00FF00;
        transform: translate(0);
    }
    15% { 
        text-shadow: -2px 0 #FF0000, 2px 0 #00FFFF, 0 -2px #00FF00;
        transform: translate(-1px, 1px);
    }
    30% { 
        text-shadow: 2px 0 #FF0000, -2px 0 #00FFFF, 0 2px #00FF00;
        transform: translate(1px, -1px);
    }
    45% { 
        text-shadow: -3px 0 #FF0000, 3px 0 #00FFFF, 0 -1px #00FF00;
        transform: translate(0, 1px);
    }
    60% { 
        text-shadow: 1px 0 #FF0000, -1px 0 #00FFFF, 0 3px #00FF00;
        transform: translate(-1px, 0);
    }
    75% { 
        text-shadow: -1px 0 #FF0000, 1px 0 #00FFFF, 0 -2px #00FF00;
        transform: translate(1px, 1px);
    }
    100% { 
        text-shadow: 2px 0 #FF0000, -2px 0 #00FFFF, 0 2px #00FF00;
        transform: translate(0);
    }
}

@keyframes text-corruption {
    0%, 85% { 
        filter: hue-rotate(0deg) brightness(100%); 
    }
    10% { 
        filter: hue-rotate(90deg) brightness(120%); 
    }
    25% { 
        filter: hue-rotate(180deg) brightness(80%); 
    }
    40% { 
        filter: hue-rotate(270deg) brightness(150%); 
    }
    60% { 
        filter: hue-rotate(45deg) brightness(90%); 
    }
}

@keyframes manifesto-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7) rotateY(10deg);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotateY(0deg);
        filter: blur(0px);
    }
}

@keyframes level-zoom {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
        filter: brightness(200%) blur(3px);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
        filter: brightness(150%) blur(1px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(100%) blur(0px);
    }
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    #hud {
        top: 10px;
        right: 10px;
        gap: 8px;
        scale: 0.85;
    }
    
    .hud-element {
        padding: 5px 7px;
        font-size: 9px;
    }
    
    .label {
        min-width: 35px;
        font-size: 8px;
    }
    
    .bar {
        width: 60px;
        height: 6px;
    }
    
    #controls {
        bottom: 10px;
        left: 10px;
        padding: 8px;
        font-size: 9px;
        line-height: 1.4;
        scale: 0.9;
    }
    
    #manifesto-display, #level-transition {
        max-width: 90%;
        padding: 20px;
    }
    
    .character-grid {
        grid-template-columns: 1fr;
    }
    
    .character-btn {
        font-size: 12px;
        padding: 12px;
    }
    
    #exhibition-takeover {
        right: 10px;
        min-width: 200px;
        scale: 0.9;
    }
    
    #network-overlay {
        min-width: 250px;
        scale: 0.9;
    }
}

@media (max-width: 480px) {
    #hud {
        scale: 0.75;
    }
    
    #controls {
        scale: 0.8;
    }
    
    .selector-content h2 {
        font-size: 16px;
    }
    
    .transition-content h2 {
        font-size: 18px;
    }
    
    #manifesto-text {
        font-size: 12px;
    }
}

/* Performance Optimizations */
* {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#canvas {
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

/* Accessibility enhancements */
.character-btn:focus, .menu-content button:focus {
    outline: 3px solid #FFFF00;
    outline-offset: 2px;
}

/* Loading state */
body.loading {
    background: #000;
}

body.loading::before {
    content: "INITIALIZING RESISTANCE...";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #00FFFF;
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    letter-spacing: 3px;
    animation: text-glitch 0.5s infinite;
}