/* F16 revision: fixed game screens, never an expanding document. */
.screen-mode{overflow:hidden!important;touch-action:manipulation!important}
.screen-mode>header,.screen-mode>footer{display:none!important}
.screen-frame{position:fixed;inset:max(8px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));z-index:4;display:flex;flex-direction:column;gap:8px;max-width:1100px;margin:auto;background:#111e18;border:1px solid #65715f;padding:12px;overflow:hidden;color:#e6e9df}
.screen-frame:has(>[data-screen-root][hidden]){display:none!important}
.screen-heading,.screen-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;min-height:44px}
.screen-title{font-size:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.screen-heading button,.screen-footer button{font:inherit;min-height:44px;padding:8px 14px;border:1px solid #65715f;background:#1d3025;color:inherit;cursor:pointer;white-space:nowrap}
.screen-footer{border-top:1px solid #ffffff24;padding-top:8px;margin:0!important;position:static!important;flex-wrap:nowrap!important}
.screen-page-status{font-size:12px;white-space:nowrap}.screen-footer button:disabled{opacity:.4}
[data-screen-root]{position:relative!important;inset:auto!important;display:block!important;flex:1!important;min-height:0!important;height:0!important;width:100%!important;max-width:100%!important;max-height:none!important;overflow:hidden!important;margin:0!important;padding:4px!important;transform:none!important;touch-action:manipulation!important;scrollbar-width:none!important;scrollbar-gutter:auto!important}
[data-screen-hidden],[data-screen-detail]{display:none!important}
.screen-detail-button{display:block;min-height:44px;width:100%;margin:4px 0;padding:10px 12px;text-align:left;border:1px solid #65715f;background:#1b2b22;color:inherit;cursor:pointer;font:inherit}
.screen-layer{position:fixed;inset:0;background:#050c09ed;z-index:40;color:#e6e9df}
.screen-layer .screen-frame{z-index:41}
.screen-text-piece{display:block;white-space:pre-wrap;overflow-wrap:anywhere}
[data-screen-root] *{min-width:0;box-sizing:border-box}
[data-screen-root] h1,[data-screen-root] h2{font-size:22px!important;margin:6px 0!important;letter-spacing:1px!important}
[data-screen-root] h3,[data-screen-root] h4{font-size:17px!important;margin:6px 0!important}
[data-screen-root] p{font-size:13px!important;line-height:1.55!important;margin:6px 0!important;overflow-wrap:anywhere}
[data-screen-root] pre{font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere}
[data-screen-root] nav,[data-screen-root] .f16-heading{position:static!important;margin:4px 0!important}
[data-screen-root] .f16-toolbar{flex-wrap:wrap;margin:4px 0!important;gap:6px}
[data-screen-root] input,[data-screen-root] select{min-height:44px;padding:8px;max-width:100%}
[data-screen-root] textarea{min-height:70px!important;max-height:110px;resize:none!important}
[data-screen-root] .f16-grid,[data-screen-root] .unlock-grid,[data-screen-root] .roster-grid,[data-screen-root] .growth-cards,[data-screen-root] .chest-rewards{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;margin:4px 0!important}
[data-screen-root] .f16-card,[data-screen-root] .upgrade{padding:10px!important;margin:0!important}
[data-screen-root] .f16-card p,[data-screen-root] .upgrade p{font-size:12px!important}
[data-screen-root] .f16-map{height:min(28dvh,200px)!important;margin:4px 0}
[data-screen-root] .treasure-stage{height:min(33dvh,250px)!important}
[data-screen-root] .result-loadout,[data-screen-root] .damage-list{overflow:visible!important;max-height:none!important}
[data-screen-root] .f16-launch{position:static!important;transform:none!important;width:100%!important;left:auto!important;bottom:auto!important;box-shadow:none!important;margin:4px 0!important}
.screen-launch{flex:none}
.screen-launch .f16-launch{position:static!important;transform:none!important;width:100%!important;left:auto!important;bottom:auto!important;min-height:44px;margin:0!important;padding:8px!important;box-shadow:none!important}
.screen-mode:has(#menu:not([hidden])) #debug-toggle{top:max(16px,env(safe-area-inset-top));bottom:auto;left:50%;right:auto;transform:translateX(-50%);min-height:32px;padding:5px 8px}
.screen-mode #overlay:not([data-game-presentation]){padding:0!important;overflow:hidden!important;background:#07100deb}
.screen-mode #overlay>.screen-frame{z-index:9}
.screen-mode #menu>.eyebrow,.screen-mode #menu>.intro{display:none!important}
.screen-mode #debug-panel[data-screen-root]{position:relative!important;z-index:auto!important}
.screen-frame:has(>#debug-panel){z-index:30}
[data-screen-root] .debug-heading{display:none!important}
.screen-mode #debug-toggle{z-index:32;left:auto;right:12px;bottom:72px}
#screen-pending{position:fixed;left:50%;top:45%;transform:translateX(-50%);z-index:12;min-height:50px;padding:14px 24px;background:#d1b67b;color:#152019;border:1px solid #7e704c;font:inherit}
@media(max-width:600px){.screen-frame{padding:8px;gap:6px}.screen-title{font-size:17px}.screen-footer button,.screen-heading button{padding:8px 10px;font-size:13px}[data-screen-root] .f16-grid,[data-screen-root] .unlock-grid,[data-screen-root] .growth-cards{grid-template-columns:1fr!important}[data-screen-root] .f16-toolbar>*{width:auto!important;flex:1 1 120px}[data-screen-root] .roster-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(orientation:landscape) and (max-height:520px){.screen-frame{inset:4px 8px;padding:6px;gap:4px}.screen-heading{min-height:44px}.screen-footer{padding-top:4px}.screen-title{font-size:17px}[data-screen-root] .f16-grid,[data-screen-root] .unlock-grid,[data-screen-root] .growth-cards{grid-template-columns:repeat(3,minmax(0,1fr))!important}[data-screen-root] .roster-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important}[data-screen-root] .portrait{height:50px!important}[data-screen-root] .f16-map{height:130px!important}}

[data-screen-root] .choice,[data-screen-root] .character{min-height:44px!important;height:auto!important;padding:10px!important}[data-screen-root] .f16-pagination{flex-wrap:wrap}[data-screen-root] .roster-layout{display:block!important}[data-screen-root] .roster-detail{padding:10px!important}[data-screen-root] .roster-detail .screen-detail-button{margin:4px 0}[data-screen-root] .f16-equipment-list{grid-template-columns:repeat(2,minmax(0,1fr))!important}

.screen-title{flex:1;min-width:0}.screen-heading>button{flex:none}[data-screen-root] .upgrade{min-width:0}[data-screen-root] .f16-pagination{min-height:44px}[data-screen-root] .f16-equipment-section{border:0;padding:0}

.screen-field{display:flex;flex-direction:column;gap:4px;margin:4px 0}.screen-field label{min-height:0;font-size:13px}[data-screen-root] .screen-field>select,[data-screen-root] .screen-field>input{width:100%}.screen-layer a{color:#d1b67b}

[data-screen-root] aside{position:static!important;height:auto!important;overflow:visible!important;padding:8px!important}[data-screen-root] nav#weapons{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;max-height:none!important;overflow:visible!important}[data-screen-root] nav#weapons button{min-width:0!important}[data-screen-root] .workbench{padding:8px!important}[data-screen-root] .arena canvas{height:min(30dvh,220px)!important}[data-screen-root] .arena{margin:4px 0}[data-screen-root] .details{display:block!important}

[data-screen-root] #roster-back-list{display:block!important}[data-screen-root] .roster-note{line-height:1.5}

[data-screen-root]{overflow-wrap:anywhere;word-break:break-word}.screen-detail-button{overflow-wrap:anywhere}

[data-screen-legacy]{display:none!important}.screen-page-status{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:11px}

/* Combat presentation is deliberately outside the fixed-screen system. */
#overlay[data-game-presentation]{align-items:flex-start;justify-content:center;padding:max(20px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));overflow:auto;touch-action:pan-y}
#overlay[data-game-presentation]>.panel{width:680px;max-width:100%;max-height:none;margin:auto;padding:0;text-align:center}

@media(orientation:landscape) and (max-height:520px){#overlay[data-game-presentation]:has(.chest-view){padding:8px 20px}}
