:root {
  --bg-primary: #313338; --bg-secondary: #2b2d31; --bg-tertiary: #1e1f22; --bg-floating: #111214; --bg-hover: #35373c; --bg-active: #404249;
  --msg-hover: #2e3035; --text: #dbdee1; --text-strong: #f2f3f5; --text-muted: #949ba4; --text-faint: #6d6f78; --link: #00a8fc;
  --blurple: #5865f2; --blurple-hover: #4752c4; --green: #23a55a; --red: #f23f43; --yellow: #f0b232; --divider: #3f4147; --input: #383a40;
  --mention-bg: rgba(88,101,242,.3); --mention-text: #c9cdfb; --embed-bg: #2b2d31; --embed-border: #1e1f22;
  --font: "gg sans", "Noto Sans", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif; --mono: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", Monaco, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg-primary); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.375; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { fill: currentColor; flex: none; }
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; min-height: 40px; }
::-webkit-scrollbar-track { background: #2b2d31; border: 3px solid transparent; background-clip: padding-box; border-radius: 8px; }
.scroller-thin::-webkit-scrollbar { width: 8px; }
.scroller-thin::-webkit-scrollbar-track { background: transparent; border: 0; }
.scroller-thin::-webkit-scrollbar-thumb { border-width: 2px; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #5865f2; }
.login::before { content: ""; position: absolute; inset: 0; background: radial-gradient(1200px 700px at 20% 10%, #7983f5 0%, transparent 60%), radial-gradient(900px 700px at 90% 90%, #3b44b8 0%, transparent 60%), linear-gradient(135deg, #4752c4, #1e2150); }
.login-card { position: relative; width: 480px; max-width: calc(100vw - 32px); padding: 32px; background: var(--bg-primary); border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,.2); text-align: center; }
.login-card h1 { margin: 0 0 8px; font-size: 24px; font-weight: 600; color: var(--text-strong); }
.login-card p { margin: 0 0 20px; color: var(--text-muted); font-size: 16px; }
.login-logo { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; background: var(--blurple); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 28px; letter-spacing: -1px; }
.btn { border: 0; border-radius: 3px; padding: 2px 16px; min-height: 38px; font-size: 14px; font-weight: 500; background: var(--blurple); color: #fff; transition: background-color .17s ease; }
.btn:hover { background: var(--blurple-hover); }
.btn.wide { width: 100%; min-height: 44px; font-size: 16px; }
.login-error { margin-top: 14px; color: var(--red); font-size: 14px; min-height: 18px; }
.login small { display: block; margin-top: 16px; color: var(--text-muted); font-size: 12px; }

/* ---------- layout ---------- */
#app { display: flex; height: 100vh; width: 100vw; }
.rail { width: 72px; background: var(--bg-tertiary); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; flex: none; overflow-y: auto; }
.rail::-webkit-scrollbar { display: none; }
.pill-wrap { position: relative; width: 72px; display: flex; justify-content: center; }
.pill { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 0 4px 4px 0; background: #fff; transition: height .2s, opacity .2s; opacity: 0; }
.pill-wrap.active .pill { height: 40px; opacity: 1; }
.pill-wrap:hover:not(.active) .pill { height: 20px; opacity: 1; }
.guild-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-primary); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 500; border: 0; transition: border-radius .2s, background-color .2s, color .2s; overflow: hidden; padding: 0; }
.guild-icon:hover, .pill-wrap.active .guild-icon { border-radius: 16px; background: var(--blurple); color: #fff; }
.guild-icon.home { color: var(--text); }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--bg-primary); margin: 0; flex: none; }
.sidebar { width: 240px; background: var(--bg-secondary); display: flex; flex-direction: column; flex: none; min-width: 0; }
.sidebar-head { height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; color: var(--text-strong); box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 1.5px 0 rgba(0,0,0,.05), 0 2px 0 rgba(0,0,0,.05); flex: none; cursor: pointer; }
.sidebar-head:hover { background: rgba(78,80,88,.3); }
.sidebar-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channels { flex: 1; overflow-y: auto; padding: 8px 0 8px 8px; }
.cat { display: flex; align-items: center; gap: 2px; padding: 16px 8px 4px 0; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; cursor: pointer; user-select: none; }
.cat:hover { color: var(--text); }
.cat svg { width: 12px; height: 12px; transition: transform .15s; }
.cat.closed svg { transform: rotate(-90deg); }
.chan { display: flex; align-items: center; gap: 6px; height: 34px; margin: 1px 8px 1px 0; padding: 0 8px; border-radius: 4px; color: var(--text-muted); cursor: pointer; font-weight: 500; user-select: none; position: relative; border: 0; background: none; width: calc(100% - 8px); text-align: left; font-size: 16px; }
.chan:hover { background: var(--bg-hover); color: var(--text); }
.chan.active { background: var(--bg-active); color: var(--text-strong); }
.chan.unread { color: var(--text-strong); }
.chan.unread::before { content: ""; position: absolute; left: -8px; top: 50%; width: 4px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: #fff; }
.chan svg { width: 20px; height: 20px; color: var(--text-faint); }
.chan span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chan .badge { min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.userpanel { height: 52px; background: #232428; padding: 0 8px; display: flex; align-items: center; gap: 8px; flex: none; }
.userpanel .who { flex: 1; min-width: 0; padding: 4px; border-radius: 4px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.userpanel .who:hover { background: rgba(78,80,88,.4); }
.userpanel .names { min-width: 0; line-height: 1.15; }
.userpanel .names b { display: block; font-size: 14px; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userpanel .names small { color: var(--text-muted); font-size: 12px; }
.icon-btn { background: none; border: 0; color: var(--text-muted); width: 32px; height: 32px; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 0; }
.icon-btn:hover { background: rgba(78,80,88,.4); color: var(--text); }
.avatar { position: relative; width: 32px; height: 32px; flex: none; }
.avatar img, .avatar .fallback { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: var(--blurple); }
.avatar .fallback { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; }
.avatar .status { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 3px solid #232428; box-sizing: content-box; }
.avatar .status.off { background: #80848e; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-primary); }
.chat-head { height: 48px; padding: 0 16px; display: flex; align-items: center; gap: 8px; box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 1.5px 0 rgba(0,0,0,.05), 0 2px 0 rgba(0,0,0,.05); flex: none; z-index: 2; }
.chat-head .hash { color: var(--text-faint); width: 24px; height: 24px; }
.chat-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--text-strong); }
.chat-head .sep { width: 1px; height: 24px; background: #4e5058; margin: 0 8px; }
.chat-head .topic { color: var(--text-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-head .tools { margin-left: auto; display: flex; gap: 4px; }
.chat-body { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 8px; position: relative; overflow-anchor: none; }
.messages-inner { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; }
.welcome { padding: 16px 16px 8px; }
.welcome .big { width: 68px; height: 68px; border-radius: 50%; background: #41434a; color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.welcome .big svg { width: 40px; height: 40px; }
.welcome h3 { margin: 0 0 4px; font-size: 32px; font-weight: 700; color: var(--text-strong); }
.welcome p { margin: 0; color: var(--text-muted); font-size: 16px; }

/* ---------- messages ---------- */
.item { list-style: none; }
.divider { display: flex; align-items: center; margin: 24px 14px 8px 16px; height: 0; border-top: 1px solid var(--divider); position: relative; }
.divider span { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: var(--bg-primary); padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.msg { position: relative; padding: 2px 48px 2px 72px; margin-top: 17px; min-height: 22px; }
.msg.grouped { margin-top: 0; }
.msg:hover { background: var(--msg-hover); }
.msg.mention { background: rgba(250,166,26,.1); box-shadow: inset 2px 0 0 var(--yellow); }
.msg.mention:hover { background: rgba(250,166,26,.08); }
.msg.ephemeral { background: rgba(88,101,242,.06); }
.msg .av { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; cursor: pointer; }
.msg .av img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--blurple); display: block; }
.msg .av .fb { width: 40px; height: 40px; border-radius: 50%; background: var(--blurple); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.msg .stamp-gutter { position: absolute; left: 0; width: 56px; text-align: right; font-size: 11px; line-height: 22px; color: var(--text-faint); opacity: 0; user-select: none; }
.msg:hover .stamp-gutter { opacity: 1; }
.msg .head { display: flex; align-items: baseline; gap: 4px; line-height: 22px; min-height: 22px; }
.msg .uname { font-weight: 500; color: var(--text-strong); cursor: pointer; font-size: 16px; }
.msg .uname:hover { text-decoration: underline; }
.fb { display: flex; align-items: center; justify-content: center; background: var(--blurple); color: #fff; font-weight: 600; border-radius: 50%; }
.avatar .fb { width: 100%; height: 100%; font-size: 14px; }
.member .bot-tag { margin-left: 4px; align-self: center; }
.bot-tag, .msg .bot-tag { display: inline-flex; align-items: center; gap: 2px; background: var(--blurple); color: #fff; font-size: 10px; font-weight: 500; line-height: 15px; height: 15px; padding: 0 4px; border-radius: 3px; text-transform: uppercase; vertical-align: 1px; margin-left: 2px; }
.msg .bot-tag svg { width: 10px; height: 10px; }
.msg .ts { font-size: 12px; color: var(--text-muted); margin-left: 4px; font-weight: 500; }
.msg .ts.edited { font-size: 10px; margin-left: 4px; }
.msg .body { color: var(--text); font-size: 16px; line-height: 1.375; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.msg .body:empty { display: none; }
.msg .body .edited-mark { font-size: 10px; color: var(--text-faint); margin-left: 4px; user-select: none; }
.msg .reply-ref { display: flex; align-items: center; gap: 4px; margin: 0 0 2px; position: relative; font-size: 14px; color: var(--text-muted); height: 20px; white-space: nowrap; }
.msg .reply-ref::before { content: ""; position: absolute; left: -52px; top: 50%; width: 33px; height: 10px; border-left: 2px solid #4e5058; border-top: 2px solid #4e5058; border-top-left-radius: 6px; margin-top: -1px; }
.msg .reply-ref img { width: 16px; height: 16px; border-radius: 50%; }
.msg .reply-ref b { color: var(--text-strong); font-weight: 500; cursor: pointer; }
.msg .reply-ref .snip { overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.msg .reply-ref .snip:hover { color: var(--text-strong); }
.msg .toolbar { position: absolute; right: 16px; top: -16px; display: none; background: var(--bg-primary); border: 1px solid var(--bg-tertiary); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 2px 5px rgba(0,0,0,.2); z-index: 3; }
.msg:hover .toolbar, .msg.menu-open .toolbar { display: flex; }
.toolbar button { width: 32px; height: 32px; background: none; border: 0; color: var(--text-muted); display: flex; align-items: center; justify-content: center; padding: 0; }
.toolbar button:hover { background: var(--bg-hover); color: var(--text); }
.toolbar button.danger:hover { color: var(--red); }
.eph-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.eph-note svg { width: 14px; height: 14px; }
.eph-note a { cursor: pointer; }

/* markdown */
.md code { font-family: var(--mono); font-size: .875em; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: .2em .4em; white-space: pre-wrap; }
.md pre { margin: 6px 0 0; max-width: 90%; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 7px; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .875rem; line-height: 1.125rem; }
.md pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.md blockquote { margin: 0; padding: 0 8px 0 12px; border-left: 4px solid #4e5058; border-radius: 4px; display: block; white-space: pre-wrap; }
.md h1, .md h2, .md h3 { margin: 8px 0 4px; font-weight: 700; color: var(--text-strong); line-height: 1.375; }
.md h1 { font-size: 1.5em; } .md h2 { font-size: 1.25em; } .md h3 { font-size: 1em; }
.md ul, .md ol { margin: 4px 0; padding-left: 24px; white-space: normal; }
.md ul { list-style: disc; } .md ol { list-style: decimal; }
.md li { white-space: pre-wrap; padding-left: 2px; }
.md small.sub { font-size: .75em; color: var(--text-muted); line-height: 1.33; display: inline-block; }
.md .spoiler { background: #202225; color: transparent; border-radius: 3px; cursor: pointer; user-select: none; }
.md .spoiler.open { background: rgba(255,255,255,.1); color: inherit; cursor: text; user-select: text; }
.md .spoiler * { visibility: hidden; }
.md .spoiler.open * { visibility: visible; }
.md u { text-decoration: underline; }
.mention-chip { background: var(--mention-bg); color: var(--mention-text); border-radius: 3px; padding: 0 2px; font-weight: 500; cursor: pointer; transition: background-color .1s, color .1s; }
.mention-chip:hover { background: var(--blurple); color: #fff; }
img.emoji { width: 1.375em; height: 1.375em; vertical-align: bottom; object-fit: contain; margin: 0 .05em; }
img.emoji.jumbo { width: 3rem; height: 3rem; }
.timestamp { background: rgba(78,80,88,.6); border-radius: 3px; padding: 0 2px; }

/* embeds */
.embeds { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.embed { display: grid; grid-template-columns: auto; width: fit-content; max-width: 520px; min-width: 0; background: var(--embed-bg); border: 1px solid var(--embed-border); border-left: 4px solid var(--embed-color, #1e1f22); border-radius: 4px; padding: 8px 16px 16px 12px; margin-top: 8px; box-sizing: border-box; white-space: normal; }
.embed.has-thumb { grid-template-columns: minmax(0, 1fr) auto; }
.embed .e-main { grid-column: 1; min-width: 0; }
.embed .e-thumb { grid-column: 2; grid-row: 1 / 8; margin: 8px 0 0 16px; justify-self: end; }
.embed .e-thumb img { max-width: 80px; max-height: 80px; border-radius: 4px; object-fit: contain; display: block; }
.embed .e-author { display: flex; align-items: center; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.embed .e-author img { width: 24px; height: 24px; border-radius: 50%; margin-right: 8px; object-fit: cover; }
.embed .e-author a { color: var(--text-strong); }
.embed .e-title { margin-top: 8px; font-size: 16px; font-weight: 600; color: var(--text-strong); overflow-wrap: anywhere; }
.embed .e-title a { color: var(--link); }
.embed .e-desc { margin-top: 8px; font-size: 14px; line-height: 1.375; font-weight: 400; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.embed .e-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.embed .e-field { min-width: 0; }
.embed .e-field .fn { font-size: 14px; font-weight: 600; color: var(--text-strong); margin-bottom: 2px; overflow-wrap: anywhere; }
.embed .e-field .fv { font-size: 14px; font-weight: 400; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.embed .e-image { margin-top: 16px; max-width: 100%; }
.embed .e-image img, .embed .e-image video { max-width: 100%; max-height: 300px; border-radius: 4px; display: block; cursor: pointer; }
.embed .e-footer { display: flex; align-items: center; margin-top: 8px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.embed .e-footer img { width: 20px; height: 20px; border-radius: 50%; margin-right: 8px; object-fit: cover; }
.embed .e-footer .dot { margin: 0 4px; }

.attachments { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; align-items: flex-start; }
.att-img { max-width: 400px; max-height: 300px; border-radius: 4px; display: block; cursor: pointer; background: #2b2d31; }
.att-file { display: flex; align-items: center; gap: 10px; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 10px 12px; max-width: 432px; min-width: 300px; }
.att-file svg { width: 30px; height: 40px; color: #a8b0ff; }
.att-file .nm { color: var(--link); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file small { display: block; color: var(--text-muted); font-size: 12px; }
video.att-vid { max-width: 400px; max-height: 300px; border-radius: 4px; background: #000; }

/* components */
.rows { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; max-width: 520px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.cbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 60px; padding: 2px 16px; border-radius: 3px; border: 0; font-size: 14px; font-weight: 500; line-height: 16px; color: #fff; transition: background-color .17s ease, color .17s ease; max-width: 100%; }
.cbtn .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbtn img.emoji { width: 16px; height: 16px; margin: 0; }
.cbtn.s1 { background: var(--blurple); } .cbtn.s1:hover:not(:disabled) { background: var(--blurple-hover); }
.cbtn.s2, .cbtn.s5 { background: #4e5058; } .cbtn.s2:hover:not(:disabled), .cbtn.s5:hover:not(:disabled) { background: #6d6f78; }
.cbtn.s3 { background: #248046; } .cbtn.s3:hover:not(:disabled) { background: #1a6334; }
.cbtn.s4 { background: #da373c; } .cbtn.s4:hover:not(:disabled) { background: #a12828; }
.cbtn:disabled { opacity: .5; cursor: not-allowed; }
.cbtn.loading { opacity: .7; cursor: progress; }
.cbtn svg { width: 16px; height: 16px; }
.csel { position: relative; width: 100%; max-width: 400px; }
.csel-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; padding: 8px 12px; background: #1e1f22; border: 1px solid #1e1f22; border-radius: 3px; color: var(--text-muted); font-size: 16px; text-align: left; }
.csel-box:hover:not(:disabled) { border-color: #000; }
.csel-box.open { border-color: var(--blurple); border-radius: 3px 3px 0 0; }
.csel-box.has { color: var(--text); }
.csel-box:disabled { opacity: .5; cursor: not-allowed; }
.csel-box .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #1e1f22; border: 1px solid var(--blurple); border-top: 0; border-radius: 0 0 3px 3px; max-height: 320px; overflow-y: auto; padding: 4px 0; }
.csel-list.up { top: auto; bottom: 100%; border-top: 1px solid var(--blurple); border-bottom: 0; border-radius: 3px 3px 0 0; }
.csel-opt { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.csel-opt:hover { background: #35373c; }
.csel-opt.sel { background: #404249; }
.csel-opt .lb { color: var(--text-strong); font-size: 16px; }
.csel-opt .ds { color: var(--text-muted); font-size: 14px; }
.csel-opt .chk { width: 18px; height: 18px; border: 2px solid #80848e; border-radius: 3px; margin-left: auto; display: flex; align-items: center; justify-content: center; }
.csel-opt.sel .chk { background: var(--blurple); border-color: var(--blurple); }
.csel-opt .chk svg { width: 12px; height: 12px; color: #fff; display: none; }
.csel-opt.sel .chk svg { display: block; }

/* reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; border-radius: 8px; border: 1px solid transparent; background: #2b2d31; color: var(--text-muted); font-size: 14px; font-weight: 500; }
.reaction:hover { border-color: #4e5058; }
.reaction.me { background: rgba(88,101,242,.15); border-color: var(--blurple); color: #c9cdfb; }
.reaction img.emoji { width: 16px; height: 16px; margin: 0; }

/* composer */
.composer { padding: 0 16px; margin-bottom: 24px; position: relative; flex: none; }
.reply-bar { display: flex; justify-content: space-between; align-items: center; background: #2b2d31; border-radius: 8px 8px 0 0; padding: 8px 16px; font-size: 14px; color: var(--text-muted); }
.reply-bar b { color: var(--text-strong); font-weight: 500; }
.reply-bar button { background: none; border: 0; color: var(--text-muted); padding: 0; display: flex; }
.reply-bar button:hover { color: var(--text); }
.pend { display: flex; gap: 8px; flex-wrap: wrap; background: var(--input); padding: 12px 16px 4px; border-radius: 8px 8px 0 0; border-bottom: 1px solid #3f4147; }
.pend .chip { background: #2b2d31; border-radius: 4px; padding: 6px 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.pend .chip button { background: none; border: 0; color: var(--red); padding: 0; display: flex; }
.box { display: flex; align-items: flex-start; background: var(--input); border-radius: 8px; min-height: 44px; }
.reply-bar + .box, .pend + .box { border-radius: 0 0 8px 8px; }
.box .attach { height: 44px; width: 44px; background: none; border: 0; color: #b5bac1; display: flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.box .attach:hover { color: var(--text); }
.box .attach svg { width: 24px; height: 24px; }
.box textarea { flex: 1; background: none; border: 0; outline: 0; resize: none; font-size: 16px; line-height: 22px; padding: 11px 10px 11px 0; max-height: 50vh; min-height: 44px; color: var(--text); overflow-y: auto; }
.box textarea::placeholder { color: #6d6f78; }
.box .right { display: flex; height: 44px; align-items: center; padding-right: 6px; flex: none; }
.box .right button { width: 32px; height: 32px; background: none; border: 0; color: #b5bac1; display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 4px; }
.box .right button:hover { color: var(--text); }
.box .right svg { width: 24px; height: 24px; }
.typing { position: absolute; left: 16px; right: 16px; bottom: -22px; height: 24px; padding: 0 16px; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); pointer-events: none; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--text); animation: bounce 1.4s infinite ease-in-out both; }
.typing .dots i:nth-child(2) { animation-delay: .16s; } .typing .dots i:nth-child(3) { animation-delay: .32s; }
@keyframes bounce { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.typing b { font-weight: 600; }

.ac { position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); background: #2b2d31; border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,.24); max-height: 340px; overflow-y: auto; padding: 8px; z-index: 20; }
.ac h4 { margin: 4px 8px 8px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); }
.ac .opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; }
.ac .opt.sel, .ac .opt:hover { background: #404249; }
.ac .opt .n { font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.ac .opt .d { color: var(--text-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; padding-left: 16px; }
.ac .opt img { width: 24px; height: 24px; border-radius: 50%; }
.ac .opt.emo img { border-radius: 0; }
.ac-emo { display: flex; width: 24px; height: 24px; flex: none; }
.ac-q { text-transform: none; color: var(--text-strong); }
.emoji-none { grid-column: 1 / -1; padding: 16px 4px; color: var(--text-muted); font-size: 14px; text-align: center; }

/* members */
.members { width: 240px; background: var(--bg-secondary); overflow-y: auto; padding: 8px 0 0 8px; flex: none; }
.members h5 { margin: 0; padding: 24px 8px 0 8px; height: 40px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); }
.member { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 8px; margin-right: 8px; border-radius: 4px; color: var(--text-muted); cursor: default; }
.member:hover { background: var(--bg-hover); }
.member.off { opacity: .45; }
.member .avatar .status { border-color: var(--bg-secondary); }
.member:hover .avatar .status { border-color: var(--bg-hover); }
.member .nm { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.members.hidden { display: none; }

/* floating */
#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--bg-floating); color: var(--text-strong); padding: 10px 16px; border-radius: 6px; box-shadow: 0 8px 16px rgba(0,0,0,.4); font-size: 14px; font-weight: 500; border-left: 4px solid var(--blurple); animation: pop .15s ease-out; }
.toast.error { border-left-color: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }
.popout { position: fixed; z-index: 500; background: #2b2d31; border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,.35); border: 1px solid #1e1f22; }
.emoji-pop { width: 352px; height: 380px; display: flex; flex-direction: column; }
.emoji-pop input { margin: 12px; padding: 8px; background: #1e1f22; border: 0; border-radius: 4px; outline: 0; font-size: 14px; }
.emoji-grid { flex: 1; overflow-y: auto; padding: 0 8px 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; align-content: start; }
.emoji-grid h6 { grid-column: 1 / -1; margin: 8px 4px 2px; font-size: 12px; text-transform: uppercase; color: var(--text-muted); }
.emoji-grid button { background: none; border: 0; border-radius: 4px; height: 38px; display: flex; align-items: center; justify-content: center; padding: 0; }
.emoji-grid button:hover { background: #404249; }
.emoji-grid img { width: 28px; height: 28px; }
.menu { min-width: 188px; padding: 6px 8px; }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 6px 8px; background: none; border: 0; border-radius: 2px; color: #b5bac1; font-size: 14px; font-weight: 500; text-align: left; }
.menu button:hover { background: var(--blurple); color: #fff; }
.menu button.danger { color: var(--red); } .menu button.danger:hover { background: var(--red); color: #fff; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 900; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 4px; }
.connecting { position: fixed; top: 0; left: 0; right: 0; background: var(--yellow); color: #000; text-align: center; font-size: 14px; font-weight: 600; padding: 4px; z-index: 999; }

@media (max-width: 1000px) { .members { display: none; } }
@media (max-width: 720px) {
  .rail { display: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; width: 280px; box-shadow: 4px 0 16px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .msg { padding-right: 16px; }
  .chat-head .topic, .chat-head .sep { display: none; }
}

/* ============================================================ fullscreen dungeon */
.dg { position: fixed; inset: 0; z-index: 200; background: #07040f; color: #fff; display: flex; flex-direction: column; overflow: hidden; font-family: var(--font); }
.dg[hidden], .dg-float[hidden], .dg-fight[hidden] { display: none !important; }
.dg-grid { position: absolute; inset: -80px; background-image: linear-gradient(rgba(190,60,200,.28) 2px, transparent 2px), linear-gradient(90deg, rgba(190,60,200,.28) 2px, transparent 2px); background-size: 64px 64px; animation: dgscroll 5s linear infinite; pointer-events: none; }
.dg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.65) 100%); pointer-events: none; }
@keyframes dgscroll { to { transform: translate(64px, 64px); } }
/* the Knight's fight: the background slowly shifts between black and a light grey (pure white made the white names unreadable) */
.dg.knight-bg { animation: dgknightbg 4s ease-in-out infinite alternate; }
@keyframes dgknightbg { from { background-color: #000; } to { background-color: #b4b4b4; } }
@media (prefers-reduced-motion: reduce) { .dg.knight-bg { animation: none; background: #000; } }
.dg-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: linear-gradient(#0009, transparent); }
.dg-title { font-size: 20px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 0 12px #c04ad0; }
.dg-party { display: flex; gap: 6px; flex: 1; }
.dg-av, .dg-pm .fb { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid #fff6; display: flex; align-items: center; justify-content: center; background: #5865f2; font-weight: 700; font-size: 14px; }
.dg-btn { background: #5865f2; color: #fff; border: 0; border-radius: 4px; padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer; }
.dg-btn:hover { background: #4752c4; }
.dg-float { position: fixed; right: 20px; bottom: 20px; z-index: 150; background: #5865f2; color: #fff; border: 0; border-radius: 24px; padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px #0008; }
.dg-stage { position: relative; z-index: 2; flex: 1; min-height: 0; }
.dg-map { position: absolute; inset: 0; transition: transform .65s cubic-bezier(.6,0,.9,.4), opacity .65s ease-in; }
.dg-map.zoom { transform: scale(9); opacity: 0; pointer-events: none; }
.dg-svg { width: 100%; height: 100%; display: block; }
.dg-edge { stroke: #ffffff30; stroke-width: 3; transition: stroke .2s, stroke-width .2s, opacity .3s; }
.dg-edge.gone { opacity: .35; }
.dg-edge.reach { stroke: #ffffff4d; stroke-dasharray: 3 13; stroke-linecap: round; animation: dgdash 2.4s linear infinite; animation-delay: var(--ph); }
.dg-edge.r1 { stroke: #ffffffe6; stroke-width: 5; filter: drop-shadow(0 0 4px #ffffff99); }
.dg-edge.r2 { stroke: #ffd65a; stroke-width: 5; stroke-dasharray: 14 10; animation: dgdash 1s linear infinite; animation-delay: var(--ph); filter: drop-shadow(0 0 5px #ffd65a88); }
.dg-edge.hl { stroke: #fff; stroke-width: 5; opacity: 1; }
@keyframes dgdash { to { stroke-dashoffset: -24; } }
.dg-shadow { fill: #242e3acc; stroke: #bec8dc55; transition: opacity .3s; }
.dg-dia { stroke: #fff6; stroke-width: 2; }
.dg-node { transition: opacity .4s, filter .4s; }
.dg-node.done { filter: grayscale(.8); }
.dg-node.done .dg-dia, .dg-node.done .dg-glyph { opacity: .45; }
.dg-node.done .dg-bob > :not(.dg-dia):not(.dg-here):not(.dg-ring):not(.dg-hit):not(.dg-num):not(.dg-vav) { opacity: .45; }
.dg-node.gone { opacity: .22; filter: grayscale(.6); }
.dg-node.far { opacity: .6; }
.dg-node:hover { opacity: 1; }
.dg-ico-t { fill: #ffffffeb; text-anchor: middle; dominant-baseline: central; font-weight: 700; font-family: "Segoe UI", Arial, sans-serif; pointer-events: none; }
.dg-node line, .dg-node ellipse, .dg-node rect:not(.dg-hit), .dg-node path, .dg-node circle, .dg-node image { pointer-events: none; }
.dg-glyph { fill: #fff; text-anchor: middle; dominant-baseline: central; font-weight: 700; pointer-events: none; }
/* every room floats; hovering one lifts it */
.dg-bob { animation: dgbob 4s ease-in-out infinite; animation-delay: calc(var(--ph) - var(--o, 0s)); }
@keyframes dgbob { 50% { transform: translateY(-5px); } }
.dg-node.done .dg-bob, .dg-node.gone .dg-bob { animation-duration: 7s; }
.dg-lift { transition: transform .2s ease-out, filter .2s; }
.dg-node:not(.gone):hover .dg-lift { transform: translateY(-8px); filter: brightness(1.18); }
.dg-here { fill: none; stroke: #5aeb8c; stroke-width: 4; }
/* the rooms to pick from: a glowing ring, the diamond breathing light, the number bobbing */
.dg-ring { fill: none; stroke: #ffd65a; stroke-width: 4; animation: dgpulse 1.4s ease-in-out infinite; animation-delay: var(--ph); transform-box: fill-box; transform-origin: center; }
@keyframes dgpulse { 50% { transform: scale(1.1); opacity: .5; } }
.dg-node.pick .dg-dia { animation: dgglow 1.4s ease-in-out infinite; animation-delay: var(--ph); }
@keyframes dgglow { 50% { filter: drop-shadow(0 0 12px #ffd65a) brightness(1.15); } }
.dg-num { fill: #ffd65a; font-size: 28px; font-weight: 800; text-anchor: middle; pointer-events: none; animation: dgnum 1.4s ease-in-out infinite; animation-delay: var(--ph); paint-order: stroke; stroke: #0008; stroke-width: 4px; }
@keyframes dgnum { 50% { transform: translateY(-6px); } }
/* votes: the voter's avatar pops onto the room */
.dg-vav-ring { fill: #1e1f22; stroke: #ffd65a; stroke-width: 2.5; }
.dg-vav-t { fill: #fff; font-size: 14px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dg-vav.new { animation: dgpop .45s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes dgpop { from { transform: scale(0); opacity: 0; } }
.dg-hit { fill: transparent; cursor: pointer; }
.dg-node.pick:hover .dg-dia { filter: brightness(1.3); }
/* the party's token */
.dg-token { pointer-events: none; }
.dg-token-bob { animation: dgbob 2.2s ease-in-out infinite; animation-delay: var(--ph); }
.dg-token-ring { fill: #1e1f22; stroke: #5aeb8c; stroke-width: 3; }
.dg-token-tip { fill: #5aeb8c; }
.dg-token-n { fill: #5865f2; stroke: #1e1f22; stroke-width: 2; }
.dg-token-nt { fill: #fff; font-size: 11px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
.dg-svg.pan { cursor: grab; touch-action: pan-y; }
.dg-svg.pan:active { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .dg-bob, .dg-token-bob, .dg-edge, .dg-ring, .dg-num, .dg-node.pick .dg-dia, .dg-vav.new { animation: none !important; } }
.dg-world { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; pointer-events: none; }   /* clicks go through to the map */
.dg-world > .dg-fight { pointer-events: auto; }
.dg-fight { position: absolute; inset: 0; z-index: 1; isolation: isolate; animation: dgfade .4s ease-out; }
.dg-fight.leaving { opacity: 0; transition: opacity .4s; }
@keyframes dgfade { from { opacity: 0; } }
.dg-unit { position: absolute; width: calc(var(--size, 90px) * 2.2); transform: translate(-50%, -50%) scale(var(--cs, 1)); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: left .75s cubic-bezier(.45,0,.15,1), top .75s cubic-bezier(.45,0,.15,1), transform .75s cubic-bezier(.45,0,.15,1), opacity .4s, filter .4s; }
/* camera: a receding floor grid fades in for the behind-the-shoulder view */
.dg-floor { position: absolute; left: -40%; right: -40%; top: 26%; bottom: -20%; pointer-events: none; opacity: 0; transform-origin: 50% 0; transform: perspective(520px) rotateX(88deg); transition: transform .75s cubic-bezier(.45,0,.15,1), opacity .75s; background-image: linear-gradient(rgba(120,140,255,.38) 2px, transparent 2px), linear-gradient(90deg, rgba(120,140,255,.38) 2px, transparent 2px); background-size: 72px 72px; animation: dgfloor 3s linear infinite; -webkit-mask-image: linear-gradient(transparent, #000 35%); mask-image: linear-gradient(transparent, #000 35%); }
.dg.cam3d .dg-floor { opacity: 1; transform: perspective(520px) rotateX(64deg); }
.dg-grid { transition: opacity .75s; } .dg.cam3d .dg-grid { opacity: .25; }
@keyframes dgfloor { to { background-position: 0 72px; } }
.u-top { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.u-name { text-align: center; font-size: 15px; font-weight: 700; text-shadow: 0 2px 4px #000, 0 0 8px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-barrow { display: flex; align-items: center; gap: 6px; }
.u-bar { position: relative; flex: 1; height: 18px; background: #12121e; border: 2px solid #000; box-shadow: 0 0 0 2px #fff4; overflow: hidden; }
.dg-unit.pc .u-bar { box-shadow: 0 0 0 2px #00ffff88; }
.u-fill { position: absolute; inset: 0 auto 0 0; background: #2ecc40; transition: width .5s ease; }
.dg-unit.pc .u-fill { background: #00e5ff; }
.u-fill.mid { background: #f5c518 !important; } .u-fill.low { background: #ff3b3b !important; }
.u-hp { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.u-ac { font-size: 12px; font-weight: 800; background: #1e1f30; border: 2px solid #fff6; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.u-circle { width: var(--size, 90px); height: var(--size, 90px); border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: calc(var(--size, 90px) * .5); font-weight: 800; border: 4px solid #fff; box-shadow: 0 0 24px #0008; background: #5865f2; }
.dg-unit.foe .u-circle { background: #b0283c; border-color: #ffb3bd; }
.dg-unit.pc .u-circle { border-color: #00e5ff; }
.u-circle img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.dg-unit.turn .u-circle { box-shadow: 0 0 0 4px #ffd65a, 0 0 30px #ffd65a; animation: dgturn 1s ease-in-out infinite alternate; }
@keyframes dgturn { to { transform: scale(1.08); } }
.dg-unit.dead { filter: grayscale(1) brightness(.5); }
/* a hovering boss's afterimages (web/app.js dgFloat): copies of its portrait under it, placed and moved by script */
.dg-unit.floating .u-circle:not(.u-ghost) { z-index: 1; }
.dg-unit .u-circle.u-ghost { position: absolute; z-index: 0; margin: 0; pointer-events: none; animation: none; box-shadow: none; transform: none; }
.dg-unit .u-circle.u-ghost::after { content: none; }
.dg-unit.foe .u-circle.u-knight { background: #000; border-color: #fff; }   /* the Roaring Knight: black, white outline, his mark */
.u-circle.u-knight .u-mark { width: 100%; height: 100%; display: block; }
/* statuses and resources: a Limbus-style row of icons under the unit (absolute, so the unit's centre doesn't move) */
.u-st { --st: clamp(22px, calc(var(--size, 90px) * .3), 32px); position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: calc(var(--size, 90px) * 2.6); display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 4px; pointer-events: auto; }
.u-sti:has(.st-pot) { margin-left: calc(var(--st) * .5); }   /* room for the potency on its left */
.u-sti:has(.st-cnt) { margin-right: calc(var(--st) * .45); }   /* and the count on its right */
.u-st:empty { display: none; }
.u-sti { position: relative; width: var(--st); height: var(--st); flex: none; cursor: help; }
.u-sti.new { animation: stpop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes stpop { from { transform: scale(.2); opacity: 0; } }
.st-face { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 0 2px #000) drop-shadow(0 1px 3px #000c); }
.st-face img { width: 100%; height: 100%; object-fit: contain; display: block; }
.st-ini { font-size: calc(var(--st) * .5); font-weight: 900; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; line-height: 1; white-space: nowrap; }   /* no icon: just its initials */
.st-pot, .st-cnt { position: absolute; font-style: normal; line-height: 1; pointer-events: none; -webkit-text-stroke: 3px #000; paint-order: stroke fill; }
.st-pot, .st-cnt { bottom: -6px; font-size: calc(var(--st) * .55); font-weight: 900; color: #fff; }
@font-face { font-family: "Excelsior Sans"; src: url("ExcelsiorSans.ttf") format("truetype"); font-display: swap; }
.dg-unit .st-pot, .dg-unit .st-cnt { font-family: "Excelsior Sans", "Bahnschrift", sans-serif; font-weight: 400; font-size: calc(var(--st) * .72); }
.st-pot { right: calc(100% - 4px); }
.st-cnt { left: calc(100% - 4px); }
.dg-bottom { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 8px; padding: 0 20px 16px; max-height: 38vh; }
.dg-feed { overflow-y: auto; max-height: 28vh; background: #0b0d14d9; border-radius: 8px; padding: 4px 8px; text-align: left; }
.dg.split .dg-bottom { max-height: none; }
.dg.split .dg-feed { height: var(--feed-h); max-height: none; }
/* the drag bar between the fight and the log */
.dg-split { position: relative; z-index: 4; flex: none; height: 12px; margin: -2px 0 2px; cursor: ns-resize; touch-action: none; }
.dg-split::before { content: ""; position: absolute; left: 50%; top: 4px; width: 56px; height: 4px; margin-left: -28px; border-radius: 2px; background: #ffffff40; transition: background .15s, width .15s, margin .15s; }
.dg-split:hover::before, .dg-split.drag::before { background: #5865f2; width: 96px; margin-left: -48px; }
.dg-feed .e-image, .dg-feed .attachments { display: none; }
.dg-feed .embed { max-width: 100%; }
.dg-cmd { display: flex; gap: 8px; }
.dg-cmd input { flex: 1; background: #1e1f22; border: 1px solid #3a3c43; border-radius: 6px; color: #fff; padding: 11px 14px; font-size: 15px; outline: none; font-family: inherit; }
.dg-cmd input:focus { border-color: #5865f2; }

/* ---- Persona-style turn menu */
.u-mrow[hidden] { display: none; }
.u-mrow { margin-top: -1px; }
.u-mbar { height: 14px; }
.u-mfill { position: absolute; inset: 0 auto 0 0; background: #3b82ff; transition: width .5s ease; }
.u-mtag { color: #8fb4ff; }
.dg-unit.picked .u-circle { box-shadow: 0 0 0 5px #ff1d2d, 0 0 34px #ff1d2d; }
.dg-unit.picked::after { content: "◎"; position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); font-size: calc(var(--size, 90px) * 1.3); color: #ff1d2daa; pointer-events: none; animation: dgturn .6s ease-in-out infinite alternate; }
.dg-unit.aim .u-circle { box-shadow: 0 0 0 5px #fff, 0 0 40px #ff1d2d; transform: scale(1.12); }
.p5-menu { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.p5-menu > * { pointer-events: auto; }
.p5-btn { position: absolute; transform: translate(0, -50%) rotate(var(--rot, 0deg)) skewX(-14deg); background: #000; color: #fff; border: 0; padding: 12px 36px 12px 30px; cursor: pointer; font: italic 900 26px/1 Impact, "Arial Black", sans-serif; letter-spacing: 1px; text-transform: uppercase; box-shadow: -8px 7px 0 #e8142b; animation: p5in .35s cubic-bezier(.2,1.4,.4,1) both; white-space: nowrap; transition: background .12s, color .12s; }
.p5-btn span { display: inline-block; transform: skewX(14deg); }
.p5-btn:hover { background: #fff; color: #000; box-shadow: -8px 7px 0 #e8142b, 0 0 0 3px #000; }
@keyframes p5in { from { opacity: 0; transform: translate(-90px, -50%) rotate(var(--rot, 0deg)) skewX(-14deg) scale(.4); } }
.p5-res { position: absolute; transform: skewX(-14deg); background: #e8142b; color: #fff; padding: 3px 14px; font: italic 800 14px Impact, "Arial Black", sans-serif; letter-spacing: .5px; }
.p5-list { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) skewX(-4deg); width: min(440px, 62%); max-height: 78%; display: flex; flex-direction: column; background: #000; color: #fff; border-left: 10px solid #e8142b; box-shadow: 10px 10px 0 #e8142b99, 0 0 40px #000; z-index: 6; transition: opacity .15s; }
.p5-list.dragging { opacity: .45; }
.p5-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; background: #e8142b; font: italic 900 24px Impact, "Arial Black", sans-serif; letter-spacing: 1px; }
.p5-x { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
.p5-hint { padding: 6px 18px; font-size: 12px; color: #aaa; font-style: italic; }
.p5-body { overflow-y: auto; padding: 4px 0 10px; }
.p5-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 18px; font: italic 800 18px Impact, "Arial Black", sans-serif; letter-spacing: .5px; text-transform: uppercase; cursor: grab; user-select: none; touch-action: none; border-bottom: 1px solid #ffffff18; }
.p5-item:hover { background: #fff; color: #000; }
.p5-item.sub { padding-left: 34px; font-size: 15px; color: #ffb3bb; }
.p5-item.poor { opacity: .4; }
.p5-item .tg { font: 700 11px var(--font); background: #e8142b; color: #fff; padding: 2px 7px; letter-spacing: .5px; font-style: normal; white-space: nowrap; }
.p5-pend { position: absolute; left: 50%; top: 10px; transform: translateX(-50%) skewX(-8deg); display: flex; gap: 10px; align-items: stretch; z-index: 7; }
.p5-chip { background: #000; color: #fff; border-left: 8px solid #e8142b; padding: 8px 22px; cursor: grab; display: flex; flex-direction: column; box-shadow: 6px 6px 0 #e8142b; touch-action: none; user-select: none; }
.p5-chip b { font: italic 900 22px Impact, "Arial Black", sans-serif; text-transform: uppercase; }
.p5-chip span { font-size: 12px; color: #ccc; font-style: italic; }
.p5-go, .p5-no { border: 0; padding: 0 26px; font: italic 900 20px Impact, "Arial Black", sans-serif; letter-spacing: 1px; cursor: pointer; box-shadow: 5px 5px 0 #000; }
.p5-go { background: #fff; color: #000; } .p5-go:hover:not(:disabled) { background: #e8142b; color: #fff; } .p5-go:disabled { opacity: .35; cursor: not-allowed; }
.p5-no { background: #e8142b; color: #fff; } .p5-no:hover { background: #000; }
.p5-drag { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 900; }
.p5-line { fill: none; stroke: #e8142b; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 12; filter: drop-shadow(0 0 6px #e8142b); }
.p5-ghost { position: fixed; z-index: 901; transform: translate(-50%, -120%) skewX(-12deg); background: #fff; color: #000; padding: 6px 16px; font: italic 900 18px Impact, "Arial Black", sans-serif; text-transform: uppercase; pointer-events: none; box-shadow: 4px 4px 0 #e8142b; }

/* ---- turn menu, restyled to match Discord's own components (overrides the block above) */
.p5-btn { transform: translate(0, -50%); background: #5865f2; color: #fff; border-radius: 4px; padding: 10px 20px; font: 500 15px/1.2 var(--font); letter-spacing: 0; text-transform: none; box-shadow: 0 2px 6px #0006; animation: p5in .25s ease-out both; }
.p5-btn span { transform: none; }
.p5-btn:hover { background: #4752c4; color: #fff; box-shadow: 0 2px 8px #0008; }
.p5-btn.p5-end { background: #4e5058; } .p5-btn.p5-end:hover { background: #6d6f78; }
.p5-btn { --rot: 0deg; }
@keyframes p5in { from { opacity: 0; transform: translate(-24px, -50%) scale(.9); } }
.p5-res { transform: none; background: #1e1f22; color: #b5bac1; border-radius: 4px; padding: 3px 10px; font: 500 12px var(--font); letter-spacing: 0; }
.p5-list { transform: translate(-50%, -50%); width: min(420px, 70%); background: #2b2d31; border: 1px solid #1e1f22; border-left: 0; border-radius: 8px; box-shadow: 0 8px 16px #0008; overflow: hidden; }
.p5-head { background: #1e1f22; padding: 12px 16px; font: 700 12px var(--font); letter-spacing: .5px; color: #b5bac1; text-transform: uppercase; }
.p5-x { color: #b5bac1; } .p5-x:hover { color: #fff; }
.p5-hint { padding: 8px 16px 4px; font-size: 12px; color: #949ba4; font-style: normal; }
.p5-body { padding: 4px 8px 8px; }
.p5-item { font: 500 15px var(--font); letter-spacing: 0; text-transform: none; padding: 8px 10px; border: 0; border-radius: 4px; color: #dbdee1; margin: 1px 0; }
.p5-item:hover { background: #404249; color: #fff; }
.p5-item.sub { color: #b5bac1; font-size: 14px; padding-left: 26px; }
.p5-item .tg { background: #1e1f22; color: #b5bac1; border-radius: 3px; font: 600 11px var(--font); padding: 2px 6px; }
.p5-pend { transform: translateX(-50%); gap: 8px; align-items: center; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 8px; padding: 8px 10px; box-shadow: 0 8px 16px #0008; }
.p5-chip { background: #1e1f22; border: 0; border-left: 4px solid #5865f2; border-radius: 4px; box-shadow: none; padding: 6px 14px; }
.p5-chip b { font: 600 15px var(--font); text-transform: none; color: #fff; }
.p5-chip span { color: #b5bac1; font-style: normal; font-size: 12px; }
.p5-go, .p5-no { box-shadow: none; border-radius: 4px; padding: 9px 18px; font: 500 14px var(--font); letter-spacing: 0; }
.p5-go { background: #248046; color: #fff; } .p5-go:hover:not(:disabled) { background: #1a6334; color: #fff; }
.p5-no { background: #4e5058; color: #fff; } .p5-no:hover { background: #6d6f78; }
.p5-rep { display: flex; align-items: center; align-self: stretch; background: #1e1f22; border-radius: 4px; padding: 0 4px 0 10px; gap: 2px; }
.p5-rep-k { color: #b5bac1; font: 600 12px var(--font); margin-right: 6px; text-transform: uppercase; letter-spacing: .3px; }
.p5-rep-b { width: 24px; height: 24px; border: 0; border-radius: 4px; background: none; color: #b5bac1; font: 600 16px/1 var(--font); cursor: pointer; }
.p5-rep-b:hover { background: #404249; color: #fff; }
.p5-rep-n { width: 34px; height: 26px; border: 0; border-radius: 4px; background: #2b2d31; color: #fff; font: 600 14px var(--font); text-align: center; -moz-appearance: textfield; }
.p5-rep-n::-webkit-inner-spin-button, .p5-rep-n::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.p5-rep-n:focus { outline: 2px solid #5865f2; outline-offset: -2px; }
.p5-line { stroke: #5865f2; stroke-width: 4; filter: none; }
/* aiming: the list gets out of the way, the drag ends in an arrowhead that snaps onto targets */
/* while dragging, the list slides down out of the way (just its header peeks in) and comes back on release */
.p5-list { transition: top .28s cubic-bezier(.3,.8,.3,1), transform .28s cubic-bezier(.3,.8,.3,1), opacity .2s; }
.p5-list.dragging { top: 100%; transform: translate(-50%, -46px); opacity: .9; pointer-events: none; }
body.dg-aiming, body.dg-aiming * { cursor: crosshair !important; }
.p5-drag .p5-line { stroke-dasharray: 3 10; transition: stroke .12s; }
.p5-head { fill: #5865f2; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; transition: fill .12s; filter: drop-shadow(0 0 4px #0009); }
.p5-drag.lock .p5-line { stroke: #fff; }
.p5-drag.lock .p5-head { fill: #fff; stroke: #5865f2; }
.p5-ghost { transform: translate(-50%, -130%); background: #5865f2; color: #fff; border-radius: 4px; font: 600 14px var(--font); text-transform: none; box-shadow: 0 4px 12px #0008; }
.dg-unit.picked .u-circle { box-shadow: 0 0 0 4px #5865f2, 0 0 28px #5865f2; }
/* target lock: one ring closes in on the portrait when it's first picked, then stays put */
.dg-unit.picked::after { content: none; }
.dg-unit .u-circle { position: relative; overflow: visible; }   /* the portrait is round by itself; the ring hangs off it */
.dg-unit.picked .u-circle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 132%; height: 132%; box-sizing: border-box;
  border: 3px solid #8f98ff; border-radius: 50%; box-shadow: 0 0 14px #5865f2, inset 0 0 10px #5865f288; transform: translate(-50%, -50%); pointer-events: none; animation: dglock .32s cubic-bezier(.2,.8,.25,1) both; }
@keyframes dglock { from { transform: translate(-50%, -50%) scale(2.3); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.dg-unit.aim .u-circle { box-shadow: 0 0 0 4px #fff, 0 0 32px #5865f2; }

.dg-fx{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:30}
.dg-unit{will-change:translate}


.dg-unit{will-change:auto !important}
.dg-fx{contain:strict}

/* ---- Honkai: Star Rail style damage numbers + TOTAL DAMAGE counter */
.dmg-pop, .dmg-total { --hsr: "Bahnschrift", "DIN Condensed", "DIN Alternate", "Arial Narrow", sans-serif; }
.dmg-pop { position: absolute; z-index: 31; pointer-events: none; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; line-height: .82; white-space: nowrap; animation: dmgpop 1.5s cubic-bezier(.2,.8,.3,1) forwards; filter: drop-shadow(0 2px 1px #000a) drop-shadow(0 0 8px #0007); --c: #e6e9ee; --c2: #a3aab4; }
/* tall, upright, tightly packed digits */
.dmg-num, .dmg-ctag { position: relative; display: inline-block; font-family: var(--hsr); font-weight: 700; font-stretch: condensed; transform: scaleX(.8); transform-origin: center; -webkit-text-stroke: 1px #0000004d; }
/* normal hits: smaller, one plain colour */
.dmg-num { font-size: 40px; letter-spacing: -1px; color: var(--c); }
/* crits: big, "CRIT Hit" over the number, pure white first, then the element gradient */
.dmg-pop.crit .dmg-num { font-size: 84px; letter-spacing: -2px; background: linear-gradient(180deg, #fff 0%, #fff 42%, var(--c) 78%, var(--c2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dmg-pop.crit .dmg-num::after { content: attr(data-v); position: absolute; inset: 0; color: #fff; -webkit-text-stroke: 1px #0000004d; animation: dmgwhite .5s ease-in .15s both; }
.dmg-ctag { font-size: 36px; letter-spacing: -.5px; color: var(--c); margin-bottom: 2px; animation: dmgtag .5s ease-in .15s both; }
@keyframes dmgwhite { from { opacity: 1; } to { opacity: 0; } }
@keyframes dmgtag { from { color: #fff; } }
/* the number's row; a status number (Rupture) has its little icon on the left */
/* the icon hangs off the number's left edge, so the number itself stays centred like any other */
.dmg-line { position: relative; display: inline-flex; align-items: center; }
.dmg-ico { position: absolute; right: calc(90% + 2px); top: 50%; transform: translateY(-50%); width: 30px; height: 30px; object-fit: contain; }
.dmg-pop.crit .dmg-ico { width: 52px; height: 52px; }
.dmg-ini { display: flex; align-items: center; justify-content: flex-end; width: auto !important; height: auto !important; margin-right: 4px; }   /* no icon: just its initials */
.dmg-ini > span { font: 900 16px/1 sans-serif; color: #fff; -webkit-text-stroke: 3px #000; paint-order: stroke fill; letter-spacing: 0; white-space: nowrap; }
.dmg-pop.crit .dmg-ini > span { font-size: 24px; }
.dmg-pop.el-physical { --c: #e6e9ee; --c2: #a3aab4; }
.dmg-pop.el-fire { --c: #ff7a4a; --c2: #e0322a; }
.dmg-pop.el-ice { --c: #7fdcff; --c2: #3a9be6; }
.dmg-pop.el-lightning { --c: #d88cff; --c2: #9a4fe0; }
.dmg-pop.el-wind { --c: #63e8b0; --c2: #22b07a; }
.dmg-pop.el-quantum { --c: #9a90ff; --c2: #5a4fe0; }
.dmg-pop.el-imaginary { --c: #ffe36b; --c2: #e8ac1c; }
.dmg-pop.heal { --c: #74f59a; --c2: #2cc466; }
.dmg-pop.miss { --c: #d7dbe2; }
.dmg-pop.miss .dmg-num { font-size: 38px; letter-spacing: 1px; }
.dmg-pop.parried { --c: #ff4d5e; }
.dmg-pop.parried .dmg-num { font-size: 50px; letter-spacing: 1px; }
@keyframes dmgpop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.7); }
  6% { opacity: 1; transform: translate(-50%, -50%) scale(.94); }
  12% { transform: translate(-50%, -50%) scale(1.03); }
  18% { transform: translate(-50%, -50%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, calc(-50% - 10px)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 26px)) scale(.97); }
}
/* TOTAL DAMAGE: top right, white caps label over a gold number with a gold streak behind it */
.dmg-total { position: absolute; right: 2.5%; top: 4%; z-index: 32; pointer-events: none; display: flex; flex-direction: column; align-items: flex-end; animation: dmgtin .3s cubic-bezier(.2,.9,.3,1) both; transition: opacity .4s, transform .4s; filter: drop-shadow(0 2px 1px #000b) drop-shadow(0 0 8px #0008); }
.dmg-total.out { opacity: 0; transform: translateX(24px); }
.dmg-tlabel { font: 700 17px var(--hsr); font-stretch: condensed; letter-spacing: .5px; text-transform: uppercase; color: #fff; display: flex; align-items: center; gap: 7px; }
.dmg-tlabel::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: linear-gradient(90deg, #fff 50%, transparent 50%); }
.dmg-tnum { position: relative; font: 700 56px/1 var(--hsr); font-stretch: condensed; letter-spacing: -1px; transform: scaleX(.82); transform-origin: right center; background: linear-gradient(180deg, #fff6d6 10%, #f7d774 55%, #d9a531 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 1px #0000004d; }
.dmg-tnum.bump { animation: dmgbump .22s ease-out; }
@keyframes dmgtin { from { opacity: 0; transform: translateX(30px); } }
@keyframes dmgbump { 0% { transform: scaleX(.82) scale(1.15); } 100% { transform: scaleX(.82); } }


/* ---- attack effect sprites: one layer over the stage, each sprite placed by its own transform */
/* status auras (AURAS in app.js): on the portrait's centre, sized off it, glowing over it (each sets its own transform) */
.u-aura{position:absolute;left:50%;top:50%;pointer-events:none;z-index:2;mix-blend-mode:screen;transition:opacity .4s}
.u-aura.out{opacity:0}
.dg-clone .u-aura{display:none}
.dg-fxl{position:absolute;inset:0;pointer-events:none;z-index:30;overflow:visible}   /* (no map edge: effects draw wherever the camera shows; .dg clips at the window) */
.dg-fxs{position:absolute;left:0;top:0;pointer-events:none}
.dg-clone{position:absolute!important;left:0;top:0;pointer-events:none;box-shadow:none!important;animation:none!important;margin:0}
.dg-fxt{position:absolute;inset:0;pointer-events:none}
.dg-flash{position:absolute;inset:0;pointer-events:none;z-index:60;opacity:0}

/* ---- fight HUD: a condensed game font, and AC / MP as plain labels instead of boxes */
/* "undertale deltarune extended (Fixed)" by Viika, FontStruct non-commercial licence: see font_undertale_license.txt */
@font-face { font-family: "UTDR"; src: url("font_undertale.otf") format("opentype"); font-display: swap; }
.dg { --hud: "UTDR", "Bahnschrift", "Arial Narrow", sans-serif; }
.dg-unit, .p5-btn, .p5-res, .dg-roll, .dg-toast { font-synthesis: none; }   /* a pixel font: no fake bold */
.dg-unit *, .p5-btn, .p5-res, .dg-roll *, .dg-toast { letter-spacing: 0 !important; }   /* it brings its own spacing */
.u-name { font: 700 19px/1.1 var(--hud); letter-spacing: .6px; }
.u-hp { font: 600 14px var(--hud); letter-spacing: .5px; }
.u-ac, .u-ac.u-mtag { background: none; border: 0; border-radius: 0; padding: 0; font: 700 16px var(--hud); letter-spacing: .8px; color: #e8ecf2; text-shadow: 0 1px 2px #000, 0 0 6px #000a; }
.u-ac.u-mtag { color: #8fb4ff; }
.p5-btn { font: 600 17px/1.1 var(--hud); letter-spacing: 1px; text-transform: uppercase; padding: 9px 22px; }
.p5-res { font: 600 13px var(--hud); letter-spacing: .6px; }

/* ---- the to-hit die that rolls over the target before a strike */
.dg-roll { position: absolute; z-index: 33; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; font-family: var(--hud); animation: rollin .18s ease-out both; filter: drop-shadow(0 3px 6px #000c); }
.dg-roll.small { scale: .8; }
.dg-roll .die { width: 54px; height: 54px; display: grid; place-items: center; background: linear-gradient(160deg, #3a3f63, #1b1e33); clip-path: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%); position: relative; transition: transform .2s; }
.dg-roll .die::before { content: ""; position: absolute; inset: 3px; clip-path: inherit; background: linear-gradient(160deg, #4b5287, #252a47); }
.dg-roll .die-n { position: relative; font-weight: 700; font-size: 24px; color: #fff; }
.dg-roll.landed .die { animation: rollland .25s ease-out; }
.dg-roll.hit .die::before { background: linear-gradient(160deg, #3f7bd8, #1d3f86); }
.dg-roll.crit .die::before, .dg-roll.nat20 .die::before { background: linear-gradient(160deg, #ffd34d, #c98a12); }
.dg-roll.crit .die-n { color: #2a1900; }
.dg-roll.miss .die::before { background: linear-gradient(160deg, #5a5d6b, #2c2e38); }
.dg-roll .roll-line { font-weight: 600; font-size: 15px; color: #e6e9f0; white-space: nowrap; text-shadow: 0 1px 2px #000; min-height: 1em; }
.dg-roll .roll-res { font-weight: 700; font-size: 18px; letter-spacing: 1.5px; min-height: 1em; text-shadow: 0 1px 2px #000; }
.dg-roll.hit .roll-res { color: #7fd0ff; } .dg-roll.crit .roll-res { color: #ffd34d; } .dg-roll.miss .roll-res { color: #a9adb8; }
@keyframes rollin { from { opacity: 0; transform: translate(-50%, -80%) scale(.6); } }
@keyframes rollland { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---- bottom-right battle feed: "Shorekeeper used Oracle Device", defeats, whose turn it is */
.dg-toasts { position: absolute; right: 18px; bottom: 14px; z-index: 34; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; max-width: min(420px, 60%); }
.dg-toast { font: 600 15px/1.25 var(--hud); letter-spacing: .3px; color: #d6dae3; background: #0d0f1ccc; border-left: 3px solid #00e5ff; padding: 6px 14px 6px 12px; border-radius: 2px 6px 6px 2px; box-shadow: 0 4px 14px #0007; backdrop-filter: blur(4px); animation: toastin .25s cubic-bezier(.2,.9,.3,1) both; transition: opacity .35s, transform .35s; }
.dg-toast b { color: #fff; font-weight: 700; }
.dg-toast.foe { border-left-color: #ff4d64; }
.dg-toast.down { border-left-color: #8a8f9c; color: #b9bdc7; }
.dg-toast.turn { background: #0d0f1ce6; }
.dg-toast.turn.pc { border-left-color: #ffd65a; }
.dg-toast.out { opacity: 0; transform: translateX(20px); }
.dg-toast.win { border-left-color: #ffd65a; color: #ffe9a8; font-size: 18px; }
.dg-toast.loot { border-left-color: #ffd65a; color: #f3eedf; }
@keyframes toastin { from { opacity: 0; transform: translateX(30px); } }

/* dialogue blocks (the animation editor's "+ Dialogue"): a line spoken over a character, in Liberation Sans */
@font-face { font-family: "Liberation Sans"; src: url(fonts/LiberationSans-Regular.ttf) format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url(fonts/LiberationSans-Bold.ttf) format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url(fonts/LiberationSans-Italic.ttf) format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Liberation Sans"; src: url(fonts/LiberationSans-BoldItalic.ttf) format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
.fx-say { position: absolute; left: 0; top: 0; z-index: 60; pointer-events: none; transform-origin: 50% 100%; width: max-content; max-width: 340px;
  font-family: "Liberation Sans", Arial, sans-serif; font-size: 17px; line-height: 1.25; font-weight: 400; color: #ffcb97; text-align: center;
  white-space: pre-wrap; overflow-wrap: anywhere; letter-spacing: .01em; }
.fx-say.outline { text-shadow: 0 0 2px rgba(0,0,0,.95), 0 1px 3px rgba(0,0,0,.9), 0 0 9px rgba(0,0,0,.65); }   /* the "Text border" toggle */
/* the soft dark haze behind the line, fading out at its edges (as in the game) */
.fx-say { isolation: isolate; }
.fx-say::before { content: ""; position: absolute; inset: -46px -120px -40px; z-index: -1; border-radius: 50%; filter: blur(12px);
  background: radial-gradient(ellipse closest-side, rgba(0,0,0,.6) 0%, rgba(0,0,0,.5) 30%, rgba(0,0,0,.3) 60%, rgba(0,0,0,.1) 85%, rgba(0,0,0,0) 100%); }
.fx-say b { font-weight: 700; }
.fx-say i { font-style: italic; }

/* Profile panel: `profile` shown privately in a popup */
.pv-back { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pv { width: min(720px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--bg-primary, #313338); border-radius: 10px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-floating, #111214); border-bottom: 1px solid var(--divider, #3f4147); flex-wrap: wrap; }
.pv-title { font-weight: 700; color: var(--header-primary, #f2f3f5); }
.pv-tabs { display: flex; gap: 4px; flex: 1; }
.pv-tab { background: transparent; border: 0; color: var(--text-muted, #b5bac1); padding: 5px 10px; border-radius: 4px; cursor: pointer; font: inherit; }
.pv-tab:hover { background: rgba(255,255,255,.06); color: #dbdee1; }
.pv-tab.on { background: rgba(255,255,255,.1); color: #fff; }
.pv-x { background: transparent; border: 0; color: var(--text-muted, #b5bac1); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.pv-x:hover { color: #fff; background: rgba(255,255,255,.08); }
.pv-body { overflow-y: auto; padding: 8px 0 14px; }
.pv-body .toolbar, .pv-body .eph-note, .pv-body .divider { display: none; }
.pv-body .msg.ephemeral { background: transparent; }
.pv-wait { padding: 30px; text-align: center; color: var(--text-muted, #b5bac1); }

/* Profile panel: Inventory tab */
.pv.wide { width: min(980px, 100%); }
.inv { display: flex; gap: 18px; padding: 6px 16px 4px; align-items: stretch; min-height: 440px; }
.inv.busy { cursor: progress; }
.inv h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #b5bac1); }
.inv-left { flex: none; width: 330px; display: flex; flex-direction: column; }
.inv-eq { background: var(--bg-secondary, #2b2d31); border: 1px solid var(--divider, #3f4147); border-radius: 10px; padding: 22px 16px 26px; display: flex; flex-direction: column; gap: 22px; }
.inv-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; justify-items: center; }
.inv-hint { margin: 10px 2px 0; font-size: 12px; color: var(--text-muted, #949ba4); }
.inv-slot { width: 88px; height: 88px; border-radius: 8px; border: 2px dashed #4e5058; display: flex; align-items: center; justify-content: center; position: relative; transition: border-color .12s, background .12s; }
.inv-row.big .inv-slot { width: 92px; height: 92px; }
.inv-slot.full { border-style: solid; border-color: transparent; }
.inv-slot-label { color: #80848e; font-size: 12px; text-align: center; padding: 4px; }
.inv-row.acc .inv-slot-label { font-size: 22px; font-weight: 700; color: #5c5f66; }
.inv-slot.locked { background: repeating-linear-gradient(45deg, #232428, #232428 6px, #1e1f22 6px, #1e1f22 12px); border-color: #3a3c41; opacity: .55; cursor: not-allowed; }
.inv-slot.locked .inv-slot-label { font-size: 18px; }
.inv-slot.can { border-color: #5865f2; background: rgba(88,101,242,.1); }
.inv-slot.over { border-color: #23a55a; border-style: solid; background: rgba(35,165,90,.18); }
.inv-right { flex: 1; min-width: 0; display: flex; flex-direction: column; border-radius: 10px; padding: 0; transition: background .12s, box-shadow .12s; }
.inv-right.can { box-shadow: inset 0 0 0 2px rgba(88,101,242,.5); }
.inv-right.over { background: rgba(35,165,90,.08); box-shadow: inset 0 0 0 2px #23a55a; }
.inv-top { display: flex; gap: 8px; margin-bottom: 10px; }
.inv-view { display: flex; gap: 4px; align-self: flex-start; margin: -4px 0 8px; padding: 3px; background: var(--bg-tertiary, #1e1f22); border-radius: 8px; }
.inv-view-btn { border: 0; background: none; color: var(--text-muted, #b5bac1); font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.inv-view-btn:hover:not(:disabled) { color: #dbdee1; background: #2e3035; }
.inv-view-btn.on { background: #5865f2; color: #fff; }
.inv-view-btn:disabled { opacity: .4; cursor: not-allowed; }
.inv-grid.mats .inv-card { cursor: default; }
.inv-view-n { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 8px; background: rgba(0,0,0,.25); }
.inv-search { flex: 1; min-width: 0; background: var(--bg-tertiary, #1e1f22); border: 1px solid transparent; border-radius: 6px; color: #dbdee1; padding: 7px 10px; font: inherit; }
.inv-search:focus { outline: none; border-color: #5865f2; }
.inv-sort { flex: none; width: 36px; background: var(--bg-tertiary, #1e1f22); border: 0; border-radius: 6px; cursor: pointer; font-size: 16px; }
.inv-sort:hover { background: #2e3035; }
.inv-grid { flex: 1; min-height: 360px; max-height: 62vh; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, 88px); gap: 16px 12px; align-content: start; padding: 6px 4px 14px; justify-content: start; }
.inv-grid .pv-wait { grid-column: 1 / -1; }
/* one item: a square, rarity icon top-left, name in the middle, reforge as a tab along the bottom */
.inv-card { --rc: #9aa0a6; width: 88px; height: 88px; position: relative; border-radius: 8px; background: linear-gradient(160deg, #3a3c43, #26272b); border: 2px solid var(--rc);
  box-shadow: 0 0 10px -4px var(--rc); display: flex; align-items: center; justify-content: center; padding: 6px 6px 8px; box-sizing: border-box; cursor: grab; user-select: none; }
.inv-row.big .inv-card { width: 92px; height: 92px; }
.inv-card.dragging { opacity: .4; }
.inv-card.dim { filter: grayscale(1); opacity: .38; cursor: default; }
.inv-card.r-uncommon { --rc: #3fb950; } .inv-card.r-rare { --rc: #4c8dff; } .inv-card.r-very-rare { --rc: #a970ff; } .inv-card.r-legendary { --rc: #f0a020; } .inv-card.r-mythical { --rc: #ff1f1f; }
.inv-rar { position: absolute; left: -7px; top: -7px; width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.8)); pointer-events: none; }
.inv-rar img { width: 100%; height: 100%; }
.inv-rar.sm { width: 15px; height: 15px; left: -6px; top: -6px; }
.inv-name { font-size: 12px; line-height: 1.25; font-weight: 600; color: #f2f3f5; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; word-break: break-word; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.inv-card:has(.inv-rf) .inv-name { margin-bottom: 10px; }
.inv-count { position: absolute; right: 4px; top: 2px; font-size: 11px; font-weight: 700; color: #dbdee1; text-shadow: 0 1px 2px #000; }
.inv-rf { position: absolute; left: 6px; right: 6px; bottom: -9px; height: 19px; background: #1e1f22; border: 1px solid #6d6f78; border-radius: 4px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.inv-rf-name { font-size: 10px; color: #dbdee1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .inv { flex-direction: column; }
  .inv-left { width: auto; }
  .inv-grid { max-height: none; min-height: 200px; }
}

/* Inventory hover card: an item's whole $dict page, following the mouse */
.inv-tip { position: fixed; left: 0; top: 0; z-index: 1000; width: 380px; max-width: calc(100vw - 16px); pointer-events: none;
  background: #111214; border: 1px solid #3f4147; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: invTipIn .12s ease-out; }
.inv-tip-in { max-height: min(60vh, 520px); overflow-y: auto; padding: 12px 14px; }
.inv-tip-title { font-weight: 700; font-size: 15px; color: #f2f3f5; margin-bottom: 6px; }
.inv-tip-text { font-size: 13px; line-height: 1.4; color: #dbdee1; white-space: pre-wrap; overflow-wrap: anywhere; }
.inv-tip-img { display: block; max-width: 100%; margin-top: 10px; border-radius: 6px; }
.inv-tip-wait { color: #b5bac1; font-size: 13px; }
@keyframes invTipIn { from { opacity: 0; } to { opacity: 1; } }

/* fight menu: hovering one button greys the others out and slides them left */
.p5-btn { transition: background .12s, color .12s, translate .22s cubic-bezier(.3,0,.2,1), filter .22s, opacity .22s; }
.p5-menu:has(.p5-btn:hover) .p5-btn:not(:hover) { translate: -16px 0; filter: grayscale(1) brightness(.7); opacity: .55; }
@media (prefers-reduced-motion: reduce) { .p5-menu:has(.p5-btn:hover) .p5-btn:not(:hover) { translate: none; } }

/* action order, top left of the arena */
.ao { position: absolute; left: 12px; top: 10px; z-index: 6; pointer-events: none; display: flex; flex-direction: column; gap: 6px; padding-left: 20px; font-family: var(--hud); }
.ao::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(#ffffff70, #ffffff30 70%, transparent); }
.ao-it { position: relative; width: 104px; height: 42px; flex: none; border-radius: 3px 10px 3px 3px; clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%, 0 9px);
  background: linear-gradient(100deg, #1d2236 0%, #2a3150 100%); box-shadow: inset 0 0 0 1px #ffffff2e; overflow: hidden; }
.ao-it::before { content: ""; position: absolute; left: -14px; top: 50%; width: 10px; height: 2px; background: #ffffff55; }   /* tick to the line */
.ao-it.foe { background: linear-gradient(100deg, #2a1218 0%, #4a1b26 100%); }
.ao-it::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #00e5ff; }
.ao-it.foe::after { background: #ff3b55; }
.ao-pic { position: absolute; right: 0; top: 0; bottom: 0; width: 80%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #ffffffd0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 38%); mask-image: linear-gradient(90deg, transparent 0, #000 38%); }
.ao-it.foe .ao-pic { color: #ffb3bd; }
.ao-pic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.ao-n { position: absolute; right: 0; bottom: 0; min-width: 24px; padding: 1px 5px 0; background: #000000d9; color: #fff; font-size: 15px; line-height: 17px; text-align: right; border-top-left-radius: 3px; }
.ao-n:empty { display: none; }
/* the one acting now: bigger, bright edge, a diamond on the line */
.ao-it.cur { width: 128px; height: 56px; margin-bottom: 4px; box-shadow: inset 0 0 0 2px #7ff3ff, 0 0 14px #00e5ff66; background: linear-gradient(100deg, #1b3a52 0%, #2c5d7a 100%); }
.ao-it.cur.foe { box-shadow: inset 0 0 0 2px #ff8a9a, 0 0 14px #ff3b5566; background: linear-gradient(100deg, #4a1520 0%, #7a2433 100%); }
.ao-it.cur::before { display: none; }
.ao-it.cur .ao-pic { width: 86%; }
.ao:has(.ao-it.cur) .ao-it.cur { clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); }
.ao-cur-mark, .ao::after { content: ""; position: absolute; left: 1px; top: 23px; width: 10px; height: 10px; rotate: 45deg; background: #7ff3ff; box-shadow: 0 0 8px #00e5ff, 0 0 0 2px #0b1a2a; }
/* the round's end: a thin bar with an hourglass */
.ao-it.end { height: 24px; width: 92px; display: flex; align-items: center; gap: 7px; padding: 0 8px; box-sizing: border-box; color: #ffd98a; clip-path: none; border-radius: 3px;
  background: linear-gradient(90deg, #3a2a10e6, #1a1408cc); box-shadow: inset 0 0 0 1px #ffd98a55; }
.ao-it.end::after { display: none; }
.ao-it.end .ao-hg { display: flex; }
.ao-it.end .ao-sep { width: 1px; height: 14px; background: #ffd98a88; }
.ao-it.end .ao-n { position: static; background: none; padding: 0; font-size: 14px; color: #ffe7b3; min-width: 0; }
.ao-it.gone { position: absolute; left: 20px; margin: 0; }
@media (max-width: 720px) { .ao { transform: scale(.78); transform-origin: 0 0; } }

/* turn order: the tuck tab, the tucked look, and fading back while animations play */
.ao { transition: translate .35s cubic-bezier(.3,0,.2,1), opacity .3s; }
.ao-tab { position: absolute; left: calc(100% + 8px); top: 50%; translate: 0 -50%; pointer-events: auto; width: 22px; height: 46px; padding: 0; border: 0; border-radius: 4px;
  background: #0d0f1cb3; box-shadow: inset 0 0 0 1px #ffffff40; color: #e8ecff; font: 700 22px/1 var(--font); cursor: pointer; transition: background .15s, box-shadow .15s; }
.ao-tab:hover { background: #2a3150e6; box-shadow: inset 0 0 0 1px #7ff3ff; color: #fff; }
.ao.tuck { translate: -78px 0; opacity: .45; }
.ao.busy { opacity: .3; }
.ao.tuck.busy { opacity: .2; }
.ao:hover .ao-tab, .ao-tab:focus-visible { opacity: 1; }

/* Dungeon panel: Join / Create */
.pill-wrap { position: relative; }
.dgp-badge { position: absolute; right: 10px; bottom: -2px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: #f23f43; color: #fff;
  font: 700 11px/18px var(--font); text-align: center; box-shadow: 0 0 0 3px var(--bg-tertiary, #1e1f22); pointer-events: none; animation: dgpPulse 1.2s ease-in-out infinite alternate; }
.dgp-wrap { position: relative; display: inline-flex; }
.dgp-wrap .dgp-badge { right: -4px; bottom: auto; top: -4px; box-shadow: none; }
.dgp-btn[style*="none"] + .dgp-badge { display: none; }   /* the phone-only button is hidden on wide screens: so is its badge */
@keyframes dgpPulse { to { transform: scale(1.12); } }
.dgp { width: min(720px, 100%); }
.dgp-head { padding: 0 12px; gap: 0; align-items: stretch; }
.dgp-tabs { display: flex; gap: 4px; flex: 1; }
.dgp-tab { background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--text-muted, #b5bac1); padding: 14px 18px 11px; font: 600 16px var(--font); cursor: pointer; }
.dgp-tab:hover { color: #dbdee1; }
.dgp-tab.on { color: #fff; border-bottom-color: #5865f2; }
.dgp-head .pv-x { align-self: center; }
.dgp-body { padding: 16px 20px 22px; min-height: 340px; }
.dgp-empty { padding: 70px 20px; text-align: center; color: var(--text-muted, #b5bac1); font-size: 18px; }
.dgp-here { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border-radius: 8px; background: #5865f222; box-shadow: inset 0 0 0 1px #5865f266; color: #dbdee1; }
.dgp-inv { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 10px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); box-shadow: inset 3px 0 0 #5865f2; animation: dgfade .25s ease-out; }
.dgp-inv.raid { box-shadow: inset 3px 0 0 #f23f43; }
.dgp-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.dgp-av.fb { display: flex; align-items: center; justify-content: center; background: #5865f2; color: #fff; font-weight: 700; }
.dgp-inv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dgp-inv-top { color: #dbdee1; }
.dgp-inv-tier { color: #f2f3f5; } .dgp-inv-tier span { color: var(--text-muted, #b5bac1); }
.dgp-inv-meta { font-size: 13px; color: var(--text-muted, #949ba4); }
.dgp-left { color: #f0b232; font-weight: 600; }
.dgp-timer { height: 3px; border-radius: 2px; background: #ffffff1a; overflow: hidden; margin-top: 3px; }
.dgp-timer i { display: block; height: 100%; background: #f0b232; transition: width .25s linear; }
.dgp-inv-btns { display: flex; flex-direction: column; gap: 6px; }
.dgp-inv-btns .dg-btn { padding: 7px 18px; }
.dg-btn.dgp-no { background: #4e5058; } .dg-btn.dgp-no:hover { background: #6d6f78; }
/* the Spectate tab, and the fight screen while spectating (no voting, answering or commands) */
.dgp-live.fight { box-shadow: inset 3px 0 0 #f0b232; } .dgp-live.raid { box-shadow: inset 3px 0 0 #f23f43; }
.dgp-live-ico { font-size: 20px; background: #313338; }
.dgp-live-tag { margin-left: 8px; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 700; background: #f23f4333; color: #ff8a8c; vertical-align: 1px; }
.dg-spec { padding: 4px 10px; border-radius: 12px; background: #ffffff1a; color: #f2f3f5; font-size: 13px; font-weight: 600; }
.dg.spec .dg-node, .dg.spec #dgMenu { pointer-events: none; }
.dg.spec .dg-cmd { display: none; }
.dg-btn:disabled { opacity: .45; cursor: not-allowed; }
.dgp-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.dgp-row > label { width: 84px; flex: none; color: var(--text-muted, #b5bac1); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.dgp-sel { flex: 1; max-width: 320px; background: var(--bg-tertiary, #1e1f22); color: #dbdee1; border: 1px solid #3f4147; border-radius: 6px; padding: 7px 10px; font: inherit; }
.dgp-sec { margin-top: 18px; padding: 14px 16px; border-radius: 10px; background: var(--bg-secondary, #2b2d31); }
.dgp-sec h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #b5bac1); }
.dgp-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.dgp-tier { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 110px; padding: 8px 12px; border-radius: 8px; border: 1px solid #3f4147; background: var(--bg-tertiary, #1e1f22); color: #dbdee1; cursor: pointer; font: inherit; text-align: left; }
.dgp-tier small { color: var(--text-muted, #949ba4); font-size: 11px; }
.dgp-tier:hover { border-color: #6d6f78; }
.dgp-tier.on { border-color: #5865f2; background: #5865f22e; color: #fff; }
.dgp-step { display: flex; align-items: center; gap: 10px; }
.dgp-step button { width: 30px; height: 30px; border-radius: 6px; border: 0; background: var(--bg-tertiary, #1e1f22); color: #fff; font-size: 18px; cursor: pointer; }
.dgp-step button:hover { background: #404249; }
.dgp-size-n { min-width: 18px; text-align: center; font-size: 17px; color: #fff; }
.dgp-go { display: flex; justify-content: flex-end; margin-top: 6px; }
.dgp-hint { margin: 0 0 10px; font-size: 13px; color: var(--text-muted, #949ba4); }
.dgp-raids { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.dgp-raid { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 8px; background: var(--bg-tertiary, #1e1f22); border: 1px solid #3f4147; }
.dgp-raid.none { opacity: .55; }
.dgp-raid.want { border-color: #f23f43; box-shadow: 0 0 0 2px #f23f4355, 0 0 18px #f23f4344; animation: dgpWant 1.2s ease-in-out 3; }
@keyframes dgpWant { 50% { box-shadow: 0 0 0 4px #f23f4388, 0 0 26px #f23f4366; } }
.dgp-raid-name { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #f2f3f5; }
.dgp-rar { width: 20px; height: 20px; display: inline-flex; } .dgp-rar img { width: 100%; height: 100%; }
.dgp-own { margin-left: auto; font-size: 13px; color: var(--text-muted, #b5bac1); font-weight: 600; }
.dgp-raid-desc { font-size: 13px; color: #b5bac1; flex: 1; }
.dgp-raid .dg-btn { align-self: flex-end; }

/* ---- Dungeon pop-up: Lobby tab (replaces the lobby message in the chat) */
.dgl-title { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-size: 18px; margin-bottom: 2px; }
.dgl-title > span:not(.dgl-where) { color: var(--text-muted, #b5bac1); font-size: 15px; }
.dgl-where { margin-left: auto; font-size: 13px; color: var(--text-muted, #949ba4); }
.dgl-party { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 8px; }
.dgl-mem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-tertiary, #1e1f22); min-width: 0; animation: dgfade .25s ease-out; }
.dgl-mem.lead { box-shadow: inset 3px 0 0 #f0b232; }
.dgl-mem .dgp-av { width: 38px; height: 38px; }
.dgl-mem-main { min-width: 0; }
.dgl-mem-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgl-mem-sub { font-size: 12px; color: var(--text-muted, #949ba4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgl-crown { margin-right: 4px; }
.dgl-pend { opacity: .7; border: 1px dashed #5865f2; }
.dgl-free { opacity: .45; border: 1px dashed #4e5058; background: transparent; }
.dgl-free .dgp-av.fb { background: #4e5058; }
.dgp-sec.ro .dgp-step button, .dgp-sec.ro .dgp-tier { cursor: default; }
.dgp-step button:disabled { opacity: .35; cursor: default; background: var(--bg-tertiary, #1e1f22); }
.dgl-fold { cursor: pointer; user-select: none; }
.dgl-fold:hover { color: #fff; }
.dgl-invlist { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; margin-top: 8px; }
.dgl-invlist.shut { display: none; }
.dgl-cand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 6px; }
.dgl-cand:hover { background: var(--bg-tertiary, #1e1f22); }
.dgp-av.sm { width: 28px; height: 28px; font-size: 11px; }
.dgl-cand-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgl-dot { width: 8px; height: 8px; border-radius: 50%; background: #80848e; flex: none; }
.dgl-dot.on { background: #23a55a; }
.dgl-cand .dg-btn { padding: 4px 12px; font-size: 13px; }
.dgl-bonus { float: right; text-transform: none; letter-spacing: 0; color: #f0b232; font-weight: 600; }
.dgl-mod { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid rgba(255,255,255,.05); }
.dgl-mod:first-of-type { border-top: 0; }
.dgl-mod.on .dgl-mod-main b { color: #f0b232; }
.dgl-mod-ic { width: 28px; text-align: center; font-size: 20px; flex: none; }
.dgl-mod-ic img { width: 24px; height: 24px; }
.dgl-mod-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dgl-mod-main small { color: var(--text-muted, #949ba4); font-size: 12px; }
.dgl-mod .dgp-size-n { min-width: 34px; text-align: center; }
.dgl-foot { flex: none; padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.06); background: var(--bg-primary, #313338); }
.dgl-foot-in { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dgl-start { background: #23a55a; padding-left: 28px; padding-right: 28px; }
.dgl-start:hover { background: #1a8a49; }
.dgl-invlist + * , .dgl-fold + input { margin-top: 8px; }
.dgl-fold + input { width: 100%; box-sizing: border-box; }
.dgl-num-wrap { display: flex; align-items: baseline; gap: 1px; min-width: 58px; justify-content: center; font-weight: 700; }
.dgl-num-wrap span { color: var(--text-muted, #b5bac1); font-size: 14px; }
.dgl-num { width: 30px; padding: 3px 2px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #fff; font: inherit; font-size: 17px; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.dgl-num::-webkit-outer-spin-button, .dgl-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dgl-num:not(:disabled):hover { border-color: #4e5058; background: var(--bg-tertiary, #1e1f22); cursor: text; }
.dgl-num:focus { outline: none; border-color: #5865f2; background: var(--bg-tertiary, #1e1f22); text-align: center; }
.dgl-num:disabled { color: #fff; opacity: 1; }

/* ---- the dungeon map's own look (Terra, raids, the dark tier's VHS, K-side, cherry rain/petals): see dgLook */
.dg.has-look .dg-grid { opacity: 0; }
.dg-look { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.dg-map > svg { position: relative; z-index: 1; }
.dg-look > * { position: absolute; inset: 0; }
.dgl-bg { background: center / cover no-repeat; }
.dgl-bg::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.dgl-vig { background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55)); }
/* Terra: the starry background, twinkling */
.dgl-stars i { position: absolute; width: var(--z); height: var(--z); border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(200,220,255,.8); animation: dglTwinkle 3s ease-in-out infinite; }
@keyframes dglTwinkle { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.15); } }
/* K-side: a black/white ramp that slowly turns inside out, with dust drifting left */
.dg-map.look-kside { background: #000; }
.dgl-ramp { background: linear-gradient(90deg, #000, #fff); }
.dgl-ramp.inv { background: linear-gradient(90deg, #fff, #000); animation: dglBreathe 3.1s ease-in-out infinite alternate; }
@keyframes dglBreathe { from { opacity: 0; } to { opacity: 1; } }
.dgl-dust i { position: absolute; left: 100%; width: var(--z); height: var(--z); border-radius: 50%; background: #888; mix-blend-mode: difference; animation: dglDrift 14s linear infinite; }
@keyframes dglDrift { from { transform: translate(0, 0); } to { transform: translate(calc(-100vw - 20px), var(--dy)); } }
.dg-map.look-kside .dg-edge.r0 { stroke: rgba(128,128,128,.6); }
/* the dark tier: an old VHS tape (grey, scanlines, a rolling bar, now and then a glitch) */
.dg-map.look-vhs { background: #000; }
.dg-map.look-vhs > svg { filter: grayscale(.7) contrast(1.05); animation: dglGlitch 6.5s steps(1) infinite; }
.dgl-tape { background: center / 100% 100% no-repeat; mix-blend-mode: screen; opacity: .9; z-index: 2; }
.dgl-scan { background: repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 1px, transparent 1px 3px); z-index: 2; }
.dgl-bar { top: -12%; bottom: auto; height: 7%; background: linear-gradient(transparent, rgba(255,255,255,.07), transparent); animation: dglRoll 7s linear infinite; z-index: 2; }
@keyframes dglRoll { to { transform: translateY(1700%); } }
@keyframes dglGlitch {
  0%, 100% { transform: none; filter: grayscale(.7) contrast(1.05); }
  41% { transform: translateX(-6px) skewX(-2deg); filter: grayscale(.4) contrast(1.4) drop-shadow(4px 0 0 rgba(255,0,60,.6)) drop-shadow(-4px 0 0 rgba(0,200,255,.6)); }
  42% { transform: none; filter: grayscale(.7) contrast(1.05); }
  73% { transform: translateX(9px); filter: grayscale(.3) contrast(1.6) drop-shadow(-6px 0 0 rgba(255,0,60,.6)) drop-shadow(6px 0 0 rgba(0,200,255,.6)); }
  74% { transform: translateX(-3px); }
  75% { transform: none; filter: grayscale(.7) contrast(1.05); }
}
/* cherry: a cold wet night with slanted rain, or falling petals */
.dg-map.look-rain { background: linear-gradient(#0b1220, #15202e); }
.dg-map.look-rain > svg { filter: saturate(.75) brightness(.92); }
.dgl-mist { top: 40%; background: linear-gradient(transparent, rgba(62,86,116,.28)); }
.dgl-rain { inset: -50% -20%; background-image: repeating-linear-gradient(100deg, transparent 0 46px, rgba(176,200,232,.35) 46px 47px, transparent 47px 90px); background-size: 90px 34px; animation: dglRain .5s linear infinite; z-index: 2; }
.dgl-rain.r2 { background-size: 130px 58px; opacity: .7; animation-duration: .7s; }
.dgl-rain.r3 { background-size: 60px 22px; opacity: .45; animation-duration: .38s; }
@keyframes dglRain { from { transform: translate(0, 0); } to { transform: translate(-30px, 160px); } }
.dgl-petals i { position: absolute; top: -20px; width: var(--z); height: calc(var(--z) * .7); border-radius: 80% 0 80% 0; background: linear-gradient(135deg, #ffd1e1, #f29bbb); opacity: .85; animation: dglFall 10s linear infinite; z-index: 2; }
@keyframes dglFall { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--dx), calc(100vh + 40px)) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .dg-look *, .dg-map[class*="look-"] > svg { animation: none !important; } }

/* ---- Profile pop-up: Presets tab (loadouts) */
.lo { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 14px 18px 4px; }
.lo-now { grid-column: 1 / -1; padding: 12px 14px; border-radius: 10px; background: var(--bg-secondary, #2b2d31); box-shadow: inset 3px 0 0 #23a55a; }
.lo-now h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #b5bac1); }
.lo-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--bg-secondary, #2b2d31); border: 1px solid transparent; transition: opacity .2s, border-color .2s; }
.lo-card:hover { border-color: #3f4147; }
.lo-card.empty { background: transparent; border: 1px dashed #4e5058; }
.lo-card.busy { opacity: .55; pointer-events: none; }
.lo-head { display: flex; align-items: center; gap: 8px; }
.lo-n { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: #5865f2; color: #fff; font-weight: 700; font-size: 13px; }
.lo-card.empty .lo-n { background: #4e5058; }
.lo-name { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #fff; font: inherit; font-weight: 600; font-size: 15px; }
.lo-name:hover { border-color: #4e5058; }
.lo-name:focus { outline: none; border-color: #5865f2; background: var(--bg-tertiary, #1e1f22); }
.lo-lines { font-size: 13px; line-height: 1.45; color: var(--text-normal, #dbdee1); flex: 1; }
.lo-lines p, .lo-lines > div { margin: 0; }
.lo-lines img.emoji { width: 16px; height: 16px; vertical-align: -3px; }
.lo-empty { flex: 1; font-size: 13px; color: var(--text-muted, #949ba4); font-style: italic; }
.lo-btns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.lo-btns .dg-btn { padding: 5px 12px; font-size: 13px; }
.lo-btns .lo-sec { background: #4e5058; }
.lo-btns .lo-sec:hover { background: #6d6f78; }

/* ---- dungeon occurrences as a pop-up over the map, styled like a Discord embed: coloured side bar (rarity), title,
   picture | text + numbered choices as Discord buttons (see dgOcc) */
.occ-back { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.6); }
.occ { --oc: #5865f2; position: relative; width: min(820px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 8px; background: #2b2d31; border-left: 4px solid var(--oc); color: #dbdee1; font-family: var(--font, "gg sans", "Noto Sans", sans-serif);
  box-shadow: 0 8px 16px rgba(0,0,0,.24), 0 0 0 1px rgba(0,0,0,.15); }
.occ.in { animation: occIn .2s ease-out; }
@keyframes occIn { from { opacity: 0; transform: scale(.97); } }
.occ.rare { --oc: #3aa0ff; } .occ.astral { --oc: #9b59f6; } .occ.rest { --oc: #f0b232; }
.occ-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.occ-name { flex: 1; min-width: 0; font-size: 18px; font-weight: 600; line-height: 1.3; color: #f2f3f5; }
.occ-name p { margin: 0; }
.occ-rar { flex: none; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; color: #fff; background: var(--oc); }
.occ:not(.rare):not(.astral):not(.rest) .occ-rar { background: #4e5058; }
.occ-x { flex: none; width: 24px; height: 24px; border: 0; border-radius: 4px; background: transparent; color: #b5bac1; font-size: 14px; cursor: pointer; }
.occ-x:hover { background: #3f4147; color: #dbdee1; }
.occ-main { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px; padding: 4px 16px 16px; min-height: 0; overflow: auto; }
.occ-main.noimg { grid-template-columns: minmax(0, 1fr); }
.occ-img { align-self: start; border-radius: 4px; overflow: hidden; background: #1e1f22; }
.occ-img img { display: block; width: 100%; height: auto; }
.occ-right { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.occ-desc { font-size: 14px; line-height: 1.375; color: #dbdee1; }
.occ-lines { font-size: 14px; padding: 8px 10px; border-radius: 4px; background: #232428; }
.occ-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.occ-opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 3px; background: #4e5058; color: #fff; font: inherit; text-align: left; cursor: pointer; transition: background-color .17s ease; }
.occ-opt:hover { background: #6d6f78; }
.occ-opt:active { background: #80848e; }
.occ-opt.mine { background: #5865f2; }
.occ-opt.occ-ok { justify-content: center; background: #5865f2; font-weight: 500; } .occ-ok .occ-opt-main { flex: none; text-align: center; } .occ-opt.occ-ok:hover { background: #4752c4; }
.occ-opt.mine:hover { background: #4752c4; }
.occ-num { flex: none; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.25); font-weight: 700; font-size: 12px; }
.occ-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.occ-opt-main b { font-size: 14px; font-weight: 500; }
.occ-opt-main small { font-size: 12px; color: rgba(255,255,255,.72); line-height: 1.3; }
.occ-opt-main p { margin: 0; display: inline; }
.occ-voters { flex: none; display: flex; padding-left: 6px; }
.occ-av { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #4e5058; margin-left: -6px; object-fit: cover; }
.occ-opt.mine .occ-av { border-color: #5865f2; }
.occ-timer { position: relative; height: 26px; display: flex; align-items: center; justify-content: flex-end; padding: 0 16px; border-top: 1px solid #1f2023; background: #2b2d31; font-size: 12px; color: #949ba4; }
.occ-timer i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--oc); transition: width .25s linear; }
.occ-timer span { position: relative; }
.occ-timer span::before { content: "Voting ends in "; }
.occ-pill { position: absolute; z-index: 30; left: 50%; bottom: 16px; translate: -50% 0; border-radius: 3px; box-shadow: 0 8px 16px rgba(0,0,0,.24); }
@media (max-width: 640px) { .occ-main { grid-template-columns: minmax(0, 1fr); } .occ-img { max-width: 240px; } }
.occ-num.emo { background: transparent; font-size: 16px; padding: 0; }
.occ-desc p { margin: 0 0 8px; } .occ-desc p:last-child { margin-bottom: 0; }

/* ---- Workers pop-up (wkOpen): your workers, the hiring board, a worker's details */
.pv.wk { width: min(860px, 100%); }
.wk-body { padding: 14px 18px 18px; }
/* the loot pop-up after collecting from workers */
#wkLoot { z-index: 950; }
.pv.wkl { width: min(460px, 100%); max-height: min(80vh, 640px); }
.wkl-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.wkl-gp { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid #f0b232; }
.wkl-gp-n { font-size: 22px; font-weight: 800; color: #f0b232; }
.wkl-jack { flex-basis: 100%; font-weight: 700; color: #fff; }   /* its own line, under the GP */
.wkl-sub { flex-basis: 100%; font-size: 12px; color: var(--text-muted, #949ba4); }
.wkl-none { font-size: 13px; color: var(--text-muted, #949ba4); text-align: center; padding: 6px; }
.wkl-group { --rc: #b5bac1; border-radius: 8px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid var(--rc); padding: 8px 12px 10px; }
.wkl-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--rc); text-transform: uppercase; letter-spacing: .04em; font-size: 13px; margin-bottom: 6px; }
.wkl-h img.emoji { width: 18px; height: 18px; }
.wkl-count { margin-left: auto; color: var(--text-muted, #b5bac1); font-weight: 600; text-transform: none; letter-spacing: 0; }
.wkl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wkl-list li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 4px; border-radius: 4px; font-size: 14px; color: #dbdee1; }
.wkl-list li:hover { background: rgba(255,255,255,.04); }
.wkl-n { color: var(--text-muted, #b5bac1); font-variant-numeric: tabular-nums; }
.wkl-foot { display: flex; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--divider, #3f4147); }
.wk-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); }
.wk-top .dg-btn { margin-left: auto; }
.wk-gp b { color: #f0b232; }
.wk-hint { font-size: 13px; color: var(--text-muted, #949ba4); }
.wk-hint a { color: #00a8fc; }
.wk-h { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, #b5bac1); }
.wk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.wk-idle { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.wk-card { --rc: #b5bac1; position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); border: 1px solid transparent; border-left: 3px solid var(--rc); cursor: pointer; transition: background .15s, border-color .15s; }
.wk-card:hover { background: #35373c; border-color: #3f4147; border-left-color: var(--rc); }
.wk-card.empty { cursor: default; background: transparent; border: 1px dashed #4e5058; align-items: center; min-height: 64px; }
.r-uncommon { --rc: #3ba55c; } .r-rare { --rc: #3aa0ff; } .r-very-rare { --rc: #b06bff; } .r-legendary { --rc: #f0b232; }
.wk-pic { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #1e1f22; }
.wk-pic.fb { display: grid; place-items: center; font-weight: 700; color: #fff; background: color-mix(in srgb, var(--rc, #5865f2) 55%, #1e1f22); }
.wk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.wk-name { font-size: 15px; line-height: 1.3; }
.wk-name img.emoji { width: 18px; height: 18px; vertical-align: -4px; }
.wk-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(240,178,50,.15); color: #f0b232; font-weight: 600; white-space: nowrap; }
.wk-stats { font-size: 12px; color: var(--text-muted, #b5bac1); line-height: 1.35; }
.wk-prog { margin-top: 4px; }
.wk-bar { height: 5px; border-radius: 3px; background: #1e1f22; overflow: hidden; }
.wk-bar i { display: block; height: 100%; background: var(--rc); transition: width 1s linear; }
.wk-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 11px; color: var(--text-muted, #949ba4); }
.wk-slotn { flex: none; position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: #1e1f22; border: 2px solid var(--rc, #4e5058); font-size: 11px; font-weight: 700; color: #fff; }
.wk-card.empty .wk-slotn { position: static; border-color: #4e5058; }
.wk-offers { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.wk-offer { --rc: #b5bac1; position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid var(--rc); }
.wk-offer.taken { opacity: .5; }
.wk-offer .wk-name { font-size: 14px; }
.wk-hired { flex: none; font-size: 13px; color: #3ba55c; font-weight: 600; }
.wk-offers + .wk-hint { margin-top: 12px; }
.wk-dhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wk-dbtns { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.wk-dhead .dg-btn { padding: 6px 12px; font-size: 13px; }
.wk-detail .msg { padding: 0 !important; min-height: 0; } .wk-detail .divider, .wk-detail .toolbar { display: none; } .wk-detail .embed { max-width: 100%; }
.wk-detail .msg > .av, .wk-detail .msg > .head { display: none; }
.wk .lo-sec { background: #4e5058; } .wk .lo-sec:hover:not(:disabled) { background: #6d6f78; } .wk .dg-btn:disabled { opacity: .45; cursor: not-allowed; }
.wk-card[draggable="true"] { cursor: grab; }
.wk-card.dragging { opacity: .4; }
.wk-idle-zone { border-radius: 10px; border: 2px dashed transparent; margin: -4px; padding: 4px; transition: border-color .15s, background .15s; }
.wk-dragging .wk-idle-zone, .wk-dragging .wk-card.empty { border-color: #4e5058; }
.wk-card.drop-over, .wk-idle-zone.drop-over { border-color: #5865f2 !important; background: rgba(88,101,242,.12); }
.wk-card.drop-over { border-style: dashed; }
.wk-idle-empty { padding: 12px 4px; }
.r-mythical { --rc: #ff1f1f; }

/* ---- Shop pop-up (shOpen): items, materials, reforges */
.pv.sh { width: min(920px, 100%); }
.sh-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid #1f2023; background: var(--bg-secondary, #2b2d31); }
.sh-gp b { color: #f0b232; }
.sh-hint { font-size: 13px; color: var(--text-muted, #949ba4); }
.sh-busy { font-size: 13px; color: #f23f43; }
.sh-search { flex: 1; min-width: 140px; max-width: 260px; padding: 6px 10px; border: 0; border-radius: 4px; background: #1e1f22; color: #dbdee1; font: inherit; font-size: 14px; }
.sh-search:focus { outline: none; box-shadow: 0 0 0 2px #5865f2; }
.sh-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #dbdee1; cursor: pointer; }
.sh-body { padding: 14px 18px 18px; }
.sh-ic img.emoji { width: 18px; height: 18px; vertical-align: -4px; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sh-card { --rc: #b5bac1; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid var(--rc); }
.sh-card.out, .sh-row.out { opacity: .5; }
.sh-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sh-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.sh-n { margin-left: auto; font-size: 12px; color: var(--text-muted, #949ba4); }
.sh-sub { flex: 1; font-size: 12px; color: var(--text-muted, #b5bac1); line-height: 1.4; }
.sh-sub img.emoji { width: 16px; height: 16px; vertical-align: -3px; }
.sh-foot { display: flex; align-items: center; gap: 8px; }
.sh-price { font-weight: 700; color: #f0b232; font-size: 14px; white-space: nowrap; }
.sh-left, .sh-have { font-size: 12px; color: var(--text-muted, #949ba4); white-space: nowrap; }
.sh-foot .sh-left { flex: 1; }
.sh-amt { width: 52px; padding: 4px 6px; border: 0; border-radius: 4px; background: #1e1f22; color: #dbdee1; font: inherit; font-size: 13px; text-align: center; }
.sh-amt:focus { outline: none; box-shadow: 0 0 0 2px #5865f2; }
.sh .dg-btn { padding: 5px 12px; font-size: 13px; }
.sh .lo-sec { background: #4e5058; } .sh .lo-sec:hover:not(:disabled) { background: #6d6f78; }
.sh .dg-btn:disabled { opacity: .45; cursor: not-allowed; }
.sh-list { display: flex; flex-direction: column; gap: 6px; }
.sh-row { --rc: #b5bac1; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto auto auto auto auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid var(--rc); }
.sh-row[hidden], .sh-frow[hidden] { display: none; }
.sh-frow { --rc: #b5bac1; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; background: var(--bg-secondary, #2b2d31); border-left: 3px solid var(--rc); }
.sh-fmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sh-fbtns { display: flex; gap: 6px; flex: none; }
.sh-grp { font-size: 14px; }
.sh-worn { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(35,165,90,.18); color: #3ba55c; font-weight: 600; }
.sh-odds { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 10px 12px; border-radius: 6px; background: #232428; font-size: 13px; color: #dbdee1; }
.sh-odds img.emoji { width: 16px; height: 16px; vertical-align: -3px; }
.sh-keep { margin-bottom: 14px; padding: 12px 14px; border-radius: 8px; background: #2b2d31; border-left: 4px solid #f0b232; font-size: 14px; line-height: 1.4; }
.sh-keep-h { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.sh-keep img.emoji { width: 18px; height: 18px; vertical-align: -4px; }
.sh-keep .md, .sh-odds .md { white-space: pre-line; overflow-wrap: anywhere; }
.sh-keep-b { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 640px) { .sh-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; } .sh-row .sh-have, .sh-row .sh-left { display: none; } }

/* ---- Dictionary pop-up (dxOpen): $dict, $workerdict, $status, $drops */
.dx-body .msg { padding: 0 0 8px !important; min-height: 0; } .dx-body .divider, .dx-body .toolbar { display: none; } .dx-body .embed { max-width: 100%; }
.dx-body .msg > .av, .dx-body .msg > .head { display: none; }
.dx-body .msg { display: flex; flex-direction: column; align-items: center; margin: 0 !important; }
.dx-body .msg > * { width: 100%; max-width: 560px; margin-left: auto !important; margin-right: auto !important; }
.dx-body .embed { margin-left: auto; margin-right: auto; }
.dx-body .reactions { justify-content: center; }
.dx-bar { gap: 8px; }
.dx-bar .sh-search { max-width: 320px; }
.dx-bar .dg-btn { padding: 6px 12px; font-size: 13px; }
.dx .lo-sec { background: #4e5058; } .dx .lo-sec:hover { background: #6d6f78; }
.dx-sel { padding: 6px 8px; border: 0; border-radius: 4px; background: #1e1f22; color: #dbdee1; font: inherit; font-size: 13px; cursor: pointer; }
.dx-sel:focus { outline: none; box-shadow: 0 0 0 2px #5865f2; }

/* ---- Skill Tree pop-up (skOpen): trees that grow up from a trunk */
.pv.sk { width: min(1060px, calc(100vw - 32px)); max-width: none; }
.sk .pv-tabs { flex-wrap: wrap; }
.sk-tabn { margin-left: 6px; padding: 0 6px; border-radius: 8px; background: #5865f2; color: #fff; font-size: 11px; font-weight: 700; }
.sk-bar { gap: 14px; }
.sk-pts { font-size: 15px; color: #dbdee1; } .sk-pts b { color: #fff; font-size: 17px; }
.sk-dim { color: #949ba4; font-size: 13px; }
.sk-busy { color: #f0b232; font-size: 13px; }
.sk-resetall { margin-left: auto; padding: 6px 12px; font-size: 13px; }
.sk .lo-sec { background: #4e5058; } .sk .lo-sec:hover:not(:disabled) { background: #6d6f78; } .sk .dg-btn:disabled { opacity: .45; cursor: not-allowed; }
.sk-body { padding: 0 !important; }
.sk-d-text { line-height: 1.4; }
.sk-d-row { color: #b5bac1; } .sk-ok { color: #23a55a; } .sk-miss { color: #f23f43; }
.sk-d-why { font-size: 13px; color: #f0b232; }
.sk-d-btns { display: flex; gap: 8px; flex-wrap: wrap; } .sk-d-btns .dg-btn { padding: 7px 14px; font-size: 13px; }

/* ---- Terra pop-up (trOpen): hub, pebble shop, Mass skills (the skill-tree look), backpack */
.tr-pad { padding: 16px 18px; }
.tr-hub { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.tr-banner { position: relative; height: 180px; border-radius: 8px; background: #1e1f22 center / cover no-repeat; overflow: hidden; }
.tr-banner-t { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 16px 12px; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff; font-size: 22px; font-weight: 700; }
.tr-title { font-size: 22px; font-weight: 700; }
.tr-flavor { margin: 0; color: #b5bac1; font-style: italic; line-height: 1.45; }
.tr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.tr-card { padding: 12px 14px; border-radius: 8px; background: #2b2d31; display: flex; flex-direction: column; gap: 5px; }
.tr-k { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #949ba4; letter-spacing: .02em; }
.tr-v { font-size: 22px; font-weight: 700; color: #f2f3f5; }
.tr-bar { height: 8px; border-radius: 4px; background: #1e1f22; overflow: hidden; } .tr-bar i { display: block; height: 100%; background: #5865f2; }
.tr-run { padding: 14px; border-radius: 8px; background: #2b2d31; border-left: 4px solid #5865f2; display: flex; flex-direction: column; gap: 6px; }
.tr-run-h { font-weight: 700; font-size: 16px; }
.tr-shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tr-item { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 8px; background: #2b2d31; border-left: 4px solid var(--rc, #4e5058); }
.tr-item-h { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.tr-item-h img.emoji { width: 18px; height: 18px; }
.tr-item-d { flex: 1; font-size: 13px; color: #b5bac1; line-height: 1.4; }
.tr-item-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tr-price { font-size: 14px; }
.tr-buy { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tr-buy .dgl-num { width: 52px; } .tr-buy .dg-btn { padding: 6px 14px; font-size: 13px; }
.tr .dx-body .msg { padding: 0 0 8px !important; }
.tr .dx-body .msg > * { max-width: 640px; }

/* ---- Terra's Drifting Market in the occurrence pop-up (dgMarket): a shelf of cards, a counter on the right, a footer */
.occ.market { width: min(780px, 100%); --oc: #5865f2; }
.mk-head { display: flex; align-items: center; gap: 6px; }
.mk-clock { height: auto; padding: 0; border: 0; background: none; font-variant-numeric: tabular-nums; color: #b5bac1; font-size: 13px; }
.mk-clock i { display: none; } .mk-clock span::before { content: none; }
.mk-paused { font-size: 13px; color: #f0b232; }
.mk-pause { display: grid; place-items: center; }
.mk-wrap { display: flex; flex-direction: column; min-height: 0; }
.mk-body { display: grid; grid-template-columns: minmax(0, 1fr) 210px; min-height: 0; border-top: 1px solid #1f2023; }
.mk-shelf-wrap { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; overflow-y: auto; min-height: 0; max-height: 52vh; }
.mk-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.mk-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 10px; border: 1px solid #1f2023; border-top: 2px solid var(--rc, #4e5058); border-radius: 6px; background: #232428; color: #dbdee1; font: inherit; cursor: pointer; text-align: center; }
.mk-card:hover { background: #2e3035; }
.mk-card.on { background: #2e3035; border-color: #5865f2; border-top-color: var(--rc, #5865f2); }
.mk-card.sold { opacity: .5; }
.mk-card-ic img.emoji { width: 34px; height: 34px; }
.mk-card-n { font-size: 13px; font-weight: 600; line-height: 1.25; }
.mk-card-p { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #b5bac1; }
.mk-card-p .occ-av { margin-left: 0; width: 16px; height: 16px; border-width: 1px; }
.mk-card-tag { position: absolute; top: 5px; right: 6px; font-size: 10px; color: #f0b232; }
.mk-detail { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 6px; background: #2b2d31; }
.mk-detail-t { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; color: #b5bac1; }
.mk-detail-t b { display: block; color: #f2f3f5; font-size: 14px; margin-bottom: 2px; }
.mk-detail-t p { margin: 0; }
.mk-detail .dg-btn { flex: none; padding: 7px 14px; font-size: 13px; }
.mk-dim { color: #949ba4; font-size: 13px; }
.mk-pop { position: absolute; left: 16px; right: 16px; top: 14px; z-index: 2; padding: 12px; border-radius: 8px; background: #111214; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: occIn .18s ease-out; }
.mk-pop-h { font-weight: 600; margin-bottom: 8px; }
.mk-pop-b { display: flex; flex-direction: column; gap: 6px; } .mk-pop-b.row { flex-direction: row; }
.mk-pop-b .dg-btn { padding: 6px 16px; font-size: 13px; }
.mk-pick { padding: 8px 10px; border: 0; border-radius: 4px; background: #2b2d31; color: #dbdee1; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.mk-pick:hover { background: #3f4147; } .mk-pick p { margin: 0; }
.mk-counter { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border-left: 1px solid #1f2023; background: #232428; }
.mk-purse b { display: block; font-size: 22px; color: #f0b232; line-height: 1.2; }
.mk-hp { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: 13px; align-items: baseline; }
.mk-hp span:nth-child(2) { text-align: right; color: #dbdee1; }
.mk-hp i { grid-column: 1 / -1; display: block; height: 4px; border-radius: 2px; background: #23a55a; box-shadow: inset 0 0 0 0 #000; }
.mk-svcs { display: flex; flex-direction: column; border-top: 1px solid #3f4147; }
.mk-svc { display: flex; justify-content: space-between; gap: 8px; padding: 8px 2px; border: 0; border-bottom: 1px solid #2e3035; background: none; color: #dbdee1; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.mk-svc:hover:not(:disabled) { color: #fff; background: #2b2d31; }
.mk-svc:disabled { color: #6d6f78; cursor: not-allowed; }
.mk-svc-p { color: #949ba4; font-variant-numeric: tabular-nums; }
.mk-note { margin-top: auto; font-size: 11px; color: #6d6f78; }
.mk-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid #1f2023; background: #2b2d31; }
.mk-leavers { flex: 1; min-width: 0; display: flex; align-items: center; }
.mk-foot .dg-btn { flex: none; padding: 8px 18px; font-size: 14px; }
.occ.market .lo-sec { background: #4e5058; }
@media (max-width: 640px) { .mk-body { grid-template-columns: 1fr; } .mk-counter { border-left: 0; border-top: 1px solid #1f2023; } }/* market stock as a scrollable list of single-line rows (replaces the card shelf) */
.mk-shelf-wrap { overflow: visible; max-height: none; }
.mk-shelf { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; padding-right: 2px; }
.mk-row { flex: none; display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 12px; border: 1px solid transparent; border-left: 3px solid var(--rc, #4e5058); border-radius: 4px 16px 16px 4px; background: #232428; color: #dbdee1; font: inherit; text-align: left; cursor: pointer; }
.mk-row:hover { background: #2b2d31; }
.mk-row.on { background: #2e3035; border-color: #5865f2; border-left-color: var(--rc, #5865f2); }
.mk-row.sold { opacity: .5; }
.mk-row-ic { flex: none; display: grid; place-items: center; }
.mk-row-ic img.emoji { width: 24px; height: 24px; }
.mk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mk-row-main b { font-size: 14px; color: #f2f3f5; }
.mk-row-fx { font-size: 12px; color: #949ba4; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-row-fx p { margin: 0; display: inline; }
.mk-row.on .mk-row-fx { white-space: normal; }
.mk-row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.mk-row-r { font-size: 11px; color: var(--rc, #949ba4); text-transform: capitalize; }
.mk-row-p { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: #dbdee1; font-variant-numeric: tabular-nums; }
.mk-row-p .occ-av { margin-left: 0; width: 16px; height: 16px; border-width: 1px; }
/* Terra hub: the art is the page, one action on it, one status strip under it */
.tr-hub2 { display: flex; flex-direction: column; }
.tr-art { position: relative; height: clamp(240px, 46vh, 400px); display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 22px 24px;
  background: #05070d center / cover no-repeat; box-shadow: inset 0 -120px 90px -40px rgba(0,0,0,.85); }
.tr-art-q { max-width: 46ch; margin: 0; font-size: 14px; font-style: italic; line-height: 1.5; color: rgba(255,255,255,.72); text-shadow: 0 1px 4px #000; }
.tr-go { display: flex; align-items: center; gap: 12px; flex: none; }
.tr-go-b { flex: none; padding: 10px 22px; border: 0; border-radius: 3px; background: #f2f3f5; color: #111214; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: background .12s, transform .12s; }
.tr-go-b:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.tr-go-b:disabled { opacity: .4; cursor: not-allowed; }
.tr-go-x { border: 0; background: none; color: rgba(255,255,255,.6); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.tr-go-x:hover { color: #f23f43; }
.tr-go-note { flex: none; font-size: 13px; color: rgba(255,255,255,.7); }
.tr-hud { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 11px 24px; border-top: 1px solid #1f2023; background: #1e1f22; font-size: 14px; color: #b5bac1; }
.tr-hud b { color: #f2f3f5; }
.tr-hud-lv { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.tr-hud-bar { color: #5865f2; letter-spacing: -1px; font-size: 13px; } .tr-hud-bar span { color: #3f4147; }
.tr-hud-dim { color: #6d6f78; font-size: 12px; font-variant-numeric: tabular-nums; }
.tr-hud-it { cursor: default; }
#trBody:has(.tr-hub2) { padding: 0 !important; }
/* page-flip reactions inside the pop-ups (Dictionary, Terra pages, Profile): real buttons, no counts */
.dx-body .reactions, #pvBody .reactions { gap: 8px; margin-top: 10px; justify-content: center; }
.dx-body .reaction, #pvBody .reaction { height: 40px; min-width: 64px; justify-content: center; padding: 0 16px; border-radius: 6px; background: #4e5058; border-color: transparent; cursor: pointer; transition: background .12s, transform .08s; }
.dx-body .reaction:hover, #pvBody .reaction:hover { background: #6d6f78; border-color: transparent; }
.dx-body .reaction:active, #pvBody .reaction:active { transform: translateY(1px); }
.dx-body .reaction img.emoji, #pvBody .reaction img.emoji { width: 22px; height: 22px; }
.dx-body .reaction > span, #pvBody .reaction > span { display: none; }

/* Dictionary: entries you can click open their own page */
.dx-body .dx-link { cursor: pointer; border-radius: 3px; }
.dx-body strong.dx-link:hover { color: #00a8fc; text-decoration: underline; }

/* the skill trees as a channel list: category header, rows, └ lines down to the skills that need them */
.skl { max-width: 760px; margin: 0 auto; padding: 18px 16px 28px; }
.skl-cat { display: flex; align-items: center; gap: 4px; padding: 0 0 8px 2px; font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #949ba4; }
.skl-chev { display: inline-flex; }
.skl-cat-d { margin-left: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; color: #80848e; }
.skl-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 5px 8px 5px 12px; border-radius: 4px; color: #949ba4; cursor: pointer; }
.skl-row:hover { background: #35373c; color: #dbdee1; }
.skl-row.sel { background: #404249; color: #fff; }
.skl-main { flex: 1; min-width: 0; }
.skl-name { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 500; line-height: 20px; }
.skl-row.some .skl-name, .skl-row.max .skl-name { color: #f2f3f5; }
.skl-lock { font-size: 12px; }
.skl-fx { font-size: 13px; line-height: 18px; color: #80848e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skl-row.lock { opacity: .6; }
.skl-rank { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: #80848e; }
.skl-row.some .skl-rank { color: #949cf7; } .skl-row.max .skl-rank { color: #23a55a; }
.skl-plus, .skl-plus-x { flex: none; width: 28px; height: 28px; }
.skl-plus { border: 0; border-radius: 4px; background: #4e5058; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.skl-plus:hover { background: #5865f2; }
.skl-kids { margin-left: 22px; }
.skl-kids > .skl-node { position: relative; padding-left: 18px; }
.skl-kids > .skl-node::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 2px solid #4e5058; }
.skl-kids > .skl-node::after { content: ""; position: absolute; left: 0; top: 23px; width: 14px; border-top: 2px solid #4e5058; }
.skl-kids > .skl-node:last-child::before { bottom: auto; height: 25px; width: 14px; border-bottom: 2px solid #4e5058; border-bottom-left-radius: 6px; }
.skl-kids > .skl-node:last-child::after { display: none; }
.skl-detail { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 8px 12px; padding: 10px 12px; border-radius: 4px; background: #2b2d31; font-size: 14px; }
@media (max-width: 720px) { .skl { padding: 12px 8px 20px; } .skl-fx { white-space: normal; } .skl-cat-d { display: none; } }

/* ---- Shop > Gem tab (gmEl): inventory | bench (gem slots over the item slot) | gems */
.gm { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(260px, 1.25fr) minmax(200px, 1fr); gap: 12px; height: min(520px, 68vh); }
.gm-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 10px; border-radius: 8px; background: #2b2d31; }
.gm-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #949ba4; }
.gm-q { flex: none; width: 100%; max-width: none; height: 32px; box-sizing: border-box; }
.gm-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.gm-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: grab; user-select: none; }
.gm-row:hover { background: #35373c; }
.gm-row.on { background: #404249; }
.gm-row:active { cursor: grabbing; }
.gm-row .sh-ic img.emoji { width: 18px; height: 18px; }
.gm-row-m { flex: 1; min-width: 0; }
.gm-row-n { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: #f2f3f5; }
.gm-row-s { font-size: 12px; color: #949ba4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-have { margin-left: auto; font-size: 12px; font-weight: 600; color: #b5bac1; }
.gm-gem.none { opacity: .45; cursor: default; }
.gm-none { padding: 8px; }
.gm-bench { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 0; overflow-y: auto; padding: 10px; border-radius: 8px; background: #2b2d31; }
.gm-tag { padding: 0 5px; border-radius: 3px; background: #4e5058; font-size: 10px; font-weight: 700; text-transform: uppercase; color: #dbdee1; }
.gm-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 4px; background: #313338; border-left: 4px solid var(--rc, #b5bac1); }
.gm-card.over { background: #35373c; }
.gm-card-n { display: flex; align-items: center; gap: 6px; font-size: 16px; color: #f2f3f5; }
.gm-card-n img.emoji { width: 18px; height: 18px; }
.gm-card-s { font-size: 13px; color: #b5bac1; }
.gm-card-sep { height: 1px; margin: 4px 0; background: #3f4147; }
.gm-sock { display: flex; align-items: flex-start; gap: 10px; padding: 6px; margin: 0 -6px; border-radius: 4px; cursor: pointer; }
.gm-sock:hover { background: #35373c; }
.gm-sock.pick { background: #3a3c42; }
.gm-sock.over { background: #2d3a33; }
.gm-sock-ic { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #1e1f22; }
.gm-sock-ic img.emoji { width: 16px; height: 16px; }
.gm-sock.open .gm-sock-ic { background: none; border: 2px solid #4e5058; box-sizing: border-box; }
.gm-sock-m { min-width: 0; padding-top: 4px; }
.gm-sock-n { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.gm-sock.open .gm-sock-n { font-weight: 400; color: #80848e; }
.gm-sock-t { margin-top: 2px; font-size: 13px; line-height: 1.4; color: #b5bac1; }
body.gm-drag-gem .gm-sock { outline: 1px dashed #5865f2; outline-offset: -1px; }
.gm-off { align-self: flex-start; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: #949ba4; cursor: pointer; }
.gm-off:hover { color: #dbdee1; text-decoration: underline; }
.gm-drop { flex: 1; display: grid; place-items: center; border: 2px dashed #3f4147; border-radius: 6px; font-size: 14px; color: #80848e; }
.gm-drop.over, body.gm-drag-item .gm-drop { border-color: #5865f2; color: #dbdee1; }
@media (max-width: 760px) { .gm { grid-template-columns: 1fr; height: auto; } .gm-list { max-height: 220px; } .gm-bench { order: -1; } }

/* ---- Terra run on the map: Artifacts / Stat rolls / Boons buttons under the title, each with a list (dgRunOpen) */
.dg-run { position: absolute; z-index: 4; top: 58px; left: 20px; display: flex; flex-wrap: wrap; gap: 6px; max-width: min(560px, calc(100% - 40px)); }
.dg-run-debris { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid #f0b23240; border-radius: 4px; background: #1e1f22d9; font-size: 13px; }
.dg-run-debris[hidden] { display: none; }
.dg-run-debris .dg-run-dim { color: #b5bac1; font-weight: 500; }
.dg-run-debris b { color: #f0b232; font-weight: 700; }
.dg-run[hidden] { display: none; }
.dg-run-b { padding: 6px 12px; border: 1px solid #ffffff1f; border-radius: 4px; background: #1e1f22d9; color: #dbdee1; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.dg-run-b:hover { background: #2b2d31; color: #fff; }
.dg-run-b.on { background: #5865f2; border-color: #5865f2; color: #fff; }
.dg-run-pop { flex-basis: 100%; max-height: min(420px, 55vh); overflow-y: auto; padding: 6px; border-radius: 6px; background: #2b2d31f2; border: 1px solid #1e1f22; box-shadow: 0 8px 24px #0008; }
.dg-run-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 4px; }
.dg-run-row + .dg-run-row { border-top: 1px solid #3f4147; border-radius: 0; }
.dg-run-row .sh-ic img.emoji { width: 16px; height: 16px; margin-top: 2px; }
.dg-run-ic { width: 18px; text-align: center; }
.dg-run-m { flex: 1; min-width: 0; }
.dg-run-n { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dg-run-x { margin-left: auto; font-size: 12px; font-weight: 600; color: #949ba4; }
.dg-run-d { margin-top: 2px; font-size: 13px; line-height: 1.4; color: #b5bac1; white-space: pre-line; }
.dg-run-none { padding: 8px; font-size: 13px; color: #949ba4; }
.dg-run-q { position: sticky; top: -6px; z-index: 1; display: block; width: 100%; max-width: none; height: 32px; margin: -6px 0 6px; box-sizing: border-box; box-shadow: 0 0 0 6px #2b2d31; }
.dg-run-list .dg-run-row[hidden] { display: none; }

/* ---- a fighter's info card (click a unit in the arena): a Discord profile modal */
.u-click { cursor: pointer; }
.dg-unit .u-circle.u-click:hover { filter: brightness(1.12); }
.dg-unit .u-name.u-click:hover { text-decoration: underline; }
.fi-back { position: absolute; inset: 0; z-index: 60; background: #000a; display: grid; place-items: center; padding: 16px; animation: fifade .15s ease-out; }
@keyframes fifade { from { opacity: 0; } }
@keyframes fipop { from { transform: scale(.94); opacity: 0; } }
.fi { --side: #5865f2; position: relative; width: min(600px, 100%); max-height: min(760px, 100%); display: flex; flex-direction: column; background: #232428; color: #dbdee1; border-radius: 8px; overflow: hidden; box-shadow: 0 8px 24px #0009; font-family: var(--font); animation: fipop .18s cubic-bezier(.2,.9,.3,1.1); }
.fi.foe { --side: #da373c; }
.fi.ally { --side: #5865f2; }
.fi-banner { flex: none; height: 92px; background: var(--side); }
.fi-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #0006; color: #fff; display: grid; place-items: center; cursor: pointer; }
.fi-x:hover { background: #000a; }
.fi-avwrap { flex: none; height: 52px; padding-left: 16px; position: relative; }
.fi-av { position: absolute; top: -50px; width: 92px; height: 92px; border-radius: 50%; border: 6px solid #232428; background: color-mix(in srgb, var(--side) 70%, #1e1f22); display: grid; place-items: center; font-size: 38px; font-weight: 700; color: #fff; box-sizing: content-box; }
.fi-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.fi-turn { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; border-radius: 50%; background: #f0b232; border: 5px solid #232428; }
.fi-head { flex: none; padding: 4px 16px 12px; }
.fi-name { font-size: 20px; font-weight: 700; color: #f2f3f5; line-height: 1.25; }
.fi-sub { margin-top: 2px; font-size: 14px; color: #b5bac1; }
.fi-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fi-badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: #2e3035; color: #dbdee1; }
.fi-badge.turn { background: #f0b2322e; color: #f0b232; }
.fi-badge.down { background: #da373c2e; color: #fa777c; }
.fi-badge.pl { background: #5865f22e; color: #c9cdfb; }
.fi-load, .fi-none { padding: 12px 16px 20px; font-size: 14px; color: #949ba4; }
.fi-vitals { flex: none; margin: 0 16px 12px; padding: 12px; background: #111214; border-radius: 8px; display: flex; flex-direction: column; gap: 10px; }
.fi-bars { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
.fi-bk { font-size: 12px; font-weight: 700; color: #b5bac1; text-transform: uppercase; }
.fi-bar { position: relative; height: 20px; border-radius: 4px; background: #2e3035; overflow: hidden; }
.fi-bar-f { position: absolute; inset: 0 auto 0 0; background: #23a55a; transition: width .3s; }
.fi-bar.mid .fi-bar-f { background: #f0b232; }
.fi-bar.low .fi-bar-f { background: #da373c; }
.fi-bar.mp .fi-bar-f { background: #5865f2; }
.fi-bar span { position: relative; display: block; text-align: center; font-size: 12px; font-weight: 700; line-height: 20px; color: #fff; text-shadow: 0 1px 2px #000a; }
.fi-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fi-chip { flex: 1 1 80px; padding: 6px 10px; border-radius: 4px; background: #2b2d31; display: flex; flex-direction: column; gap: 1px; }
.fi-chip span { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #949ba4; }
.fi-chip b { font-size: 16px; color: #f2f3f5; }
.fi-tabs { flex: none; display: flex; gap: 24px; padding: 0 16px; border-bottom: 1px solid #3f4147; }
.fi-tab { position: relative; border: 0; background: none; padding: 10px 0 12px; font: 500 14px var(--font); color: #b5bac1; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.fi-tab:hover { color: #dbdee1; }
.fi-tab.on { color: #f2f3f5; }
.fi-tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: #f2f3f5; }
.fi-n { font-size: 12px; color: #949ba4; }
.fi-body { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 12px 16px 16px; scrollbar-width: thin; scrollbar-color: #1a1b1e transparent; }
.fi-sec + .fi-sec { margin-top: 16px; }
.fi-sec h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #b5bac1; }
.fi-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.fi-stat { background: #2b2d31; border-radius: 4px; padding: 6px 0 8px; display: flex; flex-direction: column; align-items: center; }
.fi-stat span { font-size: 11px; font-weight: 700; color: #949ba4; }
.fi-stat b { font-size: 18px; color: #f2f3f5; line-height: 1.3; }
.fi-stat i { font-style: normal; font-size: 12px; color: #b5bac1; }
.fi-list { display: flex; flex-direction: column; gap: 2px; }
.fi-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 4px; }
.fi-row:hover { background: #2e3035; }
.fi-row[hidden] { display: none; }
.fi-row-m { min-width: 0; flex: 1; }
.fi-row-t { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fi-row-t b { font-size: 15px; font-weight: 600; color: #f2f3f5; }
.fi-row-d { margin-top: 2px; font-size: 13px; line-height: 1.4; color: #b5bac1; }
.fi-tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: #1e1f22; color: #b5bac1; }
.fi-tag.c-bonus, .fi-tag.c-bonus_action { color: #f0b232; }
.fi-tag.c-free { color: #23a55a; }
.fi-tag.c-reaction { color: #c9cdfb; }
.fi-st-ic { flex: none; width: 32px; height: 32px; border-radius: 50%; background: #2b2d31; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #dbdee1; box-shadow: 0 0 0 2px #4e5058; }
.fi-st-ic.buff { box-shadow: 0 0 0 2px #23a55a; } .fi-st-ic.debuff { box-shadow: 0 0 0 2px #da373c; } .fi-st-ic.res { box-shadow: 0 0 0 2px #5865f2; }
.fi-st-ic img { width: 26px; height: 26px; object-fit: contain; }
.fi-row-t b.k-buff { color: #57d389; } .fi-row-t b.k-debuff { color: #fa777c; }
.fi-res { display: flex; flex-wrap: wrap; gap: 6px; }
.fi-pill { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 12px; font-size: 13px; background: #2b2d31; }
.fi-pill b { font-size: 12px; }
.fi-pill.weak b { color: #fa777c; } .fi-pill.resist b { color: #57d389; } .fi-pill.immune b { color: #c9cdfb; }
.fi-qwrap { position: sticky; top: -12px; z-index: 1; margin: -12px -16px 8px; padding: 12px 16px 4px; background: #232428; }
.fi-q { width: 100%; box-sizing: border-box; height: 32px; padding: 0 10px; border: 0; border-radius: 4px; background: #1e1f22; color: #dbdee1; font: 14px var(--font); outline: none; }
.fi-slot { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #949ba4; margin-bottom: 2px; }
.fi-gear { border-left: 3px solid var(--rc, #4e5058); border-radius: 0 4px 4px 0; }
.fi-gear .fi-gname { color: var(--rc, #f2f3f5); }
.fi-gear.r-very-rare { --rc: #b06bff; } .fi-gear.r-mythical { --rc: #ff4d4d; }
@media (max-width: 520px) { .fi-stats { grid-template-columns: repeat(3, 1fr); } .fi-tabs { gap: 16px; } }

/* the left bar's hover names (Discord's server tooltip) */
.rail-tip { position: fixed; z-index: 2000; transform: translateY(-50%); max-width: 260px; padding: 8px 12px; border-radius: 6px; background: #111214; color: #dbdee1; box-shadow: 0 8px 16px #0006; pointer-events: none; display: flex; flex-direction: column; gap: 2px; animation: railtip .1s ease-out; }
.rail-tip::before { content: ""; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; background: #111214; transform: translateY(-50%) rotate(45deg); border-radius: 1px; }
.rail-tip b { font: 600 16px/1.25 var(--font); color: #f2f3f5; }
.rail-tip span { font: 400 13px/1.3 var(--font); color: #b5bac1; }
@keyframes railtip { from { opacity: 0; transform: translate(-4px, -50%) scale(.96); } }

/* ---- Profile pop-up: Class tab */
.cls { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 8px; color: #dbdee1; }
.cls-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #2b2d31; border-radius: 8px; }
.cls-top-m { flex: 1; min-width: 0; }
.cls-who { font-size: 18px; font-weight: 700; color: #f2f3f5; }
.cls-line { font-size: 14px; color: #b5bac1; margin-top: 2px; }
.cls-line b { color: #f2f3f5; font-weight: 600; }
.cls-note { padding: 8px 12px; border-radius: 6px; background: #f0b2321f; color: #f0b232; font-size: 14px; }
.cls-h { margin: 6px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #b5bac1; }
.cls-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cls-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid #3f4147; border-radius: 6px; background: #2b2d31; color: #dbdee1; text-align: left; font: inherit; cursor: pointer; }
.cls-opt:hover:not(:disabled) { background: #35373c; border-color: #5865f2; }
.cls-opt:disabled { cursor: default; opacity: .7; }
.cls-opt.on { border-color: #5865f2; opacity: 1; }
.cls-opt b { font-size: 15px; color: #f2f3f5; display: flex; gap: 6px; align-items: center; }
.cls-opt span { font-size: 12px; color: #949ba4; }
.cls-opt i { font-style: normal; font-size: 11px; font-weight: 700; color: #949cf7; text-transform: uppercase; }
.cls-sec { background: #2b2d31; border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.cls-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cls-sec-h b { font-size: 16px; color: #f2f3f5; }
.cls-dim { color: #949ba4; font-size: 13px; font-weight: 400; }
.cls-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: #1e1f22; color: #b5bac1; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.cls-tag.on { background: #5865f2; color: #fff; }
.cls-subh { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: #b5bac1; margin-top: 4px; }
.cls-subh b { text-transform: none; font-size: 14px; color: #f2f3f5; }
.cls-subh .cls-dim { text-transform: none; }
.cls-link { margin-left: auto; border: 0; background: none; color: #00a8fc; font: 500 13px var(--font); cursor: pointer; text-transform: none; }
.cls-link:hover:not(:disabled) { text-decoration: underline; }
.cls-subs { display: flex; flex-direction: column; gap: 4px; }
.cls-subo { border-radius: 6px; background: #232428; border: 1px solid transparent; }
.cls-subo.mine { border-color: #5865f2; }
.cls-subo-h { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.cls-subo-h:hover { background: #2e3035; border-radius: 6px; }
.cls-chev { flex: none; width: 12px; color: #949ba4; font-size: 18px; line-height: 1; transition: transform .15s; }
.cls-chev.on { transform: rotate(90deg); }
.cls-subo-m { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cls-subo-m b { font-size: 15px; color: #f2f3f5; }
.cls-subo-m span { font-size: 13px; color: #b5bac1; }
.cls-subo .dg-btn { flex: none; }
.cls-subo-f { padding: 0 10px 10px 32px; display: flex; flex-direction: column; gap: 6px; }
.cls-choice { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cls-seg { display: inline-flex; background: #1e1f22; border-radius: 6px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.cls-seg button { border: 0; border-radius: 4px; background: none; color: #b5bac1; padding: 5px 10px; font: 500 13px var(--font); cursor: pointer; }
.cls-seg button:hover:not(:disabled) { background: #35373c; color: #f2f3f5; }
.cls-seg button.on { background: #5865f2; color: #fff; cursor: default; }
.cls-fs { display: flex; flex-direction: column; gap: 2px; }
.cls-f { display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 4px; }
.cls-f:hover { background: #2e3035; }
.cls-f b { font-size: 14px; color: #f2f3f5; font-weight: 600; }
.cls-f.later { opacity: .55; }
.cls-lv { flex: none; min-width: 40px; margin-top: 1px; padding: 1px 0; border-radius: 3px; background: #1e1f22; color: #b5bac1; font-size: 11px; font-weight: 700; text-align: center; }
.cls-ft { font-size: 13px; line-height: 1.4; color: #b5bac1; }
.cls-more { align-self: flex-start; border: 0; background: none; color: #00a8fc; font: 500 13px var(--font); cursor: pointer; padding: 2px 0; }
.cls-more:hover { text-decoration: underline; }

/* Shop selling tray */
.sell-layout { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(330px, 1.35fr); gap: 12px; height: min(550px, 68vh); }
.sell-area { min-width: 0; }
.sell-inventory .gm-row { flex: none; }
.sell-muted { opacity: .5; cursor: default; }
.sell-all { padding: 4px 8px; font-size: 12px; }
.sell-fill, .sell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sell-fill .dg-btn { padding: 5px 8px; font-size: 12px; }
.sell-tray { flex: 1; min-height: 140px; overflow-y: auto; border: 2px dashed #3f4147; border-radius: 6px; padding: 6px; }
.sell-tray.over, .sell-inventory.over { border-color: #5865f2; background: #323544; }
.sell-empty { min-height: 160px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #949ba4; text-align: center; }
.sell-empty small { font-size: 12px; }
.sell-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 4px; background: #313338; margin-bottom: 4px; cursor: grab; }
.sell-row .sh-amt { width: 58px; }
.sell-total { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px; border-top: 1px solid #3f4147; }
.sell-actions { justify-content: flex-end; }
@media (max-width: 760px) { .sell-layout { grid-template-columns: 1fr; height: auto; } .sell-inventory { max-height: 240px; } .sell-tray { max-height: 300px; } }

/* Inventory lock selection */
.inv-sort.on { background: #5865f2; }
.inv-sort:disabled { opacity: .4; cursor: default; }
.inv-lock-yes { color: #3ba55c; font-size: 23px; }
.inv-lock-no { color: #ed4245; }
.inv-lock-count { align-self: center; color: #b5bac1; font-size: 13px; }
.inv-lock-badge, .inv-lock-mark { position: absolute; bottom: 3px; right: 3px; font-size: 13px; border-radius: 4px; background: #1e1f22; line-height: 18px; padding: 0 2px; pointer-events: none; }
.inv-lock-mark { left: 3px; right: auto; background: #5865f2; }
.inv-card.lock-selectable { cursor: pointer; touch-action: none; user-select: none; }
.inv-card.lock-selected { outline: 3px solid #5865f2; outline-offset: 3px; background: linear-gradient(160deg, #424b78, #30364d); }
.inv.lock-mode .inv-grid { touch-action: none; }
.inv-lock-marquee { position: fixed; z-index: 1100; pointer-events: none; border: 1px solid #8791ff; background: rgba(88,101,242,.2); }

.rail [data-rail] { flex: none; }
.rail [data-rail] .guild-icon { cursor: grab; }
.rail [data-rail] .guild-icon:active { cursor: grabbing; }
.rail .rail-dragging { opacity: .4; }

/* Shared field suggestions */
.mp-ac { position: fixed; z-index: 4000; max-height: 280px; overflow-y: auto; padding: 5px; background: #111214; border: 1px solid #3f4147; border-radius: 7px; box-shadow: 0 8px 24px #0008; box-sizing: border-box; }
.mp-ac-row { display: flex; gap: 12px; align-items: center; min-height: 34px; padding: 6px 9px; cursor: pointer; border-radius: 4px; box-sizing: border-box; }
.mp-ac-row:hover, .mp-ac-row.selected { background: #404249; }
.mp-ac-name { color: #f2f3f5; font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.mp-ac-desc { margin-left: auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #949ba4; }

/* ---- `attack` pop-up: the arrow image, a timer, and the key input right below it */
.pv.atk { width: min(860px, 100%); }
.atk-body { padding: 4px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.atk-timer { width: 100%; height: 6px; border-radius: 3px; background: #1e1f22; overflow: hidden; }
.atk-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #f23f43, #f0b232 40%, #23a55a); transition: width .1s linear; }
.atk-stage { position: relative; width: 100%; border-radius: 8px; overflow: hidden; background: #202225; }
.atk-img, .atk-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.atk-row { width: 100%; max-width: 640px; display: flex; gap: 10px; align-items: stretch; }
.atk-input { flex: 1; min-height: 46px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 8px;
  background: var(--bg-tertiary, #1e1f22); border: 2px solid #5865f2; outline: none; font-size: 22px; font-weight: 700; color: #dbdee1; }
.atk-ph { font-size: 14px; font-weight: 400; color: #80848e; }
.atk-k { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: #2b2d31; transition: background .15s, color .15s; }
.atk-k.good { background: #23a55a; color: #fff; animation: atk-pop .38s ease-out; }
.atk-k.bad { background: #f23f43; color: #fff; }
@keyframes atk-pop { 0% { transform: scale(1.35); box-shadow: 0 0 14px #23a55a; } 100% { transform: scale(1); box-shadow: none; } }
.atk-input.failed { border-color: #f23f43; background: rgba(242,63,67,.12); justify-content: center; animation: atk-shake .35s; }
.atk-input.cleared { border-color: #23a55a; background: rgba(35,165,90,.12); justify-content: center; }
.atk-input.timeout { border-color: #80848e; justify-content: center; }
.atk-msg { font-size: 20px; letter-spacing: .12em; }
.atk-input.failed .atk-msg { color: #f23f43; } .atk-input.cleared .atk-msg { color: #23a55a; } .atk-input.timeout .atk-msg { color: #b5bac1; }
@keyframes atk-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.atk-pad { display: flex; gap: 4px; }
.atk-padkey { width: 40px; border: 0; border-radius: 6px; background: #2b2d31; color: #dbdee1; font-size: 18px; cursor: pointer; }
.atk-padkey:hover:not(:disabled) { background: #3a3c42; }
.atk-padkey:disabled { opacity: .35; cursor: default; }
.atk-hint { font-size: 12px; color: var(--text-muted, #949ba4); }
#atk { transition: opacity 1.2s ease; }
#atk.fading { opacity: 0; pointer-events: none; }
#atk.fading .pv { transform: scale(.97); transition: transform 1.2s ease; }
/* the chat behind (with the same arrows in the attack message) mustn't show through */
#atk.pv-back { background: rgba(10,11,13,.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ---- The dodge box (dodge.js): fullscreen, the canvas scaled to fit with its pixels kept crisp */
.dodge-back { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.72); display: flex; align-items: center; justify-content: center; }
.dodge-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(100vw, calc((100vh - 40px) * 4 / 3)); }
.dodge-cv { width: 100%; height: auto; aspect-ratio: 4 / 3; display: block; image-rendering: auto; }
.dodge-help { color: #6d7280; font-size: 13px; }

/* ---- Skill banner over an attacker (skillbar.js): emblem with the to-hit total, the action's name on a slanted ribbon, a die per hit */
.sb { position: absolute; z-index: 34; pointer-events: none; transform: translate(-30%, -100%) translateX(calc((1 - var(--sb-in, 1)) * -26px)); filter: drop-shadow(0 3px 4px #000b);
  --sb-font: "Excelsior Sans", "Arial Black", "Segoe UI Black", Impact, sans-serif; font-family: var(--sb-font); white-space: nowrap; }
.sb-row { display: flex; align-items: center; }
.sb-emb { position: relative; width: 74px; height: 74px; flex: none; z-index: 2; }
/* the game's art: a white heptagon (fill.png) under a flame frame (frame.png), both tinted by the damage type(s) */
.sb-art { position: absolute; left: -5px; top: -21px; width: 88px; height: 100.5px; isolation: isolate; }
.sb-art > * { position: absolute; inset: 0; -webkit-mask: var(--m) center / 100% 100% no-repeat; mask: var(--m) center / 100% 100% no-repeat; }
.sb-fill { --m: url(sb_fill.png); background: radial-gradient(circle at 48% 52%, #2b2b30 0%, #131316 55%, var(--sb-dark) 100%); }
.sb-frame { --m: url(sb_frame.png); background: url(sb_frame.png) center / 100% 100% no-repeat; }
.sb-tint { --m: url(sb_frame.png); background: var(--sb-grad-d); mix-blend-mode: multiply; }
.sb-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-top: 6px; font-size: 54px; line-height: 1; font-weight: 400; color: #fff; letter-spacing: 0; text-indent: 0;
  -webkit-text-stroke: 1.3px currentColor; filter: drop-shadow(1.5px 0 0 var(--sb-edge)) drop-shadow(-1.5px 0 0 var(--sb-edge)) drop-shadow(0 1.5px 0 var(--sb-edge)) drop-shadow(0 -1.5px 0 var(--sb-edge)) drop-shadow(0 2px 1px #000a); }
.sb-num.spin { opacity: .8; transform: scale(.92); }
.sb.landed .sb-num { animation: sb-numpop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes sb-numpop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
/* the to-hit modifier, on a small flat plate shaped like the nameplate, centred above the emblem (the plate is a ::before, so
   the number can be bigger than it without being clipped) */
.sb-bonus::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--sb-grad); clip-path: polygon(0 20%, calc(100% - 9px) 0, 100% 100%, 0 100%); }
.sb-bonus { position: absolute; left: 50%; transform: translateX(-50%); top: -27px; height: 22px; padding: 3px 13px 0 9px; box-sizing: border-box; display: flex; align-items: center; font-size: 25.5px; line-height: 1; font-weight: 400; color: #f6eedb; z-index: -1;
  text-shadow: -1.5px -1.5px 0 var(--sb-dark), 1.5px -1.5px 0 var(--sb-dark), -1.5px 1.5px 0 var(--sb-dark), 1.5px 1.5px 0 var(--sb-dark); }
/* a plain flat bar in the skill's colour that runs out from behind the emblem: its top edge rises toward the right and its right end slants out to the bottom corner */
.sb-rib { position: relative; align-self: flex-start; margin: 9px 0 0 -18px; height: 32px; padding: 5px 60px 0 26px; box-sizing: border-box; display: flex; align-items: center; background: var(--sb-grad);
  clip-path: polygon(0 18%, calc(100% - 22px) 0, 100% 100%, 0 100%); }
.sb-name { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-size: 20px; font-weight: 400; color: #f6eedb; letter-spacing: 1px;
  text-shadow: -1.5px -1.5px 0 var(--sb-dark), 1.5px -1.5px 0 var(--sb-dark), -1.5px 1.5px 0 var(--sb-dark), 1.5px 1.5px 0 var(--sb-dark), 0 1.5px 0 var(--sb-dark), 1.5px 0 0 var(--sb-dark), -1.5px 0 0 var(--sb-dark), 0 -1.5px 0 var(--sb-dark); }
.sb-dice { display: flex; gap: 3px; margin: 0 0 -1px 84px; height: 18px; align-items: flex-end; }
/* the dice are the arena's to-hit die in small: a hexagon with a rim (::before) and a face (::after); the die itself is
   left unclipped so its glow isn't cut off */
.sb-die { position: relative; width: 15px; height: 16px; display: flex; align-items: center; justify-content: center;
  --hex: polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%); --rim: #6e3f14; --face: #6e3f14; }
.sb-die::before, .sb-die::after { content: ""; position: absolute; clip-path: var(--hex); }
.sb-die::before { inset: 0; background: var(--rim); }
.sb-die::after { inset: 1.5px; background: var(--face); }
.sb-die i { position: relative; z-index: 1; font-style: normal; font-size: 10px; line-height: 1; font-weight: 400; color: #fff; font-family: var(--sb-font); }
.sb-die.rolling { transform: rotate(var(--sb-spin, 0deg)) scale(1.15); }
.sb-die.done { filter: drop-shadow(0 0 3px #ffd400); animation: sb-diepop .3s cubic-bezier(.2,1.6,.4,1);
  --rim: #ffd21f; --face: #ffd21f; }
.sb-die.done i { color: #2a1900; }
.sb-die.missed { --rim: #4a4d55; --face: #4a4d55; }
.sb-die.missed i { color: #ff8a8a; }
@keyframes sb-diepop { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }

/* the Skill Tree rail button's hover sub-button (🎯 Hunt, once Monster Hunter is learned) and the Hunt pop-up */
.pill-wrap.has-sub { flex-wrap: wrap; row-gap: 6px; }
.pill-wrap.has-sub .pill { top: 24px; }
.rail-sub { display: none; flex-basis: 100%; max-width: 32px; width: 32px; height: 32px; margin: 0 20px; border: 0; border-radius: 50%; padding: 0; background: var(--bg-primary); color: var(--text); font-size: 15px; cursor: pointer; align-items: center; justify-content: center; transition: border-radius .2s, background-color .2s; }
.rail-sub:hover { border-radius: 11px; background: var(--blurple); }
.pill-wrap.hunt-on:hover .rail-sub { display: flex; animation: railsub .15s ease-out; }
@keyframes railsub { from { opacity: 0; transform: translateY(-6px) scale(.8); } }
.pv.hu { width: min(620px, 94vw); }
.hu-status { padding: 10px 12px; margin-bottom: 14px; border-radius: 8px; background: var(--bg-secondary); line-height: 1.45; }
.hu-group { margin-bottom: 14px; }
.hu-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.hu-head span { font-size: 12px; color: var(--text-muted); }
.hu-note { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.hu-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hu-pick { border: 1px solid var(--bg-tertiary); background: var(--bg-secondary); color: var(--text); border-radius: 6px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.hu-pick:hover { background: var(--bg-hover); }
.hu-pick.on { background: var(--blurple); border-color: var(--blurple); color: #fff; cursor: default; }

/* the Drifting Market's fusion table */
.mk-fz-b { margin-top: auto; border: 1px solid #5865f266; border-radius: 6px; padding: 8px 10px; }
.mk-fz-b.on { background: #5865f22e; color: #fff; }
.fz { display: flex; flex-direction: column; gap: 14px; }
.fz-top { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 8px; background: #1e1f22; border: 1px solid #ffffff12; }
.fz-title { font-size: 14px; }
.fz-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.fz-slot { min-height: 46px; display: flex; align-items: center; justify-content: center; padding: 4px 6px; border-radius: 6px; border: 1px dashed #4e5058; background: none; font: inherit; font-size: 12px; color: #dbdee1; text-align: center; }
.fz-slot.full { border: 1px solid var(--rc, #4e5058); background: #2b2d31; cursor: pointer; }
.fz-slot.full:hover { background: #3a2a2d; border-color: #f23f43; }
.fz-slot .fz-chip { flex-direction: column; gap: 2px; }
.fz-chip { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.fz-name { overflow: hidden; text-overflow: ellipsis; color: var(--rc, #dbdee1); font-weight: 600; }
.fz-ic { display: inline-flex; width: 16px; height: 16px; flex: none; }
.fz-ic img, .fz-ic .emoji { width: 16px; height: 16px; }
.fz-prev { font-size: 13px; color: #b5bac1; }
.fz-prev.ok { color: #57f287; }
.fz-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.fz-sec { display: flex; flex-direction: column; gap: 6px; }
.fz-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #949ba4; }
.fz-recipe { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-left: 3px solid var(--rc, #4e5058); border-radius: 4px; background: #2b2d31; color: #dbdee1; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.fz-recipe:hover { background: #35373c; }
.fz-recipe b { color: var(--rc, #fff); white-space: nowrap; }
.fz-have { display: flex; flex-wrap: wrap; gap: 6px; }
.fz-add { display: inline-flex; padding: 5px 9px; border: 1px solid #ffffff14; border-radius: 6px; background: #2b2d31; color: #dbdee1; font: inherit; font-size: 13px; cursor: pointer; }
.fz-add:hover:not(:disabled) { background: #35373c; border-color: var(--rc, #4e5058); }
.fz-add:disabled { opacity: .45; cursor: not-allowed; }
.fz-n { color: #949ba4; font-size: 12px; }

/* the market's fusion view (two panels: your artifacts | the slots around the result) */
.mk-body.fz-body { display: block; padding: 12px 16px 14px; }
.fz2-top { display: flex; justify-content: flex-start; margin-bottom: 10px; }
.fz2-wait .pv-wait { padding: 40px 0; }
.fz2 { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 14px; }
.fz-panel { display: flex; flex-direction: column; min-height: 0; border: 1px solid #ffffff14; border-radius: 10px; background: #1e1f22; padding: 10px 12px 12px; }
.fz-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.fz-ph .mk-dim { font-size: 12px; }
.fz-link { border: 0; background: none; color: #00a8fc; font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.fz-link:hover { text-decoration: underline; }
.fz-grid { display: grid; grid-template-columns: repeat(auto-fill, 72px); gap: 12px 10px; align-content: start; padding: 8px 6px 6px; height: 360px; overflow-y: auto; }
.fz-gh { grid-column: 1 / -1; font-size: 11px; font-weight: 700; text-transform: uppercase; color: #949ba4; margin-top: 4px; }
.fz-card { width: 72px; height: 72px; cursor: grab; user-select: none; }
.fz-card .inv-name { font-size: 11px; }
.fz-card .fz-glyph { display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--rc); background: #1e1f22; border-radius: 50%; border: 1px solid var(--rc); }
.fz-card.dim { cursor: default; }
.fz-left.drag-out, .fz2.drag-out .fz-left { outline: 2px dashed #f23f4380; outline-offset: -2px; }
.fz-left.over { background: #2b1e21; }
.fz-ring { position: relative; width: 260px; height: 240px; margin: 4px auto 6px; }
.fz-slot2 { position: absolute; width: 68px; height: 68px; border-radius: 10px; border: 2px dashed #4e5058; background: #2b2d31; display: flex; align-items: center; justify-content: center; transition: border-color .15s, background-color .15s, transform .15s; }
.fz2.drag-in .fz-slot2 { border-color: #5865f2; }
.fz-slot2.over { background: #5865f233; transform: scale(1.08); }
.fz-slot2.full { border: 0; background: none; }
.fz-card.slot { width: 68px; height: 68px; cursor: pointer; }
.fz-slot2.full .fz-card.slot:hover { border-color: #f23f43; }
.fz-result { position: absolute; left: 92px; top: 80px; width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid #4e5058; background: radial-gradient(circle, #2b2d31, #1e1f22); }
.fz-result.ok { border-color: #57f287; box-shadow: 0 0 18px #57f28755; }
.fz-result.bad { border-color: #f23f4399; }
.fz-result .fz-card.slot { border-radius: 50%; width: 68px; height: 68px; cursor: help; }
.fz-result .fz-card .inv-name { font-size: 10px; padding: 0 6px; }
.fz-res-empty { font-size: 22px; color: #6d6f78; font-weight: 700; }
.fz-result.bad .fz-res-empty { color: #f23f43; }
.fz-right .fz-prev { text-align: center; min-height: 34px; font-size: 12.5px; }
.fz-btns2 { display: flex; gap: 8px; justify-content: center; }
.fz-btns2 .dg-btn { flex: 1; padding-left: 6px; padding-right: 6px; }
.fz-btns2 .dg-btn.on { background: #5865f2; }
.fz-rlist { height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.fz-rrow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #2b2d31; border: 1px solid transparent; }
.fz-rrow.can { border-color: #57f28766; }
.fz-rmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.fz-arrow { color: #949ba4; font-size: 16px; flex: none; }
.fz-rin { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.fz-card.sm { width: 54px; height: 54px; cursor: help; padding: 2px; }
.fz-card.sm .inv-name { font-size: 9px !important; -webkit-line-clamp: 3; }
.fz-card.sm .inv-rar { width: 16px; height: 16px; left: -5px; top: -5px; }
.fz-card.sm .inv-count { font-size: 10px; right: 3px; }
.fz-fill { flex: none; }
.fz-generic { font-size: 12px; color: #949ba4; padding: 6px 2px; }
.fz-tip { position: fixed; z-index: 3000; max-width: 280px; padding: 9px 12px; border-radius: 8px; background: #111214; border: 1px solid #ffffff14; box-shadow: 0 8px 20px #000a; pointer-events: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: #dbdee1; }
.fz-tip b { font-size: 14px; color: #f2f3f5; }
.fz-tip-r { font-size: 11px; color: #949ba4; text-transform: uppercase; font-weight: 700; }
.fz-tip-n { font-size: 11.5px; color: #949ba4; }
.fz-card .inv-name { word-break: normal; overflow-wrap: anywhere; hyphens: auto; font-size: 10.5px; line-height: 1.2; }
.fz-card.slot .inv-name { font-size: 10px; }
.fz-card { padding: 4px 3px 5px; }
.fz-card .inv-name { overflow-wrap: break-word; }
.fz-result { left: 86px; top: 74px; width: 88px; height: 88px; }
.fz-result .fz-card.slot { width: 80px; height: 80px; }
.fz-result .fz-card .inv-name { font-size: 10.5px; padding: 0 8px; }
.fz-result { border-radius: 12px; background: #2b2d31; }
.fz-result .fz-card.slot { border-radius: 8px; }
.fz-result { left: 99px; top: 87px; width: 62px; height: 62px; }
.fz-result .fz-card.slot { width: 56px; height: 56px; }
.fz-result .fz-card .inv-name { font-size: 9.5px; padding: 0 3px; }
.fz-result .fz-card .inv-rar { width: 16px; height: 16px; left: -5px; top: -5px; }
.fz-result .fz-card.slot { padding: 2px 1px; }
.fz-result .fz-card .inv-name { padding: 0; font-size: 9px; overflow-wrap: normal; }
.fz-result { top: 78px; }   /* halfway between the top slot and the bottom two (the ring's middle, not its geometric center) */
