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

body {
    background: #0a0a0f;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', monospace;
    padding: 10px;
}

#game-container {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 4px solid #4a2c82;
    border-radius: 8px;
    box-shadow: 
        0 0 20px rgba(74, 44, 130, 0.5),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    max-width: 100%;
}

#title-bar {
    background: linear-gradient(90deg, #2d1b4e, #4a2c82, #2d1b4e);
    color: #ffd93d;
    text-align: center;
    padding: 12px;
    font-size: 16px;
    letter-spacing: 4px;
    text-shadow: 2px 2px 0 #000;
    border-bottom: 3px solid #ffd93d;
}

#dialogue-bar {
    background: #000;
    color: #4ecdc4;
    padding: 12px 16px;
    min-height: 48px;
    font-size: 10px;
    line-height: 1.6;
    border-bottom: 2px solid #333;
    text-shadow: 0 0 10px #4ecdc4;
}

#canvas {
    display: block;
    background: #0d0d15;
    cursor: crosshair;
    max-width: 100%;
    height: auto;
}

#ui-container {
    display: flex;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d15 100%);
    padding: 10px;
    gap: 10px;
    border-top: 2px solid #333;
    flex-wrap: wrap;
    justify-content: space-between;
}

#verb-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.verb-btn {
    background: linear-gradient(180deg, #3d2466 0%, #2d1b4e 100%);
    color: #ccc;
    border: 2px solid #4a2c82;
    padding: 10px 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.1s;
    text-shadow: 1px 1px 0 #000;
}

.verb-btn:hover {
    background: linear-gradient(180deg, #4a2c82 0%, #3d2466 100%);
    color: #fff;
}

.verb-btn.active {
    background: linear-gradient(180deg, #6b3fa0 0%, #4a2c82 100%);
    color: #ffd93d;
    border-color: #ffd93d;
    box-shadow: 0 0 10px rgba(255, 217, 61, 0.5);
}

#action-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffd93d;
    font-size: 10px;
    text-align: center;
    padding: 10px;
    min-width: 150px;
    text-shadow: 0 0 10px rgba(255, 217, 61, 0.5);
}

#inventory-panel {
    flex: 1;
    min-width: 200px;
}

#inventory-slots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.inventory-slot {
    width: 48px;
    height: 48px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d15 100%);
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
}

.inventory-slot:hover {
    border-color: #4ecdc4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.inventory-slot.selected {
    border-color: #ffd93d;
    box-shadow: 0 0 15px rgba(255, 217, 61, 0.7);
}

.inventory-slot img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
}

#controls-info {
    background: #0a0a0f;
    color: #666;
    text-align: center;
    padding: 8px;
    font-size: 8px;
    border-top: 1px solid #222;
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 808px;
    padding: 15px 10px;
    color: #666;
    font-size: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

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

footer a:hover {
    text-decoration: underline;
}

#game-controls {
    display: flex;
    gap: 8px;
}

#game-controls button {
    background: #1a1a2e;
    color: #4ecdc4;
    border: 1px solid #333;
    padding: 6px 10px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#game-controls button:hover {
    background: #2d1b4e;
    border-color: #4ecdc4;
}

/* Win Screen */
#win-screen {
    position: fixed;
    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: 1000;
}

#win-screen.hidden {
    display: none;
}

#win-content {
    background: linear-gradient(180deg, #2d1b4e 0%, #1a1a2e 100%);
    border: 4px solid #ffd93d;
    padding: 40px;
    text-align: center;
    max-width: 90%;
    animation: winPulse 1s ease-in-out infinite alternate;
}

@keyframes winPulse {
    from { box-shadow: 0 0 20px rgba(255, 217, 61, 0.5); }
    to { box-shadow: 0 0 40px rgba(255, 217, 61, 0.8); }
}

#win-content h1 {
    color: #ffd93d;
    font-size: 18px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

#win-content p {
    color: #4ecdc4;
    font-size: 10px;
    margin: 15px 0;
    line-height: 1.8;
}

#play-again-btn {
    background: linear-gradient(180deg, #4ecdc4 0%, #26a69a 100%);
    color: #000;
    border: none;
    padding: 15px 30px;
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s;
}

#play-again-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.7);
}

.win-footer {
    margin-top: 30px !important;
    color: #666 !important;
    font-size: 8px !important;
}

.win-footer a {
    color: #4ecdc4;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 850px) {
    #canvas {
        width: 100%;
        height: auto;
    }
    
    #ui-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    #verb-panel {
        order: 2;
    }
    
    #action-display {
        order: 1;
    }
    
    #inventory-panel {
        order: 3;
    }
    
    #inventory-slots {
        justify-content: center;
    }
    
    .verb-btn {
        padding: 12px;
        font-size: 10px;
    }
    
    footer {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 500px) {
    #title-bar {
        font-size: 12px;
        letter-spacing: 2px;
    }
    
    #dialogue-bar {
        font-size: 8px;
        padding: 10px;
    }
    
    .inventory-slot {
        width: 40px;
        height: 40px;
    }
    
    .inventory-slot img {
        width: 28px;
        height: 28px;
    }
    
    #win-content h1 {
        font-size: 14px;
    }
}