:root {
  --bg: #16181d;
  --bg-side: #1c1f26;
  --bg-rail: #101216;
  --surface: #23262e;
  --surface-2: #2c3039;
  --border: #2a2e37;
  --text: #e8eaef;
  --muted: #9ca2ad;
  --faint: #6b717d;
  --accent: #ff7a59;
  --accent-ink: #1a0f0b;
  --accent-soft: rgba(255, 122, 89, 0.12);
  --danger: #f0605d;
  --ok: #5fd38d;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, ui-monospace, monospace;
  --content: #dfe2e8;
  --hover: rgba(255, 255, 255, 0.03);
  --me-bar: #181a20;
  --input-bg: var(--bg-rail);
  --shadow: rgba(0, 0, 0, 0.45);
  --fs: 15px;
  color-scheme: dark;
}
:root[data-theme="midnight"] {
  --bg: #0b0c0f;
  --bg-side: #101216;
  --bg-rail: #060708;
  --surface: #171a20;
  --surface-2: #20242c;
  --border: #1c1f26;
  --me-bar: #0d0f12;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-side: #f3f4f7;
  --bg-rail: #e4e6eb;
  --surface: #e9ebf0;
  --surface-2: #dcdfe6;
  --border: #dde0e6;
  --text: #1d2026;
  --muted: #5d6470;
  --faint: #8a909b;
  --accent: #e8603c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(232, 96, 60, 0.10);
  --content: #2b2f36;
  --hover: rgba(0, 0, 0, 0.035);
  --me-bar: #eceef2;
  --input-bg: #ffffff;
  --shadow: rgba(20, 24, 33, 0.18);
  --ok: #1f9d55;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- buttons & fields */
.btn {
  border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600;
  background: var(--surface-2); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.field input, .field textarea, .field select, .search-input {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--input-bg); outline: none; resize: vertical;
}
.field input[type=color] { padding: 2px; height: 40px; cursor: pointer; }
.field input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
.field input:focus, .field textarea:focus, .field select:focus, .search-input:focus { border-color: var(--accent); }
.field small { font-size: 12px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 10px; }

/* ---------------------------------------------------------------- auth */
.auth {
  height: 100%; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(255,122,89,.16), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(79,195,200,.10), transparent 60%),
    var(--bg-rail);
}
.auth-card {
  width: 100%; max-width: 400px; padding: 32px; border-radius: 16px;
  background: var(--bg-side); border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 22px; }
.brand img { width: 32px; height: 32px; }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card > p.muted { margin: 0 0 22px; }
.switch-line { margin: 16px 0 0; text-align: center; }

/* ---------------------------------------------------------------- layout */
/* The single row is pinned to the window height and every pane may shrink
   (min-height: 0) — without this, long chats grew taller than the screen and
   stopped scrolling. */
.app {
  display: grid; height: 100%;
  grid-template-columns: 72px 248px minmax(0, 1fr) 240px;
  grid-template-rows: minmax(0, 1fr);
}
.app > * { min-height: 0; }
.app.no-members { grid-template-columns: 72px 248px minmax(0, 1fr) 0; }
.app.no-members .members { display: none; }
.scrim { display: none; }

/* ---------------------------------------------------------------- server rail */
.rail {
  background: var(--bg-rail); padding: 12px 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item {
  position: relative; width: 48px; height: 48px; flex: none; border: 0;
  border-radius: 24px; background: var(--sc, var(--surface)); color: var(--text);
  font-weight: 700; font-size: 15px; display: grid; place-items: center;
  transition: border-radius .18s, background .18s, color .18s;
}
.rail-item:hover, .rail-item.active { border-radius: 15px; background: var(--accent); color: var(--accent-ink); }
.rail-item::before {
  content: ""; position: absolute; left: -12px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--text); height: 0; transition: height .18s;
}
.rail-item.unread::before { height: 8px; }
.rail-item:hover::before { height: 20px; }
.rail-item.active::before { height: 40px; }
.rail-item.add { color: var(--ok); background: var(--surface); }
.rail-item.add:hover { background: var(--ok); color: #0c1f14; }
.rail-item svg { width: 24px; height: 24px; }
.rail-sep { width: 32px; height: 2px; border-radius: 2px; background: var(--surface); flex: none; }
.badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; border: 3px solid var(--bg-rail); box-sizing: content-box;
}

/* ---------------------------------------------------------------- sidebar */
.sidebar { background: var(--bg-side); display: flex; flex-direction: column; min-width: 0; }
.sidebar-header {
  height: 52px; flex: none; padding: 0 10px 0 16px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border); font-weight: 700;
}
.sidebar-header .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-header.clickable { cursor: pointer; }
.sidebar-header.clickable:hover { background: var(--surface); }
.sidebar-list { flex: 1; overflow-y: auto; padding: 10px 8px; }
.section-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 8px 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
}
.section-label:first-child { padding-top: 4px; }
.section-label .icon-btn { width: 22px; height: 22px; }
.section-label .icon-btn svg { width: 16px; height: 16px; }

.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0;
  border-radius: 7px; background: transparent; color: var(--muted); text-align: left; position: relative;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item.unread { color: var(--text); font-weight: 700; }
.nav-item.unread::before {
  content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text);
}
.nav-item .hash { color: var(--faint); font-size: 18px; width: 18px; text-align: center; line-height: 1; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .trail { opacity: 0; width: 22px; height: 22px; }
.nav-item:hover .trail, .nav-item.active .trail { opacity: 1; }
.empty-note { padding: 10px 8px; color: var(--faint); font-size: 13px; }

.me-bar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 10px;
  background: var(--me-bar); border-top: 1px solid var(--border);
}
.me-bar .who { flex: 1; min-width: 0; line-height: 1.2; }
.me-bar .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.me-bar .who span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- avatars */
.avatar {
  --c: var(--accent);
  position: relative; flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #15161a;
  background: var(--c); user-select: none;
}
.avatar.lg { width: 40px; height: 40px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; font-size: 30px; }
.avatar .dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--faint); border: 3px solid var(--bg-side); box-sizing: content-box;
}
.avatar .dot.on { background: var(--ok); }
.avatar.xl .dot { width: 16px; height: 16px; border-width: 4px; }

/* ---------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; min-width: 0; background: var(--bg); position: relative; }
.chat-header {
  height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border);
}
.chat-header .title { font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-header .title .hash { color: var(--faint); font-size: 22px; font-weight: 400; }
.chat-header .title span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header .spacer { flex: 1; }
.menu-toggle { display: none; }

.conn-banner {
  background: #5a3a12; color: #ffd9a8; text-align: center; font-size: 13px; padding: 4px;
}

.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 0 12px; overflow-wrap: anywhere; }
.loading, .older-hint { text-align: center; color: var(--faint); padding: 18px; font-size: 13px; }

.intro { padding: 32px 18px 12px; }
.intro .big-icon {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-size: 34px; color: var(--text); margin-bottom: 12px;
}
.intro h2 { margin: 0 0 4px; font-size: 26px; }
.intro p { margin: 0; color: var(--muted); }

.day {
  display: flex; align-items: center; gap: 10px; margin: 18px 16px 6px; color: var(--faint);
  font-size: 12px; font-weight: 700;
}
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.msg {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px;
  padding: 3px 56px 3px 16px; margin-top: 14px;
}
.msg.grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--hover); }
.msg.mention { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.msg .avatar { grid-row: span 2; cursor: pointer; margin-top: 2px; }
.msg .gutter-time {
  font-size: 11px; color: var(--faint); text-align: right; opacity: 0; padding-top: 3px;
}
.msg.grouped:hover .gutter-time { opacity: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head .author { font-weight: 700; cursor: pointer; }
.msg-head .author:hover { text-decoration: underline; }
.msg-head time { font-size: 12px; color: var(--faint); }
.content { white-space: normal; color: var(--content); }
.content .edited { font-size: 11px; color: var(--faint); margin-left: 4px; }
.content code {
  font-family: var(--mono); font-size: 13px; background: var(--bg-rail);
  padding: 2px 5px; border-radius: 4px;
}
.content pre {
  margin: 4px 0; padding: 10px 12px; background: var(--bg-rail); border: 1px solid var(--border);
  border-radius: 8px; overflow-x: auto; max-width: 100%;
}
.content pre code { background: none; padding: 0; white-space: pre; }
.content blockquote { margin: 2px 0; padding-left: 10px; border-left: 3px solid var(--surface-2); color: var(--muted); }
.content .ping { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 600; }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px;
  border: 1px solid transparent; background: var(--surface); font-size: 14px;
}
.reaction span { font-size: 12px; font-weight: 700; color: var(--muted); }
.reaction:hover { border-color: var(--surface-2); }
.reaction.mine { background: var(--accent-soft); border-color: var(--accent); }
.reaction.mine span { color: var(--accent); }

.msg-actions {
  position: absolute; right: 16px; top: -14px; display: none; gap: 2px; padding: 2px;
  background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 2;
}
.msg:hover .msg-actions, .msg-actions.open { display: flex; }
.msg-actions .icon-btn.danger:hover { color: var(--danger); }

.edit-box {
  width: 100%; resize: none; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--surface); padding: 8px 10px; outline: none; margin-top: 2px;
}
.edit-hint { font-size: 12px; color: var(--faint); margin: 2px 0 4px; }

/* ---------------------------------------------------------------- composer */
.composer-wrap { padding: 0 16px 4px; flex: none; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px;
  background: var(--surface); border-radius: 12px; border: 1px solid transparent;
}
.composer:focus-within { border-color: var(--surface-2); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent;
  max-height: 40vh; padding: 5px 0; line-height: 1.45;
}
.composer textarea::placeholder { color: var(--faint); }
.send-btn {
  flex: none; width: 34px; height: 34px; border-radius: 8px; border: 0;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
}
.send-btn:disabled { background: var(--surface-2); color: var(--faint); cursor: default; }
.composer.disabled { opacity: .5; pointer-events: none; }
.typing { height: 22px; font-size: 12px; color: var(--muted); padding: 3px 4px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.typing b { color: var(--text); }
.typing .dots { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s; }
.typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.empty-state { height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.empty-state h2 { color: var(--text); margin: 12px 0 6px; }
.empty-state img { width: 72px; height: 72px; opacity: .9; }

/* ---------------------------------------------------------------- members */
.members { background: var(--bg-side); overflow-y: auto; padding: 8px; }
.member {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0;
  border-radius: 7px; background: transparent; text-align: left;
}
.member:hover { background: var(--surface); }
.member.offline { opacity: .45; }
.member .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.member .crown { color: #f5b942; width: 14px; height: 14px; flex: none; }
.profile { padding: 20px 12px; text-align: center; }
.profile .avatar { margin: 0 auto 12px; }
.profile h3 { margin: 0; }
.profile p { margin: 4px 0 16px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- friends */
.nav-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--muted); flex: none; }
.nav-icon svg { width: 20px; height: 20px; }
.nav-item.active .nav-icon { color: var(--text); }
.pill {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
}
.chat-header .title .nav-icon { color: var(--faint); }
.header-tabs {
  display: flex; align-items: center; gap: 6px; margin-left: 12px; padding-left: 14px;
  border-left: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; min-width: 0;
}
.header-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 6px;
  padding: 4px 10px; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tab-btn:hover { background: var(--surface); color: var(--text); }
.tab-btn.active { background: var(--surface-2); color: var(--text); }
.tab-btn.add { background: var(--ok); color: #0c1f14; }
.tab-btn.add.active { background: transparent; color: var(--ok); }

.friends-page { padding: 16px 20px; max-width: 900px; height: 100%; }
.friends-page h2 { margin: 4px 0 4px; font-size: 18px; }
.friends-page > p { margin: 0 0 14px; }
.friends-page .empty-state { height: auto; padding-top: 12vh; }
.friend-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-top: 1px solid var(--border);
  border-radius: 8px;
}
.friend-row:hover { background: var(--surface); border-top-color: transparent; }
.friend-row:hover + .friend-row { border-top-color: transparent; }
.friend-row .avatar { cursor: pointer; }
.friend-row .avatar .dot { border-color: var(--bg); }
.friend-row:hover .avatar .dot { border-color: var(--surface); }
.friend-info { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.friend-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-info span { font-size: 13px; color: var(--muted); }
.friend-actions { display: flex; gap: 8px; }
.round-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--bg-side); color: var(--muted);
}
.round-btn svg { width: 18px; height: 18px; }
.round-btn:hover { color: var(--text); background: var(--bg-rail); }
.round-btn.ok:hover { color: var(--ok); }
.round-btn.danger:hover { color: var(--danger); }

.add-friend {
  display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 14px; border-radius: 10px;
  background: var(--bg-rail); border: 1px solid var(--border);
}
.add-friend:focus-within { border-color: var(--accent); }
.add-friend.ok { border-color: var(--ok); }
.add-friend.bad { border-color: var(--danger); }
.add-friend input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 6px 0; }
.add-note { font-size: 13px; margin-top: 8px; }
.add-note.ok { color: var(--ok); }
.add-note.bad { color: var(--danger); }
.card-actions, .profile-actions { display: grid; gap: 8px; }
.profile-actions { margin-bottom: 16px; }

