/* Reset default browser styles */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
}

/* Main app container */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f0f0f0; /* Light grey background */
}

/* Header section */
#app-header {
    text-align: center;
    background-color: #ffffff; /* White background */
    padding: 10px;
    border-bottom: 1px solid #ccc; /* Light grey border */
}

.header-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.header-mobile-bar {
    display: none;
}

.player-identity {
    min-width: 170px;
    max-width: 32%;
    text-align: left;
    line-height: 1.25;
}

.player-display-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-session-id {
    margin-top: 2px;
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-main-spacer {
    min-width: 170px;
    max-width: 32%;
}

.header-titles h1 {
    margin: 0;
    font-size: 24px;
    color: #333; /* Dark grey */
}

.header-titles h2 {
    margin: 0;
    font-size: 18px;
    color: #555; /* Medium grey */
}

/* Phone: quick mic/sound + hamburger */
@media (max-width: 767px) {
    #app-header {
        padding: 0;
        text-align: left;
    }

    .header-main-row {
        display: block;
    }

    .player-identity {
        max-width: none;
        padding: 8px 10px 0;
    }

    .header-main-spacer {
        display: none;
    }

    .header-mobile-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 10px;
        border-bottom: 1px solid #e0e0e0;
        background: #fafafa;
    }

    .menu-toggle {
        flex: 0 0 auto;
        width: 40px;
        height: 36px;
        padding: 0;
        font-size: 20px;
        line-height: 1;
        border: 1px solid #ccc;
        border-radius: 4px;
        background: #fff;
        cursor: pointer;
    }

    .header-mobile-bar .compact-button {
        flex: 1;
        min-width: 0;
        margin: 0;
        padding: 8px 6px;
        font-size: 11px;
    }

    .header-titles {
        padding: 8px 10px 10px;
        text-align: center;
    }

    .header-titles h1 {
        font-size: 18px;
    }

    .header-titles h2 {
        font-size: 14px;
    }

    .hide-on-phone {
        display: none !important;
    }

    /* Drawer: left panel off-canvas */
    #content-container {
        position: relative;
    }

    #player-inventory {
        position: fixed;
        top: 0;
        left: 0;
        width: min(300px, 88vw);
        height: 100%;
        max-height: 100vh;
        margin: 0;
        z-index: 1002;
        transform: translateX(-100%);
        transition: transform 0.22s ease-out;
        box-shadow: 4px 0 18px rgba(0, 0, 0, 0.15);
        border-right: 1px solid #ccc;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.drawer-open #player-inventory {
        transform: translateX(0);
    }

    .drawer-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1001;
        margin: 0;
        padding: 0;
        border: none;
        background: rgba(0, 0, 0, 0.35);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    body.drawer-open .drawer-backdrop {
        display: block;
    }

    #main-content {
        width: 100%;
        min-width: 0;
    }

    .prompt-text,
    .response-text {
        max-width: 92%;
    }
}

/* Desktop: hide drawer backdrop interaction */
@media (min-width: 768px) {
    .drawer-backdrop {
        display: none !important;
    }
}

/* Content container below the header */
#content-container {
    display: flex;
    flex: 1; /* Take up remaining vertical space */
    overflow: hidden;
}

/* Player inventory section on the left */
#player-inventory {
    width: 20%; /* Fixed width for inventory */
    display: flex;
    flex-direction: column;
    padding: 10px;
    background-color: #ffffff; /* White background */
    border-right: 1px solid #ccc; /* Divider */
    overflow: hidden;
}

#player-inventory h3 {
    text-align: center;
    margin: 0 0 10px;
}

.inventory-item-count {
    font-size: 0.85em;
    font-weight: normal;
    color: #666;
}

#left-panel-controls {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

#playback-speed-controls {
    margin-bottom: 8px;
    font-size: 12px;
}

#playback-speed-controls label {
    display: block;
    margin-bottom: 4px;
}

#playback-speed-slider {
    width: 100%;
    margin: 0;
}

.left-panel-section {
    min-height: 0;
    overflow-y: auto;
}

#inventory-section {
    flex: 13; /* ~65% of vertical space below controls */
    margin-top: 8px;
}

#exits-section {
    flex: 7; /* ~35% of vertical space */
    border-top: 1px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

#inventory-list,
#exits-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#inventory-list li,
#exits-list li {
    padding: 5px;
    margin-bottom: 5px;
    background-color: #e8eaf6; /* Light blue background */
    border-radius: 4px;
}

/* Main content area */
#main-content {
    display: flex;
    flex-direction: column;
    flex: 1; /* Take up remaining horizontal space */
    overflow: hidden; /* Prevent overflow */
}

/* Conversation area (dynamic height) */
#conversation-container {
    flex: 1; /* Dynamic height based on available space */
    overflow-y: auto; /* Scrollable if content overflows */
    padding: 10px;
    background-color: #ffffff; /* White background */
    border: 1px solid #ccc; /* Border around conversation */
    border-radius: 5px;
}

/* Input and button area */
#prompt-windows {
    display: flex;
    padding: 10px;
    background-color: #ffffff; /* White background */
    border-top: 1px solid #ccc;
}

#prompt-input {
    flex: 1; /* Take up remaining horizontal space */
    padding: 10px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#send-button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff; /* Blue button */
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

/* New / save / restore — compact row under prompt */
.game-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 6px 10px 8px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
}

.game-controls-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.game-controls-label {
    color: #666;
    margin-right: 2px;
    white-space: nowrap;
}

.game-btn {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
}

.game-btn:hover {
    background: #e9ecef;
}

.game-btn-slot {
    min-width: 26px;
    padding-left: 6px;
    padding-right: 6px;
}

#btn-new-game {
    background: #fff;
    border-color: #bbb;
}

/* State display (fixed at the bottom) */
#state-display {
    padding: 10px;
    text-align: center;
    background-color: #f8f9fa; /* Light grey */
    border-top: 1px solid #ccc;
    font-size: 14px;
    color: #333; /* Dark grey text */
}

/* Message styling */
.prompt-container,
.response-container {
    margin-bottom: 10px; /* Space between messages */
}

.prompt-text,
.response-text {
    display: inline-block;
    padding: 10px;
    border-radius: 10px;
    max-width: 60%;
    word-wrap: break-word;
    background-color: #fff; /* White message background */
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

/* Align user prompts and server responses */
.prompt-container {
    text-align: right;
}

.response-container {
    text-align: left;
}

.system-notice .system-notice-text {
    max-width: 90%;
    font-size: 13px;
    font-style: italic;
    color: #666;
    background-color: #f5f5f5;
    box-shadow: none;
}

.control-button {
    padding: 10px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px;
  }

.compact-button {
    flex: 1;
    margin: 0;
    padding: 7px 8px;
    font-size: 12px;
}
  
  .control-button.muted {
    background-color: #f44336;
  }