/* ===================================================
   DOOM 3D - Authentic Retro CSS Stylesheet
   CRT Scanlines, Retro Doom Status Bar, LED numbers,
   Responsive Canvas, Mobile Controls & Modals.
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Share+Tech+Mono&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #050203;
    font-family: 'Press Start 2P', monospace;
    color: #e0e0e0;
}

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

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* First Person Weapon Overlay Canvas (CS:GO / Right-Handed Viewmodel) */
#weapon-canvas {
    position: absolute;
    bottom: 85px;
    left: 0;
    width: 100%;
    height: calc(100% - 85px);
    pointer-events: none;
    z-index: 10;
}

/* Screen Damage & Pickup Flash Tint */
#damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    transition: background-color 0.05s ease-out;
}

/* CRT Monitor Scanline Filter */
#crt-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 25;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.45) 50%);
    background-size: 100% 4px;
    opacity: 0.75;
}

/* Center Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 15;
}
#crosshair::before, #crosshair::after {
    content: '';
    position: absolute;
    background: #00ff66;
    box-shadow: 0 0 4px #00ff66;
}
#crosshair::before {
    top: 8px;
    left: 0;
    width: 18px;
    height: 2px;
}
#crosshair::after {
    top: 0;
    left: 8px;
    width: 2px;
    height: 18px;
}

/* Top Notification Ticker */
#hud-ticker {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: #ffff44;
    text-shadow: 2px 2px #b00, -2px -2px #000;
    letter-spacing: 2px;
    text-align: center;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border: 2px solid #880000;
}

/* ===================================================
   AUTHENTIC RETRO DOOM STATUS BAR (BOTTOM HUD)
   =================================================== */

#doom-hud {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: #2b2b2b;
    border-top: 4px solid #5a5a5a;
    box-shadow: inset 0 3px 0 #8c8c8c, 0 -4px 10px rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
    background-image: 
        linear-gradient(45deg, #1f1f1f 25%, transparent 25%), 
        linear-gradient(-45deg, #1f1f1f 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #1f1f1f 75%), 
        linear-gradient(-45deg, transparent 75%, #1f1f1f 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.hud-panel {
    display: flex;
    align-items: center;
    height: 78px;
    background: #1a1a1a;
    border: 3px solid #404040;
    box-shadow: inset 2px 2px 0 #000, inset -2px -2px 0 #555;
    padding: 0 10px;
}

.hud-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    padding: 0 12px;
    border-right: 2px solid #333;
}

.hud-label {
    font-size: 9px;
    color: #aa2222;
    text-shadow: 1px 1px #000;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.hud-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 32px;
    font-weight: bold;
    color: #ff2200;
    text-shadow: 0 0 8px #ff0000, 2px 2px #500;
    letter-spacing: 2px;
}

/* Doomguy Animated Face Box */
.hud-face-box {
    width: 76px;
    height: 74px;
    background: #111;
    border: 2px solid #555;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
}
#doomguy-face {
    width: 64px;
    height: 68px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ARMS Matrix (1-7) */
.hud-arms-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
    border-right: 2px solid #333;
}
.arms-grid {
    display: grid;
    grid-template-columns: repeat(3, 16px);
    gap: 4px;
    margin-top: 4px;
}
.arm-num {
    font-size: 10px;
    text-align: center;
    color: #444;
}
.arm-num.active {
    color: #ffff00;
    text-shadow: 0 0 4px #ffaa00;
}
.arm-num.selected {
    color: #00ff66;
    text-decoration: underline;
    font-weight: bold;
}

/* Keys Matrix */
.hud-keys-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
}
.keys-grid {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.key-slot {
    width: 14px;
    height: 18px;
    background: #222;
    border: 1px solid #444;
}
#key-blue.has-key {
    background: #0088ff;
    box-shadow: 0 0 8px #0088ff;
    border-color: #ffffff;
}
#key-red.has-key {
    background: #ff1122;
    box-shadow: 0 0 8px #ff1122;
    border-color: #ffffff;
}
#key-yellow.has-key {
    background: #ffbb00;
    box-shadow: 0 0 8px #ffbb00;
    border-color: #ffffff;
}

/* ===================================================
   MODALS, OVERLAYS & MENUS
   =================================================== */

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-content {
    background: #1c1515;
    border: 4px solid #8b0000;
    box-shadow: 0 0 25px rgba(255, 0, 0, 0.4), inset 0 0 15px #000;
    padding: 30px 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
}

.doom-title {
    font-size: 34px;
    color: #ff2200;
    text-shadow: 4px 4px #4a0000, -2px -2px #000, 0 0 15px #ff5500;
    margin-bottom: 12px;
    letter-spacing: 4px;
}

.doom-subtitle {
    font-size: 11px;
    color: #ffaa44;
    margin-bottom: 24px;
    line-height: 1.6;
}

.instructions-box {
    background: #0d0808;
    border: 2px solid #441111;
    padding: 16px;
    font-size: 10px;
    color: #bbb;
    line-height: 1.8;
    text-align: left;
    margin-bottom: 24px;
}

.instructions-box span {
    color: #ffff44;
}

.btn-doom {
    display: inline-block;
    background: #8b0000;
    color: #ffffff;
    border: 3px solid #ff4444;
    padding: 14px 28px;
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 4px 4px 0 #3a0000;
    text-shadow: 2px 2px #000;
    transition: transform 0.1s, background 0.1s;
    margin: 8px;
}

.btn-doom:hover {
    background: #b30000;
    transform: scale(1.05);
}

.btn-doom:active {
    transform: translateY(2px);
    box-shadow: 2px 2px 0 #3a0000;
}

/* Settings Form */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0;
    font-size: 10px;
    color: #eee;
}

.setting-row input[type="range"] {
    width: 160px;
    accent-color: #ff2200;
}

/* ===================================================
   MOBILE VIRTUAL CONTROLS
   =================================================== */

#mobile-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 90px);
    pointer-events: none;
    z-index: 28;
}

#mobile-controls.hidden {
    display: none;
}

/* Left Virtual Joystick */
#joystick-base {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: auto;
}

#joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 50, 50, 0.6);
    border: 2px solid #ff4444;
    border-radius: 50%;
}

/* Right Swipe Look Zone */
#mobile-look-zone {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 60%;
    pointer-events: auto;
}

/* Right Action Buttons */
.mobile-action-buttons {
    position: absolute;
    bottom: 25px;
    right: 25px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: auto;
}

.btn-mobile-act {
    background: rgba(40, 40, 40, 0.7);
    border: 2px solid #ff4444;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

.btn-mobile-fire {
    background: rgba(200, 0, 0, 0.85);
    border-color: #ffbb00;
    padding: 18px 24px;
    font-size: 14px;
    font-weight: bold;
}

.mobile-weapon-row {
    display: flex;
    gap: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #doom-hud {
        height: 75px;
    }
    .hud-stat-box {
        min-width: 65px;
        padding: 0 6px;
    }
    .hud-value {
        font-size: 22px;
    }
    .hud-face-box {
        width: 60px;
        height: 60px;
    }
    #doomguy-face {
        width: 50px;
        height: 54px;
    }
    .doom-title {
        font-size: 24px;
    }
}