/* ---------------------------------------------------------------- modals, popovers, toast */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center;
  padding: 16px; z-index: 50; animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 440px; background: var(--bg-side); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; box-shadow: 0 24px 70px rgba(0,0,0,.5);
  animation: pop .18s ease-out; max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal > p { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.tabs { display: flex; gap: 4px; background: var(--bg-rail); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; border-radius: 7px; padding: 8px; background: transparent; color: var(--muted); font-weight: 600; }
.tabs button.active { background: var(--surface-2); color: var(--text); }
.invite-row { display: flex; gap: 8px; }
.invite-row input { flex: 1; font-family: var(--mono); }
.user-pick { max-height: 300px; overflow-y: auto; margin-top: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

.popover {
  position: fixed; z-index: 40; background: var(--bg-side); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 34px rgba(0,0,0,.45); padding: 6px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(6, 36px); gap: 2px; }
.emoji-grid button { width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; font-size: 20px; }
.emoji-grid button:hover { background: var(--surface-2); }
.menu { min-width: 200px; display: grid; }
.menu button {
  display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 10px;
  border-radius: 6px; text-align: left; color: var(--text);
}
.menu button svg { width: 18px; height: 18px; flex: none; }
.menu button:hover { background: var(--accent); color: var(--accent-ink); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger); color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 6px; }
.user-card { width: 260px; padding: 16px; text-align: center; }
.user-card .avatar { margin: 0 auto 10px; }
.user-card h3 { margin: 0 0 2px; }
.user-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--surface-2); color: var(--text); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .2s, transform .2s; pointer-events: none;
  z-index: 60; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .app, .app.no-members { grid-template-columns: 72px 248px minmax(0, 1fr); }
  .members {
    position: fixed; right: 0; top: 52px; bottom: 0; width: 260px; z-index: 30;
    transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 30px rgba(0,0,0,.35);
  }
  .app.show-members .members { transform: none; }
}
@media (max-width: 760px) {
  .app, .app.no-members { grid-template-columns: minmax(0, 1fr); }
  .rail, .sidebar {
    position: fixed; top: 0; bottom: 0; z-index: 35; transition: transform .2s;
    transform: translateX(-340px);
  }
  .rail { left: 0; width: 72px; }
  .sidebar { left: 72px; width: min(268px, calc(100vw - 88px)); }
  .app.show-nav .rail, .app.show-nav .sidebar { transform: none; }
  .app.show-nav .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 34; }
  .menu-toggle { display: inline-grid; }
  .msg { padding-right: 16px; }
  .chat-header .sub { display: none; }
  .header-tabs { margin-left: 4px; padding-left: 8px; }
  .chat-header .friends-title .name { display: none; }
  .friends-page { padding: 12px; }
  .add-friend { flex-wrap: wrap; padding: 8px; }
  .add-friend input { flex-basis: 100%; padding: 4px 6px; }
  .add-friend .btn { width: 100%; }
}

