/* === Global Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    user-select: none;
}

/* === Game Canvas === */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    -webkit-touch-callout: none;
    position: fixed;
    top: 0;
    left: 0;
}

/* === HUD Overlay === */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(0, 191, 255, 0.7);
    font-weight: bold;
    text-shadow: 0 0 4px rgba(0, 191, 255, 0.5);
}

/* Health bar */
#health-bar-container {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 250px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 191, 255, 0.4);
    border-radius: 2px;
    overflow: hidden;
}

#health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff3333, #ff6600);
    transition: width 0.3s ease;
}

#health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #fff;
    text-shadow: 0 0 4px #000;
}

/* Ammo counter */
#ammo-counter {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 28px;
    color: #00bfff;
    text-shadow: 0 0 8px rgba(0, 191, 255, 0.5);
    letter-spacing: 2px;
}

/* Floor indicator */
#floor-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: rgba(0, 191, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 6px rgba(0, 191, 255, 0.3);
}

/* Checkpoint notification */
#checkpoint-notification {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    text-align: center;
    animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Low health overlay */
#low-health-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(139, 0, 0, 0.5) 100%);
    pointer-events: none;
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* === Minimap === */
#minimap-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 180px;
    height: 180px;
    border: 1px solid rgba(0, 191, 255, 0.4);
    border-radius: 4px;
    overflow: hidden;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
}

#minimap-canvas {
    width: 100%;
    height: 100%;
}

/* === Menu Overlay === */
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(0, 0, 0, 0.9);
}

/* Title screen */
#title-screen {
    text-align: center;
}

.game-title {
    font-size: 72px;
    letter-spacing: 16px;
    color: #00bfff;
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.5), 0 0 40px rgba(0, 191, 255, 0.3);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 18px;
    color: #667;
    letter-spacing: 6px;
    margin-bottom: 60px;
}

#start-btn, #resume-btn, #restart-btn, #respawn-btn, #quit-btn, #victory-quit-btn {
    padding: 14px 40px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 3px;
    color: #00bfff;
    background: transparent;
    border: 1px solid rgba(0, 191, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
    margin: 8px;
}

#start-btn:hover, #resume-btn:hover, #restart-btn:hover,
#respawn-btn:hover, #quit-btn:hover, #victory-quit-btn:hover {
    background: rgba(0, 191, 255, 0.15);
    border-color: #00bfff;
    text-shadow: 0 0 8px rgba(0, 191, 255, 0.5);
}

.credits {
    margin-top: 60px;
    font-size: 12px;
    color: #445;
    letter-spacing: 2px;
}

/* Pause / Game Over / Victory screens */
#pause-menu, #game-over-screen, #victory-screen {
    text-align: center;
}

#pause-menu h2, #game-over-screen h2, #victory-screen h2 {
    font-size: 48px;
    letter-spacing: 8px;
    margin-bottom: 30px;
}

#game-over-screen h2 {
    color: #ff3333;
    text-shadow: 0 0 20px rgba(255, 51, 51, 0.5);
}

#victory-screen h2 {
    color: #00ff88;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

#death-message, #victory-message {
    color: #667;
    margin-bottom: 30px;
    font-size: 14px;
}

/* === Loading Screen === */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: #000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(0, 191, 255, 0.2);
    border-top-color: #00bfff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: #445;
    font-size: 14px;
    letter-spacing: 2px;
}

/* === Narrative Overlay === */
#narrative-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

#narrative-content {
    max-width: 600px;
    text-align: center;
    font-size: 18px;
    line-height: 1.8;
    color: #ccc;
    letter-spacing: 1px;
    padding: 20px;
}

#narrative-overlay::after {
    content: 'click to continue';
    font-size: 11px;
    color: #555;
    letter-spacing: 2px;
    margin-top: 30px;
    animation: narrativePulse 2s ease-in-out infinite;
}

@keyframes narrativePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

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

/* === Mobile Touch Controls === */
#touch-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
}

#joystick-zone {
    position: absolute;
    bottom: 40px;
    left: 40px;
    width: 120px;
    height: 120px;
    pointer-events: auto;
}

#joystick-base {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(0, 191, 255, 0.1);
    border: 2px solid rgba(0, 191, 255, 0.3);
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 191, 255, 0.4);
    border: 2px solid rgba(0, 191, 255, 0.6);
    transition: transform 0.05s;
}

#look-zone {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    pointer-events: auto;
}

#action-buttons {
    position: absolute;
    bottom: 40px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: auto;
}

.touch-btn {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(0, 191, 255, 0.15);
    border: 2px solid rgba(0, 191, 255, 0.4);
    color: #00bfff;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn.action-btn {
    width: 70px;
    height: 70px;
    font-size: 12px;
    background: rgba(255, 50, 50, 0.2);
    border-color: rgba(255, 50, 50, 0.5);
    color: #ff4444;
}

.touch-btn.toggle-btn.active {
    background: rgba(0, 191, 255, 0.4);
    border-color: #00bfff;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.3);
}

.pause-btn {
    position: absolute;
    top: 10px;
    right: 200px;
    width: 40px;
    height: 40px;
    font-size: 18px;
}

/* Hide touch controls on desktop */
@media (min-width: 1024px) {
    #touch-controls {
        display: none !important;
    }
}

