:root {
  --night: #121214; --panel: #161618; --raised: #222226; --line: #2a2a2e;
  --ember: #ff6b35; --glow: #ffb347; --vacant: #4ade80; --occupied: #f87171;
  --text: #ededed; --muted: #a1a1aa;
  font-family: Inter, system-ui, sans-serif; color: var(--text); background: var(--night);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: var(--text); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--occupied); min-height: 1.2em; margin: 0; font-size: 14px; }

/* Auth */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px; }
.auth-logo { width: 120px; align-self: center; }
.wordmark { margin: 0; text-align: center; font: 800 40px/1 Montserrat, sans-serif; letter-spacing: .02em; }
.auth-card p { text-align: center; margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-card input, dialog input { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); outline: none; }
.auth-card input:focus, dialog input:focus { border-color: var(--ember); }
.primary { height: 42px; border: 0; border-radius: 10px; background: var(--ember); color: var(--night); font-weight: 700; }
.primary:hover { filter: brightness(1.08); }
.link { background: none; border: 0; color: var(--glow); font-size: 14px; }

/* Layout */
.app { display: flex; height: 100vh; }
.rail { width: 72px; flex: 0 0 72px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; }
.home { width: 60px; height: 60px; border: 0; border-radius: 14px; background: var(--raised); padding: 2px; }
.home img { width: 100%; height: 100%; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 1px; }
.guild-list { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.rail-btn, .guild { width: 48px; height: 48px; border: 0; border-radius: 24px; background: var(--raised); font-weight: 600; transition: border-radius .15s, background .15s; position: relative; }
.rail-btn:hover, .guild:hover { border-radius: 16px; }
.guild.active { border-radius: 16px; background: var(--ember); color: var(--night); }
.guild.active::before { content: ""; position: absolute; left: -12px; top: 4px; width: 4px; height: 40px; border-radius: 0 4px 4px 0; background: var(--text); }
.rail-btn.add, .rail-btn.join { color: var(--vacant); font-size: 22px; display: grid; place-items: center; }

.sidebar { width: 240px; flex: 0 0 240px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar-head { height: 56px; padding: 0 12px 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 700; }
.channels { flex: 1; overflow-y: auto; padding: 16px 8px; }
.section-label { display: flex; justify-content: space-between; align-items: center; padding: 12px 8px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.channel { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--muted); text-align: left; }
.channel:hover { background: var(--raised); color: var(--text); }
.channel.active { background: var(--raised); color: var(--text); font-weight: 600; }
.channel.voice { cursor: default; }
.channel .soon { margin-left: auto; font-size: 11px; color: var(--muted); }
.icon-btn { border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn.small { width: 20px; height: 20px; font-size: 16px; }
.user-panel { height: 60px; padding: 0 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.me { flex: 1; min-width: 0; line-height: 1.2; }
.me-name { font-weight: 600; font-size: 14px; }
.me-status { font-size: 12px; color: var(--vacant); }

.avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--night); }

.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head { height: 56px; flex: 0 0 56px; padding: 0 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.hash { color: var(--muted); font-size: 20px; }
#channel-name { font-weight: 600; }
.divider { width: 1px; height: 22px; background: var(--line); }
.topic { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--occupied); }
.conn.up { background: var(--vacant); }

.messages { flex: 1; overflow-y: auto; padding: 16px 0; display: flex; flex-direction: column; }
.messages .empty { margin: auto; text-align: center; color: var(--muted); }
.msg { display: flex; gap: 14px; padding: 4px 16px; }
.msg:hover { background: #ffffff06; }
.msg.first { margin-top: 12px; }
.msg .avatar { width: 40px; height: 40px; flex-basis: 40px; }
.msg .gutter { width: 40px; flex: 0 0 40px; }
.msg-body { min-width: 0; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; }
.msg-time { font-size: 12px; color: var(--muted); }
.msg-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.msg-text a { color: var(--glow); }
.msg-text code { font-family: "JetBrains Mono", monospace; font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

.composer { display: flex; gap: 8px; margin: 0 16px 16px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.composer input { flex: 1; border: 0; outline: none; background: none; height: 40px; font-size: 15px; }
.send { width: 40px; border: 0; border-radius: 10px; background: var(--ember); color: var(--night); display: grid; place-items: center; }

.members { width: 220px; flex: 0 0 220px; background: var(--panel); border-left: 1px solid var(--line); padding: 8px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.member .avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--raised); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(360px, 90vw); }
dialog::backdrop { background: #0009; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0; font-size: 18px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; }
.ghost { height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--text); font-weight: 600; }
.ghost:hover { border-color: var(--muted); }
.ghost.danger { color: var(--occupied); }
dialog .ghost { height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: none; }
dialog .primary { padding: 0 16px; }

@media (max-width: 900px) { .members { display: none; } }
@media (max-width: 640px) { .sidebar { width: 180px; flex-basis: 180px; } }

/* ---- Round 2: composer, messages, menus, dialogs ---- */
.composer-wrap { margin: 0 16px 6px; }
.composer { margin: 0; align-items: flex-end; padding: 6px; }
.composer textarea { flex: 1; resize: none; border: 0; outline: none; background: none; color: var(--text); font: 15px/1.45 Inter, sans-serif; padding: 9px 4px; max-height: 200px; }
.tool { width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); display: grid; place-items: center; }
.tool:hover { background: var(--raised); color: var(--text); }
.tool.gif { font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.send { height: 36px; align-self: flex-end; }
.typing { height: 20px; font-size: 12px; color: var(--muted); padding: 2px 4px; }
.reply-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: var(--raised); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; font-size: 13px; color: var(--muted); }
.reply-bar strong { color: var(--text); }
.pending-files { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px; background: var(--raised); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; }
.reply-bar + .pending-files { border-radius: 0; }
.chip { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.chip button { border: 0; background: none; color: var(--muted); }

.msg { position: relative; }
.msg.highlight { background: #ff6b3512; box-shadow: inset 2px 0 0 var(--ember); }
.msg.mentions-me { background: #ffb34710; box-shadow: inset 2px 0 0 var(--glow); }
.msg-actions { position: absolute; right: 16px; top: -14px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; z-index: 2; }
.msg:hover .msg-actions, .msg-actions.open { display: flex; }
.msg-actions button { width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); display: grid; place-items: center; font-size: 15px; }
.msg-actions button:hover { background: var(--raised); color: var(--text); }
.msg-actions button.danger:hover { color: var(--occupied); }
.reply-ref { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-left: 54px; padding: 4px 16px 0; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-ref strong { color: var(--glow); font-weight: 600; }
.edited { font-size: 11px; color: var(--muted); margin-left: 4px; }
.edit-box { width: 100%; margin-top: 4px; }
.edit-box textarea { width: 100%; min-height: 40px; resize: vertical; background: var(--panel); border: 1px solid var(--ember); border-radius: 8px; color: var(--text); font: 15px/1.45 Inter, sans-serif; padding: 8px; outline: none; }
.edit-hint { font-size: 12px; color: var(--muted); }
.mention { color: var(--ember); background: #ff6b3526; border-radius: 4px; padding: 0 3px; font-weight: 500; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.reaction { display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); font-size: 14px; }
.reaction.me { border-color: var(--ember); background: #ff6b3526; }
.reaction .count { font-size: 12px; font-weight: 600; color: var(--muted); }
.reaction.me .count { color: var(--text); }

.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; align-items: flex-start; }
.attachments img, .attachments video, .embed-image img { max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.file-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); max-width: 420px; }
.file-card a { color: var(--glow); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.file-card .size { font-size: 12px; color: var(--muted); }

.embed { margin-top: 6px; max-width: 460px; border-left: 3px solid var(--ember); background: var(--panel); border-radius: 0 8px 8px 0; padding: 10px 12px; display: grid; gap: 4px; }
.embed .site { font-size: 12px; color: var(--muted); }
.embed .title { color: var(--glow); font-weight: 600; text-decoration: none; }
.embed .title:hover { text-decoration: underline; }
.embed .desc { font-size: 14px; color: var(--text); opacity: .85; }
.embed img { max-width: 100%; max-height: 240px; border-radius: 6px; margin-top: 4px; }
.embed-image { margin-top: 6px; }

.channel { position: relative; }
.channel.unread { color: var(--text); font-weight: 600; }
.channel.unread::before { content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.guild .badge { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ember); border: 3px solid var(--panel); }

.member-group { padding: 14px 8px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.member { cursor: default; }
.member:hover { background: var(--raised); }
.member .info { min-width: 0; line-height: 1.2; }
.member .sub { font-size: 12px; color: var(--muted); }
.member .crown { color: var(--glow); font-size: 12px; margin-left: 4px; }
.member.timed-out .sub { color: var(--occupied); }

/* Context menus and popovers */
.menu { position: fixed; z-index: 50; min-width: 200px; max-width: 280px; background: #18181b; border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px #0008; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font-size: 14px; text-align: left; }
.menu button:hover:not(:disabled), .menu button.open { background: var(--ember); color: var(--night); }
.menu button.danger { color: var(--occupied); }
.menu button.danger:hover { background: var(--occupied); color: var(--night); }
.menu button:disabled { color: #5a5a60; cursor: default; }
.menu .sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu .quick { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .quick button { width: 34px; height: 34px; justify-content: center; padding: 0; font-size: 18px; }
.menu .quick button:hover { background: var(--raised); }
.menu .check { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--muted); display: inline-grid; place-items: center; font-size: 11px; }
.menu .check.on { background: var(--ember); border-color: var(--ember); color: var(--night); }
.menu .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }

.popover { position: fixed; z-index: 40; background: #18181b; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #0008; padding: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; }
.emoji-grid button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; font-size: 20px; }
.emoji-grid button:hover { background: var(--raised); }
.gif-panel { width: 420px; max-width: 92vw; display: flex; flex-direction: column; gap: 8px; }
.gif-panel input { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); outline: none; }
.gif-grid { columns: 2; column-gap: 6px; height: 360px; overflow-y: auto; }
.gif-grid img { width: 100%; border-radius: 6px; margin-bottom: 6px; cursor: pointer; display: block; break-inside: avoid; }
.gif-grid img:hover { outline: 2px solid var(--ember); }
.gif-credit { font-size: 11px; color: var(--muted); text-align: right; }

.drop-overlay { position: fixed; inset: 0; z-index: 60; background: #121214cc; display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { padding: 40px 60px; border: 2px dashed var(--ember); border-radius: 20px; font-size: 20px; font-weight: 700; color: var(--ember); }

.lightbox { position: fixed; inset: 0; z-index: 70; background: #000d; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }

/* Settings dialogs */
dialog.settings { width: min(860px, 95vw); height: min(640px, 90vh); padding: 0; }
dialog.settings[open] { display: flex; }
.settings-nav { width: 200px; flex: 0 0 200px; background: var(--night); padding: 16px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.settings-nav h3 { margin: 4px 8px 8px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.settings-nav button { text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.settings-nav button:hover { background: var(--raised); color: var(--text); }
.settings-nav button.active { background: var(--raised); color: var(--text); font-weight: 600; }
.settings-main { flex: 1; min-width: 0; padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.settings-main h2 { margin: 0; }
.settings-main label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.settings-main input[type=text] { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); outline: none; }
.settings-main input[type=color] { width: 60px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--night); padding: 2px; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.perm-row .name { font-weight: 600; font-size: 14px; }
.perm-row .desc { font-size: 12px; color: var(--muted); }
.toggle { position: relative; width: 40px; height: 22px; flex: 0 0 40px; border-radius: 11px; border: 0; background: var(--line); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.toggle.on { background: var(--vacant); }
.toggle.on::after { left: 21px; background: var(--night); }
.tri { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.tri button { width: 34px; height: 28px; border: 0; background: none; color: var(--muted); font-weight: 700; }
.tri button.deny.on { background: var(--occupied); color: var(--night); }
.tri button.inherit.on { background: var(--raised); color: var(--text); }
.tri button.allow.on { background: var(--vacant); color: var(--night); }
.settings-actions { display: flex; gap: 8px; justify-content: space-between; position: sticky; bottom: -20px; background: var(--panel); padding: 12px 0; border-top: 1px solid var(--line); }
.settings-main .ghost, .settings-main .danger-btn { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: none; }
.settings-main .danger-btn { border-color: var(--occupied); color: var(--occupied); }
.settings-main .primary { padding: 0 16px; height: 38px; }
.ban-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.close-x { position: absolute; top: 12px; right: 12px; }
.inherit-hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.tri button:disabled { cursor: default; opacity: .6; }

/* Mention autocomplete */
.composer-wrap { position: relative; }
.mention-list { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; background: #18181b; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px #0008; }
.mention-title { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); padding: 4px 8px 6px; }
.mention-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: none; text-align: left; }
.mention-list button.active, .mention-list button:hover { background: var(--raised); }
.mention-list .label { font-weight: 600; }
.mention-list .sub { margin-left: auto; font-size: 12px; color: var(--muted); }
.mention-icon { width: 24px; height: 24px; border-radius: 50%; background: var(--raised); display: grid; place-items: center; font-weight: 700; color: var(--muted); }

/* Presence */
.avatar-wrap { position: relative; flex: 0 0 32px; }
.status-dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--vacant); border: 3px solid var(--panel); }
.member.offline { opacity: .45; }
.member.offline:hover { opacity: .8; }

/* Bots and rich embeds */
.bot-tag { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; background: var(--ember); color: var(--night); align-self: center; }
img.avatar.img { object-fit: cover; width: 40px; height: 40px; background: var(--raised); }
.embed.rich { display: flex; gap: 12px; align-items: flex-start; max-width: 520px; }
.rich-main { display: grid; gap: 6px; min-width: 0; flex: 1; }
.rich-author { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.rich-author a { color: var(--text); text-decoration: none; }
.rich-author img { width: 20px; height: 20px; border-radius: 50%; }
.rich-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.rich-field { flex: 1 1 100%; min-width: 0; }
.rich-field.inline { flex: 1 1 140px; }
.rich-field .fname { font-size: 13px; font-weight: 700; }
.rich-field .fvalue { font-size: 14px; white-space: pre-wrap; }
.rich-image { max-width: 100%; max-height: 300px; border-radius: 6px; cursor: zoom-in; }
.rich-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; flex: 0 0 72px; }
.rich-footer { font-size: 12px; color: var(--muted); }

/* Integrations settings */
.int-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.int-info { flex: 1; min-width: 0; }
.int-info .name { font-weight: 600; }
.small { font-size: 12px; }
.int-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); }
.int-form > div { align-self: end; }
.select { height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: inherit; }

/* Voice */
.channel.voice { cursor: pointer; }
.voice-user { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 30px; font-size: 14px; color: var(--muted); border-radius: 6px; }
.voice-user:hover { background: var(--raised); color: var(--text); }
.voice-user .avatar { font-size: 11px; box-shadow: 0 0 0 2px transparent; transition: box-shadow .1s; }
.voice-user.live .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--vacant) 35%, transparent); }
.voice-user.speaking .avatar { box-shadow: 0 0 0 2px var(--vacant); }
.voice-user.speaking .vname { color: var(--text); }
.voice-user .vname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user .vicon { font-size: 12px; }
.voice-panel { border-top: 1px solid var(--line); padding: 8px 10px; display: grid; gap: 8px; }
.vp-top { display: flex; align-items: center; gap: 8px; }
.vp-info { flex: 1; min-width: 0; line-height: 1.25; }
.vp-status { font-size: 13px; font-weight: 700; color: var(--vacant); background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; text-align: left; }
button.vp-status:hover { text-decoration: underline; }
.vstats { min-width: 250px; font-size: 13px; }
.vstats-title { font-weight: 700; margin-bottom: 6px; }
.vstats-row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; color: var(--muted, #a1a1aa); }
.vstats-row span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }
.vstats-row.bad span:last-child { color: #f87171; }
.vstats-hint { margin: 8px 0 0; max-width: 260px; font-size: 12px; line-height: 1.4; color: var(--glow); }
.vp-status.connecting { color: var(--glow); }
.vp-channel { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.danger:hover { background: var(--occupied); color: var(--night); }
.vp-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.vp-btn { height: 32px; border: 0; border-radius: 8px; background: var(--raised); font-size: 15px; }
.vp-btn:hover { filter: brightness(1.3); }
.vp-btn.off { background: #f8717133; }
.menu-slider { padding: 8px 10px 10px; display: grid; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-slider .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.menu-slider input, .sb-foot input[type=range] { accent-color: var(--ember); width: 100%; }
.voice-settings { width: 300px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* Long device names used to stretch the dropdowns out of the box. */
.voice-settings .select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.voice-settings h3, .soundboard h3 { margin: 0; font-size: 15px; }
.voice-settings .field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.voice-settings .ghost { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: none; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check-row input[type=checkbox] { accent-color: var(--ember); }
.soundboard { width: 340px; display: grid; gap: 10px; }
.sb-head { display: flex; justify-content: space-between; align-items: center; }
.small-btn { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: none; font-size: 13px; }
.sound-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.sound-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.sound-btn:hover:not(:disabled) { border-color: var(--ember); }
.sound-btn:active:not(:disabled) { transform: scale(.96); }
.sound-btn:disabled { opacity: .5; cursor: not-allowed; }
.semoji { font-size: 22px; }
.sname { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
dialog .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* User settings */
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input[type=text] { flex: 1; min-width: 0; }
.settings-main input[type=password] { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); outline: none; color: var(--text); }
.settings-main input:disabled { opacity: .6; }
.settings-main .select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.settings-main h3 { font-size: 15px; }
.mic-meter { flex: 1; height: 10px; border-radius: 5px; background: var(--night); border: 1px solid var(--line); overflow: hidden; }
.mic-bar { height: 100%; width: 0; background: var(--muted); transition: width 60ms linear; }
.mic-bar.talking { background: var(--vacant); }
.vol-row { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.vol-row input[type=range] { width: 100%; accent-color: var(--ember); }
.vol-row .vol-value { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.mic-meter { position: relative; }
.vad-line { position: absolute; top: -3px; bottom: -3px; left: var(--vad-pos, 50%); width: 2px; background: var(--ember); border-radius: 1px; }
.db-row { grid-template-columns: auto 1fr 52px; }
.desktop-status { color: var(--vacant); }
.desktop-status.bad { color: #f87171; }

/* ---------- Profiles ---------- */
.msg-author { cursor: pointer; }
.msg-author:hover { text-decoration: underline; }
.profile-pop { padding: 0 !important; overflow: hidden; }
.profile-card { width: 320px; background: var(--panel); border-radius: 12px; overflow: hidden; position: relative; }
.profile-card.themed { background: linear-gradient(rgba(18,18,20,.82), rgba(18,18,20,.92)), var(--theme); }
.profile-card .pc-banner { height: 110px; }
.profile-card .pc-avatar { position: absolute; top: 64px; left: 16px; padding: 5px; border-radius: 50%; background: var(--panel); box-shadow: 0 0 0 2px var(--accent-ring, transparent); }
.profile-card.themed .pc-avatar { background: #1a1a1e; }
.profile-card .pc-avatar .avatar { font-size: 32px; }
.pc-body { padding: 52px 16px 16px; display: grid; gap: 10px; }
.pc-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pc-user { color: var(--muted); font-size: 13px; margin-top: -8px; }
.pc-section h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.pc-section p { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-roles { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-role { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--raised); }
.pc-role .dot { width: 9px; height: 9px; border-radius: 50%; }
.pc-actions { display: flex; gap: 8px; }
.pl-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.pl-form { display: grid; gap: 16px; }
.pl-form textarea { width: 100%; resize: vertical; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: inherit; }
.pl-form input[type=color] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--night); padding: 2px; }
.pl-preview { position: sticky; top: 0; display: grid; gap: 6px; }
.pl-preview h4 { margin: 0; }
.pl-preview .profile-card { border: 1px solid var(--line); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.theme-swatch { height: 56px; border-radius: 10px; border: 2px solid transparent; display: flex; align-items: flex-end; padding: 4px 6px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000a; }
.theme-swatch.none { background: var(--raised); color: var(--muted); text-shadow: none; justify-content: center; align-items: center; }
.theme-swatch.on { border-color: var(--ember); box-shadow: 0 0 0 2px var(--night) inset; }
@media (max-width: 900px) { .pl-layout { grid-template-columns: 1fr; } .pl-preview { position: static; } }

/* ---------- Raid planner ---------- */
.event-card { margin-top: 6px; max-width: 640px; border: 1px solid var(--line); border-left: 4px solid var(--ember); border-radius: 12px; background: var(--panel); padding: 14px; display: grid; gap: 10px; }
.event-card.live { border-left-color: var(--vacant); }
.event-card.over { opacity: .7; }
.ev-head { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: start; }
.ev-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--ember); }
.event-card.live .ev-kicker { color: var(--vacant); }
.ev-title { font-size: 18px; font-weight: 700; margin: 2px 0; }
.ev-when { font-size: 13px; color: var(--muted); }
.ev-rel { color: var(--glow); }
.ev-total { font-size: 13px; color: var(--muted); background: var(--raised); border-radius: 8px; padding: 4px 8px; }
.ev-total strong { color: var(--text); font-size: 16px; }
.ev-desc { margin: 0; font-size: 14px; white-space: pre-wrap; }
.ev-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ev-col { background: var(--night); border-radius: 8px; padding: 8px; min-height: 60px; }
.ev-col-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ev-count.full { color: var(--vacant); }
.ev-person { font-size: 13px; display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.ev-person.over { opacity: .55; }
.ev-spec { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ev-empty { color: var(--muted); font-size: 13px; }
.ev-line { font-size: 13px; color: var(--muted); }
.ev-line strong { color: var(--text); font-weight: 600; }
.su-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-name.me { text-decoration: underline; text-underline-offset: 3px; }
.su-name.manageable { cursor: pointer; }
.ev-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-btn { border: 1px solid var(--line); background: var(--raised); border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.ev-btn:hover { border-color: var(--ember); }
.ev-btn.on { background: var(--ember); border-color: var(--ember); color: #1a0d05; }
.ev-btn.ghost { background: none; color: var(--muted); }
.signup-pop { width: 340px; display: grid; gap: 8px; }
.signup-pop h3 { margin: 0; font-size: 15px; }
.signup-pop input { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); }
.su-classes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.su-class { border: 1px solid var(--line); background: var(--night); border-radius: 6px; padding: 5px 4px; font-size: 12px; font-weight: 600; color: var(--cc); }
.su-class.on { background: var(--cc); color: #111; border-color: var(--cc); }
.su-specs { display: flex; flex-wrap: wrap; gap: 4px; min-height: 30px; }
.su-spec { border: 1px solid var(--line); background: var(--night); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.su-spec.on { border-color: var(--ember); background: #ff6b3522; }
dialog.raid-dialog { width: min(560px, 94vw); }
.raid-dialog .field input, .raid-dialog .field textarea, .raid-dialog .field select { width: 100%; }
.raid-dialog textarea { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: inherit; resize: vertical; }
.raid-dialog input[type=number], .raid-dialog input[type=datetime-local] { height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); color-scheme: dark; }
.raid-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.raid-row.three { grid-template-columns: repeat(3, 1fr); }
.raid-list { width: 320px; display: grid; gap: 6px; }
.raid-list h3 { margin: 0 0 4px; font-size: 15px; }
.raid-row-btn { text-align: left; border: 1px solid var(--line); background: var(--night); border-radius: 8px; padding: 8px 10px; display: grid; gap: 2px; }
.raid-row-btn:hover { border-color: var(--ember); }
.rl-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.rl-mine { color: var(--vacant); font-size: 12px; }

/* ---------- Bots and slash commands ---------- */
.interaction-ref code { background: var(--raised); padding: 0 4px; border-radius: 4px; }
.command-pop { margin: 0 0 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; max-height: 260px; overflow-y: auto; }
.cp-head { font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 6px 6px; letter-spacing: .06em; }
.cp-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; text-align: left; border: 0; background: none; border-radius: 6px; padding: 6px 8px; }
.cp-item.on, .cp-item:hover { background: var(--raised); }
.cp-name { font-family: "JetBrains Mono", monospace; font-size: 13px; }
.cp-desc { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-bot { color: var(--muted); font-size: 11px; }
.cp-hint { font-size: 13px; padding: 4px 6px; }
.bot-state { font-size: 12px; color: var(--muted); }
.bot-state.on { color: var(--vacant); }
.code-snippet { margin: 0; padding: 8px 10px; background: var(--night); border: 1px solid var(--line); border-radius: 8px; font: 12px/1.4 "JetBrains Mono", monospace; white-space: pre-wrap; word-break: break-all; color: var(--text); }

/* ---------- Phones and tablets ---------- */
.mobile-only, .mobile-scrim { display: none; }
.ptt-hold { margin-top: 8px; width: 100%; height: 52px; border-radius: 12px; border: 2px solid var(--ember); background: none; font-weight: 700; font-size: 16px; touch-action: none; user-select: none; -webkit-user-select: none; }
.ptt-hold.on { background: var(--ember); color: #1a0d05; }
@media (max-width: 760px) {
  .app { position: relative; overflow: hidden; height: 100dvh; }
  .mobile-only { display: inline-grid; }
  .rail, .sidebar { position: absolute; top: 0; bottom: 0; z-index: 30; transform: translateX(-120%); transition: transform .2s ease; }
  .rail { left: 0; }
  .sidebar { left: 72px; width: min(260px, calc(100vw - 112px)); flex-basis: auto; }
  .app.show-nav .rail, .app.show-nav .sidebar { transform: none; }
  .members { display: block !important; position: absolute; top: 0; bottom: 0; right: 0; z-index: 30; width: min(260px, 80vw); transform: translateX(120%); transition: transform .2s ease; }
  .app.show-members .members { transform: none; }
  .app.show-nav .mobile-scrim, .app.show-members .mobile-scrim { display: block; position: absolute; inset: 0; z-index: 20; background: #0008; }
  .chat-head { padding: 0 8px; gap: 6px; }
  .chat-head .topic, .chat-head .divider { display: none; }
  .chat-head #members-toggle { margin-left: auto; }
  .messages { padding-left: 4px; padding-right: 4px; }
  .composer .tool.gif { display: none; }
  .ev-cols { grid-template-columns: 1fr; }
  dialog.settings { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; flex-direction: column; }
  dialog.settings .settings-nav { flex-direction: row; overflow-x: auto; width: auto; flex: 0 0 auto; padding: 8px; }
  dialog.settings .settings-nav h3 { display: none; }
  dialog.settings .settings-main { padding: 16px; }
  .profile-card { width: min(320px, calc(100vw - 16px)); }
  .signup-pop { width: min(340px, calc(100vw - 32px)); }
}

/* ---------- Safe areas (phone notches, status bar, navigation buttons) ---------- */
:root { --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px); }
/* The Android app draws under the status bar and navigation buttons. */
html.android-app { --safe-top: max(env(safe-area-inset-top, 0px), 32px); --safe-bottom: max(env(safe-area-inset-bottom, 0px), 48px); }
.app, .auth { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
.app { box-sizing: border-box; }
@media (max-width: 760px) {
  .app { height: 100dvh; }
  .rail, .sidebar, .members { top: var(--safe-top); bottom: var(--safe-bottom); }
  /* Fully off screen when closed. */
  .sidebar { transform: translateX(calc(-100% - 80px)); }
  .rail { transform: translateX(calc(-100% - 8px)); }
  .members { transform: translateX(calc(100% + 8px)); }
  dialog.settings { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
  dialog.settings .settings-main { flex: 1; min-height: 0; overflow-y: auto; }
  dialog.settings .close-x { top: calc(var(--safe-top) + 8px); background: var(--night); z-index: 2; }
  dialog.settings .settings-nav { padding-right: 52px; }
  dialog.settings .settings-nav button { white-space: nowrap; flex: 0 0 auto; }
  .composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  dialog:not(.settings) { max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px); overflow-y: auto; }
  .popover { max-width: calc(100vw - 16px); max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px); overflow-y: auto; }
}
.update-bar { position: fixed; left: 8px; right: 8px; bottom: calc(var(--safe-bottom) + 76px); z-index: 50; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--raised); border: 1px solid var(--ember); box-shadow: 0 8px 24px #0008; }
.update-bar span { flex: 1; font-size: 14px; }
.update-bar .primary { height: 36px; padding: 0 14px; }

/* ---------- Pins, search, unread mention counts ---------- */
.channel .cname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; flex: 0 0 auto; }
.guild .mention-badge.rail-badge { position: absolute; right: -4px; bottom: -4px; margin: 0; border: 3px solid var(--panel); height: 22px; line-height: 16px; border-radius: 11px; }

.chat-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tool-btn { display: flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.tool-btn:hover, .tool-btn.on, .chat-tools .icon-btn.on { background: var(--raised); color: var(--text); }
.search-box { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; background: var(--night); border: 1px solid var(--line); width: 180px; transition: width .15s, border-color .15s; cursor: text; }
.search-box:focus-within { width: 260px; border-color: var(--ember); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 13px; }
.search-icon { font-size: 12px; opacity: .7; }

.side-panel { width: 400px; flex: 0 0 400px; min-width: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); }
.app.panel-open .members { display: none; }
.sp-head { height: 56px; flex: 0 0 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
@media (max-width: 1100px) { .side-panel { width: 340px; flex-basis: 340px; } }
.sp-search { display: none; padding: 10px 12px 0; }
.sp-search input { width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); outline: none; }
.sp-search input:focus { border-color: var(--ember); }
.sp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.sp-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.sp-note code { font-family: "JetBrains Mono", monospace; font-size: 11px; background: var(--night); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--text); }
.sp-count { font-weight: 600; color: var(--text); font-size: 13px; }
.sp-card { padding: 10px 12px; border-radius: 10px; background: var(--night); border: 1px solid var(--line); cursor: pointer; display: grid; gap: 6px; }
.sp-card:hover, .sp-card:focus-visible { border-color: var(--ember); outline: none; }
.sp-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.sp-meta .avatar { width: 22px; height: 22px; flex-basis: 22px; font-size: 11px; }
.sp-chan { color: var(--glow); font-weight: 600; white-space: nowrap; }
.sp-time { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-x { margin-left: auto; border: 0; background: none; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; }
.sp-x:hover { background: var(--raised); color: var(--occupied); }
.sp-text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.sp-text mark { background: #ffb34740; color: var(--text); border-radius: 3px; padding: 0 1px; }
.sp-thumb { max-width: 100%; max-height: 140px; border-radius: 6px; justify-self: start; }
.sp-files { font-size: 12px; color: var(--muted); }
.sp-empty { text-align: center; padding: 24px 12px; color: var(--text); }
.sp-empty p { margin: 4px 0; font-size: 14px; }
.sp-empty-icon { font-size: 32px; margin-bottom: 6px; }
.sp-more { align-self: center; margin-top: 4px; }

.msg.flash { background: #ffb34726; box-shadow: inset 3px 0 0 var(--glow); transition: background .4s; }
.msg.pinned::after { content: "📌"; position: absolute; right: 18px; top: 6px; font-size: 11px; opacity: .7; pointer-events: none; }
.msg.pinned:hover::after { display: none; }
.msg-actions button.pin.on { background: #ff6b3526; }
.detached-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; margin-bottom: 6px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.detached-bar .ghost { height: 30px; padding: 0 10px; color: var(--glow); border-color: var(--ember); }

#nav-toggle { position: relative; }
#nav-toggle.has-mentions::after { content: ""; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: #e5484d; border: 2px solid var(--night); }
@media (max-width: 760px) {
  .chat-tools { margin-left: auto; gap: 2px; }
  .chat-head #members-toggle { margin-left: 0; }
  .search-box, .tool-label { display: none; }
  .tool-btn { padding: 0 8px; font-size: 16px; }
  .side-panel { position: absolute; z-index: 25; left: 0; right: 0; top: calc(var(--safe-top) + 56px); bottom: var(--safe-bottom); width: auto; border-left: 0; }
  .sp-head { height: 48px; flex-basis: 48px; }
  .sp-search { display: block; }
}

/* ---------- Direct messages ---------- */
.home { position: relative; transition: border-radius .15s, background .15s; }
.home.active { background: var(--ember); border-radius: 18px; }
.home.active::before { content: ""; position: absolute; left: -6px; top: 10px; width: 4px; height: 40px; border-radius: 0 4px 4px 0; background: var(--text); }
.home .mention-badge.rail-badge { position: absolute; right: -4px; bottom: -4px; margin: 0; border: 3px solid var(--panel); height: 22px; line-height: 16px; border-radius: 11px; }
.app.home-mode .sidebar .channels:not(#dm-list) { display: none; }
.app.home-mode #invite-btn, .app.home-mode #raid-btn, .app.home-mode #pins-btn,
.app.home-mode .search-box, .app.home-mode #search-toggle { display: none !important; }
.app.home-mode .chat-head .hash { font-size: 18px; }
.dm-row { gap: 10px; padding: 6px 8px; }
.dm-row .avatar, .dm-row .group-icon { font-size: 13px; }
.dm-avatar { flex: 0 0 32px; }
.dm-avatar .status-dot { width: 11px; height: 11px; }
.dm-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.dm-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.dm-sub.online { color: var(--vacant); }
.group-icon { border-radius: 50%; display: grid; place-items: center; font-size: 16px; flex: 0 0 auto; }
.dm-empty { margin: 4px 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }
#dm-tools { font-size: 18px; letter-spacing: .05em; }
.pc-actions .primary { height: 36px; padding: 0 16px; }

dialog.people-dialog { width: min(440px, 94vw); }
.people-list { max-height: min(320px, 45dvh); overflow-y: auto; display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: var(--night); }
.person-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.person-row:hover { background: var(--raised); }
.person-row input { width: 18px; height: 18px; accent-color: var(--ember); margin: 0; flex: 0 0 auto; }
.person-row .avatar { font-size: 12px; }
.person-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-dialog .row { align-items: center; }
.small { font-size: 12px; }

/* ---------- Scroll-back ---------- */
.history-start, .history-loading { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 16px 4px; }

/* ---------- Threads ---------- */
.thread-link { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin-top: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; text-align: left; }
.thread-link:hover { border-color: var(--ember); }
.tl-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-count { color: var(--glow); white-space: nowrap; }
.tl-go { color: var(--muted); }
.side-panel.thread-panel .sp-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-panel .sp-head { gap: 4px; }
.side-panel .sp-head .sp-title { flex: 1; }
.sp-body.thread-body { gap: 0; padding: 4px 0 12px; }
.tmsg { padding: 2px 12px; gap: 10px; }
.tmsg.first { margin-top: 10px; }
.tmsg .avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; }
.tmsg .gutter { width: 32px; flex: 0 0 32px; }
.tmsg .msg-actions { right: 8px; top: -12px; }
.tmsg .msg-text { font-size: 14px; }
.tmsg-reply { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmsg-reply strong { color: var(--glow); }
.thread-start { display: grid; gap: 4px; padding: 12px; margin: 0 12px 4px; border-bottom: 1px solid var(--line); }
.thread-start .sp-card { margin-top: 8px; }
.thread-start-icon { font-size: 26px; }
.thread-start-name { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.thread-empty { padding: 12px 16px; }
.thread-composer-wrap { padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.thread-composer-wrap .pending-files { border-radius: 12px 12px 0 0; }
.thread-composer .tool { font-size: 20px; }
.thread-composer .send span { font-size: 15px; }
.sp-actions { padding: 10px 12px 0; }
.sp-actions .primary { height: 36px; padding: 0 14px; }
.thread-card .tc-name { font-weight: 600; overflow-wrap: anywhere; }
.thread-card .tc-sub { font-size: 12px; color: var(--muted); }

/* ---------- Polls ---------- */
.poll-card { margin-top: 6px; max-width: 480px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 12px 14px; display: grid; gap: 8px; }
.poll-kicker { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--glow); }
.poll-card.ended .poll-kicker { color: var(--muted); }
.poll-q { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.poll-hint { font-size: 12px; color: var(--muted); margin-top: -4px; }
.poll-options { display: grid; gap: 6px; }
.poll-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--night); text-align: left; }
.poll-opt:hover:not(:disabled) { border-color: var(--muted); }
.poll-opt:disabled { cursor: default; color: var(--text); }
.poll-opt.mine { border-color: var(--ember); }
.poll-opt.winner { border-color: var(--glow); }
.poll-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #ff6b351a; transition: width .3s; pointer-events: none; }
.poll-opt.mine .poll-fill { background: #ff6b353d; }
.poll-check { position: relative; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; font-size: 11px; font-weight: 800; line-height: 1; }
.poll-check.square { border-radius: 5px; }
.poll-opt.mine .poll-check { background: var(--ember); border-color: var(--ember); color: var(--night); }
.poll-text { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-count { position: relative; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.poll-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.link.poll-link { font-size: 12px; padding: 0; }
.poll-voters { width: min(300px, calc(100vw - 32px)); max-height: 340px; overflow-y: auto; display: grid; gap: 10px; }
.pv-title { font-weight: 700; }
.pv-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.pv-people { display: flex; flex-wrap: wrap; gap: 6px; }
.pv-person { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 8px 2px 2px; border-radius: 12px; background: var(--raised); }
.pv-person .avatar { width: 20px; height: 20px; flex-basis: 20px; font-size: 10px; }
dialog.poll-dialog { width: min(460px, 94vw); }
dialog .field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
dialog select { height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: inherit; }
.poll-edit-options { display: grid; gap: 6px; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; }
.poll-edit-row input { flex: 1; min-width: 0; }
.poll-dialog .field > .ghost { justify-self: start; height: 34px; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--ember); margin: 0; }

/* ---------- Custom emoji ---------- */
.custom-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; }
.msg-text.jumbo .custom-emoji { width: 48px; height: 48px; vertical-align: middle; }
.reaction .custom-emoji { width: 18px; height: 18px; vertical-align: middle; }
.emoji-grid button .custom-emoji { width: 28px; height: 28px; vertical-align: middle; }
.emoji-picker { display: grid; gap: 6px; width: 306px; max-width: calc(100vw - 40px); }
.emoji-tabs { display: flex; gap: 4px; }
.emoji-tabs button { flex: 1; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.emoji-tabs button.on { background: var(--raised); color: var(--text); }
.emoji-pane { height: 232px; overflow-y: auto; overflow-x: hidden; }
.emoji-section-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; padding: 6px 2px 4px; }
.emoji-none { margin: 8px 4px; line-height: 1.5; }
.emoji-upload { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); }
.emoji-preview { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 12px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 22px; }
.emoji-preview img { max-width: 56px; max-height: 56px; }
.emoji-upload-fields { display: grid; gap: 8px; flex: 1; min-width: 0; }
.emoji-upload-fields input { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); outline: none; }
.emoji-upload-fields input:focus { border-color: var(--ember); }
.emoji-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap; }
.emoji-big { width: 32px; height: 32px; object-fit: contain; }

@media (max-width: 760px) {
  .emoji-grid { grid-template-columns: repeat(7, 36px); }
  .tmsg .msg-actions { top: -10px; }
  .poll-card { max-width: none; }
  .composer .tool { width: 32px; flex-basis: 32px; }
}

/* ---------- Raid planner extras: repeat, deadline, bench, calendar, attendance ---------- */
.ev-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-repeat { font-weight: 600; letter-spacing: 0; color: var(--muted); font-size: 11px; background: var(--raised); border-radius: 6px; padding: 1px 6px; }
.ev-lock { font-size: 12px; }
.ev-deadline { font-size: 13px; color: var(--glow); }
.ev-deadline.locked { color: var(--muted); background: var(--night); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }
.event-card.locked:not(.over) { border-left-color: var(--muted); }
.ev-bench { background: var(--night); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ev-bench-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.ev-bench ol { margin: 0; padding-left: 22px; display: grid; gap: 2px; }
.ev-bench li::marker { color: var(--muted); }
.ev-btn.attendance { margin-left: auto; border-color: var(--glow); color: var(--glow); }
.ev-btn.attendance.done { border-color: var(--line); color: var(--muted); }
.su-full { color: var(--glow); }
.su-full:empty { display: none; }
.raid-row.even { grid-template-columns: 1fr 1fr; }
.repeat-box { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--night); }
.repeat-box[hidden] { display: none; }
.raid-dialog input[type=date] { height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); color-scheme: dark; }
.day-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.day-chip { min-width: 44px; height: 34px; border: 1px solid var(--line); background: var(--panel); border-radius: 17px; font-size: 13px; font-weight: 600; color: var(--muted); }
.day-chip.on { background: var(--ember); border-color: var(--ember); color: #1a0d05; }
.rl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.rl-head h3 { margin: 0; }
.rl-tools { display: flex; gap: 4px; }
.rl-tool { border: 1px solid var(--line); background: var(--night); border-radius: 8px; padding: 4px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.rl-tool:hover { border-color: var(--ember); }
.rl-tag { margin-left: 6px; font-size: 12px; }
.raid-list { width: 360px; max-width: calc(100vw - 32px); }
.rl-rows { display: grid; gap: 6px; max-height: min(46vh, 400px); overflow-y: auto; padding-right: 2px; }

dialog.raid-host { padding: 16px; }
dialog.raid-host .popover, dialog.raid-host .menu { z-index: 60; }
dialog.raid-host #toast { z-index: 70; }
.raid-close { flex: 0 0 auto; font-size: 16px; }
dialog.raid-card-dialog { width: min(700px, 96vw); }
.raid-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.raid-card-body .event-card { max-width: none; margin: 0; }

dialog.calendar-dialog { width: min(1180px, 96vw); height: min(800px, 92vh); max-width: none; max-height: none; }
dialog.calendar-dialog[open] { display: flex; flex-direction: column; }
.cal { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cal-nav, .cal-actions { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { margin: 0 4px; font-size: 18px; min-width: 150px; text-align: center; }
.cal-nav .icon-btn { font-size: 22px; }
.cal-today { height: 34px; padding: 0 12px; border: 1px solid var(--line); background: var(--night); border-radius: 8px; font-size: 13px; font-weight: 600; }
.cal-today:hover { border-color: var(--ember); }
.cal-plan { height: 34px; padding: 0 14px; border-radius: 8px; }
.cal-tz { margin-top: -2px; }
.cal-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(0, 1fr)); gap: 4px; min-height: 0; }
.cal-wd { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 0 6px 2px; }
.cal-day { min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; padding: 4px; border: 1px solid var(--line); background: var(--night); border-radius: 8px; }
.cal-day:hover { border-color: #ff6b3588; }
.cal-day.other { opacity: .45; }
.cal-day.selected { border-color: var(--ember); box-shadow: inset 0 0 0 1px var(--ember); }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 11px; flex: 0 0 auto; }
.cal-day.today .cal-num { background: var(--ember); color: #1a0d05; }
.cal-chip { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 4px; background: #ff6b3526; border-left: 3px solid var(--ember); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
.cal-chip.mine { background: #4ade8026; border-left-color: var(--vacant); }
.cal-chip.over { opacity: .6; }
.cal-chip-time { color: var(--muted); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-daypanel { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.cal-daypanel h3 { margin: 0; font-size: 15px; }
.cal-daypanel .event-card { margin: 0; max-width: none; }
.cal-daypanel .ev-cols { grid-template-columns: 1fr; }
.cal-plan-day { border: 1px dashed var(--line); background: none; border-radius: 10px; padding: 10px; color: var(--glow); font-weight: 600; flex: 0 0 auto; }
.cal-plan-day:hover { border-color: var(--ember); }
.cal-agenda { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cal-agenda-day h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; letter-spacing: .02em; }
.cal-agenda-day.today h3 { color: var(--ember); }
.cal-today-tag { font-size: 11px; background: var(--ember); color: #1a0d05; border-radius: 6px; padding: 0 6px; }
.cal-agenda-item { display: grid; gap: 6px; margin-bottom: 6px; }
.cal-agenda-item .event-card { margin: 0; }
.cal-agenda-row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--ember); border-radius: 10px; background: var(--night); }
.cal-agenda-item.open .cal-agenda-row { border-color: var(--ember); }
.cal-agenda-time { font-weight: 700; font-size: 13px; color: var(--glow); }
.cal-agenda-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cal-agenda-row .rl-mine { grid-column: 2 / 4; font-size: 12px; }
.cal-empty { text-align: center; padding: 24px 0; }

dialog.attendance-dialog { width: min(640px, 96vw); }
dialog.attendance-dialog[open] { display: flex; flex-direction: column; gap: 10px; max-height: 92vh; }
.att-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.att-head h2 { margin: 0; }
.att-head-tools { display: flex; gap: 6px; align-items: center; }
.att-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-tools .ghost { height: 36px; }
.att-list { display: grid; gap: 6px; overflow-y: auto; min-height: 0; flex: 1 1 auto; align-content: start; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--night); }
.att-who { display: grid; min-width: 0; }
.att-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-choices { display: flex; gap: 4px; }
.att-choice { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.att-choice.on.present { background: #4ade80; border-color: #4ade80; color: #062b12; }
.att-choice.on.late { background: var(--glow); border-color: var(--glow); color: #2b1a02; }
.att-choice.on.absent { background: var(--occupied); border-color: var(--occupied); color: #2b0606; }
.att-choice.on.benched { background: #93a4c3; border-color: #93a4c3; color: #0d1424; }
.attendance-dialog select { width: 100%; }
.att-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--line); vertical-align: middle; }
.att-dot.present { background: #4ade80; }
.att-dot.late { background: var(--glow); }
.att-dot.absent { background: var(--occupied); }
.att-dot.benched { background: #93a4c3; }
.att-dot.none { background: none; border: 1px dashed var(--line); }
.att-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.att-legend > span { display: inline-flex; gap: 6px; align-items: center; }

dialog.attendance-table-dialog { width: min(1040px, 96vw); }
dialog.attendance-table-dialog[open] { display: flex; flex-direction: column; gap: 10px; max-height: 92vh; }
.att-table-wrap { overflow: auto; min-height: 0; flex: 1; border: 1px solid var(--line); border-radius: 10px; }
.att-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.att-table th, .att-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.att-table thead th { position: sticky; top: 0; background: var(--raised); font-size: 12px; color: var(--muted); z-index: 1; }
.att-table th.sortable { cursor: pointer; user-select: none; }
.att-table th.sorted { color: var(--text); }
.att-table th.name, .att-table td.name { text-align: left; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.att-table thead th.name { z-index: 2; background: var(--raised); }
.att-table th.raid-col { font-weight: 600; }
.att-table td.raid-col { padding: 6px; }
.att-member { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.att-member .avatar { font-size: 11px; }
.pct-bar { position: relative; width: 70px; height: 20px; border-radius: 6px; background: linear-gradient(90deg, #ff6b3555 var(--pct), var(--night) var(--pct)); display: grid; place-items: center; font-weight: 700; margin: 0 auto; }
.att-empty { padding: 24px; text-align: center; }
.pc-attendance .pca-row { display: flex; gap: 8px; align-items: baseline; }
.pca-pct { font-size: 20px; color: var(--glow); }
.pca-dots { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }

@media (max-width: 760px) {
  dialog.calendar-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; padding: calc(var(--safe-top) + 10px) 10px calc(var(--safe-bottom) + 10px); overflow: hidden; }
  .cal-head { flex-wrap: nowrap; }
  .cal-nav { gap: 2px; min-width: 0; }
  .cal-nav h2 { font-size: 16px; min-width: 0; white-space: nowrap; }
  .cal-actions .cal-today, .cal-nav .cal-today, .cal-plan .plan-long { display: none; }
  .cal-plan { padding: 0 12px; white-space: nowrap; }
  .raid-dialog .raid-row:not(.three), .raid-dialog .raid-row.even { grid-template-columns: 1fr; }
  .day-chips { flex-wrap: nowrap; gap: 3px; }
  .day-chip { min-width: 0; flex: 1 1 0; padding: 0; font-size: 12px; }
  dialog.raid-card-dialog { padding: 10px; }
  dialog.attendance-dialog, dialog.attendance-table-dialog { width: 100vw; max-width: none; max-height: none; height: 100dvh; border-radius: 0; padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 12px); }
  dialog.attendance-dialog[open], dialog.attendance-table-dialog[open] { max-height: none; }
  dialog.attendance-dialog { height: auto; max-height: 100dvh; }
  dialog.attendance-dialog[open] { max-height: 100dvh; }
  .att-choices { width: 100%; }
  .att-choice { flex: 1; justify-content: center; padding: 0 4px; }
  .att-choice .att-lbl { font-size: 11px; }
  .att-head-tools .select { max-width: 140px; }
  .raid-row.even { grid-template-columns: 1fr 1fr; }
  .raid-list { width: min(360px, calc(100vw - 32px)); }
}

/* ---------- WoW tools: group finder, item/link/character cards, characters ---------- */
.lfg-card { margin-top: 6px; width: min(100%, 640px); box-sizing: border-box; border: 1px solid var(--line); border-left: 4px solid #4fb3ff; border-radius: 12px; background: var(--panel); padding: 12px 14px; display: grid; gap: 10px; }
.lfg-card.kind-raid { border-left-color: var(--ember); }
.lfg-card.full { border-left-color: var(--vacant); }
.lfg-card.closed, .lfg-card.expired { border-left-color: var(--muted); }
.lfg-card.closed .lfg-cols, .lfg-card.expired .lfg-cols, .lfg-card.closed .lfg-title, .lfg-card.expired .lfg-title { opacity: .65; }
.lfg-head { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: start; }
.lfg-head-main { min-width: 0; }
.lfg-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #4fb3ff; }
.lfg-card.kind-raid .lfg-kicker { color: var(--ember); }
.lfg-pill { letter-spacing: .04em; border-radius: 6px; padding: 1px 6px; font-size: 10px; background: var(--raised); color: var(--muted); }
.lfg-pill.full { background: #4ade8022; color: var(--vacant); }
.lfg-title { font-size: 18px; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
.lfg-when { font-size: 13px; color: var(--muted); }
.lfg-note { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lfg-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.lfg-col { background: var(--night); border-radius: 8px; padding: 8px; display: grid; gap: 3px; align-content: start; }
.lfg-col-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.lfg-count.full { color: var(--vacant); }
.lfg-person { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; min-width: 0; padding: 1px 0; border-radius: 4px; }
.lfg-person.manageable { cursor: pointer; }
.lfg-person.manageable:hover { background: var(--raised); }
.lfg-person.me .lfg-pname { text-decoration: underline; text-decoration-color: #fff4; text-underline-offset: 3px; }
.lfg-pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lfg-crown { font-size: 11px; margin-right: 3px; }
.lfg-pmeta { color: var(--muted); font-size: 11px; white-space: nowrap; flex: 0 0 auto; }
.lfg-open { font-size: 12px; color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 2px 6px; text-align: center; }
.lfg-join:disabled { opacity: .45; cursor: not-allowed; }
.lfg-foot { font-size: 12px; color: var(--muted); }
.lfg-join-pop .lfg-join-row { display: grid; grid-template-columns: 1fr 84px; gap: 6px; }
.lfg-join-pop .lfg-join-row input { min-width: 0; }
.lfg-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.lfg-quick-btn { border: 1px solid var(--line); background: var(--night); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.lfg-quick-btn:hover { border-color: var(--ember); color: var(--text); }
.lfg-dialog input:disabled, .lfg-dialog select:disabled { opacity: .5; }

.wow-embed { margin-top: 6px; width: min(100%, 480px); box-sizing: border-box; display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--q, var(--ember)); border-radius: 0 10px 10px 0; padding: 10px 12px; }
.wow-main { display: grid; gap: 4px; min-width: 0; flex: 1; }
.wow-title { font-weight: 700; text-decoration: none; color: var(--q, var(--glow)); overflow-wrap: anywhere; }
a.wow-title:hover { text-decoration: underline; }
.wow-site { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.wow-desc { font-size: 14px; opacity: .85; overflow-wrap: anywhere; }
.wow-foot { font-size: 12px; color: var(--muted); }
.wow-item { background: linear-gradient(180deg, #0b0f1c, #070a12); border-color: #2b3550; border-left-color: var(--q, #9d9d9d); }
.wow-item .wow-title { font-size: 15px; }
.wow-item.missing { background: var(--panel); border-color: var(--line); border-left-color: var(--line); }
.wow-item.missing .wow-title { color: var(--glow); }
.wow-icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 6px; border: 2px solid var(--q, #555); object-fit: cover; background: #000; }
.wow-icon.blank { display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.wow-tooltip { font-size: 13px; line-height: 1.45; white-space: pre-line; color: #e6e6e6; overflow-wrap: anywhere; }
.wow-link .wow-badge { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .02em; color: #fff; background: var(--q, var(--raised)); }
.wow-link.site-wowhead .wow-badge { background: #9b1c17; }
.wow-link.site-wcl .wow-badge { background: #2a3b8f; }
.wow-link.site-rio .wow-badge { background: #b36a00; }
.wow-link .wow-title { color: var(--text); }
.wow-thumb { width: 64px; height: 64px; flex: 0 0 64px; object-fit: cover; border-radius: 6px; }
.wow-char .wow-title { font-size: 17px; }

.char-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.char-chip { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--line); background: var(--night); border-radius: 8px; padding: 4px 8px; font-size: 13px; color: var(--text); max-width: 100%; }
button.char-chip:hover { border-color: var(--cc); }
.char-chip.on { border-color: var(--cc); box-shadow: inset 0 0 0 1px var(--cc); }
.char-chip.small { padding: 3px 7px; font-size: 12px; }
.char-name { color: var(--cc); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.char-meta { color: var(--muted); font-size: 11px; white-space: nowrap; }
.char-star { color: var(--glow); }
.char-link { text-decoration: none; }
.chars-settings { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.chars-settings h2 { margin: 0; }
.chars-settings p { margin: 0; }
.char-list { display: grid; gap: 8px; }
.char-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--cc); border-radius: 10px; background: var(--night); }
.char-row-main { display: grid; gap: 2px; min-width: 0; }
.char-row-name { font-weight: 700; color: var(--cc); }
.char-row-main a { color: var(--glow); text-decoration: none; justify-self: start; }
.char-row-main a:hover { text-decoration: underline; }
.char-src { margin-left: 8px; font-size: 10px; font-weight: 700; color: #8fb8ff; background: #1d2b4a; border-radius: 6px; padding: 1px 6px; vertical-align: 2px; }
.char-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.small-btn { height: 32px !important; padding: 0 10px !important; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: none; }
.small-btn.danger { color: var(--occupied); }
.bnet-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px solid #22406e; border-radius: 10px; background: #0d1626; }
.prof-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prof-chip { width: auto !important; padding: 0 10px !important; flex: 0 0 auto !important; min-width: 0 !important; }
dialog.char-dialog { width: min(480px, 94vw); }
.pc-chars .char-chips { gap: 4px; }

@media (max-width: 760px) {
  .lfg-card, .wow-embed { width: 100%; }
  .lfg-dialog .raid-row.even:not(.stack) { grid-template-columns: 1fr 1fr; }
  .lfg-cols { grid-template-columns: 1fr; }
  .lfg-actions .ev-btn { flex: 1 1 auto; }
  .lfg-title { font-size: 16px; }
  .char-row-actions { width: 100%; }
}

/* Reply and "used /command" lines must not get squashed when the chat overflows. */
.reply-ref { flex-shrink: 0; }
/* Let messages with group or WoW cards use the chat's width (cards cap themselves). */
.msg-body:has(> .lfg-card), .msg-body:has(> .wow-embed) { flex: 1; }

/* ---------- Voice extras: moderation icons, screen share, favourites, entrance sounds ---------- */
.vp-buttons.five { grid-template-columns: repeat(5, 1fr); }
.vp-btn { color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.vp-btn.forced { background: #ef444440; box-shadow: inset 0 0 0 1px #ef4444; cursor: not-allowed; }
.vp-btn.share.on { background: color-mix(in srgb, var(--vacant) 28%, transparent); color: var(--vacant); }
.voice-user .vicon { display: inline-flex; align-items: center; flex: 0 0 auto; }
.voice-user .vicon.self, .voice-user .vicon.local { color: var(--muted); }
.voice-user .vicon.server { color: #f87171; }
.live-badge { flex: 0 0 auto; font: 800 10px/1 Inter, system-ui, sans-serif; letter-spacing: .05em; color: #fff; background: #e11d48; border: 0; border-radius: 4px; padding: 3px 5px; cursor: pointer; }
button.live-badge:hover { filter: brightness(1.15); }

.chat { position: relative; }
.screen-stage { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; background: color-mix(in srgb, var(--night) 70%, var(--panel)); }
.screen-stage[hidden] { display: none; }
.screen-tile { position: relative; flex: 0 0 auto; height: 126px; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.screen-tile:hover, .screen-tile:focus-visible { border-color: var(--ember); outline: none; }
.screen-tile video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.st-label { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); display: flex; align-items: center; gap: 6px; padding: 3px 7px 3px 3px; border-radius: 6px; background: rgba(0, 0, 0, .65); font-size: 12px; font-weight: 600; color: #fff; }
.st-label .live-badge { cursor: default; }
.st-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-tools { position: absolute; top: 8px; right: 8px; display: none; gap: 6px; }
.st-btn { height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; font-weight: 600; }
.st-btn:hover { background: rgba(0, 0, 0, .85); }
.st-hide { flex: 0 0 auto; align-self: center; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--muted); font-size: 12px; }
.screen-stage.focused { position: absolute; inset: 56px 0 0 0; z-index: 30; flex-wrap: wrap; align-content: flex-start; padding: 12px; background: var(--night); border: 0; overflow: hidden; }
.screen-stage.focused .screen-tile.big { order: -1; flex: 1 1 100%; height: calc(100% - 120px); aspect-ratio: auto; cursor: default; }
.screen-stage.focused.solo .screen-tile.big { height: calc(100% - 44px); }
.screen-stage.focused .screen-tile:not(.big) { height: 84px; }
.screen-stage.focused .screen-tile.big .st-tools { display: flex; }
.screen-stage.focused .st-hide { display: none; }
.screen-tile:fullscreen { border: 0; border-radius: 0; cursor: default; }
.screen-tile:fullscreen .st-tools { display: none; }

.sound-scroll { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; }
.sound-scroll .sound-grid { max-height: none; overflow: visible; }
.sb-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sound-tile { position: relative; display: grid; }
.sound-tile .sound-btn { width: 100%; }
.sound-star { position: absolute; top: 1px; right: 3px; border: 0; background: none; padding: 2px 3px; font-size: 14px; line-height: 1; color: var(--muted); opacity: 0; transition: opacity .1s; }
.sound-tile:hover .sound-star, .sound-tile.fav .sound-star, .sound-star:focus-visible { opacity: 1; }
.sound-tile.fav .sound-star { color: var(--glow); }
.soundboard.cooling .sound-btn:not(:disabled) { opacity: .55; }
@media (pointer: coarse) { .sound-star { opacity: 1; font-size: 16px; } }

.entrance-box { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.entrance-box h3 { margin: 0; font-size: 15px; }
.entrance-row { flex-wrap: wrap; }
.entrance-row .ghost { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: none; }
.entrance-row .ghost.danger { color: var(--occupied); }

@media (max-width: 760px) {
  .screen-tile { height: 96px; }
  .screen-stage.focused { inset: 0; padding: 8px; padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .screen-stage.focused .screen-tile.big { height: calc(100% - 100px); }
  .screen-stage.focused.solo .screen-tile.big { height: 100%; }
  .screen-stage.focused .screen-tile:not(.big) { height: 72px; }
}
.vp-status.forced { color: #f87171; }

/* ---------- Notifications settings ---------- */
.notify-box { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); }
.notify-box h3 { margin: 0; font-size: 15px; }
.notify-box p { margin: 0; }
.notify-box .primary { justify-self: start; }
.inline-row.wrap { flex-wrap: wrap; }
.push-state { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.push-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: 0 0 10px; }
.push-dot.on { background: var(--vacant); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vacant) 25%, transparent); }
.push-dot.bad { background: var(--occupied); }
.device-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.device-row:first-of-type { border-top: 0; }
.device-icon { font-size: 18px; width: 24px; text-align: center; flex: 0 0 24px; }
.this-device { color: var(--ember); font-weight: 600; }
.level-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 4px 0; }
.level-row .level-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-row .select { width: 230px; flex: 0 0 auto; }
.channel.muted-channel { opacity: .55; }
.channel .mute-icon { margin-left: auto; font-size: 11px; opacity: .8; }
.channel .mention-badge + .mute-icon { margin-left: 4px; }

/* ---------- Audit log ---------- */
.audit-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.audit-filters .select { flex: 1 1 200px; min-width: 0; }
.audit-list { display: grid; border: 1px solid var(--line); border-radius: 12px; background: var(--night); overflow: hidden; }
.audit-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--line); }
.audit-row:first-child { border-top: 0; }
.audit-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--raised); display: grid; place-items: center; font-size: 15px; }
.audit-row.danger .audit-icon { background: color-mix(in srgb, var(--occupied) 22%, var(--raised)); }
.audit-line { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.audit-who, .audit-target { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; }
span.audit-target { cursor: default; }
.audit-who:hover, button.audit-target:hover { text-decoration: underline; }
.audit-action { color: var(--muted); }
.audit-details { margin-top: 2px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.audit-time { font-size: 12px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.audit-list .sp-empty { padding: 28px 16px; }
.audit-more { justify-self: center; }

/* ---------- Server status ---------- */
.status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.status-item { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); min-width: 0; }
.status-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.status-value { margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.status-item.good { border-color: color-mix(in srgb, var(--vacant) 45%, var(--line)); }
.status-item.warn { border-color: color-mix(in srgb, var(--glow) 55%, var(--line)); }
.status-item.bad { border-color: var(--occupied); }
.status-item.unknown .status-value { color: var(--muted); }

/* ---------- Badges ---------- */
.badge-chip { --bc: #a1a1aa; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 6px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--text);
  background: color-mix(in srgb, var(--bc) 18%, var(--night)); border: 1px solid color-mix(in srgb, var(--bc) 55%, transparent); white-space: nowrap; }
.badge-chip .badge-emoji { font-size: 13px; line-height: 1; }
.badge-chip.small { padding: 0 5px; }
.pc-badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.name-badges { display: inline-flex; gap: 2px; margin-left: 5px; vertical-align: middle; }
.name-badge { font-size: 12px; line-height: 1; cursor: default; }
.member .info > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta .name-badges { margin-left: 0; margin-right: 2px; }
.badge-form .inline-row input[type=text] { flex: 1; min-width: 0; }
.badge-form { grid-template-columns: minmax(0, 1fr); }
.badge-emoji-btn { width: 40px; height: 38px; flex: 0 0 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 20px; }
.badge-emoji-grid { grid-template-columns: repeat(8, 1fr); }
.badge-item { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.badge-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge-desc { min-width: 0; }
.badge-actions { display: flex; gap: 6px; margin-left: auto; }
.holder-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.holder-chip { padding: 2px 4px 2px 3px; border-radius: 12px; gap: 5px; }
.holder-chip .avatar { font-size: 9px; }
.give-select { height: 30px; width: auto; max-width: 180px; font-size: 13px; }
.auto-badges { display: grid; gap: 6px; }
.auto-badge { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.auto-count { white-space: nowrap; }

@media (max-width: 760px) {
  .level-row .select { width: 160px; }
  .audit-row { grid-template-columns: 28px minmax(0, 1fr); }
  .audit-icon { width: 28px; height: 28px; }
  .audit-time { grid-column: 2; padding-top: 0; }
  .auto-badge { grid-template-columns: auto minmax(0, 1fr); }
  .auto-badge .auto-count { grid-column: 2; }
}

/* ---------- Animated profile backgrounds ---------- */
.profile-card.anim { isolation: isolate; }
.profile-card .pc-fx { position: absolute; inset: 0; pointer-events: none; opacity: .5; }
.profile-card.anim .pc-body { position: relative; }
.profile-card.anim .pc-banner { position: relative; overflow: hidden; }
.profile-card.anim .pc-banner:not(.img)::after, .theme-swatch.anim::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.theme-swatch.anim { position: relative; overflow: hidden; }
.theme-swatch.anim > span { position: relative; z-index: 1; }
/* Ember drift: sparks rising. */
.anim-emberdrift .pc-fx, .anim-emberdrift .pc-banner:not(.img)::after, .theme-swatch.anim-emberdrift::after {
  background-image:
    radial-gradient(2px 2px at 20% 80%, #ffcf8a 60%, transparent 70%),
    radial-gradient(1.5px 1.5px at 65% 35%, #ff8a3d 60%, transparent 70%),
    radial-gradient(2.5px 2.5px at 85% 60%, #ffb36b 60%, transparent 70%),
    radial-gradient(1.5px 1.5px at 40% 15%, #ffe2b0 60%, transparent 70%);
  background-size: 90px 90px, 130px 130px, 170px 170px, 110px 110px;
  animation: oh-ember 9s linear infinite;
  will-change: background-position;
}
@keyframes oh-ember {
  from { background-position: 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 0 -90px, 0 -130px, 0 -170px, 0 -110px; }
}
/* Starfield: stars drifting past at three speeds. */
.anim-starfield .pc-fx, .anim-starfield .pc-banner:not(.img)::after, .theme-swatch.anim-starfield::after {
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff 60%, transparent 70%),
    radial-gradient(1px 1px at 60% 70%, #dfe8ff 60%, transparent 70%),
    radial-gradient(1px 1px at 70% 60%, #cfe0ff 60%, transparent 70%),
    radial-gradient(1px 1px at 25% 85%, #fff 60%, transparent 70%),
    radial-gradient(1.5px 1.5px at 40% 75%, #fff 60%, transparent 70%),
    radial-gradient(1.5px 1.5px at 80% 10%, #ffe9c4 60%, transparent 70%),
    radial-gradient(2px 2px at 85% 25%, #fff6d5 60%, transparent 70%);
  background-size: 40px 40px, 55px 55px, 70px 70px, 90px 90px, 120px 120px, 160px 160px, 230px 230px;
  animation: oh-stars 30s linear infinite;
  will-change: background-position;
}
.anim-starfield .pc-fx { opacity: .9; }
@keyframes oh-stars {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: -40px 0, -55px 0, -140px 0, -180px 0, -360px 0, -480px 0, -460px 0; }
}
/* Aurora: slow coloured curtains. */
.anim-aurora .pc-fx, .anim-aurora .pc-banner:not(.img)::after, .theme-swatch.anim-aurora::after {
  background-image:
    linear-gradient(115deg, transparent 15%, rgba(72, 255, 180, .45) 30%, transparent 45%, rgba(80, 170, 255, .4) 60%, transparent 72%, rgba(190, 100, 255, .38) 85%, transparent 95%);
  background-size: 300% 100%;
  animation: oh-aurora 16s ease-in-out infinite alternate;
  will-change: background-position;
}
.anim-aurora .pc-fx { opacity: .4; }
@keyframes oh-aurora {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .profile-card .pc-fx, .profile-card.anim .pc-banner::after, .theme-swatch.anim::after { animation: none !important; }
}

/* ---------- Screen share quality picker ---------- */
.share-picker { display: grid; gap: 8px; width: 260px; padding: 4px; }
.share-title { font-weight: 700; }
.share-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.share-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 3px; border-radius: 10px; background: var(--night); border: 1px solid var(--line); }
.share-seg button { height: 30px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-weight: 600; font-size: 13px; }
.share-seg button:hover { color: var(--text); background: var(--raised); }
.share-seg button.on { background: var(--ember); color: var(--night); }
.share-hint { min-height: 2.6em; }
.share-go { height: 38px; }
.st-quality { flex: 0 0 auto; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .14); font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Settings: each page draws into its own box (laid out as if it weren't there). */
.settings-page { display: contents; }

/* ---------- Raid sign-up posting times, games, channel picker ---------- */
.post-field { display: grid; gap: 6px; }
.post-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.post-row > .select { flex: 1 1 160px; min-width: 0; }
.post-extra { display: flex; gap: 8px; flex: 2 1 220px; min-width: 0; }
.post-extra[hidden] { display: none; }
.post-extra .select { flex: 1 1 auto; min-width: 0; }
.post-extra input[type=time] { flex: 0 0 auto; width: 120px; }
.post-preview { font-weight: 400; }
.ev-game, .char-game { font-weight: 700; letter-spacing: 0; font-size: 10px; line-height: 15px; border-radius: 6px; padding: 0 6px; color: #f5d6a8; background: #3a2a14; white-space: nowrap; }
.char-game.g-tbc, .ev-game.g-tbc { color: #b8f5a8; background: #1d3a16; }
.char-game.g-era { color: #c9c9d6; background: #2a2a34; }
.char-chip .char-game { align-self: center; }
.char-row-name .char-game { margin-left: 8px; vertical-align: 2px; }
.char-fix { margin-left: 8px; font-size: 11px; font-weight: 700; color: var(--glow); background: none; border: 1px dashed var(--glow); border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }
.ev-opens { color: #8fb8ff; background: #0d1626; border: 1px dashed #22406e; border-radius: 8px; padding: 6px 10px; }
.event-card.not-open { border-left-color: #4f7fd0; }
.event-card.not-open .ev-kicker { color: #8fb8ff; }
.cal-chip.pending { background: #4f7fd026; border-left-color: #4f7fd0; }
.cal-opens { display: block; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lfg-what { grid-template-columns: 2fr 1fr; }
@media (max-width: 760px) {
  .post-extra { flex-basis: 100%; }
  .raid-dialog .raid-row.lfg-what { grid-template-columns: 1fr; }
}
.char-place:not(.even) { grid-template-columns: 1fr; }

/* ---------- Raid managers, characters on sign-ups, invite lists ---------- */
.ev-person .su-name { flex: 0 1 auto; min-width: 0; }
.ev-person:has(.ev-owner:not(:empty)) { flex-wrap: wrap; row-gap: 0; }
.ev-owner { order: 3; flex: 1 0 100%; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.2; margin-top: -1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-owner:empty { display: none; }
.ev-btn.export { margin-left: auto; }
.ev-btn.attendance + .ev-btn.export { margin-left: 0; }
.su-char-hint { margin-top: -2px; }
.combo-warn { color: var(--glow) !important; }
.rs-head { margin: 10px 0 0; }
.rs-roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.rs-role { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--night); cursor: pointer; min-width: 0; }
.rs-role:has(input:checked) { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 12%, var(--night)); }
.rs-role input { width: 18px; height: 18px; margin: 0; accent-color: var(--ember); flex: none; }
.rs-role .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rs-role-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-who { margin: 0; }
.rs-channel .select { width: 100%; max-width: 360px; }
dialog.export-dialog, dialog.add-raid-dialog { width: min(600px, 96vw); }
dialog.export-dialog[open], dialog.add-raid-dialog[open] { display: flex; flex-direction: column; gap: 10px; max-height: 92vh; }
.add-raid-body { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.add-raid-body .select { width: 100%; }
.exp-options { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.exp-name { display: flex; flex-direction: row; align-items: center; gap: 8px; margin-left: auto; }
.exp-name .select { width: auto; }
.exp-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.exp-tab { min-height: 32px; padding: 4px 12px; line-height: 1.2; border: 1px solid var(--line); border-radius: 8px; background: var(--night); color: var(--muted); font-size: 13px; font-weight: 600; }
.exp-tab.on { background: var(--ember); border-color: var(--ember); color: #1a0d05; }
.exp-out { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.exp-help { margin: 0; }
.exp-block { display: grid; gap: 4px; }
.exp-block-head { display: flex; justify-content: space-between; align-items: center; }
.exp-copy { height: 30px; padding: 0 14px; border-radius: 8px; font-size: 13px; }
.exp-text { width: 100%; box-sizing: border-box; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); resize: vertical; }
.exp-flag { padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--glow); background: color-mix(in srgb, var(--glow) 8%, transparent); font-size: 13px; }
.exp-flag strong { color: var(--glow); }
@media (max-width: 760px) {
  dialog.export-dialog, dialog.add-raid-dialog { width: 100vw; max-width: none; height: auto; max-height: 100dvh; border-radius: 0; padding: calc(var(--safe-top) + 12px) 12px calc(var(--safe-bottom) + 12px); }
  dialog.export-dialog[open], dialog.add-raid-dialog[open] { max-height: 100dvh; }
  .exp-name { margin-left: 0; width: 100%; }
  .exp-name .select { flex: 1; }
  .exp-tab { flex: 1 1 calc(50% - 4px); padding: 4px 6px; }
  .exp-tab:first-child { flex-basis: 100%; }
  .rs-roles { grid-template-columns: 1fr; }
}

/* ---------- Edit channel, topics, slowmode, spoiler and age-restricted channels ---------- */
.chat-head .topic.has-topic { cursor: pointer; }
.chat-head .topic a { color: var(--glow); }
.chat-head .topic .mention { padding: 0 3px; }
.chat-head .topic .custom-emoji { width: 18px; height: 18px; vertical-align: -4px; }
#channel-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
#channel-name.has-topic { cursor: pointer; }
#channel-name .nsfw-badge, .channel .nsfw-badge { font-size: 11px; line-height: 1; flex: 0 0 auto; filter: saturate(.9); }
.channel .ch-gear { visibility: hidden; margin-left: auto; flex: 0 0 auto; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 5px; font-size: 13px; color: var(--muted); }
.channel .mention-badge ~ .ch-gear, .channel .mute-icon ~ .ch-gear { margin-left: 4px; }
.channel:hover .ch-gear, .channel:focus-within .ch-gear, .channel.active .ch-gear { visibility: visible; }
.channel .ch-gear:hover { color: var(--text); background: var(--line); }
@media (hover: none) { .channel:not(.active) .ch-gear { visibility: hidden; } }

.topic-dialog { width: min(520px, 92vw); }
.topic-dialog h3 { margin: 0 0 10px; font-size: 18px; }
.topic-dialog .topic-full { margin: 0 0 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; max-height: 50vh; overflow-y: auto; }
.topic-dialog .topic-full a { color: var(--glow); }
.topic-actions { display: flex; justify-content: space-between; gap: 8px; }

/* The 18+ gate fills the chat until you answer. */
.age-gate { margin: auto; width: min(440px, calc(100% - 32px)); text-align: center; padding: 32px 28px 28px; border: 1px solid var(--line); border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, #ff6b3522, transparent 60%), var(--panel); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.age-gate .ag-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; background: #f8717122; box-shadow: 0 0 0 6px #f8717112; margin-bottom: 6px; }
.age-gate h2 { margin: 0; font-size: 21px; }
.age-gate .ag-text { margin: 0; font-weight: 600; }
.age-gate .ag-sub { margin: 0; font-size: 13px; line-height: 1.45; }
.age-gate .ag-actions { display: flex; gap: 10px; margin-top: 12px; width: 100%; }
.age-gate .ag-actions button { flex: 1; height: 42px; }
.composer-wrap.age-gated .composer, .composer-wrap.age-gated .typing, .composer-wrap.age-gated .slowmode-note { display: none; }

/* Slowmode countdown, on the typing line. */
.slowmode-note { position: absolute; right: 6px; bottom: 2px; font-size: 12px; line-height: 20px; color: var(--muted); pointer-events: none; white-space: nowrap; }
.slowmode-note.cooling { color: var(--glow); font-weight: 600; }

/* Spoiler channels: blurred until clicked. */
.spoiler-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 16px 8px; padding: 6px 8px 6px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--raised) 92%, transparent); backdrop-filter: blur(6px); font-size: 13px; color: var(--muted); }
.spoiler-bar strong { color: var(--text); }
.spoiler-bar .ghost { height: 30px; padding: 0 10px; color: var(--glow); border-color: var(--ember); flex: 0 0 auto; }
.msg.spoilered .msg-body { position: relative; cursor: pointer; }
.msg.spoilered .msg-body > :not(.msg-meta):not(.spoiler-cover) { filter: blur(9px) saturate(.6); user-select: none; pointer-events: none; }
.msg.spoilered .spoiler-cover { position: absolute; left: 0; right: 0; bottom: 0; top: 0; border: 0; background: none; display: flex; align-items: center; padding: 0; cursor: pointer; }
.msg.first.spoilered .spoiler-cover { top: 22px; }
.msg.spoilered .spoiler-cover span { padding: 2px 10px; border-radius: 6px; background: var(--night); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.msg.spoilered:hover .spoiler-cover span { color: var(--text); border-color: var(--muted); }

/* Edit channel */
dialog.edit-channel .settings-nav .ec-kind { margin-top: -4px; font-size: 11px; opacity: .7; }
dialog.edit-channel .settings-nav .ec-sep { height: 1px; background: var(--line); margin: 8px 8px; flex: 0 0 auto; }
dialog.edit-channel .settings-nav .ec-delete-tab { color: var(--occupied); }
dialog.edit-channel .settings-nav .ec-delete-tab:hover, dialog.edit-channel .settings-nav .ec-delete-tab.active { background: #f8717118; color: var(--occupied); }
.ec-page { display: flex; flex-direction: column; gap: 16px; max-width: 620px; padding-bottom: 8px; }
.ec-page .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ec-page .field input[type=text] { width: 100%; color: var(--text); font-size: 15px; }
.ec-page .field input[type=text]:focus, .ec-page textarea:focus { border-color: var(--ember); }
.ec-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ec-hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.ec-count { font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.ec-count.near { color: var(--glow); }
.ec-page textarea { width: 100%; min-height: 96px; resize: vertical; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: 14px/1.45 Inter, sans-serif; outline: none; }
.ec-topic-preview { border-left: 3px solid var(--ember); background: var(--night); border-radius: 0 8px 8px 0; padding: 8px 12px; font-weight: 400; color: var(--text); font-size: 14px; }
.ec-topic-preview .ec-preview-label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 2px; }
.ec-topic-preview .ec-preview-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.ec-topic-preview a { color: var(--glow); }
.ec-divider { height: 1px; background: var(--line); }
.ec-slow-value { color: var(--text); font-size: 13px; }
.ec-slider { position: relative; padding: 4px 8px 22px; }
.ec-slider input[type=range] { width: 100%; margin: 0; accent-color: var(--ember); height: 22px; cursor: pointer; }
.ec-ticks { position: absolute; left: 16px; right: 16px; bottom: 0; height: 16px; }
.ec-ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.ec-ticks span:first-child { transform: translateX(-30%); }
.ec-ticks span:last-child { transform: translateX(-70%); }
.ec-modes { display: flex; flex-direction: column; gap: 8px; }
.ec-mode { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); cursor: pointer; transition: border-color .15s, background .15s; }
.ec-mode:hover { border-color: #3a3a40; }
.ec-mode:has(input:checked) { border-color: var(--ember); background: #ff6b3512; }
.ec-mode-nsfw:has(input:checked) { border-color: var(--occupied); background: #f8717112; }
.ec-mode input { margin: 3px 0 0; accent-color: var(--ember); width: 16px; height: 16px; flex: 0 0 auto; }
.ec-mode-nsfw input { accent-color: var(--occupied); }
.ec-mode-icon { font-size: 20px; line-height: 1; flex: 0 0 auto; margin-top: 1px; }
.ec-mode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ec-mode-name { color: var(--text); font-size: 14px; font-weight: 600; }
.ec-mode-desc { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.4; }
.ec-savebar { position: sticky; bottom: -12px; margin-top: auto; display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 10px 16px;
  border-radius: 12px; background: var(--night); border: 1px solid var(--line); box-shadow: 0 8px 24px #000a; z-index: 2; }
.ec-savebar.show { display: flex; animation: ec-pop .18s ease-out; }
.ec-savebar-text { font-size: 14px; font-weight: 600; }
.ec-savebar-btns { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.ec-savebar .link { color: var(--text); font-weight: 600; }
.ec-savebar .primary { height: 36px; }
@keyframes ec-pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ec-savebar.show { animation: none; } }
.ec-perms { display: flex; gap: 16px; min-height: 100%; }
.ec-perms .ec-perm-targets { width: 190px; flex: 0 0 190px; border-radius: 12px; border: 1px solid var(--line); padding: 10px 6px; align-self: flex-start; position: sticky; top: 0; max-height: 100%; }
.ec-perm-page { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ec-danger { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 12px; border: 1px solid #f8717155; background: #f8717110; }
.ec-danger p { margin: 0; }
.ec-danger-icon { font-size: 30px; line-height: 1; }
.ec-danger-title { font-weight: 700; font-size: 15px; margin-bottom: 4px !important; }
.ec-delete-btn { background: var(--occupied) !important; color: var(--night) !important; border-color: var(--occupied) !important; font-weight: 700; }
@media (max-width: 760px) {
  #channel-name.has-topic::after { content: "›"; color: var(--muted); font-weight: 400; }
  .ec-page { max-width: none; }
  .ec-perms { flex-direction: column; gap: 10px; }
  dialog.settings .ec-perms .ec-perm-targets { width: auto; flex: 0 0 auto; position: static; padding: 6px; padding-right: 6px; border-radius: 10px; }
  .ec-savebar { bottom: 0; flex-wrap: wrap; }
  .ec-savebar-text { font-size: 13px; }
  .spoiler-bar { margin: -8px 4px 8px; }
  .age-gate { padding: 26px 18px 20px; }
}
.app.age-gated #pins-btn, .app.age-gated #threads-btn { visibility: hidden; }
dialog.edit-channel .ec-perm-targets h3 { font-size: 11px !important; margin: 4px 8px 6px; }
dialog.edit-channel .ec-perm-targets h3:first-child { display: none; }
.ec-perm-page > p { font-size: 13px; line-height: 1.45; }
@media (max-width: 760px) {
  dialog.edit-channel .ec-wide { display: none; }
  .ec-ticks span:nth-child(13) { display: none; }
}
dialog.edit-channel .settings-nav .ec-delete-tab { gap: 0; white-space: pre; }

/* ---------- Soundboard popover (soundboard.js) ---------- */
.popover.sb-pop { padding: 0; overflow: hidden; }
.sb-board { width: 520px; height: 480px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; background: var(--panel); }
.sb-top { display: flex; gap: 8px; align-items: center; padding: 12px 12px 8px; }
.sb-search-wrap { flex: 1; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 8px; background: var(--night); border: 1px solid var(--line); color: var(--muted); }
.sb-search-wrap:focus-within { border-color: var(--ember); }
.sb-search-icon { display: inline-flex; }
.sb-search { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 14px; }
.sb-vol-btn { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.sb-vol-btn.on { border-color: var(--ember); color: var(--glow); }
.sb-vol-btn.muted { color: var(--occupied); }
.sb-volume { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 8px 10px; border-radius: 8px; background: var(--raised); font-size: 13px; }
.sb-volume input[type=range] { flex: 1; accent-color: var(--ember); }
.sb-volume .check-row { gap: 6px; }
.sb-note { margin: 0 12px 6px; }
.sb-body { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--line); }
.sb-rail { flex: 0 0 52px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; overflow-y: auto; background: var(--night); border-right: 1px solid var(--line); scrollbar-width: none; }
.sb-rail-btn { width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 50%; background: var(--raised); font-size: 17px; line-height: 1; display: grid; place-items: center; transition: border-radius .15s, background .15s; }
.sb-rail-btn.guild { font-size: 12px; font-weight: 700; color: var(--text); }
.sb-rail-btn:hover { border-radius: 12px; background: color-mix(in srgb, var(--ember) 30%, var(--raised)); }
.sb-list { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 12px 12px; scroll-padding-top: 4px; }
.sb-sec + .sb-sec { margin-top: 4px; }
.sb-sec-head { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 2px 6px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.sb-sec-head:hover { color: var(--text); }
.sb-caret { display: inline-block; transition: transform .15s; }
.sb-sec.closed .sb-caret { transform: rotate(-90deg); }
.sb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sb-empty, .sb-none { margin: 2px 2px 8px; }
.sb-tile { position: relative; min-width: 0; }
.sb-play { position: relative; width: 100%; height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 20px; background: var(--raised); overflow: hidden; text-align: left; }
.sb-play:hover, .sb-play:focus-visible { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 12%, var(--raised)); outline: 0; }
.sb-play:active { transform: scale(.97); }
.sb-emoji { flex: 0 0 auto; font-size: 17px; line-height: 1; }
.sb-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.sb-tile .sb-prev, .sb-tile .sb-star { position: absolute; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 50%; padding: 0; font-size: 11px; line-height: 1; background: var(--night); color: var(--muted); opacity: 0; transition: opacity .1s; }
.sb-tile .sb-star { right: 6px; font-size: 13px; }
.sb-tile .sb-prev { right: 31px; }
.sb-tile:hover .sb-prev, .sb-tile:hover .sb-star, .sb-tile:focus-within .sb-prev, .sb-tile:focus-within .sb-star { opacity: 1; }
.sb-tile:hover .sb-name, .sb-tile:focus-within .sb-name { margin-right: 46px; }
.sb-tile.fav .sb-star { opacity: 1; color: var(--glow); background: none; }
.sb-tile .sb-prev:hover, .sb-tile .sb-star:hover { color: var(--text); }
.sb-board.cooling .sb-play { opacity: .5; }
.sb-board.cooling .sb-play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--ember) 35%, transparent), transparent); transform-origin: left; animation: sb-sweep 2s linear forwards; pointer-events: none; }
@keyframes sb-sweep { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.sb-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--night); }
.sb-manage-link { border: 0; background: none; padding: 0; color: var(--glow); font-size: 13px; font-weight: 600; }
.sb-manage-link:hover { text-decoration: underline; }
.vp-btn.sb-open svg { display: block; }
@media (pointer: coarse) {
  .sb-tile .sb-prev, .sb-tile .sb-star { opacity: 1; }
  .sb-tile .sb-name { margin-right: 46px; }
}
@media (max-width: 760px) {
  .popover.sb-pop { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-width: 100%; max-height: none; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .sb-board { width: 100%; max-width: 100%; height: min(78dvh, 620px); padding-bottom: var(--safe-bottom); }
  .sb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sb-foot > .muted { display: none; }
  .sb-foot:not(:has(.sb-manage-link)) { display: none; }
}

/* Manage sounds */
dialog.sb-manage { width: min(560px, 94vw); max-height: 86dvh; overflow-y: auto; }
.sbm-head { display: flex; align-items: center; justify-content: space-between; }
.sbm-head h2 { margin: 0; }
dialog.sb-manage h3 { margin: 18px 0 4px; font-size: 15px; }
dialog.sb-manage p { margin: 0 0 8px; }
.sbm-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sbm-sub .primary.sbm-add { height: 32px; padding: 0 14px; font-size: 13px; }
.sbm-classics, .sbm-list { display: grid; gap: 6px; }
.sbm-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.sbm-row input { min-width: 0; flex: 1; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--night); }
.sbm-row input.sbm-emoji { flex: 0 0 52px; text-align: center; }
.sbm-row .ghost { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: none; white-space: nowrap; }
.sbm-row .ghost.danger { color: var(--occupied); }
.sbm-emoji-show { font-size: 18px; width: 28px; text-align: center; }
.sbm-name { flex: 1; }
.sbm-row.is-hidden { opacity: .6; }
.sbm-row.is-hidden .sbm-name { text-decoration: line-through; }
.sbm-toggle.off { color: var(--glow); border-color: var(--glow) !important; }

/* Entrance sound: built-in choices */
.entrance-classics { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.entrance-classics button { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--raised); font-size: 13px; }
.entrance-classics button.on { border-color: var(--ember); background: color-mix(in srgb, var(--ember) 18%, var(--raised)); color: var(--glow); }
/* ---------- Invite links (invites.js) ---------- */
dialog.invite-dialog { width: min(500px, 94vw); max-height: 90vh; }
.invite-dialog h2 { overflow-wrap: anywhere; }
.invite-dialog .inv-guild { color: var(--glow); }
.inv-link-row { display: flex; gap: 8px; align-items: stretch; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--night); }
.inv-link-row input.inv-link { flex: 1; min-width: 0; height: 40px; border: 0; background: none; padding: 0 8px; font: 500 14px/1 "JetBrains Mono", ui-monospace, monospace; color: var(--text); text-overflow: ellipsis; }
.inv-link-row .inv-copy { flex: none; height: 40px; min-width: 104px; transition: background .2s, color .2s; }
.inv-copy.copied, .inv-row-copy.copied { background: var(--vacant); color: var(--night); border-color: var(--vacant); }
.inv-copy:disabled { opacity: .5; cursor: default; }
.inv-meta { margin: -4px 0 0; }
.inv-options { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.inv-options[open] { padding-bottom: 12px; }
.inv-options summary { cursor: pointer; padding: 10px 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.inv-options summary:hover { color: var(--text); }
.inv-option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.inv-option-grid select { width: 100%; }
.inv-options .inv-new { width: 100%; }
.inv-list-head { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.inv-list { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; }
.settings-inv-list { max-height: none; }
.inv-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); }
.inv-row-main { flex: 1; min-width: 0; }
.inv-row-code { font: 500 13px/1.4 "JetBrains Mono", ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; }
.inv-row-by { display: inline-flex; align-items: center; gap: 5px; }
.inv-row-by .avatar { font-size: 9px; }
.inv-row-actions { display: flex; gap: 6px; flex: none; }
.inv-row-actions .small-btn { min-width: 62px; }
.auth-invite { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #ff6b3555; border-radius: 12px; background: #ff6b3512; font-size: 14px; line-height: 1.35; }
.auth-invite > span:last-child { display: grid; gap: 1px; min-width: 0; }
.auth-invite b { color: #fff; font-size: 15px; overflow-wrap: anywhere; }
.auth-invite.dead { display: block; border-color: #f8717150; background: #f8717112; }
.auth-invite-tile { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: radial-gradient(120% 120% at 30% 20%, #ff9a5c, var(--ember) 45%, #c2410c); color: #1a0d06; font-weight: 800; font-size: 15px; }
@media (max-width: 760px) {
  dialog.invite-dialog { padding: 18px; }
  .inv-option-grid { grid-template-columns: 1fr; }
  .inv-row { flex-wrap: wrap; }
  .inv-row-actions { width: 100%; justify-content: flex-end; }
}