/* ================================================================ v1.2 additions */
.small-btn { padding: 5px 10px; font-size: 13px; }
.btn.danger.small-btn, .btn.small-btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small-btn.danger:hover { background: var(--danger); color: #fff; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 0; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.btn svg { vertical-align: -4px; }

/* server icons (invites, settings) */
.server-icon {
  width: 48px; height: 48px; border-radius: 15px; flex: none; display: grid; place-items: center;
  background: var(--sc, var(--surface-2)); color: var(--text); font-weight: 800;
}
.server-icon.lg { width: 56px; height: 56px; font-size: 18px; }
.server-icon.xl { width: 80px; height: 80px; font-size: 26px; border-radius: 22px; }
.server-icon.skeleton { animation: pulse 1.2s infinite; }
.server-icon.dead { color: var(--danger); }
@keyframes pulse { 50% { opacity: .5; } }

/* sidebar extras */
.dm-item .label { display: grid; line-height: 1.2; }
.dm-status { font-size: 12px; color: var(--faint); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.nav-item .marks { font-size: 11px; margin-left: 4px; }
.has-news { position: relative; color: var(--accent); }
.has-news::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.member-text { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.member-status { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.about-box { text-align: left; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 0 0 12px; }
.about-box p { margin: 0; font-size: 13px; color: var(--content); white-space: pre-wrap; }
.about-box .section-label { padding: 0 0 4px; }

/* composer */
.composer { align-items: center; padding: 6px 6px 6px 6px; gap: 4px; }
.composer-btn {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); display: grid; place-items: center;
}
.composer-btn svg { width: 22px; height: 22px; }
.composer-btn:hover { color: var(--text); background: var(--surface-2); }
.gif-btn { font-size: 11px; font-weight: 900; letter-spacing: .03em; }
.gif-btn:hover { color: var(--accent); }
.composer textarea { padding: 7px 4px; }
.composer textarea:disabled { cursor: not-allowed; }
.tray { display: flex; gap: 8px; padding: 8px; margin-bottom: 6px; background: var(--surface); border-radius: 12px; overflow-x: auto; }
.tray-item { position: relative; width: 92px; height: 92px; flex: none; border-radius: 8px; overflow: hidden; background: var(--bg-rail); }
.tray-item img { width: 100%; height: 100%; object-fit: cover; }
.tray-item.uploading img { opacity: .45; }
.tray-item.error { outline: 2px solid var(--danger); }
.tray-remove {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 6px; border: 0;
  background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center;
}
.tray-remove svg { width: 16px; height: 16px; }
.tray-error { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.spinner {
  position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.drop-zone {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; pointer-events: none;
  background: rgba(255, 122, 89, .14); border: 3px dashed var(--accent); border-radius: 14px; margin: 8px;
}
.drop-zone div { background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 14px 22px; border-radius: 12px; }

/* message extras */
.content.big-emoji { font-size: 2.6em; line-height: 1.2; }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.attachment { position: relative; max-width: 100%; border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--surface); line-height: 0; }
.attachment img { max-width: 100%; height: auto; display: block; }
.gif-tag {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 900;
  background: rgba(0,0,0,.6); color: #fff; line-height: 1.6;
}
.att-star {
  position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s;
}
.attachment:hover .att-star, .att-star.saved { opacity: 1; }
.att-star.saved { color: #f5b942; }
.link-warning {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; padding: 4px 8px; border-radius: 6px;
  background: rgba(240, 96, 93, .12); color: var(--danger); font-size: 12px; font-weight: 600;
}
.link-warning svg { width: 16px; height: 16px; flex: none; }
.blocked-msg { margin-top: 6px; }
.blocked-msg .link-btn { color: var(--faint); font-size: 13px; }
.add-reaction { opacity: 0; }
.msg:hover .add-reaction { opacity: 1; }
.add-reaction svg { width: 16px; height: 16px; color: var(--muted); }
.quick-react { font-size: 17px; }
.msg-actions { top: -16px; }

/* invite cards */
.invite-card {
  max-width: 430px; margin-top: 6px; padding: 12px 14px; border-radius: 10px; background: var(--bg-side);
  border: 1px solid var(--border); line-height: 1.35;
}
.invite-card.big { max-width: none; border: 0; padding: 0; background: none; }
.invite-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.invite-body { display: flex; align-items: center; gap: 12px; }
.invite-meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.invite-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.invite-meta p { margin: 6px 0 0; color: var(--content); }
.dot-on, .dot-off { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 0; }
.dot-on { background: var(--ok); }
.dot-off { background: var(--faint); margin-left: 8px; }
.auth-invite {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 18px; border-radius: 12px;
  background: var(--surface); line-height: 1.3;
}
.auth-invite div:last-child { display: grid; }

/* popovers: emoji + gif pickers */
.emoji-pop { width: 340px; padding: 0; overflow: hidden; }
.emoji-picker { display: grid; }
.emoji-cats { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.emoji-cats button { flex: none; width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; font-size: 18px; opacity: .6; }
.emoji-cats button:hover, .emoji-cats button.active { opacity: 1; background: var(--surface-2); }
.emoji-title { padding: 8px 10px 2px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.emoji-grid.big { grid-template-columns: repeat(8, 1fr); max-height: 260px; overflow-y: auto; padding: 4px 6px 6px; }
.emoji-grid.big button { width: auto; }
.emoji-hint { padding: 4px 10px 8px; }
.emoji-pop .emoji-picker > .emoji-grid:not(.big) { padding: 6px; }
.emoji-pop [data-more-emoji] { margin: 0 6px 6px; width: calc(100% - 12px); }
.gif-picker { width: 380px; max-width: calc(100vw - 16px); padding: 10px; }
.gif-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.gif-head b { flex: 1; }
.gif-grid { columns: 2; column-gap: 6px; max-height: 340px; overflow-y: auto; }
.gif-cell { position: relative; break-inside: avoid; margin-bottom: 6px; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface); line-height: 0; }
.gif-cell img { width: 100%; height: auto; display: block; }
.gif-cell:hover { outline: 2px solid var(--accent); }
.gif-remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; border: 0;
  background: rgba(0,0,0,.65); color: #fff; display: none; place-items: center;
}
.gif-remove svg { width: 14px; height: 14px; }
.gif-cell:hover .gif-remove { display: grid; }
.gif-empty { text-align: center; padding: 18px 10px; }
.gif-empty p { margin: 4px 0; }
.gif-empty-art {
  width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff7a59, #b48cff); color: #fff; font-weight: 900; font-size: 20px;
}
.user-card .card-actions { display: grid; gap: 8px; }
.user-card .about-box { margin-bottom: 14px; }

/* toast variants */
.toast { display: flex; align-items: center; gap: 10px; }
.toast.shield { background: #4a1d1d; color: #ffd4d2; border: 1px solid var(--danger); }
.toast-icon svg { width: 22px; height: 22px; color: var(--danger); display: block; }

/* modals: wide, lightbox, full-screen settings */
.modal.wide { max-width: 640px; }
.modal.lightbox { max-width: min(92vw, 1100px); width: auto; background: transparent; border: 0; box-shadow: none; padding: 0; text-align: center; }
.lightbox-img { max-width: 100%; max-height: 78vh; border-radius: 10px; display: block; margin: 0 auto; background: var(--surface); }
.lightbox-bar { display: flex; gap: 14px; justify-content: center; align-items: center; margin-top: 12px; }
.lightbox-bar a { color: #fff; }
.modal-backdrop.full { padding: 0; }
.modal.full { max-width: none; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; padding: 0; overflow: hidden; animation: fade .15s; }
.settings-shell { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 760px) minmax(60px, 1fr); height: 100%; }
.settings-nav { background: var(--bg-side); overflow-y: auto; padding: 48px 12px 24px; display: flex; flex-direction: column; align-items: flex-end; }
.settings-nav > * { width: 200px; }
.settings-group { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 14px 10px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.settings-tab { display: block; width: 200px; text-align: left; border: 0; border-radius: 6px; padding: 7px 10px; margin-bottom: 2px; background: transparent; color: var(--muted); font-weight: 600; }
.settings-tab:hover { background: var(--surface); color: var(--text); }
.settings-tab.active { background: var(--surface-2); color: var(--text); }
.settings-tab.danger { color: var(--danger); }
.settings-content { overflow-y: auto; background: var(--bg); }
.settings-inner { padding: 48px 40px 80px; max-width: 760px; }
.settings-inner h2 { margin: 0 0 20px; font-size: 22px; }
.settings-inner h3 { margin: 28px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.settings-close {
  justify-self: start; align-self: start; margin: 48px 0 0 20px; border: 0; background: none; color: var(--muted);
  display: grid; justify-items: center; gap: 4px; font-size: 12px; font-weight: 700;
}
.settings-close svg { width: 36px; height: 36px; padding: 7px; border: 2px solid currentColor; border-radius: 50%; }
.settings-close:hover { color: var(--text); }
.settings-form { max-width: 460px; }
.big-name { font-size: 20px; }
.toggle-row, .radio-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.toggle-row > span, .radio-row > span { flex: 1; display: grid; gap: 2px; }
.radio-row { justify-content: flex-start; }
.radio-row input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.switch {
  appearance: none; flex: none; width: 42px; height: 24px; border-radius: 12px; background: var(--surface-2);
  position: relative; cursor: pointer; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(18px); }
.check { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  background: var(--c, var(--surface-2)); display: grid; place-items: center;
}
.swatch.active, .swatch:has(input:checked) { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.swatch input[type=radio] { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch.none::after { content: "—"; color: var(--muted); font-weight: 800; }
.swatch.custom { background: conic-gradient(#ff5f5f, #f5b942, #7bd389, #4fc3c8, #6aa8ff, #b48cff, #ff5f5f); overflow: hidden; }
.swatch.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.user-card.preview { background: var(--bg-side); border-radius: 12px; width: auto; }
.theme-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.theme-card { display: grid; gap: 8px; justify-items: center; border: 2px solid var(--border); border-radius: 12px; padding: 10px; background: var(--bg-side); font-weight: 600; width: 130px; }
.theme-card.active { border-color: var(--accent); }
.theme-sample { width: 100%; height: 60px; border-radius: 8px; display: grid; grid-template-columns: 1fr 2fr; gap: 4px; padding: 6px; }
.theme-sample i { border-radius: 4px; }
.theme-sample i:last-child { grid-column: 1 / 3; height: 10px; }
.t-dark { background: #16181d; } .t-dark i { background: #2c3039; }
.t-midnight { background: #060708; } .t-midnight i { background: #171a20; }
.t-light { background: #f3f4f7; } .t-light i { background: #d6d9e0; }
.range-row { display: flex; align-items: center; gap: 12px; max-width: 420px; }
.range-row input { flex: 1; accent-color: var(--accent); }
.shield-hero {
  display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(95, 211, 141, .16), rgba(79, 195, 200, .10)); border: 1px solid rgba(95, 211, 141, .35);
}
.shield-hero > svg { width: 44px; height: 44px; color: var(--ok); flex: none; }
.shield-hero div { display: grid; gap: 2px; }
.shield-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.shield-list li { display: flex; gap: 10px; align-items: flex-start; }
.shield-list svg { width: 18px; height: 18px; color: var(--ok); flex: none; margin-top: 2px; }
.shield-alert {
  display: flex; gap: 12px; padding: 12px; border-radius: 10px; margin-bottom: 12px;
  background: rgba(240, 96, 93, .12); border: 1px solid var(--danger);
}
.shield-alert svg { width: 28px; height: 28px; color: var(--danger); flex: none; }
.shield-alert div { display: grid; gap: 2px; }
.url-box { font-family: var(--mono); font-size: 13px; padding: 10px 12px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; margin-bottom: 8px; }
.server-overview { display: flex; gap: 18px; align-items: flex-end; margin-bottom: 14px; }
.server-overview .field { margin-bottom: 0; }
.member-table { margin-top: 10px; }
.member-table .member { cursor: default; }
.member .btn.small-btn { flex: none; }

/* patch notes */
.patch-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.patch-head > svg { width: 40px; height: 40px; color: var(--accent); padding: 8px; background: var(--accent-soft); border-radius: 12px; }
.patch-head h2 { margin: 0; }
.patch-head p { margin: 0; }
.patch-notes { max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.settings-inner .patch-notes { max-height: none; }
.patch { padding: 14px 0; border-top: 1px solid var(--border); }
.patch:first-child { border-top: 0; }
.patch header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.patch-version { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); }
.patch.latest .patch-version { background: var(--accent); color: var(--accent-ink); }
.patch h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.patch-new { color: var(--ok); }
.patch-murmur { color: #4fc3c8; }
.patch-fixed { color: #f5b942; }
.patch ul { margin: 0; padding-left: 20px; color: var(--content); }
.patch li { margin: 3px 0; }

/* GIF studio */
.studio-modal { max-width: 760px; }
.studio-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.studio-head h2 { margin: 0; flex: 1; }
.studio-head .tabs { margin: 0; flex: none; }
.studio-head .tabs button { white-space: nowrap; padding: 8px 14px; }
.studio-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.studio-preview {
  display: grid; place-items: center; align-content: center; gap: 8px; min-height: 240px; padding: 12px; border-radius: 12px;
  background: repeating-conic-gradient(var(--surface) 0 25%, var(--bg-side) 0 50%) 0 0 / 20px 20px;
}
.studio-preview canvas { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 6px 24px var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.chip:hover { border-color: var(--muted); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
[data-effects].disabled { opacity: .4; pointer-events: none; }
.color-row { display: flex; gap: 12px; }
.color-row .field { flex: 1; }
.studio-status { flex: 1; text-align: left; align-self: center; }
.studio .modal-actions { flex-wrap: wrap; }

/* compact mode */
body.compact .msg { margin-top: 6px; padding-top: 1px; padding-bottom: 1px; grid-template-columns: 28px minmax(0, 1fr); }
body.compact .msg.grouped { margin-top: 0; }
body.compact .msg .avatar.lg { width: 28px; height: 28px; font-size: 12px; }
body.compact .day { margin: 10px 16px 2px; }

/* light theme touch-ups */
:root[data-theme="light"] .msg-actions { box-shadow: 0 4px 14px var(--shadow); }
:root[data-theme="light"] .modal-backdrop { background: rgba(20, 24, 33, .45); }
:root[data-theme="light"] .toast { background: #2b2f36; color: #fff; }
:root[data-theme="light"] .avatar .dot { border-color: var(--bg-side); }
:root[data-theme="light"] .content pre, :root[data-theme="light"] .content code { background: #eef0f4; }

@media (max-width: 900px) {
  .settings-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; align-items: center; padding: 10px 56px 10px 10px; overflow-x: auto; gap: 4px; }
  .settings-nav > * { width: auto; flex: none; }
  .settings-tab { width: auto; white-space: nowrap; }
  .settings-group, .settings-nav hr { display: none; }
  .settings-close { position: fixed; top: 8px; right: 8px; margin: 0; }
  .settings-close span { display: none; }
  .settings-close svg { width: 32px; height: 32px; }
  .settings-inner { padding: 20px 16px 60px; }
  .profile-grid { grid-template-columns: 1fr; }
  .studio-body { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .composer-btn { width: 30px; }
  .emoji-pop { width: calc(100vw - 16px); }
  .attachment { width: auto !important; }
}

/* ================================================================ v1.3 additions */
/* avatars with pictures + presence dots */
.avatar.has-img { background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.xxl { width: 84px; height: 84px; font-size: 34px; }
.avatar .dot { background: var(--faint); }
.avatar .dot.online { background: var(--ok); }
.avatar .dot.idle { background: #f5b942; box-shadow: inset -4px -3px 0 0 #00000000; }
.avatar .dot.idle::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--bg-side); top: -1px; left: -1px; }
.avatar .dot.dnd { background: var(--danger); }
.avatar .dot.dnd::after { content: ""; position: absolute; left: 2px; right: 2px; top: 5px; height: 2px; border-radius: 2px; background: var(--bg-side); }
.avatar .dot.invisible, .avatar .dot.offline { background: var(--bg-side); box-shadow: inset 0 0 0 3px var(--faint); }
.avatar.xl .dot, .avatar.xxl .dot { width: 18px; height: 18px; border-width: 4px; }
.avatar.xxl .dot.dnd::after { top: 8px; }
/* Status dots in the status menu (separate class so they never affect the dots on profile pictures) */
.status-dot { display: inline-block; position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%; }
.status-dot.online { background: var(--ok); }
.status-dot.idle { background: #f5b942; }
.status-dot.dnd { background: var(--danger); }
.status-dot.invisible { box-shadow: inset 0 0 0 3px var(--faint); }
.plus-badge { color: #f5b942; margin-left: 4px; font-size: .85em; text-shadow: 0 0 8px rgba(245, 185, 66, .6); }
.server-icon.tiny { width: 20px; height: 20px; border-radius: 6px; font-size: 9px; display: inline-grid; vertical-align: -5px; }

/* me bar */
.me-bar { gap: 4px; padding: 0 6px; }
.me-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px; border-radius: 8px; text-align: left; color: var(--text); }
.me-who:hover { background: var(--surface); }
.me-who .who { flex: 1; min-width: 0; line-height: 1.2; display: grid; }
.me-who .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.me-who .who span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus-btn { width: auto; min-width: 30px; padding: 0 6px; gap: 3px; display: inline-flex; color: #f5b942; font-size: 16px; font-weight: 800; }
.plus-btn .pts { font-size: 11px; color: var(--muted); }
.plus-btn.active { background: linear-gradient(135deg, rgba(245,185,66,.25), rgba(180,140,255,.25)); }
.me-pop { width: 290px; padding: 6px; }
.me-card { display: flex; gap: 10px; align-items: center; padding: 8px; margin-bottom: 4px; border-radius: 8px; background: var(--bg); }
.me-card > div:last-child { display: grid; min-width: 0; }
.menu button.current { background: var(--surface-2); }
.menu button svg:last-child:not(:first-child) { margin-left: auto; color: var(--ok); }
.mm-text { display: grid; line-height: 1.25; flex: 1; min-width: 0; }
.mm-text small { color: var(--muted); font-size: 12px; font-weight: 400; }
.menu button:hover .mm-text small { color: inherit; }
.menu .accent { color: var(--accent); }
.status-row { display: flex; gap: 8px; }
.status-emoji { width: 44px; flex: none; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); font-size: 22px; }

/* header */
.news-btn { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; font-size: 13px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent-soft); }
.news-btn.has-news { background: var(--accent-soft); }
.news-btn svg { width: 16px; height: 16px; }
.chat-header .ch-emoji.big { font-size: 20px; }
@media (max-width: 1100px) { .news-btn span { display: none; } .news-btn { width: 30px; padding: 0; border: 0; } }

/* sidebar: categories and channel rows */
.sidebar-tools { padding: 0 0 8px; }
.create-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); }
.create-btn svg { width: 16px; height: 16px; }
.category { margin-top: 10px; }
.category-head {
  display: flex; align-items: center; gap: 4px; width: 100%; border: 0; background: none; padding: 6px 4px 4px 0;
  color: var(--faint); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; text-align: left;
}
.category-head:hover { color: var(--text); }
.category-head .cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-head .cat-arrow svg { width: 14px; height: 14px; transition: transform .15s; }
.category.collapsed .cat-arrow svg { transform: rotate(-90deg); }
.category-head .icon-btn { width: 20px; height: 20px; opacity: 0; }
.category-head .icon-btn svg { width: 14px; height: 14px; }
.category-head:hover .icon-btn { opacity: 1; }
.nav-item .ch-emoji { width: 18px; text-align: center; font-size: 15px; }
.ch-mark { display: inline-grid; color: var(--faint); }
.ch-mark svg { width: 13px; height: 13px; }
.dm-name { display: block; overflow: hidden; text-overflow: ellipsis; }

/* profile card */
.profile-pop { width: 330px; padding: 0; overflow: hidden; max-height: calc(100vh - 16px); overflow-y: auto; }
.pcard { position: relative; background: var(--bg-side); border-radius: inherit; }
.pcard.themed { box-shadow: inset 0 0 0 2px var(--pc-accent), 0 0 30px -8px var(--pc-accent); }
.pcard.themed .pc-body { background: linear-gradient(180deg, color-mix(in srgb, var(--pc-accent) 14%, var(--bg-side)), var(--bg-side) 70%); }
.pc-banner { height: 110px; background: var(--surface-2); }
.pc-banner.small { height: 70px; border-radius: 12px 12px 0 0; }
.pc-head { position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 14px; margin-top: -44px; }
.pc-head .avatar { border: 6px solid var(--bg-side); box-sizing: content-box; }
.pc-head .avatar .dot { border-color: var(--bg-side); }
.pc-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; padding-bottom: 6px; max-width: 60%; }
.pc-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.pc-badge svg { width: 12px; height: 12px; color: #f5b942; }
.pc-badge.plus { color: #f5b942; background: rgba(245, 185, 66, .14); }
.pc-body { padding: 8px 16px 16px; }
.pc-names h3 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.pc-names span { color: var(--muted); font-size: 13px; }
.pc-status { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg); font-size: 13px; }
.pc-status.warn { color: #f5b942; }
.pc-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pc-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.pc-about { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--content); }
.pc-since { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--content); }
.pc-since span { display: inline-flex; align-items: center; gap: 6px; }
.pc-since svg { width: 16px; height: 16px; color: var(--muted); }
.role-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: var(--bg); font-size: 12px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent); }
.role-chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--rc); }
.role-chip.small { font-size: 11px; padding: 1px 6px; }
.role-x { border: 0; background: none; color: var(--muted); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.role-x:hover { color: var(--danger); }
.role-add { border: 1px dashed var(--border); background: transparent; border-radius: 6px; font-size: 12px; padding: 2px 4px; color: var(--muted); cursor: pointer; }
.pc-mutuals { display: grid; gap: 4px; }
.pc-mutual { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 3px 4px; border-radius: 6px; font-size: 13px; text-align: left; color: var(--content); }
.pc-mutual:hover { background: var(--surface); }
.pc-actions { display: grid; gap: 8px; margin-top: 14px; }
.pc-mod { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-message { margin-top: 12px; }
.pc-message input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--input-bg); outline: none; }
.pc-message input:focus { border-color: var(--accent); }
.dm-profile { margin: -8px; }
.dm-profile .pcard { border-radius: 0; min-height: 100%; }
.pcard.preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.profile-settings-preview { max-width: 340px; margin-bottom: 16px; }

/* edit profile */
.ep-modal { max-width: 860px; }
.ep-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ep-head h2 { margin: 0; }
.ep-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.ep-form { max-height: 62vh; overflow-y: auto; padding-right: 6px; }
.ep-block { padding: 12px 0; border-bottom: 1px solid var(--border); }
.ep-block small { display: block; margin-top: 6px; font-size: 12px; }
.plus-lock { color: #f5b942; font-size: 11px; text-transform: none; letter-spacing: 0; }
.swatch:disabled { opacity: .35; cursor: not-allowed; }
.ep-preview .pcard { max-width: 320px; }

/* Murmur+ */
.plus-modal { max-width: 520px; }
.plus-hero { display: flex; gap: 16px; align-items: center; margin: -24px -24px 18px; padding: 24px; border-radius: 14px 14px 0 0;
  background: linear-gradient(135deg, #b48cff 0%, #ff7a59 55%, #f5b942 100%); color: #1a0f0b; }
.plus-hero h2 { margin: 0; color: #1a0f0b; }
.plus-hero p { margin: 2px 0 0; }
.plus-logo { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 34px; background: rgba(255,255,255,.35); flex: none; }
.plus-status { display: grid; gap: 4px; padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.plus-status span { color: var(--muted); font-size: 13px; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #b48cff, #ff7a59, #f5b942); }
.plus-perks { list-style: none; padding: 0; margin: 16px 0 8px; display: grid; gap: 10px; }
.plus-perks li { display: flex; gap: 12px; align-items: center; }
.plus-perks li div { display: grid; }
.plus-perks li span:not(.perk-icon) { color: var(--muted); font-size: 13px; }
.perk-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); flex: none; font-size: 18px; }
.btn.plus-buy { background: linear-gradient(135deg, #b48cff, #ff7a59); color: #fff; }
.btn.plus-buy:disabled { background: var(--surface-2); color: var(--faint); }

/* Terms of Service */
.tos-modal { max-width: 680px; }
.tos-scroll { max-height: 58vh; overflow-y: auto; padding-right: 6px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tos-text h4 { margin: 16px 0 6px; }
.tos-text ul { margin: 0; padding-left: 20px; }
.tos-text li, .tos-text p { color: var(--content); font-size: 14px; margin: 4px 0; }
#auth-tos { font-size: 13px; margin: 0 0 12px; align-items: flex-start; }
#auth-tos input { margin-top: 3px; }

/* message extras */
.cmd-tag, .bot-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.bot-tag { background: var(--accent); color: var(--accent-ink); }
.msg.ephemeral { background: rgba(106, 168, 255, .07); box-shadow: inset 3px 0 0 #6aa8ff; }
.eph-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.msg.announce { background: linear-gradient(90deg, rgba(245, 185, 66, .12), transparent 70%); box-shadow: inset 3px 0 0 #f5b942; }
.announce-label { font-size: 12px; font-weight: 800; color: #f5b942; text-transform: uppercase; letter-spacing: .04em; margin: 2px 0; }
.msg.announce .content { font-size: 1.05em; }
.msg.system .content { color: var(--muted); font-style: italic; }
.spoiler { background: var(--content); color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer; transition: background .15s, color .15s; }
.spoiler * { visibility: hidden; }
.spoiler.revealed { background: var(--surface-2); color: inherit; cursor: auto; }
.spoiler.revealed * { visibility: visible; }
.channel-link { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 4px; cursor: pointer; font-weight: 600; text-decoration: none; }
.channel-link:hover { text-decoration: underline; }
.ping[data-user] { cursor: pointer; }
.poll { max-width: 440px; margin-top: 4px; padding: 12px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); display: grid; gap: 6px; }
.poll-q { font-weight: 700; margin-bottom: 2px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 8px 10px; text-align: left; overflow: hidden; }
.poll-opt:hover { border-color: var(--muted); }
.poll-opt.mine { border-color: var(--accent); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); transition: width .25s; }
.poll-opt.mine .poll-bar { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.poll-text, .poll-count { position: relative; }
.poll-text { flex: 1; }
.poll-count { font-size: 12px; color: var(--muted); font-weight: 700; }

/* autocomplete */
.composer-wrap { position: relative; }
.autocomplete {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); z-index: 25; max-height: 340px; overflow-y: auto;
  background: var(--bg-side); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 -8px 30px var(--shadow); padding: 6px;
}
.ac-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 8px 6px; }
.ac-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 8px; border-radius: 7px; text-align: left; }
.ac-item.active, .ac-item:hover { background: var(--surface-2); }
.ac-item .avatar { width: 24px; height: 24px; font-size: 11px; }
.ac-item .avatar .dot { width: 8px; height: 8px; border-width: 2px; }
.ac-label { font-weight: 700; }
.ac-hint { color: var(--muted); font-size: 13px; font-family: var(--mono); }
.ac-tag { font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: rgba(240, 96, 93, .15); color: var(--danger); }
.ac-desc { margin-left: auto; color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.ac-foot { font-size: 11px; color: var(--faint); padding: 6px 8px 2px; border-top: 1px solid var(--border); margin-top: 4px; }

/* GIF picker tabs */
.small-tabs { margin: 0; flex: 1; padding: 3px; }
.small-tabs button { padding: 5px 6px; font-size: 12px; }
.gif-head { gap: 6px; }
.gif-name { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; line-height: 1.6; }

/* server settings: roles, members */
.roles-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.role-list { display: grid; gap: 2px; position: sticky; top: 0; }
.role-list .btn { margin-bottom: 8px; }
.role-item { display: flex; align-items: center; gap: 8px; border: 0; background: none; border-radius: 6px; padding: 7px 8px; text-align: left; color: var(--muted); font-weight: 600; }
.role-item:hover { background: var(--surface); color: var(--text); }
.role-item.active { background: var(--surface-2); color: var(--text); }
.role-item i, .role-editor-head i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.role-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-item small { color: var(--faint); }
.role-editor-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 15px; }
.inline-tabs { margin: 0 0 14px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface); color: var(--muted); }
.save-bar {
  position: sticky; bottom: 12px; display: none; align-items: center; gap: 8px; margin-top: 18px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-rail); box-shadow: 0 8px 30px var(--shadow); border: 1px solid var(--border);
}
.save-bar.show { display: flex; animation: pop .15s ease-out; }
.save-bar span { flex: 1; font-weight: 600; }
.toggle-row input:disabled { opacity: .4; cursor: not-allowed; }
.toggle-row:has(input:disabled) { cursor: default; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-grid div { padding: 14px; border-radius: 10px; background: var(--bg-side); display: grid; }
.stat-grid b { font-size: 22px; }
.stat-grid span { color: var(--muted); font-size: 13px; }
.member-admin { align-items: flex-start; padding: 10px 8px; border-bottom: 1px solid var(--border); border-radius: 0; flex-wrap: wrap; }
.member-admin .member-text { gap: 2px; }
.member-admin .crown svg { width: 14px; height: 14px; color: #f5b942; }

/* channel settings */
.name-row { display: flex; gap: 8px; align-items: center; }
.name-row input { flex: 1; }
.icon-pick { width: 42px; height: 42px; flex: none; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); font-size: 20px; color: var(--muted); }
.icon-pick:hover { border-color: var(--accent); }
.prefix-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); padding-left: 10px; }
.prefix-input span { color: var(--faint); font-size: 18px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.prefix-input input { border: 0; background: transparent; }
.perm-card { padding: 4px 14px 12px; border-radius: 12px; background: var(--bg-side); margin-bottom: 14px; }
.perm-card .toggle-row { border-bottom: 0; }
.perm-sub { padding-top: 6px; border-top: 1px solid var(--border); }
.role-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.role-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); cursor: pointer; font-size: 13px; font-weight: 600; }
.role-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-check input { accent-color: var(--accent); }
.role-check i { width: 10px; height: 10px; border-radius: 50%; }
.private-roles { margin: -4px 0 12px; }
.account-card { display: block; padding: 0 0 6px; overflow: hidden; }
.account-row { display: flex; align-items: center; gap: 14px; padding: 0 16px; margin-top: -26px; }
.account-row .avatar { border: 5px solid var(--bg-side); box-sizing: content-box; }
.account-row > div { flex: 1; display: grid; padding-top: 24px; }
.account-row .btn { margin-top: 24px; }
.account-fields { display: flex; align-items: center; justify-content: space-between; margin: 12px 16px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); }
.account-fields div { display: grid; }
.account-fields .pc-label { margin: 0; }

@media (max-width: 900px) {
  .ep-grid, .roles-layout { grid-template-columns: 1fr; }
  .role-list { position: static; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ep-form { max-height: none; }
}
@media (max-width: 760px) {
  .profile-pop { width: calc(100vw - 16px); }
  .autocomplete { left: 8px; right: 8px; }
  .ac-desc { display: none; }
}
/* Redrawing an already-open window must not flash */
.modal-backdrop.no-anim, .modal-backdrop.no-anim .modal { animation: none !important; }

/* ================================================================ v1.4 additions */
/* logo */
.brand .wordmark { font-size: 26px; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(90deg, #ff8a5c, #ff6b7f 50%, #a77bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand img { width: 40px; height: 40px; }
.rail-item.home { background: transparent; padding: 0; overflow: visible; }
.rail-logo { width: 48px; height: 48px; border-radius: 16px; transition: border-radius .18s, transform .18s; display: block; }
.rail-item.home:hover .rail-logo, .rail-item.home.active .rail-logo { border-radius: 14px; transform: scale(1.04); }
.rail-item.home:hover, .rail-item.home.active { background: transparent; }
.since-logo { width: 16px; height: 16px; border-radius: 5px; }

/* avatars: tiny size + dots that sit on the picture's edge */
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar .dot { right: -2px; bottom: -2px; }
.avatar.xl .dot, .avatar.xxl .dot { right: 0; bottom: 0; }
.avatar.lg .dot { right: -2px; bottom: -2px; }

/* red @mention badges */
.rail-item .badge { background: var(--danger); }
.nav-item .pill { background: var(--danger); }

/* side panels (member list and DM profile) */
.members { border-left: 1px solid var(--border); padding: 12px 10px; }
.members .section-label { padding: 16px 8px 4px; }
.members .section-label:first-child { padding-top: 4px; }
.members .member { padding: 5px 8px; border-radius: 8px; }
.members .member:hover { background: var(--surface); }
.members .member .avatar { width: 34px; height: 34px; }
.members:has(.side-profile) { padding: 0; background: var(--bg-side); }
.side-profile { min-height: 100%; }
.side-profile .pcard { border-radius: 0; min-height: 100%; background: var(--bg-side); }

/* profile card */
.pcard { overflow: hidden; }
.pc-head { margin-top: -46px; padding: 0 16px; align-items: flex-end; }
.pc-head .avatar { border: 0; }
.pc-avatar { padding: 6px; border-radius: 50%; background: var(--bg-side); line-height: 0; }
.pc-avatar .avatar .dot { border-color: var(--bg-side); }
.pc-badges { padding-bottom: 10px; }
.pc-badge.bot { background: #5865f2; color: #fff; }
.pc-inner { margin: 10px 12px 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.pcard.themed .pc-inner { background: color-mix(in srgb, var(--pc-accent) 8%, var(--bg)); border-color: color-mix(in srgb, var(--pc-accent) 35%, var(--border)); }
.pc-inner .pc-status { background: var(--bg-side); }
.pc-inner .pc-section:first-of-type { margin-top: 12px; }
.pc-actions.two { grid-template-columns: 1fr 1fr; }
.pc-actions .btn svg { width: 16px; height: 16px; }
.danger-link { display: block; margin: 10px auto 0; color: var(--faint); font-size: 12px; }
.danger-link:hover { color: var(--danger); }
.pc-cmds { display: flex; flex-wrap: wrap; gap: 5px; }
.pc-cmd { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--bg-side); border: 1px solid var(--border); }
.role-plus { width: 24px; height: 24px; border-radius: 6px; border: 1px dashed var(--muted); background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.role-plus svg { width: 15px; height: 15px; }
.role-plus:hover, .role-plus.open { border-style: solid; border-color: var(--accent); color: var(--accent); }
.role-picker { margin-top: 10px; padding: 8px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); display: grid; gap: 2px; }
.role-pick { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; text-align: left; color: var(--text); }
.role-pick:hover { background: var(--surface); }
.role-pick i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.role-pick span:nth-of-type(1) { flex: 1; }
.role-pick .check { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--faint); display: grid; place-items: center; }
.role-pick.on .check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.role-pick .check svg { width: 14px; height: 14px; }
.role-picker small { padding: 4px 8px 0; }

/* replies, bot interactions and forwards */
.msg.has-ref { margin-top: 14px; }
.msg-ref { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding-left: 20px; margin-bottom: 2px; font-size: 13px; color: var(--muted); cursor: pointer; min-width: 0; position: relative; }
.msg-ref.interaction { cursor: default; }
.msg-ref .ref-curve { position: absolute; left: 19px; top: 50%; width: 30px; height: 12px; border-left: 2px solid var(--surface-2); border-top: 2px solid var(--surface-2); border-top-left-radius: 8px; }
.msg-ref > .avatar { margin-left: 34px; }
.msg-ref b { white-space: nowrap; }
.msg-ref .ref-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--content); opacity: .8; }
.msg-ref:not(.interaction):hover .ref-text { opacity: 1; color: var(--text); }
.msg-ref .ref-text br { display: none; }
.cmd-name { color: var(--accent); font-weight: 700; }
.msg.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
.forwarded { margin-top: 4px; padding: 8px 12px; border-left: 3px solid var(--surface-2); border-radius: 0 8px 8px 0; background: var(--hover); max-width: 560px; }
.fw-label { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.fw-label svg { width: 14px; height: 14px; }
.fw-author { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 2px; }
.fw-meta { font-size: 11px; color: var(--faint); margin-top: 4px; }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 14px; margin-bottom: -6px; padding-bottom: 12px; border-radius: 12px 12px 0 0; background: var(--bg-side); font-size: 13px; color: var(--muted); }
.reply-bar > span { flex: 1; }
.ping-toggle { border: 0; background: transparent; font-weight: 800; font-size: 12px; color: var(--faint); }
.ping-toggle.on { color: #6aa8ff; }
.reply-bar .icon-btn { width: 24px; height: 24px; }
.fw-preview { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: var(--bg); margin-bottom: 12px; font-size: 13px; }
.fw-preview span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-list { max-height: 300px; overflow-y: auto; margin-top: 8px; }
.fw-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.fw-row:hover { background: var(--surface); }
.fw-text { flex: 1; display: grid; min-width: 0; line-height: 1.25; }
.fw-text span { font-size: 12px; color: var(--muted); }

/* Shield-blurred pictures and reporting */
.att-sensitive { cursor: not-allowed; }
.att-sensitive img { filter: blur(6px) saturate(.6); transform: scale(1.06); }
.sensitive-cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 12px;
  background: rgba(10, 11, 14, .55); color: #fff; line-height: 1.3; }
.sensitive-cover svg { width: 30px; height: 30px; color: #f5b942; }
.sensitive-cover span { font-size: 12px; opacity: .8; }
.att-report { position: absolute; top: 6px; right: 42px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.attachment:not(:has(.att-star)) .att-report { right: 6px; }
.attachment:hover .att-report { opacity: 1; }
.att-report:hover { color: var(--danger); }

/* cropper */
.crop-modal { max-width: 400px; }
.cropper { display: grid; place-items: center; background: repeating-conic-gradient(var(--surface) 0 25%, var(--bg-side) 0 50%) 0 0 / 20px 20px; border-radius: 12px; overflow: hidden; }
.cropper canvas { width: 100%; max-width: 320px; aspect-ratio: 1; cursor: grab; touch-action: none; display: block; }
.cropper canvas:active { cursor: grabbing; }
.crop-zoom { margin: 14px auto 0; }

/* Edit profile quality of life */
.ep-pic-row { display: flex; align-items: center; gap: 16px; }
.ep-pic-text { display: grid; gap: 6px; }
.ep-avatar { position: relative; border: 0; padding: 0; background: none; border-radius: 50%; line-height: 0; cursor: pointer; }
.ep-overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 2px; border-radius: inherit;
  background: rgba(0,0,0,.55); color: #fff; opacity: 0; transition: opacity .15s; font-size: 11px; line-height: 1.2; text-transform: uppercase; letter-spacing: .03em; }
.ep-overlay svg { width: 18px; height: 18px; }
.ep-avatar:hover .ep-overlay, .ep-banner:hover .ep-overlay, .drop .ep-overlay { opacity: 1; }
.ep-banner { position: relative; display: block; width: 100%; height: 96px; border: 0; border-radius: 10px; cursor: pointer; padding: 0; }
.ep-banner.locked .ep-overlay { opacity: 1; background: rgba(0,0,0,.35); text-transform: none; font-size: 13px; }
.drop { outline: 3px dashed var(--accent); outline-offset: 3px; }
.ep-preview .pc-avatar, .ep-preview .pc-banner { cursor: pointer; }
.ep-preview .pc-banner:hover { filter: brightness(1.1); }

/* Murmur+ (clean) */
.plus-modal { max-width: 480px; }
.plus-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.plus-head img { width: 52px; height: 52px; }
.plus-head h2 { margin: 0; font-size: 24px; }
.plus-head h2 span { color: #f5b942; }
.plus-head p { margin: 2px 0 0; color: var(--muted); }
.plus-head > div:nth-child(2) { flex: 1; }
.plus-price { text-align: right; display: grid; line-height: 1.1; }
.plus-price b { font-size: 26px; }
.plus-price span { font-size: 12px; color: var(--muted); }
.plus-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.plus-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 8px 8px; }
.plus-table th:last-child { color: #f5b942; }
.plus-table td { padding: 10px 8px; border-top: 1px solid var(--border); }
.plus-table td:first-child { font-weight: 600; }
.plus-yes { display: inline-grid; vertical-align: -3px; margin-right: 6px; color: #f5b942; }
.plus-yes svg { width: 16px; height: 16px; }
.plus-balance { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--bg); }
.plus-balance > div:first-child { display: grid; gap: 2px; }
.plus-balance span { color: var(--muted); font-size: 13px; }
.mm-plus { width: 20px; text-align: center; color: #f5b942; font-weight: 900; }

/* My account (rebuilt) */
.acct { border-radius: 14px; overflow: hidden; background: var(--bg-side); border: 1px solid var(--border); max-width: 640px; }
.acct-banner { height: 100px; }
.acct-top { display: flex; align-items: flex-end; gap: 14px; padding: 0 18px; margin-top: -36px; }
.acct-avatar { padding: 6px; border-radius: 50%; background: var(--bg-side); line-height: 0; flex: none; }
.acct-avatar .avatar .dot { border-color: var(--bg-side); }
.acct-name { flex: 1; min-width: 0; display: grid; padding-bottom: 8px; }
.acct-name b { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-name span { color: var(--muted); font-size: 13px; }
.acct-top .btn { margin-bottom: 12px; flex: none; }
.acct-fields { margin: 14px; padding: 4px 14px; border-radius: 10px; background: var(--bg); }
.acct-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.acct-field + .acct-field { border-top: 1px solid var(--border); }
.acct-field > div { display: grid; }
.acct-field .pc-label { margin: 0 0 2px; }

/* content rules */
.rule-grid { padding: 6px 14px; }
.rule-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.rule-row + .rule-row { border-top: 1px solid var(--border); }
.rule-row > div:first-child { flex: 1; display: grid; gap: 2px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 8px; padding: 3px; gap: 2px; flex: none; }
.seg button { border: 0; background: transparent; border-radius: 6px; padding: 5px 9px; font-size: 12px; font-weight: 700; color: var(--muted); }
.seg button small { font-weight: 400; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.seg button.on.ok { background: rgba(95, 211, 141, .2); color: var(--ok); }
.seg button.on.bad { background: rgba(240, 96, 93, .18); color: var(--danger); }
.words-box { margin-top: 8px; font-family: var(--mono); font-size: 13px; resize: vertical; }

/* Bot Builder */
.bb-btn { padding: 5px 10px; font-size: 12px; }
.bb-bot { display: flex; align-items: center; gap: 8px; }
.bb-bot .avatar { width: 22px; height: 22px; font-size: 10px; }
.bb-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.bb-head h2 { margin: 0; }
.bb-cmds { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: start; }
.bb-cmd-list { display: grid; gap: 2px; }
.bb-cmd { border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.bb-cmd:hover { background: var(--surface); color: var(--text); }
.bb-cmd.active { background: var(--surface-2); color: var(--text); }
.bb-cmd.has-error::after { content: " ⚠"; color: var(--danger); }
.bb-cmd-list .btn { margin-top: 8px; }
.bb-editor { display: grid; gap: 4px; }
.bb-row { display: flex; gap: 10px; }
.bb-row .grow { flex: 1; }
.bb-row .grow2 { flex: 2; }
.code-box { width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.55; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-rail); color: var(--text); resize: vertical; outline: none; tab-size: 2; white-space: pre; overflow-x: auto; }
.code-box:focus { border-color: var(--accent); }
.code-box.static { margin: 0; }
.example-pick { float: right; font-size: 12px; text-transform: none; letter-spacing: 0; background: var(--surface); border: 0; border-radius: 6px; padding: 2px 6px; color: var(--text); }
.script-status { font-size: 12px; min-height: 18px; margin-top: 4px; }
.script-status.ok { color: var(--ok); }
.script-status.bad { color: var(--danger); }
.bb-test { margin: 10px 0 14px; padding: 12px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); }
.bb-test code { font-family: var(--mono); color: var(--accent); }
.bb-test-out { margin-top: 10px; }
.test-msg { display: flex; gap: 10px; padding: 8px; border-radius: 8px; background: var(--bg); }
.test-error { color: var(--danger); font-size: 13px; }
.bb-help { margin-top: 18px; }
.bb-help summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.cheat { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.cheat p { margin: 4px 0; font-size: 13px; color: var(--content); }
.cheat code, .bb-hero code { font-family: var(--mono); font-size: 12px; background: var(--bg-rail); padding: 1px 5px; border-radius: 4px; color: var(--accent); }
.bb-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.bb-hero img { width: 64px; height: 64px; }
.bb-hero h2 { margin: 0 0 4px; }
.bb-hero p { margin: 0; }
.bb-create { display: flex; gap: 8px; max-width: 480px; }
.bb-create input { flex: 1; }
.save-bar span.bad { color: var(--danger); }
.ac-tag.bot { background: rgba(88, 101, 242, .18); color: #8b97ff; text-transform: none; }
.bot-tag { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: #5865f2; color: #fff; margin-left: 4px; vertical-align: 1px; letter-spacing: .02em; }
.bot-dir { max-width: 620px; }

@media (max-width: 900px) {
  .bb-cmds, .cheat { grid-template-columns: 1fr; }
  .rule-row { flex-wrap: wrap; }
  .bb-row { flex-direction: column; gap: 0; }
}

/* ================================================================ v1.5 additions */
/* compact profile pop-up */
.profile-pop { width: 300px; }
.pcard.pop .pc-banner { height: 60px; }
.pcard.pop .pc-head { margin-top: -38px; }
.pcard.pop .pc-inner { margin: 8px 10px 10px; padding: 12px; }
.pcard.pop .pc-section { margin-top: 10px; padding-top: 10px; }
.pc-head { position: relative; }
.pc-tools { display: flex; gap: 6px; padding-bottom: 8px; }
.pc-tool { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--muted); display: grid; place-items: center; padding: 0; }
.pc-tool svg { width: 17px; height: 17px; }
.pc-tool:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.pc-tool.accent { color: var(--ok); }
.pc-tool:disabled { opacity: .55; cursor: default; }
.pc-menu { position: absolute; right: 12px; top: 64px; z-index: 5; min-width: 210px; display: none; padding: 6px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); box-shadow: 0 10px 30px var(--shadow); }
.pcard.pop .pc-menu { top: 58px; }
.pc-menu.open { display: grid; }
.pc-menu button svg { width: 16px; height: 16px; flex: none; }
.pc-names h3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-names .pc-badge { font-size: 10px; padding: 1px 6px; }
.pc-names .pc-badge svg { width: 12px; height: 12px; }
.pcard.pop .pc-names h3 { font-size: 18px; }
.pc-about.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pc-since-line { margin-top: 10px; font-size: 12px; color: var(--faint); }
.pcard.pop .pc-message { margin-top: 10px; }
.profile-modal { max-width: 440px; padding: 0; overflow: hidden; }
.profile-modal .pcard { border-radius: 14px; }
.profile-modal .pc-banner { height: 130px; }

/* compact "me" menu */
.me-pop { width: 250px; }
.me-menu.compact .me-card { align-items: center; }
.me-menu.compact .me-card > div { flex: 1; }
.me-menu.compact .menu button { padding: 7px 10px; }
.mm-arrow { margin-left: auto; display: inline-grid; transition: transform .15s; }
.mm-arrow.open { transform: rotate(90deg); }
.mm-arrow svg { width: 14px; height: 14px; }
.mm-sub { display: grid; padding: 2px 0 4px 24px; }
.mm-sub button { font-size: 13px; }
.mm-clear { margin-left: auto; display: inline-grid; width: 22px; height: 22px; place-items: center; border-radius: 6px; color: var(--muted); }
.mm-clear:hover { background: var(--danger); color: #fff; }
.mm-clear svg { width: 14px; height: 14px; }

/* group DMs */
.group-icon { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--gc); color: #15161a; }
.group-icon svg { width: 18px; height: 18px; }
.group-icon.lg { width: 48px; height: 48px; }
.group-icon.lg svg { width: 26px; height: 26px; }
.group-icon.xl { width: 72px; height: 72px; }
.group-icon.xl svg { width: 38px; height: 38px; }
.chat-header .group-icon { width: 26px; height: 26px; }
.chat-header .group-icon svg { width: 15px; height: 15px; }
.group-panel-actions { display: grid; gap: 6px; margin: 14px 4px 0; }
.group-panel-actions svg { width: 15px; height: 15px; vertical-align: -3px; }
.gs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.gs-head h2 { margin: 0; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.pp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.pp-chip button { border: 0; background: none; color: inherit; font-size: 15px; padding: 0 4px; }
.pp-list { max-height: 280px; }
.pp-row { cursor: pointer; }
.pp-row.on { background: var(--accent-soft); }
.pp-check { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* voice calls */
.call-bar { flex: none; display: grid; gap: 12px; justify-items: center; padding: 18px 16px 14px; background: linear-gradient(180deg, #0d0f13, var(--bg)); border-bottom: 1px solid var(--border); }
.call-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.call-tile { display: grid; justify-items: center; gap: 6px; }
.call-tile .avatar { box-shadow: 0 0 0 3px transparent; transition: box-shadow .12s; }
.call-tile.speaking .avatar { box-shadow: 0 0 0 3px var(--ok), 0 0 18px rgba(95, 211, 141, .5); }
.call-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.call-muted { display: inline-grid; color: var(--danger); }
.call-muted svg { width: 14px; height: 14px; }
.call-controls { display: flex; gap: 10px; }
.call-controls .btn svg { width: 16px; height: 16px; }
.call-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.call-btn:hover { filter: brightness(1.15); }
.call-btn.off { background: var(--text); color: var(--bg); }
.call-btn.hang { background: var(--danger); color: #fff; }
.voice-status { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--border); background: var(--me-bar); }
.voice-status > div { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.voice-status b { color: var(--ok); font-size: 13px; }
.voice-status span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-status .icon-btn.danger:hover { color: var(--danger); }
.ring-card { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: var(--bg-side); border: 1px solid var(--border); box-shadow: 0 18px 50px var(--shadow); animation: ring-pop .25s ease-out; }
.ring-text { display: grid; line-height: 1.3; min-width: 120px; }
.ring-text span { font-size: 13px; color: var(--muted); }
.ring-card .round-btn.ok { background: var(--ok); color: #0c1f14; }
.ring-card .round-btn.danger { background: var(--danger); color: #fff; }
.ring-card .avatar { animation: ring-pulse 1.2s infinite; }
@keyframes ring-pop { from { transform: translate(-50%, -20px); opacity: 0; } }
@keyframes ring-pulse { 50% { box-shadow: 0 0 0 6px rgba(95, 211, 141, .35); } }

/* poll creator */
.poll-modal { max-width: 460px; }
.poll-modal h2 { display: flex; align-items: center; gap: 8px; }
.poll-answers { display: grid; gap: 6px; margin-bottom: 8px; }
.poll-answer { display: flex; gap: 6px; align-items: center; }
.plus-menu { min-width: 230px; }

/* Ad mode */
.ad-modal { max-width: 520px; }
.ad-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ad-label { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 4px; background: #f5b942; color: #1a1305; }
.ad-slot { min-height: 250px; border-radius: 10px; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.ad-slot ins { width: 100%; }
.house-ad { text-align: center; padding: 24px; max-width: 360px; }
.house-ad img { width: 64px; height: 64px; }
.house-ad h3 { margin: 10px 0 4px; }
.house-ad p { margin: 0 0 14px; color: var(--muted); }
.ad-modal .modal-actions span { flex: 1; text-align: left; }

/* bot events */
.bb-event { padding: 12px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); margin-bottom: 12px; }
.bb-event-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.bb-trigger { padding: 10px 0; border-top: 1px solid var(--border); display: grid; gap: 6px; }
.bb-trigger:first-of-type { border-top: 0; }
/* let the ⋯ menu float outside the small profile card instead of being cut off */
.profile-pop { overflow: visible; max-height: none; }
.pcard.pop, .pcard.panel { overflow: visible; }
.pcard.pop .pc-banner { border-radius: 10px 10px 0 0; }
.pc-menu { max-height: 70vh; overflow-y: auto; }
.me-menu.compact .me-card > div { flex: 0 0 auto; }
.me-menu.compact .me-card > div:not(.avatar) { flex: 1; display: grid; min-width: 0; line-height: 1.25; }

/* ---------- 1.5: voice channels ---------- */
.nav-item.ch.voice .hash { display: grid; place-items: center; width: 20px; }
.nav-item.ch.voice .hash svg { width: 17px; height: 17px; }
.nav-item.ch.voice.in-voice { color: var(--ok); }
.nav-item.ch.voice.in-voice .label { font-weight: 600; }
.vc-count { margin-left: auto; font-size: 11px; color: var(--muted); padding: 0 6px; border-radius: 8px; background: var(--surface-2); }
.vc-people { display: grid; gap: 1px; margin: 0 0 4px 30px; }
.vc-person { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; cursor: pointer; min-width: 0; }
.vc-person:hover { background: var(--hover); }
.vc-av { display: grid; border-radius: 50%; transition: box-shadow .12s; }
.vc-av .avatar { width: 22px; height: 22px; font-size: 9px; }
.vc-av.speaking { box-shadow: 0 0 0 2px var(--ok); }
.vc-name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.vc-muted { display: grid; color: var(--danger); }
.vc-muted svg { width: 14px; height: 14px; }
.voice-status { flex-direction: column; align-items: stretch; gap: 6px; }
.voice-status > .vs-top { display: flex; align-items: center; gap: 4px; }
.voice-status .vs-info { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.voice-status .vs-info[data-call] { cursor: pointer; }
.voice-status .vs-info[data-call]:hover span { text-decoration: underline; }
.voice-status b.connecting { color: var(--warn, #e0b341); }
.vs-btns { display: flex; gap: 6px; }
.vs-btn { flex: 1; height: 30px; border: 0; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }
.vs-btn:hover { filter: brightness(1.15); }
.vs-btn.off { color: var(--danger); }
.vs-btn svg { width: 18px; height: 18px; }
.ch-type-pick { display: grid; gap: 8px; }
.ch-type { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-side); border: 1px solid var(--border); cursor: pointer; }
.ch-type:has(input:checked) { border-color: var(--accent); background: var(--hover); }
.ch-type input { accent-color: var(--accent); }
.ch-type .ct-icon { width: 24px; display: grid; place-items: center; font-size: 22px; color: var(--muted); }
.ch-type b { display: block; font-size: 14px; }
.ch-type small { color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.ch-type > span:last-child { text-transform: none; letter-spacing: 0; color: var(--text); }
.prefix-input .ch-prefix { display: grid; place-items: center; }
.prefix-input .ch-prefix svg { width: 18px; height: 18px; }
.voice-status > .vs-btns { display: flex; flex: none; }
.voice-status > .vs-top { flex: none; }
.ch-type input[type=radio] { width: auto; flex: none; margin: 0; padding: 0; border: 0; }
.ch-type > span:last-child { flex: 1; display: grid; text-align: left; }

/* ---------- 1.5.1: ad stats ---------- */
.as-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.as-tile { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--bg-side); border: 1px solid var(--border); }
.as-tile > span { font-size: 12px; color: var(--muted); }
.as-tile > b { font-size: 24px; font-variant-numeric: tabular-nums; }
.as-tile b small { font-size: 14px; color: var(--muted); font-weight: 500; }
.as-tile > small { font-size: 12px; color: var(--faint); }
.as-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.as-legend span { display: inline-flex; align-items: center; gap: 6px; }
.as-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.as-chart { display: flex; align-items: stretch; gap: 3px; height: 150px; padding: 10px; border-radius: 12px; background: var(--bg-side); border: 1px solid var(--border); }
.as-col { flex: 1; display: flex; min-width: 0; }
.as-col:hover { background: var(--hover); border-radius: 4px; }
.as-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.as-bar i { display: block; border-radius: 3px; min-height: 2px; }
.as-chart i.g, .as-legend i.g { background: var(--accent); }
.as-chart i.h, .as-legend i.h { background: var(--ok); }
.as-chart i.o, .as-legend i.o { background: var(--faint); }
.as-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin: 4px 2px 0; }
.as-top { display: grid; gap: 2px; }
.as-top .member { cursor: pointer; }
.as-top .member .name { flex: 1; }
.as-rank { width: 18px; text-align: center; color: var(--muted); font-weight: 700; font-size: 13px; }
.as-setup { display: grid; gap: 1px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.as-setup > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--bg-side); font-size: 14px; flex-wrap: wrap; }
.as-setup span { color: var(--muted); }
.as-setup b { font-weight: 600; text-align: right; }
.as-setup b.ok { color: var(--ok); }
.modal-actions.left { justify-content: flex-start; }

/* ---------- 1.5.2: public homepage ---------- */
.skip-landing #landing { display: none; }
.landing { position: fixed; inset: 0; overflow-y: auto; z-index: 5; background: var(--bg); color: var(--text); scroll-behavior: smooth;
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(255, 107, 127, .16), transparent 60%), radial-gradient(800px 500px at -10% 10%, rgba(167, 123, 255, .14), transparent 60%); }
.landing main { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.ld-nav { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 18px; padding: 12px max(20px, calc((100% - 1120px) / 2 + 20px));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.ld-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.ld-brand img { width: 32px; height: 32px; }
.ld-brand .wordmark, .ld-foot .wordmark { font-size: 22px; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(90deg, #ff8a5c, #ff6b7f 50%, #a77bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-links { display: flex; gap: 18px; margin-left: 12px; }
.ld-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.ld-links a:hover { color: var(--text); }
.ld-cta { margin-left: auto; display: flex; gap: 8px; }
.btn.big { padding: 13px 22px; font-size: 16px; border-radius: 10px; }
.ld-hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding: 72px 0 56px; }
.ld-kicker { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 5px 12px; border-radius: 99px; }
.ld-hero h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.05; letter-spacing: -.03em; margin: 18px 0 16px; }
.ld-hero-text > p { font-size: 18px; line-height: 1.55; color: var(--muted); margin: 0; max-width: 560px; }
.ld-hero-btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 12px; }
.ld-fine { font-size: 13px; color: var(--faint); margin: 0; }
.ld-shot { min-width: 0; }
.ld-win { display: grid; grid-template-columns: 150px 1fr; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 30px 80px var(--shadow);
  background: var(--bg-chat, var(--bg)); font-size: 13px; transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); }
.ld-side { display: grid; align-content: start; gap: 3px; padding: 14px 10px; background: var(--bg-side); border-right: 1px solid var(--border); }
.ld-side b { font-size: 14px; margin-bottom: 8px; }
.ld-side span { color: var(--muted); padding: 3px 6px; border-radius: 5px; white-space: nowrap; }
.ld-side span.on { background: var(--hover); color: var(--text); }
.ld-side .ld-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--faint); margin-top: 8px; }
.ld-side .ld-vc { color: var(--ok); font-weight: 600; }
.ld-side .ld-vp { display: flex; align-items: center; gap: 6px; padding-left: 18px; font-size: 12px; }
.ld-vp i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px var(--ok); }
.ld-chat { display: grid; align-content: start; gap: 12px; padding: 0 14px 14px; min-width: 0; }
.ld-head { padding: 12px 0; border-bottom: 1px solid var(--border); font-weight: 700; }
.ld-msg { display: flex; gap: 10px; align-items: flex-start; }
.ld-msg > i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; color: #fff; }
.ld-msg > i.bot { background: var(--surface-2); }
.ld-msg p { margin: 2px 0 0; color: var(--text); }
.ld-msg small { font-size: 9px; background: var(--accent); color: var(--accent-ink); padding: 1px 4px; border-radius: 4px; vertical-align: middle; }
.ld-poll { display: grid; gap: 5px; margin-top: 4px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-side); min-width: 200px; }
.ld-poll span { position: relative; display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.ld-poll span::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: color-mix(in srgb, var(--accent) 30%, transparent); }
.ld-poll em { position: relative; font-style: normal; color: var(--muted); }
.ld-input { margin-top: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--faint); }
.ld-section { padding: 56px 0; border-top: 1px solid var(--border); }
.ld-section h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; margin: 0 0 8px; }
.ld-lead { color: var(--muted); font-size: 17px; margin: 0 0 28px; max-width: 640px; line-height: 1.5; }
.ld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ld-grid article { padding: 20px; border-radius: 14px; background: var(--bg-side); border: 1px solid var(--border); }
.ld-grid article > span { font-size: 26px; }
.ld-grid h3 { margin: 10px 0 6px; font-size: 17px; }
.ld-grid p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14.5px; }
.ld-safety { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: start; }
.ld-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.ld-list li { padding-left: 30px; position: relative; color: var(--muted); line-height: 1.5; }
.ld-list li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
.ld-list b { color: var(--text); }
.ld-card { padding: 24px; border-radius: 16px; background: var(--bg-side); border: 1px solid var(--border); }
.ld-card h3 { margin: 0 0 8px; }
.ld-card p { color: var(--muted); line-height: 1.55; }
.ld-card a, .ld-foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.ld-steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; }
.ld-steps li { counter-increment: s; display: grid; gap: 6px; padding: 20px; border-radius: 14px; border: 1px solid var(--border); }
.ld-steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent); color: var(--accent-ink); margin-bottom: 6px; }
.ld-steps span { color: var(--muted); line-height: 1.5; }
.ld-faq details { border-bottom: 1px solid var(--border); padding: 4px 0; max-width: 780px; }
.ld-faq summary { cursor: pointer; font-weight: 700; font-size: 16px; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; }
.ld-faq summary::after { content: '+'; color: var(--muted); font-size: 20px; line-height: 1; }
.ld-faq details[open] summary::after { content: '–'; }
.ld-faq details p { margin: 0 0 14px; color: var(--muted); line-height: 1.6; }
.ld-final { text-align: center; padding: 64px 0 72px; border-top: 1px solid var(--border); }
.ld-final h2 { font-size: clamp(26px, 3.4vw, 36px); margin: 0 0 20px; }
.ld-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 24px max(20px, calc((100% - 1120px) / 2 + 20px)); border-top: 1px solid var(--border); background: var(--bg-side); }
.ld-foot img { width: 26px; height: 26px; }
.ld-foot .wordmark { font-size: 18px; }
.ld-foot nav { display: flex; flex-wrap: wrap; gap: 18px; }
.ld-copy { margin-left: auto; color: var(--faint); font-size: 13px; }
.auth-back { display: inline-block; margin-bottom: 16px; font-size: 13px; color: var(--muted); text-decoration: none; }
.auth-back:hover { color: var(--text); }
@media (max-width: 860px) {
  .ld-hero { grid-template-columns: 1fr; padding-top: 40px; gap: 32px; }
  .ld-win { transform: none; }
  .ld-safety { grid-template-columns: 1fr; }
  .ld-links { display: none; }
}
@media (max-width: 520px) {
  .ld-cta .btn.ghost { display: none; }
  .ld-win { grid-template-columns: 1fr; }
  .ld-side { display: none; }
  .ld-hero-btns .btn { flex: 1; }
  .ld-copy { margin-left: 0; }
}

/* Standalone pages: /privacy and /terms */
.doc-page { min-height: 100%; overflow-y: auto; }
.doc-page main { max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; }
.doc-page h1 { font-size: 34px; letter-spacing: -.02em; margin: 24px 0 6px; }
.doc-page h2 { font-size: 19px; margin: 28px 0 8px; }
.doc-page p, .doc-page li { color: var(--muted); line-height: 1.65; }
.doc-page ul { padding-left: 20px; }
