/* One viewport: the world, HUD and touch controls belong to the game screen. */
body.gameShell{--glass:#102b3de8;--line:#b6def32e;--dock:218px;margin:0;overflow:hidden;background:#071827;color:#f4f8fc;overscroll-behavior:none}
body.gameShell main{position:fixed;inset:0;width:100%;height:100%;height:100dvh;height:var(--appHeight,100dvh);max-width:none;margin:0;padding:0;overflow:hidden}
body.gameShell .stage{position:absolute;inset:0;border:0;border-radius:0;box-shadow:none;background:radial-gradient(ellipse at 50% 30%,#214b5e,#071827 80%);overflow:hidden;isolation:isolate}
#gameViewport{position:absolute;inset:0;inset:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);display:grid;place-items:center;overflow:hidden}
#gameBoard{position:relative;width:100%;height:100%;flex:none;container-type:inline-size}
body.gameShell #game{width:100%;height:100%;aspect-ratio:auto;touch-action:none}
body.gameShell.inBattle #gameViewport{bottom:var(--dock)}
body.gameShell.oldStyleBattle{--dock:174px}
body.gameShell.oldStyleBattle #gameBoard{container-type:inline-size}
body.gameShell footer{display:none}
body.gameShell main>header{position:absolute;right:max(18px,env(safe-area-inset-right));top:max(16px,env(safe-area-inset-top));z-index:15;display:block;margin:0;min-height:0;pointer-events:none}
body.gameShell main>header>div{display:none}
body.gameShell main>header nav{position:absolute;right:0;top:54px;display:none;grid-template-columns:1fr 1fr;width:320px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 90px);overflow:auto;gap:8px;padding:16px;background:var(--glass);border:1px solid var(--line);border-radius:20px;box-shadow:0 18px 60px #0006;backdrop-filter:blur(16px);pointer-events:auto}
body.gameShell.menuOpen main>header nav{display:grid}
body.gameShell main>header nav button{min-width:0;min-height:48px;padding:10px;font-size:13px;border-radius:12px;background:#24485b;border:1px solid #a6c9dd42;color:#f4f8fc}
body.gameShell main>header nav kbd{font-size:10px}
body.gameShell.touchUI main>header nav kbd{display:none}
#journeyMenuBtn{display:flex;align-items:center;gap:9px;min-height:44px;padding:9px 16px;border-radius:24px;background:var(--glass);border:1px solid var(--line);box-shadow:0 4px 20px #06172444;backdrop-filter:blur(12px);font-size:12px;font-weight:750;letter-spacing:.04em;pointer-events:auto;color:#fff}
.pokeballMark{display:inline-block;width:19px;height:19px;border:2px solid #eaf5ff;border-radius:50%;position:relative;background:linear-gradient(#ef6675 0 43%,#eaf5ff 43% 57%,transparent 57%)}
.pokeballMark:after{content:'';position:absolute;width:6px;height:6px;background:#0d2d40;border:2px solid #eaf5ff;border-radius:50%;left:50%;top:50%;transform:translate(-50%,-50%)}
body.gameShell.inBattle #journeyMenuBtn{font-size:0;gap:0;padding:10px;width:44px;height:44px;border-radius:50%}
#menuScrim{position:absolute;inset:0;z-index:13;background:#06182766;backdrop-filter:blur(2px);touch-action:none}
body.gameShell #placeTag{top:max(16px,env(safe-area-inset-top));left:max(18px,env(safe-area-inset-left));max-width:calc(100% - 135px);border:1px solid var(--line);background:var(--glass);border-radius:16px;padding:11px 16px;box-shadow:0 4px 24px #06172422;backdrop-filter:blur(12px)}
body.gameShell #placeTag small{font-size:9px;letter-spacing:1.7px;color:#a7d1e5}
body.gameShell #placeTag strong{font-size:20px;letter-spacing:-.4px;color:#fff}
body.gameShell #placeTag span{font-size:10px;color:#c0d8e3}
body.gameShell #worldPanel{position:absolute;bottom:max(18px,env(safe-area-inset-bottom));left:max(18px,env(safe-area-inset-left));margin:0;padding:8px 12px;gap:10px;border-radius:18px;border:1px solid var(--line);background:var(--glass);box-shadow:0 5px 30px #06172433;backdrop-filter:blur(12px);max-width:calc(100% - 36px);z-index:2}
body.gameShell #worldPanel>p,body.gameShell #saveStatus,body.gameShell #worldPanel small{display:none}
body.gameShell #worldPanel>div{display:flex;align-items:center;gap:8px}
#hudPartnerPortrait{width:36px;height:36px;object-fit:contain;image-rendering:pixelated}
body.gameShell #leadBtn{margin:0;padding:0;border:0;background:transparent;color:#f4f8fc;font-size:12px;min-height:36px}
body.gameShell #contextBtn{z-index:4;bottom:82px;padding:12px 20px;border-radius:24px;border:1px solid #c1eadb70;background:#143f40ed;color:#fff;min-height:44px;font-size:12px;max-width:calc(100% - 28px);white-space:normal}
body.gameShell #toast{z-index:9;bottom:138px;border:1px solid var(--line);border-radius:14px;background:#0d2a3cee;color:#fff;max-width:min(460px,90%);font-size:12px;padding:10px 16px}
body.gameShell #dialogue{bottom:max(18px,env(safe-area-inset-bottom));left:50%;right:auto;transform:translateX(-50%);width:min(680px,calc(100% - 28px));max-height:80%;overflow:auto;padding:20px 24px;border-radius:18px;border:2px solid #adc9d4;box-shadow:0 12px 50px #0006;background:#f5f8f7;color:#1e3846;z-index:16}
body.gameShell #dialogue p{font-size:15px;line-height:1.55}
body.gameShell #dialogue small{color:#487a8e}
body.gameShell #dialogue button{min-height:44px;padding:10px 14px;font-size:13px;border-radius:11px;background:#e0eaf0;border-color:#adc5d1;color:#193d50}
body.gameShell #screenOverlay{z-index:18;padding:24px;background:#0c243de8}
body.gameShell #screenOverlay button{min-height:44px}
body.gameShell #panel{bottom:auto;height:var(--appHeight,100dvh);padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));background:#071b30e8;backdrop-filter:blur(14px);overscroll-behavior:contain}
body.gameShell .panelCard{background:#123047;border-color:#739bad55;border-radius:20px}
body.gameShell #closePanel{min-height:44px;position:sticky;top:0;z-index:4}
body.gameShell #combatPanel{position:absolute;bottom:0;left:0;right:0;height:var(--dock);margin:0;padding:8px max(14px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));z-index:5;overflow:auto;background:linear-gradient(145deg,#173a50f5,#0d2638fc);border:1px solid var(--line);border-bottom:0;border-radius:24px 24px 0 0;box-shadow:0 -10px 40px #04132144;overscroll-behavior:contain}
body.gameShell #combatPanel>*{max-width:1000px;margin-left:auto;margin-right:auto}
body.gameShell .partyStripHeader{margin-top:0;font-size:9px}
body.gameShell .partySlot{min-height:50px;padding:2px 3px 11px;border-radius:10px}
body.gameShell .partySlot img{width:25px;height:25px}
body.gameShell .partyInfo strong{font-size:9px}
body.gameShell .partyInfo small,body.gameShell #battleHint{display:none}
body.gameShell #moveBar{gap:6px;margin:6px auto}
body.gameShell .move,body.gameShell .move.active{min-height:54px;padding:7px 10px;border-radius:12px}
body.gameShell .move strong{font-size:13px;margin:2px 0}
body.gameShell .move span{font-size:9px}
body.gameShell .battleActions{gap:6px;justify-content:center}
body.gameShell .battleActions button{min-height:36px;padding:6px 10px;font-size:11px}
body.gameShell #battleHud{top:14px;left:14px;right:var(--hudRight,14px)}
body.gameShell:not(.oldStyleBattle) .hpbox{background:var(--glass);border-color:var(--line);border-radius:14px;backdrop-filter:blur(10px)}
body.gameShell.oldStyleBattle #combatPanel{display:grid;grid-template-columns:48% 52%;grid-template-rows:1fr auto;aspect-ratio:auto;overflow:auto}
body.gameShell.oldStyleBattle #classicMessage{margin:5px 10px 5px 0;padding:12px;border-radius:12px;border:2px solid #b6c4d2;outline:0;box-shadow:none}
body.gameShell.oldStyleBattle #classicMessageText{font-size:clamp(14px,2.2cqw,24px);text-shadow:none}
body.gameShell.oldStyleBattle #classicMainMenu{padding:4px 0;gap:6px}
body.gameShell.oldStyleBattle #classicMainMenu button{min-height:44px;aspect-ratio:auto;border-radius:10px}
body.gameShell.oldStyleBattle #moveBar .move,body.gameShell.oldStyleBattle #moveBar .move.active{min-height:48px}
body.gameShell.oldStyleBattle #classicBack{min-height:36px;border-radius:8px}
body.gameShell.oldStyleBattle #battleHud{inset:0}
#touchControls{position:absolute;inset:0;z-index:6;pointer-events:none;display:none}
body.gameShell.touchUI #touchControls{display:block}
.touchPad{position:absolute;width:128px;height:128px;border-radius:50%;bottom:max(22px,env(safe-area-inset-bottom));left:max(20px,env(safe-area-inset-left));pointer-events:auto;touch-action:none;background:#163c4f80;border:1px solid #e0f5ff55;box-shadow:inset 0 0 25px #ecf9ff14,0 6px 20px #00192933;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.touchPad:before{content:'↑';position:absolute;inset:5px;text-align:center;color:#d3f0fa80;font-size:20px}
.touchPad:after{content:'←  ↓  →';position:absolute;bottom:12px;left:0;right:0;text-align:center;color:#d3f0fa80;font-size:16px}
.touchKnob{position:absolute;left:40px;top:40px;width:46px;height:46px;border-radius:50%;background:#e2f2f3d9;border:2px solid #fff8;box-shadow:0 4px 12px #001d3244;pointer-events:none}
.touchActions{position:absolute;right:max(20px,env(safe-area-inset-right));bottom:max(30px,env(safe-area-inset-bottom));display:flex;align-items:flex-end;gap:12px}
.touchActions button{pointer-events:auto;touch-action:none;border-radius:50%;width:68px;height:68px;background:#e55b6cea;border:2px solid #ffd4dc99;box-shadow:0 5px 20px #001b3544;color:white;font-size:12px;font-weight:800;padding:0;user-select:none;-webkit-user-select:none}
.touchActions #touchRun{width:54px;height:54px;background:#1e5267e8;border-color:#b6e4f577}
body.gameShell.touchUI #worldPanel{bottom:auto;top:112px;left:14px;padding:5px 9px;border-radius:13px}
body.gameShell.touchUI #worldPanel #hudPartnerPortrait{width:26px;height:26px}
body.gameShell.touchUI #worldPanel #leadBtn{font-size:10px;min-height:26px}
body.gameShell.touchUI #contextBtn{bottom:168px}
body.gameShell.touchUI #toast{bottom:218px}
body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchPad{bottom:calc(var(--dock) + 12px);width:106px;height:106px;left:14px}
body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchKnob{left:29px;top:29px}
body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchActions{bottom:calc(var(--dock) + 24px);right:14px}
body.gameShell.touchUI.inBattle #touchInteract{display:none}
body.gameShell.touchUI.inBattle #touchRun{background:#246b88eb}
body.gameShell.controlsBlocked #touchControls,body.gameShell.oldStyleBattle #touchControls{display:none}
@media(max-width:600px){
 body.gameShell{--dock:calc(280px + env(safe-area-inset-bottom))}body.gameShell.oldStyleBattle{--dock:calc(220px + env(safe-area-inset-bottom))}
 body.gameShell #placeTag{padding:9px 12px;left:12px;top:max(12px,env(safe-area-inset-top));max-width:calc(100% - 112px)}
 body.gameShell #placeTag strong{font-size:16px}body.gameShell #placeTag span{display:none}
 body.gameShell main>header{right:12px;top:max(12px,env(safe-area-inset-top))}#journeyMenuBtn{padding:8px 12px}
 body.gameShell #combatPanel{padding:8px 8px max(8px,env(safe-area-inset-bottom));border-radius:18px 18px 0 0}
 body.gameShell #moveBar{grid-template-columns:1fr 1fr;gap:5px}.gameShell .battleActions button{min-height:40px}
 body.gameShell .move strong{font-size:12px}body.gameShell .move,body.gameShell .move.active{min-height:50px}
 body.gameShell .battleActions{gap:4px}body.gameShell .battleActions button{font-size:10px;padding:6px 8px}
 body.gameShell .partySlot{min-height:48px}.gameShell .partyState{font-size:7px;letter-spacing:0}
 body.gameShell:not(.oldStyleBattle) .hpbox{min-width:0;width:44%;padding:7px 9px}.gameShell:not(.oldStyleBattle) .hpbox strong{font-size:12px}
 body.gameShell:not(.oldStyleBattle) #battleHud{left:8px;right:var(--hudRight,8px);top:8px}.gameShell:not(.oldStyleBattle) .hpbox small{font-size:7px;letter-spacing:1px}
 body.gameShell #dialogue{padding:16px;max-height:74%}.gameShell #dialogue p{font-size:13px}
 body.gameShell .panelCard{padding:14px;max-width:100%}.gameShell .teamCard{gap:8px;padding:10px}.gameShell .teamCard img{width:48px;height:48px}
 body.gameShell .panelCard button{min-height:44px}.gameShell .pcWorkspace{display:flex;flex-direction:column}.gameShell .pcWorkspace>*{width:100%;min-width:0}
 body.gameShell #panel:has(.pcStorage) .panelCard{padding:12px}
 body.gameShell #panel:has(.pcStorage) #closePanel{position:sticky;top:0;min-height:44px;z-index:5}
 body.gameShell .pcSlotGrid{gap:3px;padding:4px}
 body.gameShell .pcHeader{flex-wrap:wrap;padding-right:76px}
 body.gameShell .pcHeader p{white-space:normal}
 body.gameShell.oldStyleBattle #combatPanel{grid-template-columns:40% 60%}.gameShell.oldStyleBattle #classicMessageText{font-size:14px}
 body.gameShell.oldStyleBattle #classicHelp{font-size:10px}.gameShell.oldStyleBattle #classicTurnLabel{font-size:9px}
}
@media(max-height:500px) and (orientation:landscape){
 body.gameShell{--dock:calc(156px + env(safe-area-inset-bottom))}body.gameShell.oldStyleBattle{--dock:calc(154px + env(safe-area-inset-bottom))}
 body.gameShell #combatPanel{padding:4px 110px 4px 8px;border-radius:14px 14px 0 0}
 body.gameShell .partyStripHeader{display:none}body.gameShell .partySlot{min-height:35px;padding:1px 2px 9px}
 body.gameShell .partySlot img{width:18px;height:18px}.gameShell .partyInfo strong{font-size:8px}
 body.gameShell .move,body.gameShell .move.active{min-height:42px;padding:4px 7px}.gameShell .move strong{font-size:11px}.gameShell .move span{display:none}
 body.gameShell .battleActions button{min-height:32px;padding:4px 7px}
 body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchPad{bottom:22px;left:auto;right:8px;width:90px;height:90px}.gameShell.touchUI.inBattle .touchKnob{left:21px;top:21px}
 body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchActions{bottom:calc(var(--dock) + 10px)}
 body.gameShell #placeTag{padding:6px 10px}.gameShell #placeTag strong{font-size:14px}.gameShell #placeTag span{display:none}
 body.gameShell.touchUI #worldPanel{top:85px}.gameShell #dialogue{max-height:82%}
 body.gameShell.oldStyleBattle #combatPanel{padding-right:8px}
 body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchPad{right:max(8px,env(safe-area-inset-right))}
 body.gameShell.touchUI.inBattle:not(.oldStyleBattle) .touchActions{right:max(14px,env(safe-area-inset-right))}
}
@media(prefers-reduced-motion:reduce){body.gameShell *{scroll-behavior:auto!important;transition:none!important}}
@container(max-width:600px){
 body.gameShell:not(.oldStyleBattle) #battleHud{left:8px;right:var(--hudRight,8px);top:8px}
 body.gameShell:not(.oldStyleBattle) .hpbox{min-width:0;width:44%;padding:6px 8px}
 body.gameShell:not(.oldStyleBattle) .hpbox strong{font-size:12px}
 body.gameShell:not(.oldStyleBattle) #battleHud.isDoubles{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;padding:0}
 body.gameShell:not(.oldStyleBattle) #battleHud.isDoubles>.hpbox,body.gameShell:not(.oldStyleBattle) #battleHud.isDoubles .doubleFighter{min-height:44px;padding:4px 5px;border-radius:9px}
 body.gameShell:not(.oldStyleBattle) #battleHud.isDoubles strong{font-size:10px}
 body.gameShell:not(.oldStyleBattle) #battleHud.isDoubles .doubleHealth{height:4px}
}
