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

body {
    background: linear-gradient(135deg, #0d0908 0%, #1a1510 50%, #0d0908 100%);
    color: #c4b998;
    font-family: 'VT323', monospace;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    display: flex;
    height: calc(100vh - 80px);
    padding: 10px;
    gap: 10px;
}

#canvas {
    background: #000;
    border: 3px solid #3d3428;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8), inset 0 0 50px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

#ui-panel {
    width: 280px;
    min-width: 240px;
    background: linear-gradient(180deg, #1a1510 0%, #0d0908 100%);
    border: 3px solid #3d3428;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

#header {
    text-align: center;
    border-bottom: 2px solid #3d3428;
    padding-bottom: 10px;
}

#header h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #ffd700;
    text-shadow: 2px 2px 0 #8b4513, -1px -1px 0 #000;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

#floor-display {
    font-size: 24px;
    color: #22d3ee;
}

#stats-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.stat-label {
    width: 60px;
    font-size: 16px;
    color: #888;
}

.bar-container {
    flex: 1;
    height: 20px;
    background: #1a1510;
    border: 2px solid #3d3428;
    border-radius: 2px;
    overflow: hidden;
}

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

.bar.hp {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

.bar.hunger {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
}

.bar.critical {
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

.stat-value {
    width: 60px;
    text-align: right;
    font-size: 16px;
}

#equipment-section, #inventory-section {
    border: 2px solid #3d3428;
    border-radius: 4px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
}

#equipment-section h2, #inventory-section h2, #event-log h2 {
    font-size: 16px;
    color: #ffd700;
    margin-bottom: 10px;
    border-bottom: 1px solid #3d3428;
    padding-bottom: 5px;
}

.equip-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #1a1510;
    border: 1px solid #3d3428;
    border-radius: 2px;
    margin-bottom: 5px;
}

.slot-icon {
    font-size: 20px;
}

#weapon-name, #armor-name {
    flex: 1;
    font-size: 14px;
}

#weapon-stat, #armor-stat {
    font-size: 12px;
    color: #22c55e;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.inv-slot {
    aspect-ratio: 1;
    background: #1a1510;
    border: 2px solid #3d3428;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.inv-slot:hover {
    transform: scale(1.1);
}

.inv-slot.selected {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

#item-description {
    font-size: 14px;
    text-align: center;
    padding: 5px;
    min-height: 24px;
}

#event-log {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#log-container {
    flex: 1;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.4;
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(61,52,40,0.3);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

#controls-display {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    font-size: 11px;
    color: #666;
    border-top: 1px solid #3d3428;
    padding-top: 10px;
}

#controls-display span {
    background: #1a1510;
    padding: 3px 6px;
    border-radius: 2px;
    border: 1px solid #3d3428;
}

#bottom-bar {
    height: 60px;
    background: #1a1510;
    border-top: 3px solid #3d3428;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

#seed-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

#seed-section label {
    font-size: 16px;
    color: #888;
}

#seed-input {
    background: #0d0908;
    border: 2px solid #3d3428;
    border-radius: 4px;
    color: #c4b998;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding: 8px 12px;
    width: 150px;
}

#seed-input:focus {
    outline: none;
    border-color: #ffd700;
}

button {
    background: linear-gradient(180deg, #3d3428 0%, #1a1510 100%);
    border: 2px solid #ffd700;
    border-radius: 4px;
    color: #ffd700;
    font-family: 'VT323', monospace;
    font-size: 18px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    background: linear-gradient(180deg, #4a4035 0%, #2a2520 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255,215,0,0.3);
}

button:active {
    transform: translateY(0);
}

#new-run {
    font-size: 20px;
    padding: 12px 30px;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#overlay-content {
    background: linear-gradient(180deg, #1a1510 0%, #0d0908 100%);
    border: 4px solid #3d3428;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
}

#overlay-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

#overlay-text {
    font-size: 18px;
    margin-bottom: 20px;
    color: #c4b998;
}

#overlay-stats {
    font-size: 16px;
    color: #888;
    margin-bottom: 30px;
    line-height: 1.8;
}

#overlay-stats div {
    border-bottom: 1px solid #3d3428;
    padding: 5px 0;
}

#overlay-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.hidden {
    display: none !important;
}

footer {
    position: fixed;
    bottom: 70px;
    right: 20px;
    z-index: 100;
}

footer a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

footer a:hover {
    color: #ffd700;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #game-container {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    #canvas {
        width: 100% !important;
        height: auto !important;
        max-height: 50vh;
    }
    
    #ui-panel {
        width: 100%;
        min-height: 200px;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    #header {
        width: 100%;
    }
    
    #stats-section {
        width: 50%;
    }
    
    #equipment-section {
        width: 45%;
    }
    
    #event-log {
        width: 100%;
        max-height: 100px;
    }
    
    #controls-display {
        display: none;
    }
    
    #bottom-bar {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 10px;
    }
    
    #seed-section {
        width: 100%;
        justify-content: center;
    }
    
    footer {
        bottom: auto;
        top: 10px;
    }
}

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

::-webkit-scrollbar-track {
    background: #0d0908;
}

::-webkit-scrollbar-thumb {
    background: #3d3428;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4035;
}