/* One scroll owner per menu; viewport height never clips controls. */
.orientation-gate[hidden]{display:none}.orientation-gate{position:fixed;inset:0;z-index:2147483647;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:24px max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));background:#101029;color:#e2fff1;text-align:center;box-sizing:border-box;outline:none}.orientation-gate>span{font:80px VT323,monospace;color:#ffdf7a}.orientation-gate h2{font:16px/1.7 'Brasil Arcade',monospace}.orientation-gate p{font:24px/1.3 VT323,monospace;max-width:28ch}.orientation-gate button{min-height:48px;padding:12px;background:#183e4c;border:2px solid #8cdbd4;color:#e2fff1;font:20px VT323,monospace}.training-rotate{display:none}.portrait-touch .training-rotate{display:block;padding:15px;background:#263b50;border:2px solid #89ccbd}.portrait-touch .course-practice :is(canvas,.course-controls){display:none}
.touch-preferences{display:flex;flex-wrap:wrap;gap:12px;margin:12px 0;border:1px solid #66828f;padding:12px;font:20px VT323,monospace;text-align:left}.touch-preferences legend{color:#ffe597}.touch-preferences label{display:flex;flex:1 1 180px;flex-direction:column;gap:6px}.touch-preferences select{min-width:0;width:100%;min-height:44px;background:#112b3c;border:2px solid #7bc4c7;color:#ebf6f4;font:20px VT323,monospace;padding:6px}.touch-preferences small{flex-basis:100%;font-size:17px;color:#b6ced8}
.resource-icon{display:inline-block;vertical-align:middle;width:1.4em;height:1.4em;flex-shrink:0;image-rendering:pixelated}.resource-icon svg{width:100%;height:100%}button svg{flex-shrink:0}
@media(max-width:1000px),(max-height:600px){
 #root #stage{min-width:0;box-sizing:border-box}#root #stage #overlay{box-sizing:border-box;min-height:0;overscroll-behavior:contain;touch-action:pan-y}
 #root #stage:not([data-mode=play]):not([data-mode=fight]) #overlay{overflow-y:auto;overflow-x:hidden;padding-bottom:max(18px,env(safe-area-inset-bottom));justify-content:flex-start}
 #root #stage #overlay :is(.panel,.shop-panel,.character-panel,.course-panel,.help-panel,.news-panel,.audio-panel){max-height:none;height:auto;min-height:0;max-width:100%;flex-shrink:0;box-sizing:border-box}
 #root #stage #overlay :is(.profile-content,.shop-grid,.course-lesson,.audio-grid){overflow:visible;max-height:none;min-height:0;flex-shrink:0}
 #root #stage #overlay :is(.shop-actions,.profile-loadout,.character-panel>footer,.chapter-actions,.course-footer){position:static;flex-wrap:wrap;flex-shrink:0;min-width:0}
 #root #stage #overlay :is(.profile-item,.profile-stat-card,.shop-card,.character-panel h2,.mission-intro p,.help-panel p){overflow-wrap:anywhere;white-space:normal;min-width:0}
 #root #stage #overlay :is(.character-panel button,.shop-actions button,.chapter-actions button,.course-footer button){min-height:44px;white-space:normal}
 #stage .keybindings-panel{width:calc(100vw - 12px);max-height:calc(100dvh - 12px);padding:14px;box-sizing:border-box;overflow:auto}
 #stage .keybindings-panel .binding-rows{max-height:none;overflow:visible}.keybindings-panel .bindings-footer{position:static}.keybindings-panel .binding-actions{flex-wrap:wrap}.keybindings-panel .binding-actions button{min-height:44px;flex:1}
 #stage .profile-resources>div{flex-direction:column;align-items:flex-start;gap:4px}.profile-resources dt{display:flex;align-items:center;gap:4px}
 #stage :is(.shop-filters,.profile-tabs){max-width:100%;flex-wrap:wrap}
}
@media(max-width:600px){
 #root #stage #overlay :is(.profile-attribute-cards,.profile-slot-cards,.profile-equipment-list,.weapon-tracks,.profile-mount-list,.shop-grid,.shop-section-grid){grid-template-columns:minmax(0,1fr);width:100%}
 #root #stage #overlay .shop-item{min-width:0}.character-panel .profile-header{flex-wrap:wrap}.profile-identity{flex:1 1 180px}.profile-loadout span{max-width:100%}
 #stage .keybindings-panel .binding-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}#stage .keybindings-panel .binding-row>div{grid-column:1/-1}#stage .keybindings-panel .binding-row button{min-height:44px;overflow-wrap:anywhere}.keybindings-panel .binding-columns{display:none}
 #root #stage #overlay .course-layout{grid-template-columns:1fr;display:grid}.course-layout nav{display:flex;flex-wrap:wrap;max-height:none;overflow:visible}.course-layout nav button{flex:1 1 145px;min-height:44px}.course-footer{gap:8px}.course-footer small{flex-basis:100%;order:3}
 #stage .profile-resources{grid-template-columns:1fr}.profile-resources>div{display:flex!important;flex-direction:row!important;align-items:center!important}
 #root #stage #overlay .shop-panel{padding:10px}.shop-panel .shop-header{flex-wrap:wrap}.shop-panel .shop-filters button{min-height:44px;font-size:18px}
 #root #stage #overlay .campaign-map-toolbar{flex-wrap:wrap}.campaign-map-toolbar>button{min-height:44px}
 #game-hub .hub-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:4px}#game-hub .hub-link{font-size:8px;flex-direction:row;min-height:44px;padding:7px}
}
@media(pointer:coarse) and (orientation:landscape),(max-width:1000px) and (orientation:landscape){
 #root #stage #touch{--button-size:clamp(44px,calc(48px * var(--touch-scale,1)),60px);padding:6px max(10px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));gap:10px;pointer-events:none}
 #root #stage #touch .dpad{grid-template-columns:repeat(2,var(--button-size));grid-template-rows:repeat(2,var(--button-size));gap:6px}
 #root #stage #touch .actions{grid-template-columns:repeat(3,var(--button-size));grid-template-rows:repeat(2,var(--button-size));gap:6px}
 #root #stage #touch button{width:100%;height:100%;min-height:44px;min-width:44px;pointer-events:auto;opacity:.94}#root #stage #touch button small{font-size:11px;letter-spacing:0}
 #root #stage #touch .weapon-toggle{grid-column:1;grid-row:1}#root #stage #touch .defend-button{grid-column:2;grid-row:1}#root #stage #touch [data-key=KeyR]{grid-column:1;grid-row:2}#root #stage #touch [data-key=KeyQ]{grid-column:2;grid-row:2}#root #stage #touch [data-key=ArrowUp]{grid-column:3;grid-row:2}
 html[data-touch-hand=left] #root #stage #touch{flex-direction:row-reverse}
 #root #stage #interact{position:absolute;left:50%;right:auto;bottom:max(10px,env(safe-area-inset-bottom));transform:translateX(-50%);max-width:calc(100% - 330px);min-width:44px;min-height:44px;white-space:normal;overflow-wrap:anywhere;font:17px/1.1 VT323,monospace;padding:7px;z-index:9}
 #root #stage[data-mode=play] #hud{right:110px;top:max(4px,env(safe-area-inset-top));left:max(4px,env(safe-area-inset-left));gap:4px;grid-template-columns:.9fr 1.2fr 1.3fr}
 #root #stage[data-mode=play] #hud b{font:14px/1.05 VT323,monospace}#root #stage[data-mode=play] #hud small{font:14px/1.05 VT323,monospace}#root #stage[data-mode=play] #hud>span{padding:4px;background:#101e30f2}#root #stage[data-mode=play] #hud .play-ability>b{white-space:normal}
 #root #stage[data-mode=play] #hud .run-clock{display:block;font-size:15px}#root #stage[data-mode=play] #hud .citizen-name{display:none}
 #root #stage[data-mode=play] :is(#sound,#pause,#fullscreen){min-width:44px;min-height:44px;width:44px;height:44px;padding:8px}#root #stage[data-mode=play] #pause{right:6px}#root #stage[data-mode=play] #sound{right:56px}#root #stage[data-mode=play] #fullscreen{top:54px;right:6px}
}

#stage .resource-shop>.resource-icon{width:56px;height:56px;display:block;margin:auto}#stage .shop-wallet>.resource-icon{width:32px;height:32px}#stage .profile-resources dt .resource-icon{width:24px;height:24px}#stage .shop-item-icon .shop-icon-art{filter:drop-shadow(1px 2px 0 #071223)}

@media(max-width:1000px),(max-height:600px){#stage .keybindings-panel[open]{display:block}#stage .keybindings-panel .binding-rows{overflow:visible;height:auto}#stage .keybindings-panel .binding-row small{display:block;font-size:17px}#root #stage #overlay .shop-categories{display:flex;flex-wrap:wrap;overflow:visible}#root #stage #overlay .shop-categories button{min-height:44px;white-space:normal}}
@media(max-width:1000px),(max-height:600px){#root #stage:not([data-mode=play]):not([data-mode=fight]) #overlay{flex-direction:column;align-items:stretch}#root #stage #overlay .character-panel{align-self:stretch;width:100%;overflow:visible}#root #stage[data-mode=equipment] #overlay{padding-top:64px}#root #stage[data-mode=shop] #overlay{padding-top:64px}}
@media(max-width:1000px),(max-height:600px){#root #stage:is([data-mode=equipment],[data-mode=shop],[data-mode=tutorial],[data-mode=help],[data-mode=dead],[data-mode=pause],[data-mode=fightPause]) #overlay{top:60px;bottom:0;height:auto;padding-top:8px}}

@media(pointer:coarse) and (orientation:landscape),(max-width:1000px) and (orientation:landscape){
 #root #stage[data-mode=play][data-history-theme] #hud b{font:15px/1.1 VT323,monospace}#root #stage[data-mode=play][data-history-theme] #hud small{font:15px/1.1 VT323,monospace}#root #stage[data-mode=play][data-history-theme] #hud .run-clock time{font-size:20px}
 #root #stage:is([data-mode=play],[data-mode=fight]) #utilities{display:grid;grid-template-columns:44px 44px;gap:5px;width:93px;right:max(6px,env(safe-area-inset-right));top:max(6px,env(safe-area-inset-top));bottom:auto}#root #stage:is([data-mode=play],[data-mode=fight]) #utilities button{position:static!important;margin:0;width:44px;height:44px;min-height:44px}#root #stage:is([data-mode=play],[data-mode=fight]) #fullscreen{grid-column:2;grid-row:2}#root #stage:is([data-mode=play],[data-mode=fight]) #pause{grid-column:2;grid-row:1}#root #stage:is([data-mode=play],[data-mode=fight]) #sound{grid-column:1;grid-row:1}
}

@media(max-height:600px) and (orientation:landscape){
 #root #stage #overlay .course-practice canvas{max-height:150px;margin:4px 0}
 #root #stage #overlay .course-controls{flex-wrap:nowrap;gap:5px}
 #root #stage #overlay .course-controls button{min-width:44px;min-height:44px;padding:6px}
 #root #stage #overlay .course-practice-label{font-size:16px;gap:6px}
 #root #stage #overlay .course-practice-label button{min-height:44px;font:15px VT323,monospace}
}

/* Celular em pé: nada além do aviso de girar (nem botões flutuantes, nem diálogos abertos). */
html.portrait-touch body>*:not(.orientation-gate),html.portrait-touch dialog{visibility:hidden!important}
html.portrait-touch dialog::backdrop{display:none}
html.portrait-touch,html.portrait-touch body{overflow:hidden;background:#101029}
/* Aviso de girar mais chamativo: céu estrelado, celular que deita em loop, letras dançando nas cores da logo. */
.orientation-gate{gap:14px;overflow:hidden;background:radial-gradient(circle at 50% 46%,#2b2a6e 0,#16163f 42%,#101029 75%)}
.orientation-gate>*{position:relative;z-index:1;margin:0}
.orientation-gate .og-sky{position:absolute;inset:0;z-index:0}
.orientation-gate .og-sky::before,.orientation-gate .og-sky::after{content:'';position:absolute;top:0;left:0;width:3px;height:3px;background:transparent;box-shadow:8vw 6vh #fff6c9,22vw 14vh #9fb4ff,37vw 4vh #fff,58vw 9vh #ffd23f,74vw 5vh #fff6c9,90vw 13vh #9fb4ff,12vw 30vh #fff,85vw 34vh #fff6c9,6vw 58vh #9fb4ff,93vw 61vh #fff,16vw 82vh #ffd23f,31vw 92vh #fff6c9,66vw 88vh #9fb4ff,82vw 79vh #fff;animation:og-twinkle 2.4s steps(2) infinite}
.orientation-gate .og-sky::after{box-shadow:28vw 22vh #fff,48vw 17vh #9fb4ff,68vw 24vh #fff6c9,9vw 44vh #ffd23f,94vw 47vh #9fb4ff,24vw 70vh #fff,52vw 76vh #fff6c9,78vw 69vh #ffd23f,44vw 96vh #fff;animation-delay:1.2s}
.orientation-gate .og-logo{width:min(74vw,300px);height:auto;image-rendering:pixelated;filter:drop-shadow(0 4px 0 #050812)}
.orientation-gate .og-stage{position:relative;width:150px;height:150px;display:grid;place-items:center}
.orientation-gate .og-glow{position:absolute;inset:6px;border-radius:50%;background:radial-gradient(circle,#ffd23f55 0,#ffd23f22 45%,transparent 70%);animation:og-glow 1.6s ease-in-out infinite}
.orientation-gate .og-phone{width:80px;height:128px;animation:og-turn 3.2s cubic-bezier(.5,-0.35,.35,1.4) infinite}
.orientation-gate .og-phone svg{display:block;width:100%;height:100%;image-rendering:pixelated;filter:drop-shadow(4px 4px 0 #050812)}
.orientation-gate .og-arrow{position:absolute;right:-4px;top:-2px;font:56px/1 VT323,monospace;color:#ffd23f;text-shadow:3px 3px 0 #a3222c;animation:og-arrow 3.2s ease-in-out infinite}
.orientation-gate .og-title{font:22px/1.4 'Brasil Arcade',monospace;letter-spacing:1px;text-shadow:3px 3px 0 #050812;white-space:nowrap}
.orientation-gate .og-title>span{display:inline-block;animation:og-wave 1.4s ease-in-out infinite;animation-delay:calc(var(--i) * .08s)}
.orientation-gate .og-title>.og-gap{width:.5em}
.orientation-gate p{font:22px/1.3 VT323,monospace;max-width:26ch;color:#e2fff1}
.orientation-gate .og-coins{display:flex;gap:18px}
.orientation-gate .og-coins>.loader-coin{width:26px;height:26px;animation:loader-coin .96s steps(1) infinite,og-hop 1.2s ease-in-out infinite}
.orientation-gate .og-coins>.loader-coin:nth-child(2){animation-delay:.32s,.2s}
.orientation-gate .og-coins>.loader-coin:nth-child(3){animation-delay:.64s,.4s}
@keyframes og-turn{0%,18%{transform:rotate(0)}42%,78%{transform:rotate(-90deg) scale(1.08)}96%,100%{transform:rotate(0)}}
@keyframes og-arrow{0%,18%{transform:rotate(0) scale(1)}30%{transform:rotate(-120deg) scale(1.25)}42%,100%{transform:rotate(-360deg) scale(1)}}
@keyframes og-wave{0%,55%,100%{transform:translateY(0)}25%{transform:translateY(-9px)}}
@keyframes og-glow{0%,100%{transform:scale(.9);opacity:.7}50%{transform:scale(1.08);opacity:1}}
@keyframes og-hop{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@keyframes og-twinkle{0%{opacity:1}50%{opacity:.35}}
@media(prefers-reduced-motion:reduce){.orientation-gate *,.orientation-gate *::before,.orientation-gate *::after{animation:none!important}.orientation-gate .og-phone{transform:rotate(-90deg)}}
