.online-actions { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.online-actions button, #online-panel button { min-height:40px; margin:0; font:600 1rem var(--font-ui); }
.online-actions button { display:inline-flex; gap:.4rem; align-items:center; }
.online-actions svg { width:1.25em; height:1.25em; fill:none; stroke:currentColor; stroke-width:1.6; }
.online-badge { padding:.12em .38em; border-radius:1em; background:var(--bad); color:#fff; font-size:.8em; }
.online-auth { width:min(100%,32rem); margin:auto; }
.online-auth form, #online-panel form { display:grid; gap:.65rem; margin:.75rem 0; }
.online-auth label, #online-panel label { display:grid; gap:.25rem; }
.online-auth input, #online-panel input:not([type=checkbox]), #online-panel textarea {
  width:100%; min-width:0; box-sizing:border-box; padding:.55em; color:var(--ink);
  background:var(--paper); border:1px solid var(--ink); border-radius:6px; font:inherit;
}
#online-panel {
  color:var(--ink); background:var(--paper); border:2px solid var(--ink); border-radius:14px;
  width:min(42rem,calc(100vw - 1.5rem)); max-height:calc(100dvh - 1.5rem); box-sizing:border-box;
  padding:clamp(.65rem,3vw,1.4rem); font:1rem/1.45 var(--font-ui); overflow:auto;
}
#online-panel::backdrop { background:#171922a8; }
.online-title, .online-row { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; }
.online-title { flex-wrap:nowrap; justify-content:space-between; border-bottom:1px dashed var(--ink); padding-bottom:.45rem; }
.online-title h2 { margin:0; font:700 clamp(21px,4vw,30px)/1.2 var(--font-ui); }
#online-panel .window-close { min-height:0; font:700 22px/1 var(--font-ui); }
#online-panel [data-shared-account] { width:40px; height:40px; padding:2px; border-radius:50%; }
.online-row { margin:.6rem 0; }
.online-row strong { margin-right:auto; overflow-wrap:anywhere; }
#online-panel .online-choice { display:flex; align-items:center; gap:.5rem; }
.online-status { color:var(--bad); overflow-wrap:anywhere; }
.online-history { display:flex; flex-direction:column; gap:.45rem; overflow:auto; max-height:36dvh; padding:.5rem; }
.online-message { background:var(--cell); border:1px solid var(--line); padding:.45rem .65rem; border-radius:8px; align-self:flex-start; max-width:85%; }
.online-message.mine { align-self:flex-end; background:var(--tint); }
.online-message p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
#online-panel:is([data-view="chat"],[data-view="friend-search"],[data-view="invite"],[data-view="mail"]) {
  --friend-ink:#192a4c;
  --friend-border:#495575;
  color:var(--friend-ink);
  background:#faead3 url("art/map-panel-paper.jpg") center/540px auto;
  border:2px solid var(--friend-ink);
  border-radius:15px 18px 13px 16px;
  box-shadow:0 9px 24px #382a2354;
}
#online-panel[data-view="mail"] {width:min(51rem,calc(100vw - 1.5rem))}
#online-panel[data-view="mail"] .online-title {border-bottom:1px solid var(--friend-border)}
#online-panel[data-view="mail"] .mail-message {border-color:#49557555}
#online-panel[data-view="mail"] .window-close {
  color:inherit;background:#f9eacf;border:1px solid var(--friend-ink);border-radius:7px;box-shadow:none;
}
#online-panel[data-view="chat"] {width:min(82vw,1180px);height:min(87dvh,760px);overflow:hidden}
#online-panel[data-view="chat"][open] {display:flex;flex-direction:column;gap:.6rem}
#online-panel[data-view="chat"] .online-title {
  position:relative;justify-content:center;padding:.15rem 3rem .6rem;border:0;text-align:center;
}
#online-panel[data-view="chat"] .online-title h2 {
  display:flex;align-items:center;gap:clamp(.4rem,2vw,1.4rem);font-size:clamp(20px,3.1vw,46px);font-weight:800;
}
#online-panel[data-view="chat"] .online-title h2::before,#online-panel[data-view="chat"] .online-title h2::after {
  content:"";width:clamp(.5rem,7vw,6rem);height:1px;background:#a65345;
}
#online-panel[data-view="chat"] .online-title .window-close {position:absolute;right:0;top:0}
.friends-sheet {display:grid;grid-template-columns:minmax(0,31fr) minmax(0,69fr);gap:.75rem;flex:1;min-height:0}
.friends-contacts,.friends-thread {
  display:flex;flex-direction:column;min-width:0;min-height:0;
  padding:clamp(.45rem,1.4vw,1.25rem);border:1px solid var(--friend-border);border-radius:12px;background:#fff4de2c;
}
.friends-contacts header,.friends-thread header {display:flex;align-items:center;gap:.6rem;padding-bottom:.55rem;border-bottom:1px solid var(--friend-border)}
.friends-contacts header {justify-content:space-between}
.friends-sheet h3 {margin:0;font-size:clamp(14px,2vw,29px);overflow-wrap:anywhere}
.friend-portrait {display:block;width:clamp(32px,5vw,69px);aspect-ratio:1;object-fit:cover;border:1.5px solid var(--friend-ink);border-radius:50%;flex:none}
.friends-contact-list {display:grid;align-content:start;gap:.4rem;overflow:auto;padding:.65rem 0}
#online-panel button.friend-contact {
  display:flex;align-items:center;gap:.55rem;text-align:left;min-width:0;padding:.4rem;border:1px solid transparent;
  border-radius:9px;color:inherit;background:none;box-shadow:none;overflow-wrap:anywhere;
}
#online-panel button.friend-contact[aria-pressed="true"] {border-color:var(--friend-border);background:#d4ab7153}
.friend-contact small {margin-left:auto;font-weight:700}
#online-panel .friend-remove {margin-left:auto;min-height:0;padding:.3rem .45rem;font-size:.68rem;box-shadow:none}
.friends-thread .online-history {flex:1;max-height:none;min-height:0;padding:.8rem .2rem}
.friends-thread .online-message {border-color:var(--friend-border);border-radius:13px;background:#fbebd1;box-shadow:1px 2px 0 #55493728}
.friends-thread .online-message.mine {background:#d9e2ee}
.friends-thread .online-message small {font-size:.67em;opacity:.7}
#online-panel .friends-thread form {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.45rem;margin:0;padding-top:.65rem;border-top:1px solid var(--friend-border)}
#online-panel :is(.friend-icon,.friend-send) {
  width:40px;height:40px;min-height:0;padding:7px;box-shadow:none;
  background:#f8e9ce;color:inherit;border:1px solid var(--friend-ink);border-radius:8px;
}
#online-panel .friend-send {background:var(--friend-ink);color:#fff1d6;border-radius:50%}
#online-panel :is(.friend-icon,.friend-send,.friend-search-field) svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#online-panel[data-view="friend-search"] form{grid-template-columns:minmax(0,1fr) auto}
#online-panel .friend-search-field {display:flex;align-items:center;gap:.45rem;min-width:0}
.friend-search-field svg{max-width:24px;max-height:24px;flex:none}
.friend-search-field input{min-width:0;flex:1}
.friend-found{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.6rem;padding:.7rem 0;border-block:1px solid var(--friend-border);margin:.5rem 0}
#online-panel[data-view="invite"] fieldset{border:1px solid var(--friend-border);border-radius:9px;margin:0;padding:.5rem}
#online-panel[data-view="invite"] .online-choice{padding:.3rem;border-bottom:1px solid #49557532}
#online-panel[data-view="invite"] .friend-portrait{width:38px}
@media(max-width:650px){
  #online-panel[data-view="chat"]{width:calc(100vw - 16px)}
  .friends-sheet{grid-template-columns:minmax(0,32fr) minmax(0,68fr);gap:.35rem}
  #online-panel button.friend-contact{gap:.25rem;padding:.22rem;font-size:.77rem}
  .friend-contact .friend-portrait{width:25px}
  #online-panel .friend-icon{width:30px;height:30px;padding:5px}
  .friends-contacts header{gap:.28rem;flex-wrap:wrap}
}
#online-panel article button { margin:.25rem .25rem .25rem 0; }
#online-map {
  position:static; width:100%; height:auto; display:block; margin:.7rem 0; border:1px solid var(--ink);
  border-radius:6px; background-color:var(--cell); background-image:linear-gradient(#78725d22 1px,transparent 1px),
  linear-gradient(90deg,#78725d22 1px,transparent 1px); background-size:18px 18px; cursor:crosshair;
}
.online-country { display:inline-block; margin:.15rem; padding:.12rem .45rem; border:1px solid var(--ink); border-radius:5px; }
#main-menu .online-auth [role=status] { color:var(--bad); }
@media(max-width:550px) {
  #main-menu { padding-inline:12px; }
  #main-menu .mode-grid { gap:9px; margin:1rem 0; }
  #main-menu .mode-card { padding:13px; gap:5px; }
  .online-actions button { padding:.35rem .55rem; }
}

#online-panel[data-view=collection] { width:min(54rem,calc(100vw - 1.5rem)); }
.shop-nav { margin:.8rem 0; }
.shop-nav button[aria-pressed=true] { outline:2px solid var(--ink); outline-offset:2px; }
.store-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr)); gap:.65rem; margin:.7rem 0; }
.store-card, .store-result { min-width:0; background:var(--cell); border:1px solid var(--line); border-radius:9px; padding:.7rem; }
.store-card h3, .store-result h3 { font:700 1rem/1.35 var(--font-ui); margin:0 0 .45rem; }
.store-card h4 { margin:.55rem 0 .15rem; }
.store-card ul, .store-result ul { padding-inline-start:1.25rem; margin:.35rem 0 .6rem; }
.store-card details { margin-bottom:.55rem; }
.store-card details summary { cursor:pointer; font-weight:600; }
.store-card p { margin:.35rem 0; }
.shop-class select { max-width:100%; font:inherit; color:var(--ink); background:var(--paper); }
.store-preview { width:64px; height:64px; object-fit:contain; }
.shop-rarity { font-weight:650; }
.shop-rarity[data-rarity=rare] { color:#2b669d; }
.shop-rarity[data-rarity=epic] { color:#7949a0; }
.shop-rarity[data-rarity=legendary] { color:#95621e; }
.shop-profile { background:var(--cell) center / cover; color:#202838; display:flex; align-items:center; gap:.75rem; border:1px solid var(--line); border-radius:8px; padding:.65rem; margin:.75rem 0; }
.shop-profile>div:not(.account-avatar-controls) { padding:.2rem .35rem; background:#fbf2dce8; border-radius:4px; min-width:0; overflow-wrap:anywhere; }
.shop-profile p { margin:.2rem 0; }
.shop-avatar { position:relative; width:64px; height:64px; flex:0 0 auto; }
.shop-avatar img { width:100%; height:100%; position:absolute; inset:0; }
.shop-avatar-picture { transform:scale(.84); }
.shop-name-mark { display:inline-block; width:1em; height:1em; margin-inline-start:.25em; vertical-align:-.12em; }
