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

body {
    overflow: hidden;
    background: #0d0520;
    font-family: 'Press Start 2P', cursive;
    color: #fff;
    cursor: crosshair;
}

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

#scene-container {
    width: 100%;
    height: 100%;
}

#scene-container canvas {
    display: block;
    image-rendering: pixelated;
}

/* CRT Scanline effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 1;
}

/* Crosshair */
#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
    pointer-events: none;
    z-index: 100;
}

/* HUD */
#hud {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(to top, rgba(26, 10, 46, 0.95), transparent);
    border-top: 3px solid #ff00ff;
    z-index: 50;
}

#hud-left, #hud-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-icon {
    font-size: 20px;
}

.health-bar {
    width: 150px;
    height: 20px;
    background: #2d1b4e;
    border: 2px solid #ff0055;
    position: relative;
}

#health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff0055, #ff3388);
    transition: width 0.2s;
}

#health-text, #ammo-text {
    font-size: 12px;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}

#hud-center {
    display: flex;
    justify-content: center;
}

#weapon-display {
    width: 150px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#weapon-icon {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 5px #00ffff);
}

/* Top HUD */
#top-hud {
    position: fixed;
    top: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 30px;
    z-index: 50;
    font-size: 10px;
}

#wave-indicator {
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
}

#score-display {
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
}

#kills-display {
    color: #ff0055;
    text-shadow: 0 0 10px #ff0055;
}

/* Menu Panels */
.menu-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(13, 5, 32, 0.95);
    border: 4px solid #ff00ff;
    padding: 40px;
    text-align: center;
    z-index: 200;
    min-width: 300px;
}

.menu-panel::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #00ffff;
    pointer-events: none;
}

.game-title {
    font-size: 28px;
    color: #ff0055;
    text-shadow: 
        0 0 10px #ff0055,
        0 0 20px #ff0055,
        0 0 40px #ff0055;
    margin-bottom: 10px;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    52% { opacity: 1; }
    54% { opacity: 0.9; }
}

.subtitle {
    font-size: 8px;
    color: #00ffff;
    margin-bottom: 30px;
}

.controls-help {
    margin: 20px 0;
    font-size: 8px;
    color: #888;
    line-height: 2;
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 8px;
    color: #00ff88;
    cursor: pointer;
    margin-top: 20px;
}

.sound-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #00ff88;
}

/* Pixel Buttons */
.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    padding: 15px 30px;
    border: none;
    cursor: pointer;
    margin: 10px;
    position: relative;
    text-transform: uppercase;
    transition: all 0.1s;
}

.pixel-btn::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: -4px;
    bottom: -4px;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.pixel-btn:hover {
    transform: translate(2px, 2px);
}

.pixel-btn:hover::before {
    transform: translate(-2px, -2px);
}

.pixel-btn.green {
    background: #00ff88;
    color: #000;
    box-shadow: inset -4px -4px 0 #00aa55;
}

.pixel-btn.blue {
    background: #00ffff;
    color: #000;
    box-shadow: inset -4px -4px 0 #00aaaa;
}

.pixel-btn.red {
    background: #ff0055;
    color: #fff;
    box-shadow: inset -4px -4px 0 #aa0033;
}

.pixel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Side Panels */
.side-panel {
    position: fixed;
    top: 80px;
    left: 0;
    width: 300px;
    max-height: calc(100vh - 160px);
    background: rgba(13, 5, 32, 0.95);
    border: 3px solid #ff00ff;
    z-index: 150;
    display: flex;
    flex-direction: column;
}

.side-panel.right {
    left: auto;
    right: 0;
    border-color: #00ffff;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 0, 255, 0.2);
    border-bottom: 2px solid #ff00ff;
}

.side-panel.right .panel-header {
    background: rgba(0, 255, 255, 0.2);
    border-bottom-color: #00ffff;
}

.panel-header h3 {
    font-size: 10px;
    color: #fff;
}

.close-btn {
    background: none;
    border: none;
    color: #ff0055;
    font-size: 24px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
}

.panel-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.pixel-input, .pixel-textarea, .pixel-select {
    width: 100%;
    background: #1a0a2e;
    border: 2px solid #3d2b5e;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.pixel-textarea {
    height: 80px;
    resize: none;
}

.pixel-input:focus, .pixel-textarea:focus, .pixel-select:focus {
    outline: none;
    border-color: #ff00ff;
}

.preview-window {
    width: 100%;
    height: 100px;
    background: #0d0520;
    border: 2px dashed #3d2b5e;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
}

.preview-window img {
    max-width: 90%;
    max-height: 90%;
    image-rendering: pixelated;
}

.preview-placeholder {
    font-size: 8px;
    color: #666;
}

.list-header {
    font-size: 8px;
    color: #00ff88;
    margin: 15px 0 10px;
    border-bottom: 1px solid #3d2b5e;
    padding-bottom: 5px;
}

.item-list {
    max-height: 150px;
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(61, 43, 94, 0.3);
    margin-bottom: 5px;
    border-left: 3px solid #ff00ff;
}

.list-item img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

.list-item span {
    flex: 1;
    font-size: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item button {
    background: #00ff88;
    color: #000;
    border: none;
    width: 24px;
    height: 24px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
}

/* Mobile Controls */
#mobile-controls {
    position: fixed;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    pointer-events: none;
}

#joystick-container {
    width: 120px;
    height: 120px;
    background: rgba(255, 0, 255, 0.2);
    border: 3px solid #ff00ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

#joystick {
    width: 50px;
    height: 50px;
    background: #ff00ff;
    border-radius: 50%;
    transition: transform 0.1s;
}

.mobile-btn {
    width: 80px;
    height: 80px;
    background: rgba(0, 255, 136, 0.3);
    border: 3px solid #00ff88;
    border-radius: 50%;
    font-size: 24px;
    pointer-events: all;
    cursor: pointer;
}

.mobile-btn.small {
    width: 50px;
    height: 50px;
    font-size: 16px;
    position: absolute;
    right: 110px;
    bottom: 0;
}

/* Footer */
#footer {
    position: fixed;
    bottom: 5px;
    right: 10px;
    z-index: 100;
}

#footer a {
    font-size: 8px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

#footer a:hover {
    color: #ff00ff;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a0a2e;
}

::-webkit-scrollbar-thumb {
    background: #ff00ff;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-panel {
        width: 90%;
        padding: 20px;
    }
    
    .game-title {
        font-size: 18px;
    }
    
    .controls-help {
        font-size: 6px;
    }
    
    .pixel-btn {
        font-size: 10px;
        padding: 12px 20px;
    }
    
    .side-panel {
        width: 250px;
        top: 50px;
        max-height: calc(100vh - 200px);
    }
    
    #hud {
        height: 60px;
        padding: 5px 10px;
    }
    
    .health-bar {
        width: 80px;
        height: 15px;
    }
    
    #weapon-display {
        width: 80px;
        height: 40px;
    }
    
    #top-hud {
        font-size: 7px;
        gap: 15px;
    }
}