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

body {
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    font-family: 'Press Start 2P', monospace;
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

#game-container {
    width: 100%;
    max-width: 800px;
    background: #0a0a14;
    border: 4px solid #2d2d44;
    border-radius: 4px;
    box-shadow: 
        0 0 20px rgba(0, 212, 255, 0.2),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

#canvas {
    display: block;
    width: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #1a1a2e;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

#dialogue-box {
    display: none;
    background: rgba(0, 0, 0, 0.85);
    color: #00d4ff;
    padding: 12px 16px;
    margin: 10px;
    border: 2px solid #2d2d44;
    font-size: 10px;
    line-height: 1.6;
    text-shadow: 2px 2px 0 #000;
    pointer-events: auto;
    cursor: pointer;
    max-height: 40%;
    overflow-y: auto;
}

#action-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: #ffd700;
    padding: 8px 12px;
    font-size: 9px;
    text-align: center;
    text-shadow: 1px 1px 0 #000;
}

#bottom-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 10px;
    background: linear-gradient(to bottom, #1a1a2e, #0d0d1a);
    border-top: 2px solid #2d2d44;
}

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

.verb-btn {
    background: #2d2d44;
    border: 2px solid #3d3d5c;
    color: #a0a0c0;
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    padding: 8px 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s ease;
}

.verb-btn:hover {
    background: #3d3d5c;
    color: #00d4ff;
    border-color: #00d4ff;
}

.verb-btn.selected {
    background: #00d4ff;
    color: #0a0a14;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#status-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    min-width: 100px;
}

#scene-name {
    font-size: 7px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
}

#iq-display {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
}

.iq-label {
    display: block;
    font-size: 10px;
    color: #0a0a14;
    font-weight: bold;
}

#iq-points {
    display: block;
    font-size: 14px;
    color: #0a0a14;
    font-weight: bold;
}

#inventory-panel {
    background: #2d2d44;
    border: 2px solid #3d3d5c;
    border-radius: 4px;
    padding: 8px;
    min-height: 60px;
}

#inventory-label {
    font-size: 6px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 6px;
}

#inventory-slots {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 36px;
}

.inventory-item {
    width: 36px;
    height: 36px;
    background: #1a1a2e;
    border: 2px solid #3d3d5c;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.inventory-item:hover {
    border-color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

.inventory-item.selected {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    background: #3d3d5c;
}

.inventory-item img {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#footer {
    margin-top: 15px;
    font-size: 8px;
    color: #555;
}

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

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

/* Mobile adjustments */
@media (max-width: 600px) {
    body {
        padding: 5px;
    }
    
    #bottom-panel {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    #verb-panel {
        order: 1;
    }
    
    #status-panel {
        order: 2;
        flex-direction: row;
        justify-content: space-between;
        padding: 8px;
        background: #2d2d44;
        border-radius: 4px;
    }
    
    #inventory-panel {
        order: 3;
    }
    
    .verb-btn {
        padding: 12px 8px;
        font-size: 8px;
    }
    
    #dialogue-box {
        font-size: 9px;
        padding: 10px;
    }
}

/* Scanline effect */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
}

/* CRT glow effect */
@keyframes flicker {
    0% { opacity: 0.97; }
    50% { opacity: 1; }
    100% { opacity: 0.98; }
}

#canvas {
    animation: flicker 0.15s infinite;
}