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

body {
    background: #0a0505;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
    color: #ffd700;
}

#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #4B0082 0%, #663399 25%, #8B4513 50%, #CD853F 75%, #FF8C00 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.title-container {
    text-align: center;
    margin-bottom: 60px;
    animation: titlePulse 2s ease-in-out infinite;
}

.title {
    font-size: clamp(2rem, 8vw, 5rem);
    text-shadow: 
        0 0 10px #ff6600,
        0 0 20px #ff3300,
        0 0 40px #ff0000,
        4px 4px 0 #000;
    letter-spacing: 0.2em;
    margin: 10px 0;
    color: #FFD700;
}

.title.doom {
    font-size: clamp(3rem, 12vw, 8rem);
    color: #ff0000;
    text-shadow: 
        0 0 20px #ff0000,
        0 0 40px #990000,
        0 0 60px #660000,
        6px 6px 0 #000;
}

.subtitle {
    font-size: clamp(0.5rem, 1.5vw, 0.9rem);
    color: #DAA520;
    letter-spacing: 0.4em;
    margin-top: 20px;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.start-prompt {
    font-size: clamp(0.6rem, 1.8vw, 1rem);
    color: #fff;
    margin-bottom: 40px;
}

.blink {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.controls-info {
    font-size: clamp(0.35rem, 1vw, 0.6rem);
    color: #ccc;
    text-align: center;
    line-height: 2.2;
}

.footer-link {
    position: absolute;
    bottom: 20px;
    font-size: 0.55rem;
    color: #888;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: #ff6b6b;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

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

#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #fff;
    text-shadow: 0 0 4px #000, 0 0 2px #000;
    pointer-events: none;
    z-index: 10;
}

/* Enhanced Doom-style HUD */
#hud {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 85px;
    background: linear-gradient(180deg, #4a3828 0%, #3d2817 30%, #2a1b0f 70%, #1a0f08 100%);
    border-top: 4px solid #8b5a2b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 10;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.9), inset 0 2px 0 rgba(255,200,100,0.1);
}

.hud-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.3);
    padding: 6px 12px;
    border: 2px solid #5a4030;
    min-width: 70px;
}

.hud-label {
    font-size: clamp(0.35rem, 0.9vw, 0.5rem);
    color: #8b7355;
    letter-spacing: 0.1em;
}

.hud-value {
    font-size: clamp(0.9rem, 2.5vw, 1.5rem);
    color: #ff0000;
    text-shadow: 0 0 8px #ff0000, 2px 2px 0 #000;
}

.hud-percent {
    font-size: clamp(0.4rem, 1vw, 0.6rem);
    color: #ff0000;
}

.hud-arms {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.3);
    padding: 6px 10px;
    border: 2px solid #5a4030;
}

.arms-slots {
    display: flex;
    gap: 4px;
}

.arm-slot {
    width: 22px;
    height: 22px;
    background: #2a1b0f;
    border: 2px solid #5a4030;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #666;
}

.arm-slot.active {
    background: #5a3020;
    border-color: #ff6600;
    color: #ffd700;
    box-shadow: 0 0 8px rgba(255,102,0,0.5);
}

.hud-face {
    width: 65px;
    height: 65px;
    background: #3d2817;
    border: 3px solid #8b5a2b;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.hud-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.hud-face.healthy {
    border-color: #00aa00;
    box-shadow: 0 0 10px rgba(0,170,0,0.3);
}

.hud-face.hurt {
    border-color: #aaaa00;
    box-shadow: 0 0 10px rgba(170,170,0,0.3);
}

.hud-face.critical {
    border-color: #ff0000;
    box-shadow: 0 0 10px rgba(255,0,0,0.5);
    animation: faceFlash 0.5s infinite;
}

@keyframes faceFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Weapon Display */
#weapon-container {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    height: 180px;
    pointer-events: none;
    z-index: 5;
}

.weapon {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.weapon.active {
    display: flex;
}

#weapon-container.attacking .weapon {
    animation: weaponAttack 0.15s ease-out;
}

@keyframes weaponAttack {
    0% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-15px) rotate(-8deg); }
    100% { transform: translateY(0) rotate(0); }
}

/* Tablet weapon - hands holding cuneiform tablet */
#tablet-weapon {
    position: relative;
}

#tablet-weapon img {
    image-rendering: pixelated;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}

.tablet-left-hand {
    position: absolute;
    bottom: 0;
    left: 30px;
    width: 70px;
    height: 70px;
    z-index: 1;
}

.tablet-main {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 100px;
    z-index: 2;
}

.tablet-right-hand {
    position: absolute;
    bottom: 10px;
    right: 30px;
    width: 70px;
    height: 70px;
    z-index: 3;
}

#bow-weapon img,
#staff-weapon img {
    width: 160px;
    height: 160px;
    image-rendering: pixelated;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.5));
}

#notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(0.7rem, 1.8vw, 1rem);
    color: #ffd700;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 20;
    pointer-events: none;
    text-align: center;
}

#damage-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(180,0,0,0.9) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 15;
}

#pause-menu,
#game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10,5,5,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    z-index: 100;
}

#pause-menu h2,
#game-over h2 {
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000, 4px 4px 0 #000;
}

#game-over p {
    font-size: clamp(0.45rem, 1.3vw, 0.7rem);
    color: #888;
    text-align: center;
    max-width: 80%;
}

.controls-help {
    font-size: clamp(0.4rem, 1vw, 0.55rem);
    color: #666;
    text-align: center;
    line-height: 2;
    margin-top: 10px;
}

button {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.55rem, 1.3vw, 0.9rem);
    padding: 14px 28px;
    background: linear-gradient(180deg, #8B4513 0%, #5a2d0a 100%);
    border: 3px solid #DAA520;
    color: #ffd700;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 1px 1px 0 #000;
}

button:hover {
    background: linear-gradient(180deg, #a05015 0%, #6a3510 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(218,165,32,0.5);
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a0a15 0%, #0a0505 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    z-index: 200;
}

.loading-text {
    font-size: clamp(0.55rem, 1.4vw, 0.9rem);
    color: #ffd700;
    animation: blink 0.6s infinite;
}

.loading-detail {
    font-size: clamp(0.4rem, 1vw, 0.6rem);
    color: #888;
}

.loading-bar {
    width: 65%;
    max-width: 420px;
    height: 22px;
    background: #1a0f08;
    border: 3px solid #8b5a2b;
}

.loading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8B0000, #ff3300, #ff6600, #ffd700);
    transition: width 0.3s;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #hud {
        height: 70px;
        padding: 0 8px;
    }
    
    .hud-section {
        padding: 4px 8px;
        min-width: 55px;
    }
    
    .hud-face {
        width: 50px;
        height: 50px;
    }
    
    #weapon-container {
        width: 200px;
        height: 130px;
        bottom: 70px;
    }
    
    .tablet-main {
        width: 100px;
        height: 70px;
    }
    
    .tablet-left-hand,
    .tablet-right-hand {
        width: 50px;
        height: 50px;
    }
    
    #bow-weapon img,
    #staff-weapon img {
        width: 120px;
        height: 120px;
    }
    
    .controls-info {
        display: none;
    }
    
    .hud-arms {
        display: none;
    }
}

@media (max-width: 480px) {
    .hud-section.kills {
        display: none;
    }
    
    #weapon-container {
        width: 160px;
        height: 100px;
    }
}