/* Scoped to gameplay page; landing/account pages retain their scrolling layout. */
body.mmo-shell{margin:0;padding:0;overflow:hidden;background:#10191b;color:#eee3cb;touch-action:pan-y}
body.mmo-shell main{display:block;margin:0;padding:0;max-width:none;width:100%;height:100dvh}
body.mmo-shell .play{margin:0;padding:0;display:block;width:100%;height:100%;min-width:0}
body.mmo-shell .viewport{position:relative;width:100%;height:100%;max-height:none;min-height:0!important;border:0;border-radius:0;aspect-ratio:auto;isolation:isolate;overflow:hidden}
body.mmo-shell #game{position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:fill!important}
#gameUI{position:absolute;inset:0;z-index:20;pointer-events:none}
#gameUI button,#gameUI input,#gameUI select,#gameUI a,#gameUI textarea{pointer-events:auto}
#gameUI [hidden],#gameUI dialog:not([open]){display:none!important;pointer-events:none!important}
.mmo-window,#gameUI #modal,#gameUI #death,#gameUI #start{box-sizing:border-box;pointer-events:auto;position:absolute;inset:auto;top:12%;left:50%;transform:translateX(-50%);width:min(620px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:76%;margin:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;background:linear-gradient(140deg,#17252bf5,#10191ef5);color:#eee3cb;border:1px solid #b89c60;border-radius:12px;padding:20px;box-shadow:0 16px 40px #0009;z-index:70;min-width:0}
#gameUI #modal,#gameUI #start,#gameUI #death{top:50%;transform:translate(-50%,-50%);max-height:90%}
#gameUI #modal .close,.mmo-window-heading button{position:sticky;float:right;top:0;right:0;min-width:44px;min-height:44px;font-size:26px;z-index:2}
.mmo-window-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:-20px;background:#172329;z-index:2;padding:8px 0;border-bottom:1px solid #b89c6066}
body.mmo-shell .character.mmo-window{left:auto;right:16px;transform:none;width:min(390px,calc(100% - 24px));height:auto}
#gameUI .character .portrait-frame,#gameUI .character #paperdoll{display:none}
#gameUI #gameMenu header{display:flex;flex-wrap:wrap;height:auto;padding:0;background:none;gap:8px;position:static}
#gameUI #gameMenu .map-heading{display:flex;flex-wrap:wrap;gap:8px}
#gameUI #gameMenu .brand{width:100%}
#gameUI button{min-height:44px}
#mmoMenuButton{position:absolute;left:calc(12px + env(safe-area-inset-left));top:calc(12px + env(safe-area-inset-top));pointer-events:auto}
body.mmo-shell .under,body.mmo-shell>.footer,body.mmo-shell>footer,body.mmo-shell .touchpad,body.mmo-shell .journal{display:none}
body.mmo-shell .quests:not(.mmo-window),body.mmo-shell #tutorial,body.mmo-shell .actionbar,body.mmo-shell #skillBar{display:none}
#gameUI #chatPanel{position:absolute;left:12px;bottom:90px;top:auto;right:auto;width:min(400px,calc(100% - 24px));max-height:40%;pointer-events:auto;overflow:auto;margin:0;z-index:65}
#gameUI #chatPanel #chatLog{max-height:160px;overflow:auto}
#gameUI #chatClose{min-width:44px;min-height:44px;float:right}
#gameUI #tradePanel{pointer-events:auto;position:absolute;left:50%;top:15%;transform:translateX(-50%);max-height:70%;max-width:90%;overflow:auto}
#gameUI #eventBanner{position:absolute;top:85px;left:50%;transform:translateX(-50%);max-width:55%;background:#17252bf0;padding:8px;pointer-events:none}
body.mmo-shell .mobile-topbar{display:none!important}
.mmo-status{position:absolute;left:calc(12px + env(safe-area-inset-left));top:calc(12px + env(safe-area-inset-top));width:clamp(180px,22vw,280px);padding:10px;background:#101a22de;border:1px solid #b89c6077;border-radius:10px;font-size:13px;pointer-events:none}
.mmo-status strong{display:block;margin-bottom:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mmo-meter{position:relative;height:18px;margin-top:5px;background:#080f14;border-radius:5px;overflow:hidden}
.mmo-meter i,.mmo-exp i{display:block;height:100%;background:#a94943;width:0;transition:width .15s}
.mmo-meter.mp i{background:#397fa3}.mmo-meter span{position:absolute;inset:0;text-align:center;color:#fff;font-size:12px;line-height:18px;text-shadow:0 1px 2px #000}
.mmo-exp{position:absolute;bottom:0;left:0;right:0;height:15px;background:#111923;pointer-events:none}.mmo-exp i{background:#c5a859}.mmo-exp span{position:absolute;inset:0;font-size:11px;text-align:center;line-height:15px;text-shadow:0 1px 2px #000}
body.mmo-shell #mmoMenuButton{top:auto;bottom:24px;left:auto;right:12px}
body.mmo-shell #skillBar{display:flex;position:absolute;bottom:65px;left:50%;transform:translateX(-50%);gap:5px;width:auto;max-width:65%;padding:5px;pointer-events:auto;margin:0;z-index:25}
body.mmo-shell #skillBar .skill-fancy{width:66px;min-width:0;height:64px;margin:0;padding:3px;position:relative;display:flex;align-items:center;justify-content:center;background:#142026ed;border:1px solid #b89c6088;border-radius:8px;overflow:hidden}
#skillBar .skill-hotbar>span{position:absolute;inset:auto 0 1px;font-size:10px;background:#091015c9}#skillBar .skill-hotbar strong{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#skillBar .skill-hotbar small{display:block;font-size:10px}
#skillBar .skill-hotbar:disabled{opacity:.62}#skillBar .skill-hotbar .skill-system-icon{opacity:var(--skill-ready,1)}
body.mmo-shell .actionbar{display:flex;position:absolute;left:50%;transform:translateX(-50%);bottom:20px;gap:4px;flex-wrap:nowrap;width:auto;max-width:75%;padding:0;margin:0;pointer-events:auto}
body.mmo-shell .actionbar button{font-size:11px;padding:5px 8px;min-height:36px;white-space:nowrap}.actionbar button b{font-size:16px}
body.mmo-shell .map-badge{left:12px;bottom:22px;max-width:250px;font-size:11px;pointer-events:none}
body.mmo-shell #toast{top:120px;bottom:auto;left:50%;transform:translateX(-50%);max-width:55%;width:auto;pointer-events:none}
body.mmo-shell #corruptionHud{position:absolute;top:152px;right:12px;left:auto;width:170px;font-size:11px;z-index:22}
body.mmo-shell .mobile-status-hud{display:none!important}
body.mmo-shell.mobile-mode #skillBar,body.mmo-shell.mobile-mode .actionbar{display:none!important}
body.mmo-shell.mobile-mode #mmoMenuButton{top:104px;bottom:auto;left:12px;right:auto}
body.mmo-shell.mobile-mode #chatPanel{bottom:20px;max-height:55%;width:calc(100% - 24px)}
body.mmo-shell.mobile-mode .mobile-chat-peek{left:50%;bottom:22px;transform:translateX(-50%);max-width:140px;font-size:11px;min-height:30px}

body.mmo-shell .character .eyebrow,body.mmo-shell .character #heroName,body.mmo-shell .character #heroClass,body.mmo-shell .character #heroGuild,body.mmo-shell .character>.meter,body.mmo-shell .character>.stats{display:none}
body.mmo-shell .character #inventory{max-height:none;overflow:visible}
body.mmo-shell #gameUI .mmo-window:not([hidden]){display:block}
body.mmo-shell #gameUI .character.mmo-window{position:absolute;inset:auto;top:12%;right:12px;left:auto;width:min(390px,calc(100% - 24px));max-width:calc(100% - 24px)!important;max-height:76%;transform:none}

#gameUI .quests.mmo-window{left:50%;transform:translateX(-50%);width:min(680px,calc(100% - 24px))}
#gameUI .quests #tutorial{display:block;padding:12px;position:static;max-width:none}
.mmo-quest-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}.mmo-quest-tabs button{font-size:12px;padding:6px 10px}.mmo-quest-tabs button[aria-pressed="true"]{border-color:#e7c875;background:#49402b}
#mmoQuestTracker{position:absolute;right:12px;top:255px;width:220px;max-height:35%;overflow:auto;background:#101d24b8;border:1px solid #ad945344;border-radius:8px;pointer-events:auto;font-size:12px}
#mmoQuestTracker>button{width:100%;text-align:left;background:transparent;font-size:12px}#mmoQuestGoals{padding:0 10px}#mmoQuestGoals p{margin:6px 0;line-height:1.35}
#gameUI #modal .world-map-canvas,#gameUI #modal .local-map-canvas{width:100%;max-width:100%;height:auto}

#mmoPartyHud{position:absolute;left:12px;top:165px;display:grid;width:200px;max-height:35%;overflow:auto;gap:3px;pointer-events:auto}#mmoPartyHud button{font-size:11px;min-height:28px;text-align:left;background:#13222ac9}
.mmo-window-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:16px}.mmo-window-nav button{font-size:13px;text-align:left}
.mmo-shop-frame{width:100%;height:min(58dvh,540px);border:1px solid #ad945355;border-radius:8px;background:#111a20}
.mmo-tooltip{position:absolute;z-index:120;max-width:min(300px,80%);max-height:40%;overflow:hidden;white-space:pre-line;background:#10191ef7;border:1px solid #c0a568;border-radius:6px;padding:10px;font-size:12px;color:#f2e7ce;pointer-events:none;box-sizing:border-box}
#gameUI #modalBody{max-height:none;overflow:visible}#gameUI .smith-risk-card{max-width:100%}

body.mmo-shell.mobile-mode{padding:0;overflow:hidden;touch-action:pan-y}body.mmo-shell.mobile-mode main{height:var(--mobile-vh,100dvh);padding:0;margin:0}
body.mmo-shell.mobile-mode .viewport{height:100%;border:0;border-radius:0}
body.mmo-shell.mobile-mode #gameUI .mmo-window,body.mmo-shell.mobile-mode #gameUI #modal{position:absolute;inset:calc(6px + env(safe-area-inset-top)) calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));transform:none;width:auto;max-width:none!important;max-height:none;height:auto;padding:12px;overflow:auto;touch-action:pan-y;-webkit-user-select:text;user-select:text}
body.mmo-shell.mobile-mode #gameUI #modal .close{position:sticky;top:0;float:right;min-width:48px;min-height:48px}
body.mmo-shell.mobile-mode #gameMenu header,body.mmo-shell.mobile-mode #gameMenu .map-heading{display:flex!important;flex-wrap:wrap}
body.mmo-shell.mobile-mode #mobileTopbar{display:flex!important;position:absolute;left:calc(8px + env(safe-area-inset-left));top:calc(105px + env(safe-area-inset-top));right:auto;max-width:calc(100% - 16px);margin:0;gap:4px;flex-wrap:wrap;pointer-events:auto;z-index:30;background:transparent;box-shadow:none}
body.mmo-shell.mobile-mode #mobileTopbar[hidden]{display:none!important}
body.mmo-shell.mobile-mode #mobileTopbar button{font-size:11px;min-width:40px;min-height:44px;padding:5px;border-radius:7px;background:#142229df}
body.mmo-shell.mobile-mode #mmoMenuButton{display:none}
body.mmo-shell.mobile-mode #mmoPartyHud{top:160px;width:150px;max-height:20%}
body.mmo-shell.mobile-mode #mmoQuestTracker{top:210px;width:155px;max-height:22%;font-size:11px}body.mmo-shell.mobile-mode #mmoQuestGoals{max-height:55px;overflow:auto}
body.mmo-shell.mobile-mode #corruptionHud{top:135px;right:10px;width:140px;transform:none;font-size:10px}
body.mmo-shell.mobile-mode #toast{top:160px;max-width:60%;font-size:12px}
body.mmo-shell.mobile-mode #chatPanel{inset:auto 8px 20px;transform:none;width:auto;max-height:70%;overflow:auto;padding:10px}
body.mmo-shell.mobile-mode #chatInput{font-size:16px;width:100%;min-height:44px}body.mmo-shell.mobile-mode #chatForm{display:flex;gap:6px}body.mmo-shell.mobile-mode #chatClose{position:sticky;top:0;min-width:48px;min-height:48px}
body.mmo-shell #chatPanel[hidden]{display:none!important;pointer-events:none!important}
@media(max-width:540px){body.mmo-shell.mobile-mode #mmoQuestTracker{top:245px;max-height:18%}body.mmo-shell.mobile-mode #mmoPartyHud{top:210px}body.mmo-shell.mobile-mode #mobileTopbar{max-width:96%;gap:3px}body.mmo-shell.mobile-mode .mmo-window-nav{grid-template-columns:repeat(2,minmax(0,1fr))}}

body.mmo-shell:not(.mmo-playing) #mobileControls,body.mmo-shell:not(.mmo-playing) #mobileTopbar,body.mmo-shell:not(.mmo-playing) #mmoMenuButton{display:none!important}
#gameUI .mmo-window,#gameUI #modal{outline:none}#gameUI button:focus-visible,#gameUI a:focus-visible{outline:2px solid #e2cb85;outline-offset:2px}

@media(min-width:1000px){body.mmo-shell:not(.mobile-mode) #gameUI #modal[data-ui-window="character"]{left:28%;width:560px;max-width:44%}}

.mmo-trade-close{float:right;position:sticky;top:0;min-width:44px;min-height:44px;font-size:25px}#gameUI #tradePanel{z-index:85}

@media(max-width:540px){body.mmo-shell.mobile-mode #corruptionHud{top:165px}}

/* Desktop retains a bounded stage at the native art scale. Mobile fills its viewport. */
body.mmo-shell:not(.mobile-mode) main{width:calc(100% - 32px);max-width:1350px;height:min(759.375px,calc(100dvh - 32px));margin:16px auto}
body.mmo-shell:not(.mobile-mode) .viewport{border-radius:10px;box-shadow:0 0 0 1px #ad945355}

#gameUI .inventory-crowns{display:block;margin:8px 0 12px;color:#f4d284;font-size:16px;overflow-wrap:anywhere}
