/* Only this isolated preview uses cinematic captions. */
/* Let the image fill the viewport; reserve safe-area only for controls/text. */
html.cinema-dialogue, html.cinema-dialogue body {
    margin: 0; padding: 0; border: 0; background: #000;
    --screen-background-color: #000;
    width: 100vw; min-width: 100vw; max-width: none;
    height: 100vh; min-height: 100vh; max-height: none; overflow: hidden;
}
.cinema-dialogue #monogatari {
    position: fixed; inset: 0; margin: 0; padding: 0; border: 0;
    width: 100%; height: 100%; max-width: none; max-height: none; background: #000;
}
.cinema-dialogue #monogatari visual-novel {
    margin: 0; padding: 0; width: 100%; height: 100%; max-width: none; background: #000;
}
@supports (width: 100dvw) {
    html.cinema-dialogue, html.cinema-dialogue body { width: 100dvw; min-width: 100dvw; }
}
@supports (height: 100dvh) {
    html.cinema-dialogue, html.cinema-dialogue body { height: 100dvh; min-height: 100dvh; }
}
.cinema-dialogue game-screen {
    --cinema-bar-height: 13%;
}
@supports (height: 100dvh) {
    html, body, #monogatari, #monogatari visual-novel { height: 100dvh; }
}
/* Full-screen image; the bars only mask it and never resize its rectangle. */
.cinema-dialogue #monogatari game-screen [data-ui="background"],
.cinema-dialogue #monogatari game-screen #scene-dissolve {
    position: absolute; inset: 0; width: 100%; height: 100%;
    background-size: cover !important; background-position: center !important;
}
.cinema-dialogue game-screen::after {
    content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
    background: linear-gradient(to bottom, #000 0, #000 var(--cinema-bar-height),
        transparent var(--cinema-bar-height), transparent calc(100% - var(--cinema-bar-height)),
        #000 calc(100% - var(--cinema-bar-height)), #000 100%);
}
.story-scene.cinema-dialogue #monogatari game-screen text-box {
    --story-font-size: clamp(14px, min(2.2vw, 4vh), 26px);
    --story-line-size: 1.3;
    position: absolute; z-index: 5;
    left: max(18px, 6vw, env(safe-area-inset-left));
    right: max(18px, 6vw, env(safe-area-inset-right));
    bottom: 0; width: auto; max-width: 1200px;
    height: var(--cinema-bar-height); min-height: var(--cinema-bar-height); max-height: var(--cinema-bar-height);
    margin: 0 auto; padding: 4px 0;
    display: flex !important; flex-direction: column; justify-content: center; align-items: stretch;
    box-sizing: border-box; border: 0; border-radius: 0; background: transparent; box-shadow: none;
    color: #f4f1ea; text-align: center; overflow-y: auto;
}
.story-scene.cinema-dialogue #monogatari game-screen text-box [data-content="text"] {
    position: absolute; top: 50%; left: 0; right: 0;
    transform: translateY(-50%);
    margin: 0; padding: 0; width: 100%; height: auto;
    display: block; overflow: visible; max-height: none;
}
.story-scene.cinema-dialogue #monogatari game-screen text-box :is([data-content="text"], [data-ui="say"], [data-content="dialog"], type-writer, p) {
    font-size: var(--cinema-fit-font, var(--story-font-size)); line-height: 1.3; text-align: center;
    margin: 0; padding: 0; box-sizing: border-box;
}
/* The typewriter inserts another div; align every line inside it as well. */
.story-scene.cinema-dialogue #monogatari game-screen text-box [data-content="text"] :is(type-writer, .type-writer-container, p, div) {
    display: block; width: 100%; max-width: none;
    margin: 0 !important; padding: 0 !important;
    text-align: center !important; box-sizing: border-box;
}
#menu-volume-control { display: none !important; }
