/* Mobile adaptation of the existing game, never a second story renderer. */
.kaiduan-game{--dialogue-size:18px;--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px)}
.kaiduan-game #words,.kaiduan-game #words-reserve{font-size:var(--dialogue-size);line-height:1.65;overflow-wrap:anywhere}
.kaiduan-game #more-actions,.kaiduan-game #landscape-quick{display:none}
.kaiduan-game #display-notice{position:fixed;z-index:7;top:calc(62px + var(--safe-top));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 32px);display:flex;align-items:center;gap:12px;padding:10px 14px;background:#111b29f2;border:1px solid #c9b5d066;border-radius:8px;font-size:14px;line-height:1.5}
.kaiduan-game #dismiss-display-notice{flex:none;min-width:44px;min-height:44px;font-size:22px}
.kaiduan-game #resource-status{position:fixed;z-index:8;left:50%;top:calc(68px + var(--safe-top));transform:translateX(-50%);max-width:90vw;padding:10px 14px;background:#111b29ed;border:1px solid #c9b5d066;border-radius:8px;display:flex;align-items:center;gap:12px;font-size:14px}
.kaiduan-game #retry-picture{min-width:60px;min-height:44px;border:1px solid #c9b5d066;border-radius:5px}
.kaiduan-game #enable-audio{position:absolute;right:calc(18px + var(--safe-right));top:calc(64px + var(--safe-top));z-index:6;min-height:44px;padding:8px 14px;background:#172232ed;border:1px solid #c9b5d066;border-radius:6px}
.kaiduan-game #more-panel .more-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}
.kaiduan-game #more-panel .more-list button{min-height:48px;padding:10px;border:1px solid #c9b5d055;border-radius:6px;text-align:left}
.kaiduan-game .settings-list label{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.kaiduan-game .settings-list input[type=range]{max-width:100%;min-height:44px;accent-color:#d7c4e4}
.kaiduan-game dialog{overscroll-behavior:contain;max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px)}
.kaiduan-game[data-reduced-motion=true] *{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(max-width:900px), (pointer:coarse){
 .kaiduan-game button,.kaiduan-game .night-header a{min-width:44px;min-height:44px}
 .kaiduan-game .dialogue-footer button{font-size:14px;padding:8px 12px;letter-spacing:0}
 .kaiduan-game #next{min-height:48px;min-width:108px;padding:10px 16px;justify-content:center;background:#cfbddb;color:#211c2c;border-radius:6px;font-size:16px}
 .kaiduan-game #more-actions{display:inline-flex;align-items:center;justify-content:center;gap:6px}
 .kaiduan-game .dialogue-footer>div{gap:4px;flex-wrap:wrap}
 .kaiduan-game #history,.kaiduan-game #refx,.kaiduan-game #revoice,.kaiduan-game #home{display:none}
 .kaiduan-game .night-header{height:calc(56px + var(--safe-top));padding:var(--safe-top) calc(62px + var(--safe-right)) 0 calc(12px + var(--safe-left));gap:8px}
 .kaiduan-game #night-app[data-view=play] .night-header{height:calc(56px + var(--safe-top));padding-top:var(--safe-top)}
 .kaiduan-game .night-header nav{gap:4px;font-size:13px}
 .kaiduan-game .night-header #sound,.kaiduan-game .night-header #clues{display:none}
 .kaiduan-game #fullscreen-quick,.kaiduan-game #night-app[data-view=intro] #fullscreen-quick,.kaiduan-game.game-fullscreen #fullscreen-quick{width:44px;height:44px;top:calc(6px + var(--safe-top));right:calc(8px + var(--safe-right));opacity:.85}
 .kaiduan-game #landscape-quick{position:absolute;z-index:5;right:calc(60px + var(--safe-right));top:calc(6px + var(--safe-top));display:flex;align-items:center;gap:6px;min-height:44px;padding:8px 12px;background:#111820b8;border:1px solid #ddd4ea55;border-radius:6px;font-size:13px}
 .kaiduan-game .night-header{padding-right:calc(164px + var(--safe-right))}
 .kaiduan-game #night-app[data-view=play] .night-header{display:none}
 .kaiduan-game dialog{padding:18px;width:calc(100% - var(--safe-left) - var(--safe-right) - 24px);max-width:700px}
 .kaiduan-game dialog header button{flex:0 0 44px}
 .kaiduan-game .settings-list{min-width:0;gap:16px}
 .kaiduan-game .night-choices button{min-height:48px;font-size:16px;line-height:1.55;padding:10px 12px}
 .kaiduan-game .content-note{font-size:12px}
 .kaiduan-game #save-status{display:none}
 .kaiduan-game .dialogue-footer{gap:6px;flex-wrap:wrap}
 .kaiduan-game #inspect-phone{font-size:14px}
}
@media(max-width:900px) and (orientation:portrait){
 /* Give spare height to the scene instead of stretching the dialogue panel. */
 .kaiduan-game #night-app[data-view=play]{display:flex;flex-direction:column;height:100dvh;min-height:0;background:#10151f}
 .kaiduan-game #night-app[data-view=play] #screen{position:relative;inset:auto;order:-1;z-index:0;width:100%;height:auto;aspect-ratio:auto;flex:1 1 0;min-height:40dvh;box-shadow:0 12px 30px #0005}
 .kaiduan-game #night-app[data-view=play] .night-tint{display:none}
 .kaiduan-game #night-app[data-view=play] #play{flex:0 1 auto;min-height:0;max-height:60dvh;padding:0;overflow:hidden}
 .kaiduan-game #night-app[data-view=play] .scene-heading{position:absolute;top:calc(16px + var(--safe-top));left:calc(14px + var(--safe-left));right:174px;margin:0;z-index:2;pointer-events:none;font-size:12px}
 .kaiduan-game #night-app[data-view=play] .scene-meta{font-size:12px}
 .kaiduan-game #night-app[data-view=play] #caption{width:100%;margin:0;flex:0 1 auto;min-height:0;max-height:60dvh;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;padding:12px calc(16px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(16px + var(--safe-left));background:linear-gradient(140deg,#1d2536,#151c29);border-top:1px solid #e3d0b636;backdrop-filter:none}
 .kaiduan-game #night-app[data-view=play] .dialogue-footer{margin-top:0;flex-shrink:0;flex-wrap:nowrap;gap:4px}
 .kaiduan-game #night-app[data-view=play] .dialogue-footer>div{min-width:0;gap:0;flex-wrap:wrap}
 .kaiduan-game #words,.kaiduan-game #words-reserve{min-height:0;margin:8px 0 12px;line-height:1.55;flex-shrink:0}
 .kaiduan-game .night-choices{flex-shrink:0;margin-bottom:10px}
 .kaiduan-game .dialogue-top strong{font-size:15px;letter-spacing:1px}
 .kaiduan-game #night-app[data-view=play] #screen:not([data-crop=detail]) img{object-position:var(--shot-focus,50%) 35%;transform:none}
 .kaiduan-game.game-fullscreen #night-app[data-view=play] #play{min-height:0}
 .kaiduan-game .intro-panel{margin:24px 7%;padding-bottom:calc(24px + var(--safe-bottom))}
 .kaiduan-game .intro-panel h1{font-size:42px}
}
@media(max-height:600px) and (orientation:landscape){
 .kaiduan-game #landscape-quick{display:none}
 .kaiduan-game #night-app[data-view=play] .night-header{display:none}
 .kaiduan-game #night-app[data-view=play] .scene-heading{display:none}
 .kaiduan-game #night-app[data-view=play] #play{height:100dvh;min-height:0;padding:calc(52px + var(--safe-top)) calc(12px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(12px + var(--safe-left))}
 .kaiduan-game #night-app[data-view=play] #caption{width:100%;margin:auto 0 0;padding:8px 14px 4px;max-height:calc(100dvh - var(--safe-top) - var(--safe-bottom) - 66px);overflow-y:auto;overscroll-behavior:contain;background:linear-gradient(110deg,#111923d9,#181b23c9)}
 .kaiduan-game #words,.kaiduan-game #words-reserve{min-height:0;margin:6px 0 8px;line-height:1.5}
 .kaiduan-game #save-status{display:none}
 .kaiduan-game .night-choices{margin:8px 0;gap:6px}
 .kaiduan-game .intro-panel{margin-top:4px;padding-bottom:var(--safe-bottom)}
 .kaiduan-game .intro-panel h1{font-size:30px;margin:12px 0}
}

/* Reserve only the current sentence, so typewriter text does not resize the art. */
.kaiduan-game .dialogue-copy{display:grid;flex-shrink:0}
.kaiduan-game .dialogue-copy>p{grid-area:1/1}
.kaiduan-game #words-reserve{visibility:hidden;pointer-events:none;min-height:46px;margin:13px 0 16px}
.kaiduan-game #caption[data-kind=narration] #words-reserve{margin-top:3px}
.kaiduan-game #caption[data-kind=thought] #words-reserve{border-left:2px solid transparent;padding-left:12px}
@media(max-width:900px) and (orientation:portrait){
 .kaiduan-game #words-reserve{min-height:0;margin:8px 0 12px}
 .kaiduan-game[data-portrait-fit=contain] #night-app[data-view=play] #screen:not([data-crop=detail]) img,.kaiduan-game #night-app[data-view=play] #screen[data-framing=message] img{object-fit:contain;object-position:center;transform:none}
}
@media(max-height:600px) and (orientation:landscape){
 .kaiduan-game #words-reserve{min-height:0;margin:6px 0 8px}
 .kaiduan-game .night-choices{grid-template-columns:repeat(2,minmax(0,1fr))}
 .kaiduan-game .night-choices>button:last-child:nth-child(odd){grid-column:1/-1}
}
