/* Shared presentation layer. Layout/safe-area ownership remains in app-shell. */
:root{--ui-surface:#24383f;--ui-raised:#30474d;--ui-edge:#718783;--ui-ink:#eef2e8;--ui-muted:#c0cfca;--ui-accent:#e5d5a6;color-scheme:dark}
body,input,select,button,textarea{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body{color:var(--ui-ink);background:#172a32}
button,input,select,textarea{border-radius:9px;color:var(--ui-ink)}
button{border-color:#718783;background:#30484c;box-shadow:none;transition:background .12s,transform .12s}
button:hover{background:#3c5658}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #e9d6a5;outline-offset:2px}
input,select,textarea{background:#1b3038;border:1px solid #718783;padding:9px 10px}
button.primary,.primary{background:#4f746c;border-color:#a1b6a4;color:#fff7df;border-radius:9px}
.shell .topbar,.mobile-vitals{background:#23383ef5;color:var(--ui-ink);border-color:#778a81}
.card,.account-form,.account-art,.roster,.sidebar,.client-window,.mobile-sheet,#worldAtlas,#accountMenu,#hotkeyEditor,#mobileHealMenu{background:#24383ff5;color:var(--ui-ink);border:1px solid #718783;border-radius:12px;box-shadow:0 5px 20px #07171c40}
.sidebar{padding:5px;gap:6px;background:#20343a}.client-window{overflow:hidden}.client-window>summary{background:#30464b;color:#edf1df;font:600 12px/1.25 ui-sans-serif,system-ui,sans-serif;min-height:30px;padding:5px 8px;border-bottom:1px solid #617873}
.window-body{padding:9px}.window-body h2,.window-body h3,.panel-title{font-family:inherit;color:#e5e8d6;letter-spacing:.02em}.window-body p,.outfit-intro,.mobile-menu-tip{color:var(--ui-muted);line-height:1.5}
.window-dock,.window-float-close,.collapse-mark{color:#d9e3d7}.drag-handle{opacity:.55}
.mobile-sheet-header{background:#30464b;border-bottom:1px solid #617873}.mobile-sheet-header h2{font:600 15px/1.2 ui-sans-serif,system-ui,sans-serif}
.mobile-sheet-tabs button,.mobile-window-menu button,.mobile-window-menu a,#accountMenu button,#accountMenu a,#godMenu select,#godMenu button,#dialogueActions button,#spells button,.outfit-view-controls button{background:#30494e;border-color:#718783;border-radius:9px;color:#eef0df}
.mobile-sheet-tabs button.selected,.mobile-window-menu button:active,.outfit-view-controls button[aria-pressed=true]{background:#53746c;color:#fff5d8;border-color:#c4c8a1}
.inventory .bag-item,.equipment .slot{background:#20353d;border:1px solid #687f7b;border-radius:9px;color:#e9ecdf;box-shadow:none}.inventory .bag-item:hover,.equipment .slot:hover{background:#344f53}
.item-icon{image-rendering:pixelated;width:32px;height:32px;object-fit:contain}.inventory .item-icon{width:40px;height:40px}.slot .item-icon{width:36px;height:36px}
.catalog-search{display:grid;grid-template-columns:minmax(0,1fr) 115px;gap:6px;align-items:end}.catalog-search input{grid-column:1}.catalog-search select{grid-column:2;grid-row:2;max-width:100%;min-width:0;font-size:13px}.catalog-search>span{grid-column:1/-1;color:#c3d0c8;font-size:12px}#catalogCount{display:block;margin:8px 0;color:#c6d3cb;font-size:12px}
#equipmentCatalog{display:grid;gap:7px}.catalog-item{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid #627a76;border-radius:10px;background:#2b4249;min-width:0}.catalog-item .item-icon{width:56px;height:56px;float:none;margin:0}.catalog-copy{display:flex;flex-direction:column;gap:4px;min-width:0;line-height:1.4}.catalog-copy strong{font-size:14px;color:#f5e9c6}.catalog-copy small{font-size:12px;color:#d5ded0}.catalog-copy p{margin:0;font-size:12px;color:#bbcfc9}
.quest-row,.party-member{border-color:#607b74;border-radius:8px}.chat-log{background:#1c3139;border-radius:8px;padding:6px}.chat-head,.eyebrow{color:#c0cfc8}.target-card,.hero-card{color:#edf0e5}.bar,.party-meter{border-radius:5px;overflow:hidden}.toast{border-radius:10px;background:#233d43ed;color:#fff0d2;border-color:#8c9d87}
.outfit-choices button{background:#233b42;border-color:#6f8980;border-radius:10px}.outfit-choices button[aria-pressed=true]{border-color:#e7ce8e;background:#46645c}.outfit-colors input{padding:2px;border-radius:6px}
body.mobile-layout .mobile-vitals strong{font:600 14px/1.2 ui-sans-serif,system-ui,sans-serif}body.mobile-layout .mobile-vitals>div:first-child>span{font:11px/1.2 ui-sans-serif,system-ui,sans-serif;color:#c1d0c7}
body.mobile-layout .mobile-meter{border-color:#79918a;border-radius:6px;background:#162c34}body.mobile-layout .mobile-meter>span{font:600 11px/1.2 ui-sans-serif,system-ui,sans-serif}
body.mobile-layout.in-realm #mobileNavigation{background:#23383f;border-top:1px solid #809187;border-radius:13px 13px 0 0}body.mobile-layout.in-realm #mobileNavigation button{background:transparent;border:0;color:#d6dfd0;border-radius:10px 10px 0 0}body.mobile-layout.in-realm #mobileNavigation button.selected{background:#3c5655;color:#fff0c9}body.mobile-layout #mobileNavigation small{font:500 10px/1.1 ui-sans-serif,system-ui,sans-serif;letter-spacing:0}body.mobile-layout #mobileNavigation button>span{color:#d6ddbe}
body.mobile-layout .mobile-actions button,body.mobile-layout .mobile-actions .custom-hotkey{border-radius:50%!important;border:1px solid #9d9f80!important;background:#263c43eb!important;box-shadow:0 2px 7px #08191d44;color:#e6ddbb}body.mobile-layout .mobile-actions #mobileHeal{background:#36534deb!important}body.mobile-layout .mobile-actions #editHotkeys{border:0!important;background:transparent!important;box-shadow:none}body.mobile-layout .mobile-actions #mobileAttack.attacking{border-color:#f2ba8b!important;background:#664a43eb!important}body.mobile-layout .mobile-actions button.unusable{opacity:.55}body.mobile-layout .mobile-actions .custom-hotkey img{width:28px;height:28px}body.mobile-layout .mobile-actions button>span{font-family:inherit}
body.mobile-layout .party-hud,body.mobile-layout .party-open{border:1px solid #8e9b83;background:#263e43e8;border-radius:10px;color:#e6e9cf}body.mobile-layout .mobile-sheet{border-radius:12px 12px 0 0;border-color:#7c9187}body.mobile-layout.mobile-sheet-compact .mobile-sheet{border-radius:12px}body.mobile-layout .mobile-sheet-header h2{font-size:14px}
@media(min-height:700px) and (orientation:portrait){body.mobile-layout .mobile-actions{width:64px!important;gap:7px!important;right:10px!important}body.mobile-layout #primaryHotkeys{gap:7px}body.mobile-layout .mobile-actions #primaryHotkeys button{width:50px!important;height:50px!important}body.mobile-layout .mobile-actions #primaryHotkeys #mobileAttack{width:58px!important;height:58px!important}body.mobile-layout #customHotkeys{grid-template-columns:50px}body.mobile-layout .mobile-actions .custom-hotkey{width:50px!important;height:50px!important}}
@media(prefers-reduced-motion:reduce){button{transition:none}}

/* Fixed logical pixel raster: no fractional CSS stretch or gameplay zoom. */
#world{image-rendering:pixelated;flex:none;max-width:none} .zoom-controls[hidden]{display:none!important}
#appScreen{background:#172a32}#appScreenFrame{background:#172a32;color-scheme:dark}
#appScreen #appScreenFrame{display:block;flex:1 1 0;height:0;min-height:0;width:100%}
#appScreenFrame[hidden],#appScreenLoading[hidden],#appScreenError[hidden]{display:none!important}#appScreenLoading,#appScreenError{margin:16px;color:#dce9df}#appScreenError a{color:#e7d4a4}
.mobile-window-menu{display:flex!important;flex-direction:column;gap:18px;padding:4px}.more-group h3{margin:3px 0 8px!important;font:600 11px/1.3 system-ui!important;text-transform:uppercase;letter-spacing:.09em;color:#b8cdc4!important}.more-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.mobile-window-menu .more-grid button,.mobile-window-menu .more-grid a,.mobile-window-menu>#mobileGodEntry{display:flex;align-items:center;gap:9px;min-width:0;min-height:76px;margin:0;padding:11px 9px;text-align:left;text-decoration:none;background:linear-gradient(140deg,#36535a,#283f47);border:1px solid #6f8982;border-radius:13px;box-shadow:inset 0 1px #b8d0bb15;color:#e5ecdd}.mobile-window-menu .more-grid button:active,.mobile-window-menu .more-grid a:active{background:#4d6a62;transform:translateY(1px)}.mobile-window-menu .more-icon{display:grid;place-items:center;flex:0 0 29px;width:29px;height:33px;color:#e0cf9b;font-size:23px}.more-icon svg{width:26px;height:26px}.mobile-window-menu .more-copy{display:flex;flex:1;flex-direction:column;gap:4px;min-width:0}.more-copy strong{font:600 12px/1.2 system-ui;color:#eff0df}.more-copy small{font:10px/1.35 system-ui;color:#bbd0c8;white-space:normal}.mobile-window-menu .more-arrow{font:20px/1 system-ui;color:#b5cbbd;flex:none}.mobile-window-menu #mobileGodEntry[hidden]{display:none!important}
@media(max-width:360px){.more-grid{gap:6px}.mobile-window-menu .more-grid button,.mobile-window-menu .more-grid a{gap:5px;padding:9px 6px}.mobile-window-menu .more-icon{flex-basis:23px;width:23px}.more-copy strong{font-size:11px}}

.mobile-window-menu .more-grid button,.mobile-window-menu .more-grid a,.mobile-window-menu>#mobileGodEntry{flex-direction:row!important}.mobile-window-menu>button[data-mobile-panel=party]{min-height:54px;border-radius:12px;text-align:left;background:#30494e;border:1px solid #718783;color:#e5ecdd}

.world-wrap{resize:none!important}.viewport-toolbar label[hidden]{display:none!important}

/* Master polish: controls use viewport anchors, independent of hotkey count. */
body.mobile-layout.in-realm{--safe-top:env(safe-area-inset-top,0px);--head-height:64px}
body.mobile-layout.in-realm .topbar{box-sizing:border-box;height:calc(var(--head-height) + var(--safe-top));min-height:calc(var(--head-height) + var(--safe-top));padding-top:calc(var(--safe-top) + 8px)!important;padding-bottom:8px!important}
body.mobile-layout.in-realm #mobileNavigation{position:relative;bottom:0!important;box-sizing:border-box;height:calc(var(--nav-height) + var(--safe-bottom));padding:3px 4px 0!important;align-items:stretch}
body.mobile-layout.in-realm #mobileNavigation button{padding-bottom:calc(4px + var(--safe-bottom));min-height:0}
body.mobile-layout.in-realm .mobile-actions{position:absolute;top:auto!important;bottom:10px!important;right:max(10px,env(safe-area-inset-right))!important;height:calc(100% - 40px);max-height:calc(100% - 40px)!important;width:76px!important;overflow:visible!important;pointer-events:none;justify-content:flex-end}
body.mobile-layout.in-realm #primaryHotkeys{display:flex;flex-direction:column;flex:0 0 auto;gap:6px;order:2;pointer-events:auto}
body.mobile-layout.in-realm #primaryHotkeys #mobileAttack{order:10;width:72px!important;height:72px!important;min-height:72px!important;font-size:14px}
body.mobile-layout.in-realm #primaryHotkeys #mobileAttack>span{font-size:28px}
body.mobile-layout.in-realm #customHotkeys{order:1;flex:0 1 auto;max-height:calc(100% - 292px);min-height:0;overflow:auto;pointer-events:auto;display:grid;grid-template-columns:50px}
body.mobile-layout.in-realm #customHotkeys:empty{display:none}
body.mobile-layout.in-realm #primaryHotkeys button{pointer-events:auto}
@media(orientation:landscape) and (max-height:600px){body.mobile-layout.in-realm{--head-height:46px}body.mobile-layout.in-realm .mobile-actions{width:168px!important;display:flex!important;max-height:calc(100% - 8px)!important;height:calc(100% - 8px);bottom:4px!important}body.mobile-layout.in-realm #primaryHotkeys{display:grid;grid-template-columns:44px 44px 72px;grid-template-rows:44px 72px;gap:3px}body.mobile-layout.in-realm #primaryHotkeys #mobileAttack{grid-column:3!important;grid-row:2!important}body.mobile-layout.in-realm #customHotkeys{position:absolute;right:170px;bottom:0;max-height:100%;grid-template-columns:repeat(2,44px)}}

.window-dock[hidden]{display:none!important}.libera-window-title,.mobile-sheet-header.libera-window-title{height:32px!important;min-height:32px!important;padding-top:0!important;padding-bottom:0!important}.libera-window-title h2{font-size:12px!important}.libera-window-title button{max-height:32px;min-height:30px!important;height:30px!important}

#finishControlLayout{position:absolute;top:50px;left:50%;transform:translateX(-50%);z-index:70;min-height:44px;background:#284a4f;color:#fff0ce;border:1px solid #dbc68b}#finishControlLayout[hidden]{display:none}.arranging-controls .mobile-actions button{outline:2px dashed #edce80;touch-action:none!important}.window-dock{font-size:14px!important;width:30px!important;min-width:30px!important}

body.mobile-layout .mobile-sheet-header.libera-window-title,body.mobile-layout #mobileSheet .libera-window-title,.client-window>summary.libera-window-title,#worldAtlas>header.libera-window-title,#accountMenu>strong.libera-window-title,#hotkeyEditor>strong.libera-window-title,#partyHud>header.libera-window-title{height:32px!important;min-height:32px!important;padding:0 4px!important;flex-wrap:nowrap!important}body.mobile-layout .mobile-sheet-header.libera-window-title>div{flex:1 1 auto!important;min-width:0}body.mobile-layout .mobile-sheet-header.libera-window-title h2{margin:0!important;font-size:12px!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}body.mobile-layout .mobile-sheet-header.libera-window-title>button,#worldAtlas>header.libera-window-title button{height:30px!important;min-height:30px!important;max-height:30px!important}
