/* Shared window language. Load after the feature styles; no layout or gameplay DOM is replaced. */
:root{--window-chrome:#172b23;--window-chrome-2:#253d30;--window-text:#f6ebcd;--window-muted:#c1bea3;--window-line:#8a7951;--window-accent:#cfb374;--window-accent-ink:#302713;--window-paper:#f4e6c2;--window-paper-deep:#e5d2a4;--window-ink:#352c1d;--window-shadow:0 20px 55px #071b1652,0 3px 10px #071b1633}:root:where([data-theme="nuit"]){--window-line:#50668b}
html[data-theme=bonta]{--window-chrome:#192f43;--window-chrome-2:#264257;--window-text:#f5eddb;--window-muted:#bacbd4;--window-line:#8ba6af;--window-accent:#d9c58e;--window-paper:var(--theme-paper);--window-paper-deep:var(--theme-paper-deep);--window-ink:var(--theme-ink)}
html[data-theme=brakmar]{--window-chrome:#2b2024;--window-chrome-2:#423037;--window-text:#f5e5d1;--window-muted:#d0b7ac;--window-line:#a77a62;--window-accent:#dfa870;--window-paper:var(--theme-paper);--window-paper-deep:var(--theme-paper-deep);--window-ink:var(--theme-ink)}
:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel){border-radius:15px;box-shadow:var(--window-shadow);border:1px solid var(--window-line);font-family:var(--font-ui,'Nunito Sans',sans-serif);font-size:13px;line-height:1.5;scrollbar-width:thin;scrollbar-color:var(--window-line) transparent}
html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog){background:var(--window-paper);color:var(--window-ink);box-shadow:var(--window-shadow);border-color:var(--window-line);padding:0;overflow:hidden;max-height:calc(100dvh - 48px)}
:is(#player-dialog,#class-dialog,#prepare-dialog)[open]{display:flex;flex-direction:column}
html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)::backdrop{background:#07181391;backdrop-filter:blur(4px)}
html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header,
:is(#adventure-panel,#multiplayer-panel)>header,#chat-panel>.chat-header{position:relative;top:0;display:flex;align-items:center;gap:12px;flex:none;min-height:64px;margin:0;padding:10px 14px;border-bottom:1px solid var(--window-line);border-radius:14px 14px 0 0;background:linear-gradient(130deg,var(--window-chrome-2),var(--window-chrome));box-shadow:inset 0 1px #ffffff0c;color:var(--window-text);z-index:1}
html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header :is(h2,strong,b,small),:is(#adventure-panel,#multiplayer-panel)>header :is(h2,strong,b,small),#chat-panel>.chat-header strong{color:var(--window-text)}
html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header h2,:is(#adventure-panel,#multiplayer-panel)>header h2{display:flex;align-items:center;gap:10px;font:400 23px/1.2 var(--font-display,'Bree Serif',serif);margin:0;min-width:0;overflow-wrap:anywhere}
:is(#player-dialog,#class-dialog,#prepare-dialog)>header h2:before,#adventure-panel>header h2:before,#multiplayer-panel>header h2:before{content:'';width:28px;height:30px;flex:none;background:url('ui-assets/book.svg') center/contain no-repeat}
#player-dialog[data-view=inventory]>header h2:before{background-image:url('ui-assets/inventory.svg')}#player-dialog[data-view=character]>header h2:before,#player-dialog[data-view=appearance]>header h2:before{background-image:url('ui-assets/character.svg')}#player-dialog[data-view=reward]>header h2:before{background-image:url('ui-assets/experience.svg')}#prepare-dialog>header h2:before{background-image:url('ui-assets/damage.svg')}#multiplayer-panel>header h2:before{background-image:url('ui-assets/friends.svg')}
#multiplayer-eyebrow,.adventure-eyebrow{color:var(--window-muted)!important;font-size:11.5px!important;line-height:1.3;letter-spacing:.08em}
html[data-theme] :is(#player-dialog-close,#close-book,#cancel-prepare),#adventure-close,#multiplayer-panel [data-mp-close],#chat-close{display:grid;place-items:center;width:44px;height:44px;min-height:44px;min-width:44px;flex:none;padding:0!important;border:1px solid #ffffff13!important;border-radius:9px!important;background:#ffffff06!important;color:var(--window-text)!important;font-size:21px!important;line-height:1;box-shadow:none}
html[data-theme] :is(#player-dialog-close,#close-book,#cancel-prepare):hover,#adventure-close:hover,#multiplayer-panel [data-mp-close]:hover,#chat-close:hover{background:#ffffff10!important;border-color:var(--window-line)!important}
:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel) :is(button,summary){min-height:44px;touch-action:manipulation}
:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel) :is(button,input,select){border-radius:8px;font-family:var(--font-ui,'Nunito Sans',sans-serif);font-size:12px}
:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel) :is(button,input,select,a,summary):focus-visible{outline:2px solid var(--window-accent);outline-offset:3px}
:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel) :is(small,.mp-note,.combat-note,.combat-glossary){font-size:11.5px;line-height:1.5}
#player-dialog-content{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:16px;scroll-padding:14px}
#class-dialog>nav{padding:10px 14px;margin:0;border-bottom:1px solid color-mix(in srgb,var(--window-line) 35%,transparent);gap:6px}
html[data-theme] #class-dialog>nav :is(#class-tab,#spell-tab){display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid transparent;background:transparent;color:var(--window-ink);padding:8px 12px;font-weight:800}
#class-tab:before,#spell-tab:before{content:'';width:22px;height:22px;background:url('ui-assets/character.svg') center/contain no-repeat}#spell-tab:before{background-image:url('ui-assets/spells.svg')}
html[data-theme] #class-dialog>nav :is(#class-tab,#spell-tab).active{background:var(--theme-accent-soft);border-color:var(--theme-accent);color:var(--theme-accent-ink)}
#class-dialog>.combat-note{margin:11px 16px 7px}#class-dialog>.combat-glossary{margin:0 16px 8px;padding:9px 11px;border:1px solid color-mix(in srgb,var(--window-line) 35%,transparent);border-radius:9px;background:color-mix(in srgb,var(--window-paper) 85%,#fff)}#book-content{flex:1;min-height:0;padding:10px 16px 16px;overscroll-behavior:contain;scroll-padding:12px}
#prepare-dialog{width:min(510px,calc(100vw - 28px))!important}#prepare-dialog>:not(header){margin-left:16px;margin-right:16px}#prepare-dialog>.prepare-actions{margin-bottom:16px}#prepare-dialog p{font-size:12px;line-height:1.5}#prepare-dialog .prepared-list{gap:7px}#prepare-dialog .prepared-list>div{padding:10px;border-radius:9px;background:var(--theme-card);border-color:color-mix(in srgb,var(--window-line) 45%,transparent)}
#multiplayer-panel{background:var(--window-paper);border-color:var(--window-line);box-shadow:var(--window-shadow)}#multiplayer-panel>header>div{min-width:0}#multiplayer-panel #multiplayer-social{color:var(--window-muted);background:transparent;border-color:transparent}#multiplayer-body{padding:13px 14px 14px}#multiplayer-body :is(.mp-person,.mp-loot>div){border-color:color-mix(in srgb,var(--window-line) 35%,transparent)}#multiplayer-panel .mp-actions{gap:7px}#multiplayer-panel .mp-primary{box-shadow:inset 0 1px #ffffff25,0 2px 4px #0001}
#adventure-panel{border-color:var(--window-line);background:var(--window-chrome);color:var(--window-text);box-shadow:var(--window-shadow)}#adventure-panel>header{gap:8px}#adventure-panel>header .adventure-eyebrow{padding-left:38px}#adventure-panel>nav{border-color:var(--window-line);padding:8px 12px}#adventure-content{padding:13px}#adventure-panel :is(.adventure-quest,.adventure-job,.adventure-note,.adventure-recipe){background:var(--window-chrome-2);border-color:color-mix(in srgb,var(--window-line) 55%,transparent);border-radius:11px}#adventure-panel :is(p,small){color:var(--window-muted)}#adventure-panel h3{color:var(--window-text)}#adventure-panel .adventure-primary{background:var(--window-accent);color:var(--window-accent-ink)}
#chat-panel{border-color:var(--window-line);background:var(--window-chrome);color:var(--window-text);box-shadow:var(--window-shadow)}#chat-panel>.chat-header{min-height:62px;padding:9px 12px;gap:10px}#chat-header-icon{width:30px;height:32px;object-fit:contain;flex:none;padding:3px}#chat-panel>.chat-header>div{display:flex;flex-direction:column;align-items:flex-start;gap:3px;flex:1;min-width:0}#chat-panel>.chat-header strong{font:400 22px/1.15 var(--font-display)}#chat-identity{color:var(--window-muted);font-size:11.5px;max-width:100%}#chat-panel .chat-tabs{display:flex;gap:5px;padding:7px 12px 0;background:#0000000a}#chat-panel .chat-tabs button{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:1;padding:8px 4px;min-height:44px;background:transparent;border-bottom:2px solid transparent;color:var(--window-muted);border-radius:0;font-size:11.5px}#chat-panel .chat-tabs button[aria-selected=true]{color:var(--window-text);border-bottom-color:var(--window-accent)}.chat-tabs img{width:20px;height:21px;object-fit:contain;flex:none}
@media(max-width:700px),(max-width:1000px) and (max-height:500px){
 html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog){width:calc(100vw - 20px);max-height:calc(100dvh - 24px);border-radius:13px}
 html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header,:is(#adventure-panel,#multiplayer-panel)>header,#chat-panel>.chat-header{padding:8px 11px;min-height:60px;border-radius:12px 12px 0 0}
 html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header h2,:is(#adventure-panel,#multiplayer-panel)>header h2{font-size:21px;gap:8px}
 :is(#player-dialog,#class-dialog,#prepare-dialog)>header h2:before,#adventure-panel>header h2:before,#multiplayer-panel>header h2:before{width:24px;height:27px}
 #player-dialog-content{padding:12px}#book-content{padding:9px 12px 12px}#class-dialog>nav{padding:8px 11px}#class-dialog>.combat-note{margin:9px 12px 6px}#class-dialog>.combat-glossary{margin:0 12px 7px;padding:8px 10px}#prepare-dialog>:not(header){margin-left:12px;margin-right:12px}#prepare-dialog>.prepare-actions{margin-bottom:12px}
 :is(#player-dialog,#class-dialog,#prepare-dialog) :is(input[type=text],input[type=search],input[type=email],input[type=password]){font-size:16px}
 #multiplayer-panel h2{font-size:21px}#adventure-panel>header .adventure-eyebrow{padding-left:32px}#chat-panel>.chat-header strong{font-size:21px}
}
@media(max-height:500px) and (orientation:landscape){html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog){max-height:calc(100dvh - 16px)}html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog)>header{min-height:54px;padding-top:5px;padding-bottom:5px}#class-dialog>.combat-note{margin-top:7px}#class-dialog>.combat-glossary{padding-block:5px}#book-content{max-height:none}}
@media(prefers-reduced-motion:reduce){:is(#player-dialog,#class-dialog,#prepare-dialog,#adventure-panel,#multiplayer-panel,#chat-panel) *{scroll-behavior:auto!important;transition:none!important}}

html[data-theme] #prepare-dialog[open]{display:block;overflow:auto}html[data-theme] #prepare-dialog>header{position:sticky;top:0}
#adventure-panel :is(button,select){background:var(--window-chrome-2);border-color:var(--window-line);color:var(--window-text)}#adventure-panel .adventure-primary{background:var(--window-accent);color:var(--window-accent-ink)}

/* The shop retains its own cards, wallet and scroll state. Only its frame is shared. */
html[data-theme] #astrub-shop{padding:0;overflow:auto;background:var(--window-paper);color:var(--window-ink);border:1px solid var(--window-line);border-radius:15px;box-shadow:var(--window-shadow);max-height:calc(100dvh - 48px)}
#astrub-shop::backdrop{background:#07181391;backdrop-filter:blur(4px)}
#astrub-shop>.shop-heading{position:sticky;top:0;z-index:2;display:flex;align-items:center;gap:12px;min-height:64px;margin:0;padding:10px 14px;border-bottom:1px solid var(--window-line);border-radius:14px 14px 0 0;background:linear-gradient(130deg,var(--window-chrome-2),var(--window-chrome));color:var(--window-text)}
#astrub-shop .shop-heading h2{display:flex;align-items:center;gap:10px;font:400 23px/1.2 var(--font-display);margin:2px 0 0;color:var(--window-text)}#astrub-shop .shop-heading h2:before{content:'';width:28px;height:30px;flex:none;background:url('ui-assets/astrub-token.svg') center/contain no-repeat}#astrub-shop .shop-eyebrow{display:block;padding-left:38px;font-size:11.5px;line-height:1.3;letter-spacing:.08em;color:var(--window-muted)}
#astrub-shop #shop-close{display:grid;place-items:center;width:44px;height:44px;min-height:44px;min-width:44px;flex:none;padding:0;border:1px solid #ffffff13;border-radius:9px;background:#ffffff06;color:var(--window-text);font-size:21px}
#astrub-shop #shop-content{padding:16px}#astrub-shop :is(button,summary){min-height:44px}#astrub-shop :is(button,summary):focus-visible{outline:2px solid var(--window-accent);outline-offset:3px}
@media(max-width:700px),(max-width:1000px) and (max-height:500px){html[data-theme] #astrub-shop{width:calc(100vw - 20px);max-height:calc(100dvh - 24px);border-radius:13px}#astrub-shop>.shop-heading{min-height:60px;padding:8px 11px;border-radius:12px 12px 0 0}#astrub-shop .shop-heading h2{font-size:21px;gap:8px}#astrub-shop .shop-heading h2:before{width:24px;height:27px}#astrub-shop .shop-eyebrow{padding-left:32px}#astrub-shop #shop-content{padding:12px}}

html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog,#astrub-shop) :is(button,summary){min-height:44px}html[data-theme] :is(#player-dialog,#class-dialog,#prepare-dialog,#astrub-shop) button{min-width:44px}

/* Theme chrome rules are deliberately important elsewhere; these windows use
   the shared palette so their headers, bodies and transcripts stay coherent. */
html[data-theme] :is(#chat-panel,#adventure-panel){background:var(--window-chrome)!important;color:var(--window-text);border-color:var(--window-line)!important;box-shadow:var(--window-shadow)!important}
html[data-theme] #multiplayer-panel{background:var(--window-paper);color:var(--window-ink);border-color:var(--window-line);box-shadow:var(--window-shadow)}
html[data-theme] #chat-panel :is(.chat-header span,.chat-channel-note,.chat-message-meta time,.chat-compose-note,#chat-clear,.chat-entry time,.chat-empty p){color:var(--window-muted)!important}
html[data-theme] #chat-panel :is(.chat-empty strong,.chat-message p,.chat-entry.system span){color:var(--window-text)!important}
html[data-theme] #chat-panel :is(.chat-message-meta b,.chat-message.own .chat-message-meta b){color:var(--window-accent)}
html[data-theme] #chat-panel .chat-message.own{background:color-mix(in srgb,var(--window-accent) 12%,var(--window-chrome-2));border-color:color-mix(in srgb,var(--window-accent) 44%,transparent)}
html[data-theme] #chat-panel :is(#chat-access a,#chat-status button,#chat-send,#chat-form){background:var(--window-chrome-2);color:var(--window-accent);border-color:var(--window-line)}
html[data-theme] #chat-panel #chat-input{color:var(--window-text)}html[data-theme] #chat-panel #chat-input::placeholder{color:var(--window-muted)}

/* Raise the account's stacking context only while its desktop menu is open.
   On mobile the account lives in the native modal menu, above all world UI. */
#game-topbar:has(#account-menu[open]){z-index:70}

/* Activities share the parchment window, with clear NPC roles and original icons. */
html[data-theme] #adventure-panel{inset:50% auto auto 50%;transform:translate(-50%,-50%);margin:0;width:min(500px,calc(100vw - 24px));max-height:calc(100dvh - 40px);background:var(--window-paper)!important;color:var(--window-ink);border-color:var(--window-line);border-radius:15px}#adventure-panel::backdrop{background:#07181391;backdrop-filter:blur(4px)}html[data-theme] #adventure-panel>header{background:linear-gradient(130deg,var(--window-chrome-2),var(--window-chrome));color:var(--window-text);padding:10px 14px}html[data-theme] #adventure-panel>header h2{font-family:var(--font-display);font-weight:400}#adventure-panel[data-context=merchant]>header h2:before{background-image:url('ui-assets/kamas.svg')}#adventure-panel[data-context=artisan]>header h2:before{background-image:url('ui-assets/inventory.svg')}#adventure-panel[data-context=dungeon]>header h2:before{background-image:url('ui-assets/damage.svg')}html[data-theme] #adventure-panel nav{border-color:var(--theme-border);padding:8px 12px;gap:5px;flex-wrap:wrap}html[data-theme] #adventure-panel :is(p,small,summary,.adventure-intro,.adventure-footnote){color:var(--theme-muted)}html[data-theme] #adventure-panel :is(h3,strong){color:var(--theme-ink)}html[data-theme] #adventure-panel :is(.adventure-quest,.adventure-job,.adventure-note,.adventure-recipe,.adventure-place){background:var(--theme-card);border-color:var(--theme-border)}html[data-theme] #adventure-panel :is(button,select){background:var(--theme-card);color:var(--theme-ink);border-color:var(--theme-border)}html[data-theme] #adventure-panel :is(button,select):hover{background:var(--theme-accent-soft);color:var(--theme-accent-ink)}html[data-theme] #adventure-panel .adventure-primary,html[data-theme] #adventure-panel nav button.is-selected{background:var(--theme-accent);color:var(--theme-accent-text);border-color:var(--theme-accent-hover)}html[data-theme] #adventure-panel .adventure-primary:hover{background:var(--theme-accent-hover);color:var(--theme-accent-text)}html[data-theme] #adventure-panel>header #adventure-close{color:var(--window-text)!important;background:transparent!important}html[data-theme] #adventure-message{background:var(--theme-card);border-color:var(--theme-border);color:var(--theme-ink)!important}html[data-theme] #adventure-message.is-error{color:var(--theme-negative)!important}.adventure-places{display:grid;gap:9px}.adventure-place{display:flex;align-items:center;gap:10px;padding:11px;border:1px solid var(--theme-border);border-radius:10px}.adventure-place>img{width:35px;height:39px;object-fit:contain;flex:none}.adventure-place>div{flex:1;min-width:0}.adventure-place p{margin:3px 0!important;line-height:1.4}.adventure-place button{flex:none}.adventure-wallet{display:flex;align-items:center;gap:5px;white-space:nowrap;font-size:12px}.adventure-wallet img{width:21px;height:22px;object-fit:contain}html[data-theme] #adventure-panel .adventure-shop-row{padding-block:10px;border-color:var(--theme-border)}html[data-theme] #adventure-panel .adventure-eyebrow{color:var(--window-muted)!important}html[data-theme] #adventure-panel .adventure-dungeon>.adventure-eyebrow{color:var(--theme-muted)!important}html[data-theme] #adventure-panel .adventure-dungeon li{color:var(--theme-muted)}html[data-theme] #adventure-panel .adventure-dungeon li.is-current{color:var(--theme-accent-ink)}
@media(max-width:700px),(max-width:1000px) and (max-height:500px){html[data-theme] #adventure-panel{width:calc(100vw - 20px);max-height:calc(100dvh - 24px);border-radius:13px}html[data-theme] #adventure-panel>header{padding:8px 11px}.adventure-place{padding:9px;gap:8px}.adventure-place>img{width:29px;height:33px}.adventure-place button{padding:8px!important}.adventure-place h3{font-size:13px!important}#adventure-panel select{font-size:16px!important}.adventure-shop-row{flex-wrap:wrap}.adventure-shop-row>div{min-width:150px}#adventure-panel nav button{font-size:11.5px!important;padding:7px 8px}}
