/* Game container and canvas */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    /* Prevent iOS scroll/bounce */
    overflow: hidden;
    touch-action: manipulation;
    box-sizing: border-box;
}

#game-container canvas {
    /* Phaser canvas styling - HD smooth rendering */
    image-rendering: auto;
    image-rendering: smooth;
    -webkit-image-rendering: auto;
}

#game-canvas {
    /* Canvas will be sized by JavaScript to maintain aspect ratio */
    image-rendering: auto;
    image-rendering: smooth;
    background-color: #1a1a2e;
}

/* Cursor styles */
#game-canvas.cursor-default {
    cursor: default;
}

#game-canvas.cursor-walk {
    cursor: pointer;
}

#game-canvas.cursor-look {
    cursor: help;
}

#game-canvas.cursor-interact {
    cursor: pointer;
}

/* Debug overlay (toggle with F12 or similar) */
#debug-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #0f0;
    font-family: monospace;
    font-size: 12px;
    padding: 10px;
    border-radius: 4px;
    z-index: 500;
    pointer-events: none;
}

#debug-overlay p {
    margin: 2px 0;
}

/* Text input for parser (Phase 3) */
#text-input-container {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* On iOS/mobile, move input below inventory */
@supports (-webkit-touch-callout: none) {
    #text-input-container {
        bottom: auto;
        top: 80px;
    }
}

#text-input {
    width: 400px;
    padding: 10px 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #c4a35a;
    border-radius: 4px;
    color: #e0e0e0;
    outline: none;
}

#text-input:focus {
    border-color: #f0d78c;
    box-shadow: 0 0 10px rgba(196, 163, 90, 0.3);
}

#text-input::placeholder {
    color: #666;
}

/* Inventory panel (Phase 4) */
#inventory-panel,
.inventory-panel {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    height: 60px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 100%);
    border: 2px solid #c4a35a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 50;
}

.inventory-slot {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    margin: 0 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.1s;
}

.inventory-slot:hover {
    border-color: #c4a35a;
    transform: scale(1.05);
}

.inventory-slot.selected {
    border-color: #f0d78c;
    box-shadow: 0 0 8px rgba(196, 163, 90, 0.5);
}

.inventory-slot img {
    max-width: 40px;
    max-height: 40px;
    image-rendering: auto;
}

.inventory-slot.empty {
    background: rgba(26, 26, 46, 0.4);
    border-color: #333;
    cursor: default;
}

.inventory-slot.empty:hover {
    transform: none;
    border-color: #333;
}

.inventory-slot .item-name {
    font-size: 9px;
    color: #c4a35a;
    text-align: center;
    word-break: break-word;
    padding: 2px;
}

.inventory-slot .item-quantity,
.inventory-slot .quantity {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #c4a35a;
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 3px;
}

.inventory-label {
    color: #c4a35a;
    font-size: 12px;
    margin-right: 10px;
    white-space: nowrap;
}

.inventory-slots {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    flex: 1;
}

.inventory-selected {
    color: #f0d78c;
    font-size: 11px;
    margin-left: 10px;
    white-space: nowrap;
    padding: 5px 10px;
    background: rgba(196, 163, 90, 0.2);
    border-radius: 4px;
    display: none;
}

.inventory-selected.active {
    display: block;
}

/* Responsive scaling */
@media (max-width: 800px) {
    .loading-content h1 {
        font-size: 1.8rem;
    }

    .loading-bar {
        width: 250px;
    }

    #text-input {
        width: 90%;
        max-width: 350px;
    }

    .message-content {
        max-width: 90%;
        padding: 12px 18px;
    }

    #message-text {
        font-size: 0.9rem;
    }
}
