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

body {
    font-family: 'Press Start 2P', cursive;
    background: #0d1a0c;
    color: #c4a35a;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    width: 100vw;
    height: calc(100vh - 40px);
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

/* Title Screen */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.title-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(180deg, #0d1a0c 0%, #1a3318 50%, #0d1a0c 100%),
        url('/api/retrodiffusion/image/128/128/mc_texture?prompt=dark+forest+trees+silhouette+night+scary&tile_x=true&tile_y=true');
    background-size: cover, 256px;
    animation: bgScroll 20s linear infinite;
}

@keyframes bgScroll {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 256px 256px; }
}

.title-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.title-logo {
    font-size: clamp(4rem, 15vw, 10rem);
    color: #8B4513;
    text-shadow: 
        0 0 20px #ff4400,
        0 0 40px #ff2200,
        4px 4px 0 #3d2817,
        8px 8px 0 #2a1c10;
    letter-spacing: 0.2em;
    animation: titlePulse 2s ease-in-out infinite;
    background: linear-gradient(180deg, #d4a574 0%, #8B4513 50%, #5c2e0f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 30px rgba(255, 68, 0, 0.5));
}

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

.subtitle {
    font-size: clamp(0.5rem, 2vw, 1rem);
    color: #7a9a6a;
    margin-top: 1rem;
    letter-spacing: 0.1em;
}

.beaver-silhouette {
    width: 120px;
    height: 120px;
    margin: 2rem auto;
    background: url('/api/retrodiffusion/image/64/64/game_asset?prompt=beaver+silhouette+holding+chainsaw+glowing+red+eyes+doom+style&remove_bg=true') center/contain no-repeat;
    filter: drop-shadow(0 0 20px #ff0000);
    animation: beaverFloat 3s ease-in-out infinite;
}

@keyframes beaverFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.start-button {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.6rem, 2vw, 1rem);
    padding: 1rem 2rem;
    background: linear-gradient(180deg, #8B4513 0%, #5c2e0f 100%);
    color: #ffd700;
    border: 4px solid #d4a574;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    box-shadow: 
        0 4px 0 #3d2817,
        0 0 20px rgba(255, 68, 0, 0.3);
    transition: all 0.1s ease;
    animation: buttonPulse 1.5s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 4px 0 #3d2817, 0 0 20px rgba(255, 68, 0, 0.3); }
    50% { box-shadow: 0 4px 0 #3d2817, 0 0 40px rgba(255, 68, 0, 0.6); }
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 0 #3d2817,
        0 0 30px rgba(255, 68, 0, 0.5);
}

.start-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #3d2817;
}

.instructions {
    margin-top: 2rem;
    font-size: 0.5rem;
    color: #5a7a4a;
    line-height: 2;
}

/* HUD */
#hud {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(180deg, transparent 0%, rgba(13, 26, 12, 0.95) 20%);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px 20px;
    z-index: 50;
}

.hud-left, .hud-right {
    flex: 1;
}

.hud-center {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ammo-display, .weapon-display {
    text-align: center;
}

.label {
    font-size: 0.5rem;
    color: #5a7a4a;
    display: block;
    margin-bottom: 4px;
}

.value {
    font-size: 1.5rem;
    text-shadow: 2px 2px 0 #000;
}

.value.health {
    color: #ff4444;
}

.value.armor {
    color: #44ff44;
}

.beaver-face {
    width: 60px;
    height: 60px;
    background: linear-gradient(180deg, #4a3728 0%, #2d2218 100%);
    border: 3px solid #8B4513;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.face-content {
    font-size: 2rem;
    filter: none;
}

.beaver-face.happy .face-content { filter: hue-rotate(0deg); }
.beaver-face.worried .face-content { filter: hue-rotate(30deg); }
.beaver-face.injured .face-content { filter: hue-rotate(60deg) saturate(1.5); }
.beaver-face.critical .face-content { animation: criticalPulse 0.3s infinite; }

@keyframes criticalPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stats {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.health-display, .armor-display {
    text-align: center;
}

.weapon-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.weapon-display img {
    width: 48px;
    height: 48px;
    image-rendering: pixelated;
}

.weapon-name {
    font-size: 0.5rem;
    color: #c4a35a;
    margin-top: 4px;
}

/* Weapon View */
#weapon-view {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    pointer-events: none;
}

#chainsaw-sprite {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 10px rgba(255, 100, 50, 0.5));
}

/* Damage Overlay */
#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 40%, rgba(255, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.1s;
}

/* Game Over */
.gameover-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: #ff2222;
    text-shadow: 
        0 0 20px #ff0000,
        4px 4px 0 #5c0000;
    animation: gameoverShake 0.5s infinite;
}

@keyframes gameoverShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Victory */
.victory-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    color: #44ff44;
    text-shadow: 
        0 0 20px #00ff00,
        4px 4px 0 #005c00;
}

.victory-subtitle {
    font-size: 0.8rem;
    color: #7a9a6a;
    margin: 1rem 0 2rem;
}

/* Mobile Controls */
#mobile-controls {
    position: absolute;
    bottom: 90px;
    left: 0;
    width: 100%;
    height: calc(100% - 90px);
    pointer-events: none;
    z-index: 45;
}

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

#joystick-base {
    width: 100%;
    height: 100%;
    background: rgba(139, 69, 19, 0.5);
    border: 3px solid rgba(212, 165, 116, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-stick {
    width: 50px;
    height: 50px;
    background: rgba(212, 165, 116, 0.8);
    border-radius: 50%;
    transition: transform 0.05s;
}

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

#attack-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    background: rgba(255, 50, 50, 0.6);
    border: 3px solid rgba(255, 100, 100, 0.8);
    border-radius: 50%;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
}

#attack-btn:active {
    background: rgba(255, 100, 100, 0.8);
    transform: scale(0.95);
}

/* Landscape Warning */
#landscape-warning {
    position: absolute;
    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;
    text-align: center;
    padding: 2rem;
}

#landscape-warning p {
    font-size: 1rem;
    color: #c4a35a;
    line-height: 2;
}

/* Footer */
#footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: #0d1a0c;
    border-top: 2px solid #3d2817;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.5rem;
    color: #5a7a4a;
    z-index: 1000;
}

#footer a {
    color: #7a9a6a;
    text-decoration: none;
}

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

.separator {
    color: #3d2817;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    #hud {
        height: 70px;
        padding: 5px 10px;
    }
    
    .value {
        font-size: 1rem;
    }
    
    .beaver-face {
        width: 45px;
        height: 45px;
    }
    
    .face-content {
        font-size: 1.5rem;
    }
    
    #chainsaw-sprite {
        width: 150px;
        height: 150px;
    }
    
    #weapon-view {
        bottom: 70px;
    }
    
    .weapon-display img {
        width: 36px;
        height: 36px;
    }
}