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

body {
    font-family: 'JetBrains Mono', monospace;
    background: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
}

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

/* Landing Screen */
#landing-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, 
        #0d1b2a 0%, 
        #1b3a4b 30%, 
        #065a60 60%, 
        #0b525b 100%);
    z-index: 100;
}

#title-container {
    text-align: center;
    margin-bottom: 40px;
}

#main-title {
    font-family: 'Uncial Antiqua', serif;
    font-size: clamp(2rem, 8vw, 5rem);
    color: #f4a261;
    text-shadow: 
        0 0 20px rgba(244, 162, 97, 0.5),
        4px 4px 0 #8b0000;
    letter-spacing: 4px;
    opacity: 0;
    animation: flicker 3s infinite;
}

#sub-title {
    font-family: 'Uncial Antiqua', serif;
    font-size: clamp(1rem, 4vw, 2.5rem);
    color: #e63946;
    text-shadow: 2px 2px 0 #8b0000;
    letter-spacing: 8px;
    opacity: 0;
}

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

#survivor-count {
    font-size: 1.2rem;
    color: #a8dadc;
    margin-bottom: 30px;
}

#count-number {
    font-size: 2rem;
    color: #e63946;
    font-weight: bold;
}

#name-input-container {
    margin-bottom: 20px;
}

#player-name {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #457b9d;
    padding: 15px 25px;
    font-size: 1.1rem;
    color: #a8dadc;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 5px;
    text-align: center;
    width: 280px;
    transition: all 0.3s;
}

#player-name:focus {
    outline: none;
    border-color: #f4a261;
    box-shadow: 0 0 20px rgba(244, 162, 97, 0.3);
}

#player-name::placeholder {
    color: #457b9d;
}

#start-button {
    background: linear-gradient(180deg, #8b0000, #5a0000);
    border: 3px solid #f4a261;
    color: #f4a261;
    font-family: 'Uncial Antiqua', serif;
    font-size: 1.5rem;
    padding: 20px 50px;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 2px 2px 0 #000;
    letter-spacing: 2px;
}

#start-button:hover {
    background: linear-gradient(180deg, #a00000, #6a0000);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.5);
}

/* Game Screen */
#game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

#scene-container canvas {
    display: block;
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#status-bars {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-icon {
    font-size: 1.2rem;
    width: 25px;
}

.bar-container {
    width: 120px;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #333;
    border-radius: 3px;
    overflow: hidden;
}

.bar {
    height: 100%;
    transition: width 0.3s;
}

.health-bar {
    background: linear-gradient(90deg, #8b0000, #e63946);
    width: 100%;
}

.hunger-bar {
    background: linear-gradient(90deg, #b5651d, #f4a261);
    width: 100%;
}

.sanity-bar {
    background: linear-gradient(90deg, #4a0080, #9b59b6);
    width: 100%;
}

#survival-info {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 5px;
}

#survivors-remaining {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.3rem;
}

#weather-icon {
    font-size: 1.5rem;
}

#inventory {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    pointer-events: auto;
}

.inv-slot {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #457b9d;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.inv-slot:hover {
    border-color: #f4a261;
    transform: scale(1.1);
}

#action-prompt {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    color: #f4a261;
    white-space: nowrap;
}

#minimap {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 100px;
    height: 100px;
    border: 3px solid #457b9d;
    border-radius: 50%;
    overflow: hidden;
    background: #1a1a2e;
}

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

/* Mobile Controls */
#mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    pointer-events: auto;
}

@media (max-width: 768px) {
    #mobile-controls {
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
    }
    
    #inventory {
        bottom: 160px;
    }
    
    .inv-slot {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
    
    #action-prompt {
        bottom: 220px;
    }
}

#joystick-zone {
    width: 120px;
    height: 120px;
}

#joystick-base {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#joystick-stick {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transition: transform 0.05s;
}

#action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(244, 162, 97, 0.7);
    border: 3px solid #f4a261;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Faction Panel */
#faction-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 30, 0.95);
    border: 3px solid #457b9d;
    padding: 30px;
    border-radius: 10px;
    min-width: 300px;
    pointer-events: auto;
    z-index: 50;
}

#faction-panel h3 {
    text-align: center;
    color: #f4a261;
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-family: 'Uncial Antiqua', serif;
}

#faction-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.faction-member {
    padding: 8px;
    margin: 5px 0;
    border-radius: 3px;
    font-size: 0.9rem;
}

.faction-member.ralph {
    background: rgba(69, 123, 157, 0.3);
    border-left: 3px solid #457b9d;
}

.faction-member.jack {
    background: rgba(139, 0, 0, 0.3);
    border-left: 3px solid #8b0000;
}

#faction-buttons {
    display: flex;
    gap: 10px;
}

.faction-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

#join-ralph {
    background: #457b9d;
    color: #fff;
}

#join-ralph:hover {
    background: #5a9bc5;
}

#join-jack {
    background: #8b0000;
    color: #fff;
}

#join-jack:hover {
    background: #a50000;
}

/* Chat */
#chat-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 280px;
    pointer-events: auto;
}

#chat-messages {
    height: 120px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 5px 5px 0 0;
    font-size: 0.85rem;
}

.chat-message {
    margin-bottom: 5px;
    line-height: 1.3;
}

#chat-input {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #457b9d;
    border-top: none;
    border-radius: 0 0 5px 5px;
    color: #a8dadc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

#chat-input:focus {
    outline: none;
    border-color: #f4a261;
}

@media (max-width: 768px) {
    #chat-box {
        display: none;
    }
}

/* Death Screen */
#death-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#death-message {
    font-family: 'Uncial Antiqua', serif;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #8b0000;
    text-shadow: 0 0 30px rgba(139, 0, 0, 0.8);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

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

#death-cause {
    font-size: 1.2rem;
    color: #a8dadc;
    margin-bottom: 40px;
}

#death-screen button {
    margin: 10px;
    padding: 15px 40px;
    font-family: 'Uncial Antiqua', serif;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
}

#respawn-button {
    background: #8b0000;
    border: 2px solid #f4a261;
    color: #f4a261;
}

#respawn-button:hover {
    background: #a50000;
    transform: scale(1.05);
}

#spectate-button {
    background: transparent;
    border: 2px solid #457b9d;
    color: #457b9d;
}

#spectate-button:hover {
    background: rgba(69, 123, 157, 0.2);
}

/* Footer */
#game-footer {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    z-index: 10;
}

#game-footer a {
    color: rgba(244, 162, 97, 0.6);
    text-decoration: none;
}

#game-footer a:hover {
    color: #f4a261;
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #457b9d;
    border-radius: 3px;
}