/* One measured viewport and one set of safe rectangles for both orientations. */
#spell-forge{width:var(--arena-width,100vw);height:var(--arena-height,100dvh);min-height:0}
#spell-forge .sf-stage{position:absolute;width:100%;height:100%;min-height:0}
#spell-forge:fullscreen,#spell-forge:-webkit-full-screen{background:#0c1620}
#spell-forge.touch-mode .sf-stage .game-header,#spell-forge.touch-mode .sf-stage .sf-label,#spell-forge.touch-mode .weapon-summary{display:none}
#spell-forge.touch-mode .touch-controls{inset:0}
#spell-forge.touch-mode .touch-button{right:auto;bottom:auto;min-height:44px;width:44px;height:44px;padding:10px}
#spell-forge.touch-mode .touch-score{left:var(--mobile-score-x);top:var(--mobile-score-y)}
#spell-forge.touch-mode .touch-pause{left:var(--mobile-pause-x);top:var(--mobile-pause-y)}
#spell-forge.touch-mode .touch-clear{left:var(--mobile-clear-x);top:var(--mobile-clear-y)}
#spell-forge.touch-mode .touch-sprint{left:var(--mobile-sprint-x);top:var(--mobile-sprint-y)}
#spell-forge.touch-mode .touch-jump{left:var(--mobile-jump-x);top:var(--mobile-jump-y)}
#spell-forge.touch-mode .touch-crouch{left:var(--mobile-crouch-x);top:var(--mobile-crouch-y)}
#spell-forge.touch-mode .touch-aim{left:var(--mobile-aim-x);top:var(--mobile-aim-y)}
#spell-forge.touch-mode .touch-attack{left:var(--mobile-attack-x);top:var(--mobile-attack-y);width:var(--mobile-attack-w);height:var(--mobile-attack-h);padding:16px}
#spell-forge.touch-mode .touch-self{left:var(--mobile-self-x);top:var(--mobile-self-y);width:var(--mobile-self-w);height:var(--mobile-self-h);padding:12px}
#spell-forge.touch-mode .touch-stick{left:var(--mobile-stick-x);top:var(--mobile-stick-y);bottom:auto;width:var(--mobile-stick-w);height:var(--mobile-stick-h)}
#spell-forge.touch-mode .sf-stage .resource-hud{left:var(--mobile-vitals-x);top:var(--mobile-vitals-y);right:auto;bottom:auto;width:var(--mobile-vitals-w);height:var(--mobile-vitals-h);padding:5px 7px;gap:4px;overflow:visible}
#spell-forge.touch-mode .sf-stage .sf-spell{left:var(--mobile-weapon-x);top:var(--mobile-weapon-y);right:auto;bottom:auto;width:var(--mobile-weapon-w);height:var(--mobile-weapon-h);padding:4px;gap:2px}
#spell-forge.touch-mode .sf-stage .spell-sources{height:18px;gap:2px}
#spell-forge.touch-mode .sf-stage .source-icon{width:18px;height:18px;padding:1px}
#spell-forge.touch-mode .sf-stage .source-link{width:5px}
#spell-forge.touch-mode .sf-stage .spell-badge{width:30px;height:30px}
#spell-forge.touch-mode .sf-stage .sf-charge{height:2px;width:100%;margin:0}
#spell-forge.touch-mode .sf-stage .hud-keys{left:var(--mobile-elements-x);top:var(--mobile-elements-y);bottom:auto;transform:none;width:var(--mobile-elements-w);height:var(--mobile-elements-h);display:grid;grid-template-columns:repeat(var(--mobile-columns),minmax(0,1fr));gap:4px;padding:4px;border:0}
#spell-forge.touch-mode .sf-stage .element-tile{width:var(--mobile-tile);height:var(--mobile-tile);padding:7px}
#spell-forge.touch-mode .sf-stage .match-tools{left:var(--mobile-tools-x);top:var(--mobile-tools-y);width:var(--mobile-tools-w);height:var(--mobile-tools-h);gap:4px;overflow:hidden}
#spell-forge.touch-mode .sf-stage .body-status{margin:0;padding:1px 4px;min-height:28px;max-height:28px;overflow:hidden;font:10px/13px Consolas,monospace;white-space:normal}
#spell-forge.touch-mode .match-actions{height:44px;gap:4px}
#spell-forge.touch-mode .match-actions .match-buy{flex:0 0 48px;min-height:44px;font-size:11px;padding:3px}
#spell-forge.touch-mode .match-actions .spell-history{gap:4px}
#spell-forge.touch-mode .match-actions .spell-recall{min-height:44px;padding:4px;gap:0}
#spell-forge.touch-mode .spell-recall kbd{display:none}
#spell-forge.touch-mode .match-actions .spell-recall span{width:22px;height:22px}
#spell-forge.touch-mode.compact-hud .body-status{display:none}
#spell-forge.touch-mode.compact-hud .match-actions{display:grid;height:92px;grid-template-columns:1fr;gap:4px}
#spell-forge.touch-mode.compact-hud .match-actions .spell-history{grid-template-columns:1fr 1fr}
#spell-forge.touch-mode .minimap:not(.is-expanded){left:var(--mobile-minimap-x);top:var(--mobile-minimap-y);right:auto;bottom:auto;transform:none;width:var(--mobile-minimap-w);height:var(--mobile-minimap-h);padding:3px}
#spell-forge.touch-mode .minimap:not(.is-expanded) canvas{height:calc(100% - 15px);aspect-ratio:auto}
#spell-forge.touch-mode .minimap.is-expanded{left:50%;top:50%;right:auto;transform:translate(-50%,-50%);width:min(340px,calc(var(--arena-height) - 64px),calc(var(--arena-width) - 32px));height:auto}
#spell-forge.touch-mode .reactor-hud{left:var(--mobile-reactor-x);top:var(--mobile-reactor-y);right:auto;transform:none;width:var(--mobile-reactor-w);max-height:var(--mobile-reactor-h);padding:4px 7px;overflow:hidden}
#spell-forge.touch-mode .reactor-scores b{font-size:20px}
#spell-forge.touch-mode .reactor-details{margin-top:3px;font-size:10px;gap:3px}
#spell-forge.touch-mode .reactor-bars{margin-top:3px}
#spell-forge.touch-mode .match-feed{left:var(--mobile-feed-x);top:var(--mobile-feed-y);right:auto;bottom:auto;width:var(--mobile-feed-w);max-height:var(--mobile-feed-h);overflow:hidden}
#spell-forge.touch-mode .match-feed .match-kill:not(:last-child){display:none}
#spell-forge.touch-mode .status-icons{position:fixed;left:var(--mobile-minimap-x);top:calc(var(--mobile-minimap-y) + var(--mobile-minimap-h) + 8px);bottom:auto;transform:none;width:var(--mobile-minimap-w);max-width:var(--mobile-minimap-w);justify-content:flex-start;gap:2px}
#spell-forge.touch-mode[data-mobile-orientation=portrait] .status-icons{left:var(--mobile-reactor-x);top:calc(var(--mobile-reactor-y) + var(--mobile-reactor-h) + 8px);width:158px;max-width:158px}
#spell-forge.touch-mode.short-portrait .status-icons,#spell-forge.touch-mode.short-portrait .match-feed{display:none}
#spell-forge.touch-mode .state-icon{width:20px;height:22px;min-width:20px}
#spell-forge.touch-mode .progression-panel{left:50%;top:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);width:min(620px,calc(var(--arena-width) - 28px));max-height:calc(var(--arena-height) - 28px);overflow:auto;overscroll-behavior:contain}
#spell-forge.touch-mode .match-board{max-height:calc(var(--arena-height) - 28px);overflow:auto}
#spell-forge.touch-mode .death-live{max-height:calc(var(--arena-height) - 32px);overflow:auto}
#spell-forge.touch-mode #sf-menu{height:100%;max-height:none;padding-bottom:0}
#spell-forge.touch-mode .menu-launch{bottom:0;padding-bottom:max(10px,env(safe-area-inset-bottom));padding-right:max(10px,env(safe-area-inset-right));padding-left:max(10px,env(safe-area-inset-left))}
