/* Base Layout Structure */
#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 10px;
    gap: 12px;
    max-width: 1280px;
    margin: 0 auto;
}

/* Header Section */
header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 15px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main Content Grid */
main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Desktop/Tablet Layout */
@media (min-width: 768px) {
    main {
        display: grid;
        grid-template-columns: minmax(360px, 430px) minmax(300px, 1fr);
        grid-template-areas: 
            "radio menu"
            "radio board"
            "xr board";
        align-items: start;
    }

    #radio-tuner { grid-area: radio; }
    #game-menu-panel { grid-area: menu; }
    #xr-container { grid-area: xr; }
    #xr-preview { grid-area: board; }
    #active-game-container { grid-area: board; }
}

/* Mobile specific game-active overrides */
@media (max-width: 767px) {
    body.game-active main {
        display: flex;
        flex-direction: column;
    }

    body.game-active #active-game-container {
        order: -1; /* Move to top on mobile */
        display: flex;
    }

    body.game-active #game-menu-panel {
        display: none; /* Hide menu when game active on mobile */
    }
}

/* Desktop: ensure it displays when active */
@media (min-width: 768px) {
    body.game-active #active-game-container {
        display: flex;
    }

    body.game-active #xr-preview {
        display: none;
    }
}

/* XR Container */
#xr-container {
    display: flex;
    justify-content: center;
    align-items: center;
    order: 3; /* Bottom on mobile */
}

/* Base states */
#active-game-container {
    display: none; /* hidden by default */
    justify-content: center;
    align-items: center;
    min-height: 330px;
}

#xr-preview {
    min-height: 430px;
    overflow: hidden;
}

/* XR Container */
#xr-container {
    display: none; /* Hidden by default until JS detects WebXR */
    justify-content: center;
    align-items: center;
    order: 3; /* Bottom on mobile */
}
