/* Web-only adjustments for the browser edition (not used by the Android app). */
#hud,
#game-screen #hud {
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
}

#hud .hud-item {
    white-space: nowrap;
}

#hud .speed-controls {
    flex: 0 0 auto;
}

.web-speed-select {
    display: none;
    font-family: "Press Start 2P", monospace;
    font-size: inherit;
    padding: 4px 6px;
    background: #0c4319;
    color: #ffe34a;
    border: 2px solid #55a82d;
    border-radius: 0;
    box-shadow: 3px 3px 0 #000;
    cursor: pointer;
}

.web-speed-select:focus-visible {
    outline: 2px solid #ffe34a;
    outline-offset: 2px;
}

#hud.web-compact .speed-controls {
    display: none;
}

#hud.web-compact .web-speed-select {
    display: inline-block;
}

.web-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    background: #4a2a78;
    border: 2px solid #a37ff0;
    color: #fff;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000, inset 2px 2px 0 rgba(255, 255, 255, 0.16);
}

.web-fullscreen-btn svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.web-fullscreen-btn.web-fullscreen-menu {
    margin: 4px auto 0;
    padding: 8px 14px;
}

.web-fullscreen-btn[hidden] {
    display: none;
}

html:fullscreen,
html:fullscreen body {
    background: #050705;
}

/* ===== Full screen: the board grows to fill the whole screen (no 800px cap). ===== */
html.web-fullscreen #app-promotion,
html.web-fullscreen #studio-watermark {
    display: none !important;
}

html.web-fullscreen body {
    padding: 0;
}

html.web-fullscreen #app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
}

html.web-fullscreen #app-content {
    height: 100%;
    overflow-y: auto;
}

html.web-fullscreen #app-content > #game-screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: 4px 6px;
    gap: 4px;
    align-items: stretch;
    justify-content: flex-start;
    overflow: hidden;
    box-sizing: border-box;
}

html.web-fullscreen #app-content > #game-screen.hidden {
    display: none;
}

html.web-fullscreen #game-screen #hud {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    box-sizing: border-box;
}

html.web-fullscreen #game-screen #play-row {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    container-type: size;
    justify-content: center;
}

html.web-fullscreen #game-screen #game-area {
    max-width: none;
    aspect-ratio: 4 / 3;
    height: auto;
}

html.web-fullscreen #game-screen #game-area canvas {
    width: 100%;
    height: 100%;
    border: 2px solid #347b27;
}

@media (orientation: landscape) {
    html.web-fullscreen #game-screen #play-row {
        flex-direction: row;
        align-items: stretch;
        gap: 6px;
    }

    html.web-fullscreen #game-screen #game-area {
        flex: 0 0 auto;
        align-self: center;
        width: min(calc(100cqw - clamp(200px, 16vw, 300px) - 6px), calc(100cqh * 4 / 3));
    }

    html.web-fullscreen #game-screen #tower-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: min-content;
        align-content: center;
        width: clamp(200px, 16vw, 300px);
        max-width: none;
        flex: 0 0 clamp(200px, 16vw, 300px);
        gap: 6px;
        margin: 0;
        padding: 6px;
        overflow-y: auto;
        box-sizing: border-box;
    }

    html.web-fullscreen #game-screen #tower-bar button {
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    html.web-fullscreen #game-screen #start-wave-btn {
        grid-column: 1 / -1;
    }

    html.web-fullscreen #game-screen #hud {
        font-size: clamp(8px, 0.62vw, 14px);
    }
}

@media (orientation: portrait) {
    html.web-fullscreen #game-screen #play-row {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    html.web-fullscreen #game-screen #game-area {
        flex: 0 0 auto;
        width: min(100cqw, calc((100cqh - var(--web-bar-h, 120px) - 4px) * 4 / 3));
    }

    html.web-fullscreen #game-screen #tower-bar {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
    }
}
