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

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 640px;
    width: 100%;
    padding: 10px;
}

#canvas {
    border: 4px solid #4a3c2a;
    border-radius: 4px;
    image-rendering: pixelated;
    background: #1a1a2e;
    box-shadow: 
        0 0 0 2px #2a2a4a,
        0 0 20px rgba(255, 107, 53, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    gap: 20px;
}

.loading-text {
    color: #c4a35a;
    font-size: 10px;
    text-transform: uppercase;
    animation: pulse 1.5s infinite;
}

.loading-bar {
    width: 200px;
    height: 12px;
    background: #2a2a4a;
    border: 2px solid #4a3c2a;
    border-radius: 2px;
    overflow: hidden;
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff6b35, #c4a35a);
    animation: loadingAnim 2s infinite;
}

@keyframes loadingAnim {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

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

#action-bar {
    width: 100%;
    max-width: 640px;
    background: #1a1a2e;
    border: 2px solid #4a3c2a;
    border-top: none;
    padding: 8px 12px;
    color: #fff;
    font-size: 8px;
    text-align: center;
    text-transform: uppercase;
}

#ui-panel {
    display: flex;
    width: 100%;
    max-width: 640px;
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 2px solid #4a3c2a;
    border-top: none;
    padding: 8px;
    gap: 8px;
}

#verb-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    flex: 1;
}

.verb-btn {
    background: linear-gradient(180deg, #c4a35a 0%, #8b7335 100%);
    border: 2px solid #4a3c2a;
    border-radius: 2px;
    color: #1a1a2e;
    font-family: 'Press Start 2P', cursive;
    font-size: 6px;
    padding: 6px 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s;
}

.verb-btn:hover {
    background: linear-gradient(180deg, #d4b36a 0%, #9b8345 100%);
    transform: translateY(-1px);
}

.verb-btn.selected {
    background: linear-gradient(180deg, #ff6b35 0%, #cc5528 100%);
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

#inventory-panel {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1.2;
}

.inv-arrow {
    background: #4a3c2a;
    border: 2px solid #c4a35a;
    border-radius: 2px;
    color: #c4a35a;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 8px 6px;
    cursor: pointer;
}

.inv-arrow:hover {
    background: #5a4c3a;
}

#inventory-slots {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.inv-slot {
    width: 36px;
    height: 36px;
    background: #1a1a2e;
    border: 2px solid #4a3c2a;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
}

.inv-slot:hover {
    border-color: #c4a35a;
}

.inv-slot.selected {
    border-color: #ff6b35;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

.inv-slot.empty {
    cursor: default;
    opacity: 0.5;
}

.inv-slot img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
}

#dialogue-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2a2a4a 0%, #1a1a2e 100%);
    border: 4px solid #c4a35a;
    border-radius: 4px;
    padding: 20px;
    max-width: 90%;
    width: 400px;
    z-index: 50;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

#dialogue-box.hidden {
    display: none;
}

#dialogue-text {
    color: #fff;
    font-size: 8px;
    line-height: 1.8;
    margin-bottom: 15px;
    text-align: center;
}

#dialogue-options {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dialogue-btn {
    background: linear-gradient(180deg, #c4a35a 0%, #8b7335 100%);
    border: 2px solid #4a3c2a;
    border-radius: 2px;
    color: #1a1a2e;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    padding: 8px 16px;
    cursor: pointer;
    text-transform: uppercase;
}

.dialogue-btn:hover {
    background: linear-gradient(180deg, #ff6b35 0%, #cc5528 100%);
    color: #fff;
}

#controls-bar {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

#controls-bar button {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid #4a3c2a;
    border-radius: 4px;
    color: #c4a35a;
    font-size: 14px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

#controls-bar button:hover {
    border-color: #c4a35a;
    background: rgba(74, 60, 42, 0.9);
}

#footer {
    margin-top: 10px;
    font-size: 6px;
    color: #4a3c2a;
}

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

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

@media (max-width: 480px) {
    #game-container {
        padding: 5px;
    }
    
    .verb-btn {
        font-size: 5px;
        padding: 5px 2px;
    }
    
    .inv-slot {
        width: 28px;
        height: 28px;
    }
    
    .inv-slot img {
        width: 22px;
        height: 22px;
    }
    
    #action-bar {
        font-size: 6px;
        padding: 6px 8px;
    }
    
    #dialogue-text {
        font-size: 7px;
    }
    
    .dialogue-btn {
        font-size: 6px;
        padding: 6px 12px;
    }
    
    #controls-bar button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}