/* Profile and account share one aligned, reachable header control. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
.phone-install .install-app-mark{display:flex;gap:14px;align-items:center;margin:16px 0}.install-app-mark img{width:56px;height:56px;border-radius:14px}.install-app-mark strong,.install-app-mark span{display:block}.install-app-mark span{font-size:14px;margin-top:4px;color:#b9d0bd}
.install-steps{padding-left:24px;margin:20px 0;display:grid;gap:16px}.install-steps li{padding-left:4px;line-height:1.5}.install-steps strong,.install-steps span{display:block}.install-steps span{font-size:14px;color:#b9d0bd}.install-note{padding:14px;border:1px solid #8ba87866;border-radius:14px;background:#b2d58c10;margin:16px 0}.install-note p{margin-top:8px}.install-more{border-top:1px solid #8ba87844;padding:12px 0}.install-more summary{cursor:pointer;min-height:32px;font-weight:700}.install-more p{margin:8px 0}.phone-install .fine-print{margin-top:12px}
.modal-backdrop{box-sizing:border-box;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left))}.modal{max-height:calc(100dvh - max(24px,env(safe-area-inset-top)) - env(safe-area-inset-bottom));overscroll-behavior:contain}
@media(pointer:coarse){button,a,input,select,summary{touch-action:manipulation}input,textarea,select{font-size:16px!important}.icon-btn{min-width:44px;min-height:44px}.modal-header{gap:8px}.modal-header h2{min-width:0;overflow-wrap:anywhere}.modal-header .icon-btn{flex-shrink:0}}
/* Short iPhone landscape viewports must not inherit the desktop 560px canvas. */
@media(orientation:landscape) and (max-height:500px){
 .realm-shell{height:100dvh;min-height:0}.realm-top{top:8px;left:12px;right:12px}.realm-brand small,.realm-daily,.realm-welcome,.realm-player,.realm-mini,.realm-controls,.realm-mode{display:none!important}
 .realm-world-tools{top:66px;right:12px}.realm-bottom{left:50%;transform:translateX(-50%);bottom:8px;width:auto;padding:0}.realm-dock{display:grid;grid-template-columns:repeat(6,48px);gap:2px;padding:4px 6px}.dock-item,.dock-attack{height:46px;width:48px;gap:3px}.dock-item .icon{width:19px;height:19px}.dock-item small{font-size:10px}.dock-divider{display:none}
 .realm-panel{top:60px;bottom:70px;right:12px;width:min(560px,calc(100% - 24px));max-width:calc(100% - 24px)}.realm-panel-header{padding:8px 14px}.realm-panel-header h2{font-size:19px}.realm-panel-header>div>span,.realm-panel .drawer-emblem{display:none}.realm-panel-body{padding:12px 16px}.realm-shell:has(.realm-panel:not([hidden])) .realm-world-tools{display:none}
 .study-shell .topbar{height:calc(54px + env(safe-area-inset-top))}.study-shell .topbar .row{gap:8px}.study-shell .back-world{padding:7px;font-size:12px}.study-shell main{padding-top:12px}
}
@media(display-mode:standalone){body{overscroll-behavior-y:none}.account-screen.compact-auth{padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom))}.compact-auth .account-card{max-height:calc(100dvh - max(12px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom)))}}
.graphics-options{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:18px 0}.graphics-choice{padding:16px;border:2px solid #6e9590;border-radius:18px;background:#18343d;color:#eaf5e7;text-align:left;font:inherit;cursor:pointer}.graphics-choice strong{display:block;font-size:22px;margin-bottom:8px}.graphics-choice span{font-size:14px;line-height:1.5;display:block}.graphics-choice[aria-pressed=true]{border-color:#d2ed9e;background:#29483e}.graphics-choice:focus-visible{outline:3px solid #e8c470;outline-offset:3px}.weapon-art{filter:drop-shadow(0 2px 2px #081e3044)}
[data-graphics=low] .realm-vignette{display:none}[data-graphics=low] .hud-panel,[data-graphics=low] .kingdom-place-label,[data-graphics=low] .realm-dock{backdrop-filter:none!important}[data-graphics=low] .auth-particles{display:none}
@media(max-width:480px){.graphics-options{grid-template-columns:1fr}.graphics-choice{padding:13px}.graphics-choice strong{font-size:19px}}
.realm-resources,.top-actions{align-items:center}
.player-profile,.study-shell .player-profile{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;padding:3px;border:1px solid #cce9cb70;border-radius:50%!important;line-height:1;overflow:visible;background:#203f3c}
.player-profile .avatar,.study-shell .player-profile .avatar{display:block;width:36px;height:36px;min-width:0;padding:0;border:0;line-height:1;background:none;border-radius:50%;overflow:hidden}
.avatar-art{display:block;width:100%;height:100%}.avatar{overflow:hidden}.avatar .avatar-art{border-radius:inherit}
.account-badge{position:absolute;right:-2px;bottom:-2px;width:17px;height:17px;display:grid;place-items:center;border:2px solid #203f3c;border-radius:50%;background:#d7e8d0;color:#294c46;font-size:12px;font-weight:900;line-height:1}
.account-badge svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
[data-state=warning] .account-badge{background:#ffd28a;color:#623d14}[data-state=saved] .account-badge{background:#a4e6bf}[data-state=syncing] .account-badge{background:#b9dbf2}
.avatar-picker{border:0;padding:0;margin:18px 0}.avatar-picker legend{font-size:15px;font-weight:800;margin-bottom:10px}.avatar-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.avatar-picker .avatar-choice{margin:0;position:relative;cursor:pointer;min-width:0}.avatar-choice input{position:absolute;opacity:0;width:1px;height:1px}.avatar-choice>span{display:flex;flex-direction:column;align-items:center;gap:5px;padding:6px 3px;border:2px solid transparent;border-radius:14px;background:#203a4440;transition:background .15s,transform .15s}.avatar-choice svg{width:min(100%,58px);height:auto;border-radius:12px}.avatar-choice small{font-size:11px;line-height:1.2;text-align:center;min-height:27px}.avatar-choice input:checked+span{border-color:#a8ddad;background:#a8ddad25}.avatar-choice input:focus-visible+span{outline:3px solid #eac773;outline-offset:2px}.avatar-choice:hover>span{transform:translateY(-2px)}
@media(max-width:760px){
 :root{--phone-body:clamp(.875rem,.78rem + .4vw,1rem);--phone-heading:clamp(1.2rem,.85rem + 1.8vw,1.55rem);--phone-gap:clamp(10px,3vw,16px)}
 .study-shell main{padding:14px var(--phone-gap) 22px}.study-shell .statement,.step-section,.study-shell .inline-why{padding:var(--phone-gap)}
 .study-shell .statement h1,.realm-panel-header h2{font-size:var(--phone-heading);line-height:1.2}.study-shell .statement .description,.study-guide p,.realm-panel-body>p,.modal p{font-size:var(--phone-body);line-height:1.5}
 .study-shell .statement h1{margin:10px 0}.study-guide{margin-bottom:12px;padding:8px;gap:8px}.step-section h3{font-size:clamp(1rem,.8rem + 1vw,1.25rem)}
 .code-option{padding:10px 9px}.code-option code{font-size:clamp(.75rem,.65rem + .5vw,.875rem);line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
 .realm-panel-body{padding:var(--phone-gap)}.realm-panel-header{padding:12px var(--phone-gap)}.quest-choice{padding:10px;margin:7px 0}.quest-choice h3{font-size:clamp(.875rem,.7rem + .8vw,1rem)}.quest-choice p{font-size:12px;line-height:1.4}
 .modal{padding:18px;max-height:calc(100dvh - 24px);overflow:auto}.modal h2{font-size:var(--phone-heading)}
 .realm-top{gap:6px;left:12px;right:12px}.realm-brand{gap:5px}.realm-brand>span{font-size:clamp(15px,4.4vw,19px)}.realm-brand img{width:28px;height:28px}.realm-resources{gap:4px}.resource-token{padding:6px;gap:3px}.resource-token b{font-size:11px}.player-profile{flex-basis:40px;width:40px;height:40px}.player-profile .avatar{width:32px;height:32px}
 .study-shell .topbar{padding:0 10px}.study-shell .top-actions{gap:5px}.study-shell .currency{font-size:11px}.study-shell .back-world{font-size:11px;padding:6px}.study-shell .topbar .row{gap:6px}
}
@media(prefers-reduced-motion:reduce){.avatar-choice>span{transition:none}.avatar-choice:hover>span{transform:none}}

[data-graphics=low] .gear-sprite,[data-graphics=low] .weapon-art{filter:none!important}

/* Landscape overlays stay independent of the WebGL render cost. */
.player-name-tag{position:absolute;z-index:4;transform:translate(-50%,-100%);max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;color:#fff9e6;font:800 12px/1.4 Nunito,system-ui,sans-serif;letter-spacing:.02em;text-shadow:0 1px 2px #163527,1px 0 #163527,-1px 0 #163527;background:#203c35b8;border:1px solid #f3e7bf66;border-radius:5px;padding:2px 9px}
.player-rarity-aura{display:none;position:absolute;z-index:1;width:125px;height:125px;transform:translate(-50%,-50%);pointer-events:none;border-radius:50%;background:radial-gradient(ellipse,color-mix(in srgb,var(--aura-color) 55%,transparent),color-mix(in srgb,var(--aura-color) 24%,transparent) 40%,transparent 70%);opacity:.8}
[data-world-mode=equipment] .player-rarity-aura{display:block;animation:rarity-breathe 3.5s ease-in-out infinite}
[data-world-mode=equipment]{border-color:var(--aura-color);box-shadow:inset 0 0 22px color-mix(in srgb,var(--aura-color) 35%,transparent)}
[data-world-mode=equipment]:after{z-index:3;color:#193d35;background:#f2edd7cc;width:auto;left:50%;transform:translateX(-50%);padding:4px 10px;border-radius:5px;white-space:nowrap;font-weight:800}
@keyframes rarity-breathe{50%{opacity:.45;transform:translate(-50%,-50%) scale(.86)}}
[data-graphics=low] .player-rarity-aura{animation:none}
.kingdom-world .kingdom-place-label{position:absolute;left:0;top:0;transform:translate(-50%,-100%);display:flex!important;align-items:center;gap:6px;z-index:3;cursor:pointer;white-space:nowrap;min-height:34px;padding:5px 10px!important;border:1px solid #97744e!important;border-bottom:3px solid #74553b!important;border-radius:4px 7px 5px 4px!important;background:linear-gradient(175deg,#f0dfb6,#d5bc89)!important;color:#493d2b!important;font:800 12px/1.25 Nunito,system-ui,sans-serif!important;letter-spacing:.02em;box-shadow:0 2px 3px #203a3026!important;backdrop-filter:none!important}
.kingdom-world .kingdom-place-label:after{content:'';position:absolute;left:50%;top:100%;height:8px;width:3px;background:#74553b}
.kingdom-world .kingdom-place-label.is-destination{background:#f5e9c8!important;border-color:#536e42!important;color:#254c38!important}
.place-emblem{color:#607046;font-size:16px;line-height:1;border-right:1px solid #98774e55;padding-right:6px}
.kingdom-place-label[data-place=forge] .place-emblem{color:#986443}.kingdom-place-label[data-place=arena] .place-emblem{color:#6b6686}
.realm-mini{width:174px;background:#263f35f0;border-color:#d9c59688}.realm-mini .atlas-map-button svg{border-radius:12px}.realm-mini>.between>span{color:#e3d9b8;letter-spacing:.06em}.atlas-landscape{max-width:480px;margin:4px auto 14px}.atlas-landscape svg{width:100%;height:auto;display:block}.atlas-caption{text-align:center;color:#bacdbb;margin-bottom:20px}
@media(max-width:760px){.realm-mini{width:118px;padding:7px}.realm-mini>.between>span{font-size:8px;white-space:nowrap}.kingdom-world .kingdom-place-label{font-size:11px!important;min-height:32px;padding:4px 8px!important}.player-name-tag{font-size:11px;max-width:130px}.atlas-landscape{max-width:300px}}
@media(prefers-reduced-motion:reduce){[data-world-mode=equipment] .player-rarity-aura{animation:none}}

@media(max-width:760px){.modal{max-height:calc(100dvh - max(24px,env(safe-area-inset-top)) - env(safe-area-inset-bottom))}}

/* World controls stay outside navigation and out of activity panels. */
.realm-mini{top:100px;bottom:auto;right:24px;width:146px}
.realm-mini>.between{gap:2px}
.realm-mini>.between>span{min-width:0;white-space:normal;line-height:1.25}
.realm-mini>.between>.icon-btn{flex-shrink:0}
.realm-world-tools{top:102px;right:180px}
.realm-world-tools .world-tool-buttons{display:flex;flex-direction:column;gap:7px}
.realm-actions{position:absolute;z-index:12;right:24px;bottom:112px;display:flex;flex-direction:column;gap:10px}
.character-action{width:58px;min-height:58px;padding:7px;border-radius:19px;border:1px solid #e9d5ac88;background:#263f35ed;color:#fff0ce;box-shadow:0 4px 0 #132b26,0 6px 16px #142b2933;display:grid;place-items:center;gap:2px;touch-action:manipulation;cursor:pointer;transition:transform .12s}
.character-action>span{font-size:25px;line-height:1}.character-action svg{width:23px;height:23px}.character-action small{font-size:11px;font-weight:750}.character-action:active{transform:translateY(3px)}.character-action:focus-visible{outline:3px solid #f5d58b;outline-offset:3px}
.realm-main:has(.realm-panel:not([hidden])) .realm-actions{display:none}
.realm-main:has(.realm-panel:not([hidden])) .realm-mini,.realm-main:has(.realm-panel:not([hidden])) .realm-world-tools{visibility:hidden}
@media(max-width:760px){
 .realm-mini{top:calc(70px + env(safe-area-inset-top));right:12px;bottom:auto;width:112px;padding:7px}
 .realm-world-tools{top:calc(72px + env(safe-area-inset-top));right:132px}
 .realm-player{top:calc(72px + env(safe-area-inset-top));bottom:auto;left:12px;width:calc(100% - 192px);max-width:190px;padding:8px;gap:7px}
 .realm-player .hero-portrait{width:38px;height:44px;min-width:38px}.realm-player .hero-status{min-width:0}.realm-player .hero-status strong{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.realm-player .hero-status>.between>span{font-size:9px}.realm-player .hero-status>small{font-size:9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}.realm-player .hero-status>.between:first-child>span{display:none}
 .realm-actions{right:14px;bottom:calc(95px + env(safe-area-inset-bottom));gap:10px}.character-action{width:52px;min-height:52px;border-radius:17px}
 .realm-main:has(.realm-panel:not([hidden])) .realm-player{visibility:hidden}
}
@media(max-width:370px){.realm-player .hero-portrait{display:none}.realm-player .hero-status{width:100%}}
@media(max-height:500px) and (orientation:landscape){
 .realm-mini{display:block!important;top:64px;right:12px;width:104px;padding:6px}.realm-world-tools{top:66px;right:124px}.realm-actions{right:12px;bottom:calc(15px + env(safe-area-inset-bottom));flex-direction:row;gap:8px}.character-action{width:48px;min-height:48px}.realm-dock{grid-template-columns:repeat(6,48px)}
}
@media(prefers-reduced-motion:reduce){.character-action{transition:none}}

.world[data-render-state=paused] .player-rarity-aura{animation-play-state:paused}

/* Keep progress fractions together; move the whole value below a tight label. */
.progress-fraction{display:inline-block;white-space:nowrap;font-variant-numeric:tabular-nums;line-height:1.3}
.treasure-meter>.between,.hero-status>.between,.hp-label{flex-wrap:wrap;gap:4px 8px}
.treasure-meter>.between>*{min-width:0}
.treasure-meter .progress-fraction,.hero-status .progress-fraction{font-size:clamp(.625rem,2.7vw,.8125rem)}
.loot-heading>div,.loot-chest>div,.activity-pair>div,.score-grid>div{min-width:0}
.loot-heading h3,.loot-chest strong,.activity-pair h3,.score-grid strong{overflow-wrap:anywhere}
@media(max-width:480px){
 .study-top{flex-wrap:wrap;justify-content:flex-start;gap:8px}
 .study-top .meta{font-size:11px}
 .loot-heading{align-items:flex-start}.loot-heading>strong{font-size:13px}
 .treasure-meter>.between{justify-content:flex-start;column-gap:12px}
 .hero-status>.between:last-child{justify-content:flex-start}
 .compare-stats>div{grid-template-columns:minmax(0,1fr) 32px 58px;gap:6px;padding:8px}
 .combat-stats{grid-template-columns:repeat(5,minmax(0,1fr))}.combat-stats small{font-size:10px;overflow-wrap:anywhere}
}
