/* Browser margins are outside the game. All in-game anchors share this box. */
html[data-game-viewport] body {
    position: relative;
    width: var(--game-frame-width, 100%);
    height: var(--game-frame-height, 100dvh);
    min-width: 0;
    margin: 0 auto;
    padding: 0;
    /* Establish the containing block for fixed HUDs without a GPU transform. */
    contain: layout;
}

html[data-game-viewport] #root {
    width: 100%;
    height: 100%;
}

html[data-game-viewport] dialog {
    max-width: calc(var(--game-frame-width, 100vw) - 24px);
}

/* This game keeps its existing scrolling page and 3:2 pasture. */
html[data-game-viewport="alpaca-meadow"] body {
    height: auto;
    min-height: 100dvh;
}

html[data-game-viewport="free-sense-maker"] .entry-shell,
html[data-game-viewport="side-scroll-idle-base"] .popup-overlay {
    width: 100%;
}

/* Modal dialogs live in the browser top layer and need the frame's offset. */
html[data-game-viewport="free-sense-maker"] dialog.credits-modal {
    left: var(--game-frame-left, 0px);
    width: var(--game-frame-width, 100%);
    max-width: var(--game-frame-width, 100%);
}

html[data-game-viewport="alpaca-quick-hat"] .game-shell {
    min-height: 0;
}
