:root{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px)}
.topbar{padding-top:max(4px,var(--safe-top))}.top-actions button{min-width:36px}.menu-sheet{max-height:calc(100dvh - 22px - var(--safe-top) - var(--safe-bottom));overflow:auto}.menu-sheet nav{overflow-x:auto;flex-wrap:nowrap;flex-shrink:0}.menu-sheet nav button{white-space:nowrap}.menu-copy{line-height:1.6}
.attribute-list>div{display:flex;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid #3d555348}.attribute-list span{flex:1}.attribute-list small{display:block;color:#9ab4aa;font-size:12px}.attribute-list strong{min-width:25px;text-align:center}.attribute-list button{width:42px;height:42px;border:1px solid #56756c;border-radius:8px;background:#233e40;color:#e6edcf;font-size:24px}.action-row{display:flex;gap:10px;margin:20px 0}.action-row>*{flex:1}.equipment-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:20px 0}.equipment-grid>div{background:#213839;border:1px solid #425b55;border-radius:9px;padding:12px}.equipment-grid small,.equipment-grid b{display:block}.equipment-grid small{color:#a3b8a6}.equipment-grid button{margin-top:8px}.item-card{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:15px 0;border-bottom:1px solid #425652}.item-card p{font-size:13px;color:#b9d3a7;margin:5px 0}.item-card small{color:#9bb4ad}.item-card button{min-width:110px}.item-card>div:last-child{display:flex;flex-direction:column;gap:8px}.setting-field{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:15px 0;font-size:14px}.setting-field select{max-width:65%;padding:10px;border:1px solid #526f63;border-radius:8px;background:#1b3439;color:#e3edcf}.shop-balance{position:sticky;top:0;padding:10px;background:#20383c;border-radius:6px;z-index:1}
.dialogue-actions{grid-column:2/-1;display:flex;flex-wrap:wrap;gap:8px}.dialogue-actions:empty{display:none}.dialogue-actions button{padding:10px;min-height:42px}.transition-shade{pointer-events:none;position:fixed;inset:0;background:#0c1e26;opacity:0;transition:opacity .16s;z-index:95}.transition-shade.active{opacity:.96;pointer-events:all}.orientation-note{position:fixed;left:50%;top:calc(44px + var(--safe-top));transform:translateX(-50%);max-width:85%;background:#253d40ee;border:1px solid #a3bc86;border-radius:8px;padding:8px 14px;color:#e7edcf;font-size:12px;z-index:70;pointer-events:none;white-space:normal;text-align:center}
.joystick{display:none;width:108px;height:108px;border-radius:50%;background:#1f404c91;border:1px solid #aacbb55c;touch-action:none;position:relative}.joystick span{position:absolute;left:31px;top:31px;width:44px;height:44px;border-radius:50%;background:#9aba9ba8;border:1px solid #d4e3b4;pointer-events:none}.dpad button,.skill,.interact,.joystick{touch-action:none;-webkit-user-select:none;user-select:none}.dpad button.pressed,.dpad button:active,.skill:active,.interact:active{background:#8cb496!important;color:#152c32!important;box-shadow:0 0 0 2px #d2e2b877 inset}
body[data-control=joystick] .joystick{display:block}body[data-control=joystick] .dpad{display:none}
@media(min-width:951px) and (pointer:fine){.movement .dpad,.movement .joystick{display:none!important}.controls{justify-content:flex-end!important}.movement{margin-left:auto!important}}
@media(max-width:650px){.topbar{gap:4px!important;padding-left:8px!important;padding-right:8px!important}.top-actions{gap:3px!important}.top-actions button{width:29px!important;min-width:29px!important;height:34px!important}.area{font-size:10px!important}.equipment-grid{grid-template-columns:1fr 1fr}.item-card{gap:9px}.item-card button{min-width:98px;font-size:12px}.controls{padding-bottom:max(8px,var(--safe-bottom))!important}.dialogue{max-height:70dvh;overflow:auto}.dialogue-actions{grid-column:1/-1}.action-row{flex-wrap:wrap}.joystick{width:102px;height:102px}.joystick span{left:29px;top:29px}.menu-sheet{width:calc(100vw - 16px)!important}.setting-field{flex-wrap:wrap}.setting-field select{max-width:100%;width:100%}}
@media(orientation:landscape) and (max-height:500px){.game{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}.movement{left:max(10px,env(safe-area-inset-left,0px))!important;bottom:max(9px,var(--safe-bottom))!important;gap:12px!important}.combat-panel{right:max(10px,env(safe-area-inset-right,0px))!important;bottom:max(9px,var(--safe-bottom))!important}.guide{top:49px!important;bottom:auto!important;max-width:42%;font-size:10px}.joystick{width:87px;height:87px}.joystick span{width:36px;height:36px;left:25px;top:25px}.menu-sheet{max-height:calc(100dvh - 12px);padding:15px!important}.menu-sheet h2{font-size:23px}.orientation-note{top:39px}}
@media(max-width:950px),(pointer:coarse){.academy-stage .dpad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:2px}.academy-stage .interact{min-height:44px}.academy-stage .skill{min-height:56px}.movement{flex-shrink:0}}
@media(orientation:portrait) and (max-width:950px){.academy-stage .controls{gap:10px}.academy-stage .movement{width:136px}.academy-stage .interact{width:136px}.academy-stage .skills{gap:4px}.academy-stage .skill b{font-size:9px}}
@media(orientation:landscape) and (max-height:500px){.interior-stage .controls{justify-content:flex-start!important}.academy-stage .interact{width:48px;height:48px}.academy-stage .skill{min-height:52px}}
.menu-sheet>header{position:sticky;top:0;z-index:6;background:#1a3036;min-height:70px;padding-bottom:12px}.menu-sheet>nav{position:sticky;top:70px;z-index:5;background:#1a3036}.menu-sheet>nav button{min-height:44px}.secondary,.cta,.attribute-list button{min-height:44px}.attribute-list button{min-width:44px}.equipment-grid b{overflow-wrap:anywhere}
@media(orientation:landscape) and (max-height:500px){.menu-sheet>header{min-height:55px;padding-bottom:6px}.menu-sheet>nav{top:55px}}
/* The body scrolls independently; navigation and close remain reachable. */
.menu-sheet{display:flex;flex-direction:column;overflow:hidden;height:min(820px,calc(100dvh - 22px - var(--safe-top) - var(--safe-bottom)))}.menu-sheet>header,.menu-sheet>nav{position:static;flex-shrink:0}.menu-sheet #menu-content{overflow-y:auto;min-height:0;overscroll-behavior:contain;padding-top:12px}.attribute-list~.stat-grid .stat-box b{white-space:nowrap}
@media(max-width:650px){.attribute-list~.stat-grid .stat-box b{font-size:17px}}
@media(orientation:landscape) and (max-height:500px){.menu-sheet{height:calc(100dvh - 12px)}}
.aether-atlas{margin:0 0 24px}.atlas-heading h3{font:26px Fredoka,Georgia,serif;margin:8px 0}.atlas-chart{display:block;width:100%;height:auto;max-height:440px;filter:drop-shadow(0 8px 20px #03171d55)}.atlas-route{fill:none;stroke:#c1c3a1;stroke-width:1.4;stroke-dasharray:3 5;opacity:.3}.atlas-route.available{stroke:#e7cf9f;opacity:.75}.atlas-label{font:8px Fredoka,system-ui,sans-serif;fill:#f0e0bb;paint-order:stroke;stroke:#19373c;stroke-width:2px;stroke-linejoin:round}.atlas-label.unknown{fill:#a0b1a8}.atlas-compass{font:13px Fredoka,Georgia,serif;fill:#dfcca5;text-anchor:middle}.atlas-sea-label{font:8px Fredoka,Georgia,serif;fill:#9bbbb8;letter-spacing:2px}.atlas-chart g[role=button]{cursor:pointer;outline:none}.atlas-chart g[role=button]:focus circle:last-of-type{stroke:#fcdd94;stroke-width:4}.atlas-info{padding:16px 18px;margin:12px 0;border:1px solid #99b9a630;border-radius:12px;background:#102d3438;min-height:125px}.atlas-info h4{font:23px Fredoka,Georgia,serif;margin:6px 0}.atlas-info p{font-size:13px;color:#c1d0c1;line-height:1.5;margin:7px 0}.atlas-connections{color:#9eb6ac!important}@media(max-width:600px){.atlas-label{font-size:9px}.atlas-chart{min-height:260px}.atlas-info{padding:12px}.atlas-heading h3{font-size:23px}}

.development [hidden]{display:none!important}
.development[open]{max-height:calc(100dvh - 72px);overflow-y:auto;overscroll-behavior:contain}.development summary{min-height:28px;display:flex;align-items:center}.development summary::before{content:'▸';margin-right:6px}.development[open] summary::before{content:'▾'}.development select,.development button,.development a{min-height:44px;box-sizing:border-box}.development a{display:flex;align-items:center}.development label:has(input[type=checkbox]){min-height:44px;display:flex;align-items:center;gap:8px}
#game.academy-stage .top-actions button{min-width:44px!important;width:44px!important;height:44px!important;padding:7px!important}#game.academy-stage .topbar{min-height:48px}#brand{min-height:44px}.attribute-list button{width:44px;height:44px}.dialogue-actions button,.menu-tabs button,.menu-sheet .secondary{min-height:44px}#menu-close{width:44px;height:44px}@media(max-width:650px){#game.academy-stage #menu-open span{display:none}#game.academy-stage #brand>span:last-child{display:none}#game.academy-stage #brand{min-width:32px;justify-content:center;padding:0}#game.academy-stage .area{max-width:92px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-actions{gap:3px!important}}@media(orientation:landscape) and (max-height:520px){#game.academy-stage .topbar{height:48px!important;min-height:48px!important}}
#game.academy-stage #menu-open{width:auto!important;min-width:88px!important}.development{top:calc(58px + var(--safe-top))}.development[open]{max-height:calc(100dvh - 72px - var(--safe-top) - var(--safe-bottom))}@media(max-width:650px){#game.academy-stage #menu-open{width:44px!important;min-width:44px!important}#game.academy-stage .topbar{height:calc(48px + var(--safe-top))!important;min-height:calc(48px + var(--safe-top))!important}}
@media(max-width:650px){#game.academy-stage #brand{width:44px;min-width:44px}.academy-stage .area{min-width:0}}
/* Landscape-first touch layout: the world extends behind translucent controls. */
@media(orientation:landscape) and (max-height:600px){
 #game.academy-stage{padding:0 env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px);height:100dvh;gap:0}
 #game.academy-stage .playfield{flex:1;min-height:0;border-radius:0;margin:0;border:0}
 #game .controls{position:absolute!important;inset:auto 0 0!important;height:0;padding:0!important;pointer-events:none;background:none;gap:0}
 #game .movement{position:fixed;left:max(12px,env(safe-area-inset-left,0px))!important;bottom:max(12px,env(safe-area-inset-bottom,0px))!important;display:block;width:auto!important;pointer-events:none}
 #game .dpad{grid-template-columns:repeat(3,44px);grid-template-rows:repeat(3,44px);gap:2px;opacity:.78;pointer-events:auto}
 #game .dpad button{background:#18343d9e;border-color:#b6d7bc78;backdrop-filter:none}
 #game .joystick{pointer-events:auto;background:#1b3d4773;width:104px;height:104px}
 #game .joystick span{width:42px;height:42px;left:30px;top:30px}
 #game .combat-panel{position:fixed;right:max(12px,env(safe-area-inset-right,0px))!important;bottom:max(12px,env(safe-area-inset-bottom,0px))!important;width:208px;max-width:36vw;pointer-events:none;margin:0}
 #game .skills{grid-template-columns:repeat(3,1fr);gap:5px;pointer-events:auto}
 #game .skill{min-height:48px;height:48px;padding:3px;background:#18333cae!important;border-color:#91afa57a}
 #game .skill .glyph{font-size:17px;height:19px}#game .skill b{font-size:8px}#game .skill small{font-size:6px}
 #game .interact{position:fixed;right:max(12px,env(safe-area-inset-right,0px));bottom:calc(max(12px,env(safe-area-inset-bottom,0px)) + 110px);width:48px!important;height:48px!important;min-height:48px;pointer-events:auto;background:#37564abf;border-color:#bed0a783}
 #game.interior-stage .interact{bottom:max(16px,env(safe-area-inset-bottom,0px))}
 #game .hero-vitals{min-width:140px;padding:5px 8px;background:#102a30b8}#game .hud{top:8px;left:10px}
 #game .quest-hud{max-width:210px;background:#102a30b0;padding:6px 9px}#game .quest-hud small{display:none}
 #game .guide{top:9px!important;left:50%;bottom:auto!important;max-width:42%;font-size:10px;background:#132d349c}
 #game .keyboard-hint{display:none}#game .combat-top{display:none}#game.turn-battle .combat-top{display:flex;background:#102a30df;padding:4px}
 .dialogue{bottom:20px!important;max-width:65%!important;max-height:calc(100dvh - 75px);overflow:auto}
 .menu-sheet{width:min(980px,calc(100vw - 24px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)))!important}
 .orientation-note{top:55px}
}
/* Mobile movement is analog only. Legacy directional markup never appears. */
.dpad{display:none!important}
body[data-control=floating] #joystick,body[data-control=joystick] #joystick{display:block}
#joystick{position:fixed;left:max(12px,env(safe-area-inset-left,0px));bottom:max(12px,env(safe-area-inset-bottom,0px));width:128px!important;height:128px!important;display:none;background:none!important;border:0!important;border-radius:0;touch-action:none;pointer-events:auto;z-index:25;user-select:none;-webkit-user-select:none;outline:none}
body[data-control=floating] #joystick{width:clamp(128px,40vw,250px)!important;height:clamp(120px,44dvh,180px)!important}
#joystick .joystick-base{position:absolute;left:64px;top:64px;width:104px;height:104px;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,#142f3940 0 42%,#25464e54 43% 66%,#c6ddbd24 67% 69%,#132f3a33 70%);border:1px solid #bdcfaa70;box-shadow:inset 0 0 16px #061f2c33,0 3px 15px #051c2820;pointer-events:none;opacity:.60}
#joystick[data-active=true] .joystick-base{opacity:.92}
#joystick .joystick-base .joystick-knob{position:absolute;left:50%!important;top:50%!important;margin:-16px 0 0 -16px;width:32px!important;height:32px!important;pointer-events:none;border:1px solid #d6e3bd9c;border-radius:50%;background:radial-gradient(circle at 35% 28%,#c5d6acdb,#769b8aba 65%,#355e67b0);box-shadow:0 3px 8px #061e3255;will-change:transform}
@media(min-width:951px) and (pointer:fine){body[data-control=floating] #joystick,body[data-control=joystick] #joystick{display:none!important}}
@media(prefers-reduced-motion:reduce){#joystick .joystick-base{transition:none}}
#joystick .joystick-base{background:radial-gradient(circle,#102a355c 0 42%,#264b547d 43% 66%,#c6ddbd40 67% 69%,#142e3e66 70%);border-color:#bdcfaa9c;opacity:.75}
#joystick[data-active=true] .joystick-base{opacity:1}

/* Dialogue owns the mobile action area while a conversation is open. */
.game.talking #controls{opacity:0;pointer-events:none}
.game.talking #controls,.game.talking #controls *{visibility:hidden!important;pointer-events:none!important}
