/* Layout — app shell, side panel, status bar, responsive breakpoints */

.game-app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-0);
}

.game-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Workshop viewport */
.workshop-area {
    flex: 1;
    width: 100%;
    position: relative;
    min-width: 0;
    background: var(--bg-inset);
    /* Blueprint grid texture behind the canvas */
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 48px 48px;
    background-position: center;
}

#workshop-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.workshop-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Legacy panel rules remain for old save-compatible modules, but the panel is
   no longer mounted. Management is accessed through world buildings. */
.side-panel {
    width: var(--panel-width);
    background: var(--bg-1);
    border-left: 1px solid var(--line-strong);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease, opacity 0.2s ease;
}

/* Hidden state — used when the player is on the street or in a shop */
.side-panel.hidden-scene {
    width: 0;
    opacity: 0;
    border-left: none;
    pointer-events: none;
}

/* Tabs — compact grid, icon over label */
.panel-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border-bottom: 1px solid var(--line-strong);
}

.panel-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 4px 7px;
    background: var(--bg-1);
    color: var(--text-3);
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.panel-tab:hover {
    background: var(--bg-2);
    color: var(--text-2);
}

.panel-tab.active {
    background: var(--bg-2);
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.panel-tab .tab-ic {
    display: flex;
    height: 20px;
    align-items: center;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4);
}

/* Panel headings */
.panel-heading {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-1);
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--line);
}

.panel-heading .bx-icon {
    color: var(--accent);
}

.panel-heading-count {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-3);
    background: var(--bg-3);
    border: 1px solid var(--line);
    padding: 1px 8px;
}

.panel-section h2:not(.panel-heading) {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: var(--sp-3);
    color: var(--text-1);
}

/* Status bar */
.status-bar {
    height: var(--status-height);
    background: var(--bg-1);
    border-top: 1px solid var(--line-strong);
    display: flex;
    align-items: center;
    padding: 0 var(--sp-3);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-3);
}

.status-item {
    padding: 0 var(--sp-3);
    border-right: 1px solid var(--line);
    white-space: nowrap;
}

.status-item:first-child {
    padding-left: 0;
}

.status-message {
    flex: 1;
    text-align: right;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: var(--sp-3);
}

/* ---------- Breakpoints ---------- */

/* 768px – 1200px tablet */
@media (max-width: 1200px) {
    .side-panel {
        width: var(--panel-width-tablet);
    }
}

/* 480px – 768px phone landscape */
@media (max-width: 768px) {
    .workshop-area {
        width: 100%;
        flex: 1;
    }
    .side-panel {
        width: 40%;
        border-left: none;
        border-top: 1px solid var(--line-strong);
    }
    .panel-tab {
        font-size: 10.5px;
        padding: 7px 2px 5px;
    }
}

/* <480px phone portrait */
@media (max-width: 480px) {
    .game-main {
        flex-direction: column;
    }
    .workshop-area {
        width: 100%;
        height: 100%;
        flex: 1;
    }
    .side-panel {
        width: 100%;
        height: 45%;
        border-left: none;
        border-top: 1px solid var(--line-strong);
    }
    .hud {
        height: auto;
        min-height: var(--hud-height);
        flex-wrap: wrap;
        gap: var(--sp-1);
    }
    .hud-left, .hud-center, .hud-right {
        flex: 1 1 auto;
        justify-content: center;
    }
}
