/* ==========================================================================
   RelixChat 2.0 — design system
   ========================================================================== */
:root {
  --accent: #7c6cff;
  --accent-rgb: 124, 108, 255;
  --fs: 15px;
  --radius: 14px;
  --radius-sm: 10px;
  --bubble-r: 18px;
  --sidebar-w: 380px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --danger: #f0556a;
  --success: #35c47c;
  --warn: #f5a524;
}
body.theme-dark {
  --bg: #0f1015;
  --bg-2: #14151c;
  --panel: #17181f;
  --panel-2: #1e2029;
  --panel-3: #262833;
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(var(--accent-rgb), .16);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #eceef3;
  --text-2: #a1a6b3;
  --text-3: #6d7280;
  --bubble-in: #20222c;
  --bubble-out: linear-gradient(135deg, rgb(var(--accent-rgb)) 0%, color-mix(in srgb, rgb(var(--accent-rgb)) 78%, #3b82f6) 100%);
  --bubble-out-solid: rgb(var(--accent-rgb));
  --out-text: #fff;
  --out-meta: rgba(255, 255, 255, .72);
  --shadow: 0 10px 40px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
  --chat-bg: #0c0d12;
  --pattern: rgba(255, 255, 255, .025);
  color-scheme: dark;
}
body.theme-light {
  --bg: #eef0f5;
  --bg-2: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #f3f4f8;
  --panel-3: #e8eaf0;
  --hover: rgba(15, 20, 40, .045);
  --active: rgba(var(--accent-rgb), .12);
  --line: rgba(15, 20, 40, .08);
  --line-2: rgba(15, 20, 40, .14);
  --text: #15171e;
  --text-2: #5d6272;
  --text-3: #8d92a0;
  --bubble-in: #ffffff;
  --bubble-out: linear-gradient(135deg, rgb(var(--accent-rgb)) 0%, color-mix(in srgb, rgb(var(--accent-rgb)) 80%, #3b82f6) 100%);
  --bubble-out-solid: rgb(var(--accent-rgb));
  --out-text: #fff;
  --out-meta: rgba(255, 255, 255, .78);
  --shadow: 0 12px 40px rgba(20, 25, 50, .16), 0 2px 8px rgba(20, 25, 50, .08);
  --shadow-sm: 0 2px 10px rgba(20, 25, 50, .08);
  --chat-bg: #e7e9f1;
  --pattern: rgba(20, 25, 60, .045);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; width: 100%; overflow: hidden; overscroll-behavior: none; }
/* the page itself never scrolls or pans (the off-screen chat pane on phones must not widen it) */
html { position: fixed; inset: 0; }
#app { position: relative; width: 100%; height: 100%; overflow: hidden; overflow: clip; }
.screen { overflow: hidden; overflow: clip; }
#pane, #sidebar { overflow: hidden; overflow: clip; }
.sb-body, .page-body, .messages, .ep-body, .fwd-list, .picker-list, .cli-out, .dlg { overscroll-behavior: contain; }
.stories-scroll, .chips { overscroll-behavior-x: contain; }
body {
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.4;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--panel-3); padding: 1px 5px; border-radius: 5px; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: .86em; }
.accent { color: var(--accent) !important; }
.grow { flex: 1; min-width: 0; }
::selection { background: rgba(var(--accent-rgb), .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-track { background: transparent; }

.ic { flex-shrink: 0; display: block; }
.flip { transform: rotate(180deg); }
.flip-h .ic { transform: scaleX(-1); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 12px; font-weight: 600; font-size: .95em;
  transition: background .15s, transform .1s, box-shadow .15s, opacity .15s; white-space: nowrap; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(var(--accent-rgb), .35); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-ghost { background: var(--panel-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-3); }
.btn-ghost.danger { color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-soft { background: rgba(240, 85, 106, .12); color: var(--danger); }
.btn-danger-soft:hover { background: rgba(240, 85, 106, .2); }
.btn-sm { height: 34px; padding: 0 14px; border-radius: 10px; font-size: .88em; }
.btn-block { width: 100%; }
.btn.loading { color: transparent !important; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.link { color: var(--accent); font-weight: 600; font-size: .9em; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: background .15s, color .15s; flex-shrink: 0; position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { background: var(--active); }
.icon-btn.sm { width: 32px; height: 32px; }

.spin, .boot-spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(var(--accent-rgb), .25); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
.spin.light { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; width: 18px; height: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- inputs */
.input, .dlg input[type=text], .dlg input[type=password], .dlg textarea, .dlg select, .s-select {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--panel-2); color: var(--text); outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
textarea.input, .dlg textarea { height: auto; padding: 11px 14px; resize: vertical; min-height: 44px; line-height: 1.45; }
.input:focus, .dlg input:focus, .dlg textarea:focus, .dlg select:focus {
  border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .14);
}
.input::placeholder, textarea::placeholder { color: var(--text-3); }
.field-label, .dlg-label { display: block; font-size: .82em; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; letter-spacing: .01em; }
.field-hint, .dlg-hint { font-size: .8em; color: var(--text-3); margin-top: 6px; line-height: 1.45; }
.form-error, .dlg-error { color: var(--danger); font-size: .86em; min-height: 1.3em; margin: 10px 0 4px; }
.prefix-input { position: relative; }
.prefix-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; pointer-events: none; }
.prefix-input .input { padding-left: 30px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 8px; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--text); background: var(--hover); }
.pw-meter { height: 4px; border-radius: 4px; background: var(--panel-3); margin-top: 8px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }
select { cursor: pointer; }
.s-select { height: 36px; width: auto; padding: 0 30px 0 12px; font-size: .9em; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }

.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 26px; background: var(--panel-3); transition: background .2s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .35); }

.range { width: 100%; height: 22px; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--panel-3); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(var(--accent-rgb), .5); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--panel-3); }
.range::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--accent); }
.check { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }

/* ---------------------------------------------------------------- screens */
#app { height: 100%; }
.screen { display: none; height: 100%; width: 100%; }
.screen.active { display: flex; }
#screen-boot, #screen-offline, #screen-auth { align-items: center; justify-content: center; padding: 24px; overflow-x: hidden; overflow-y: auto; position: relative; overscroll-behavior: contain; }
.boot { display: flex; flex-direction: column; align-items: center; gap: 28px; }

.logo-mark {
  width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 26px; color: #fff; letter-spacing: -.02em; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #22d3ee));
  box-shadow: 0 8px 28px rgba(var(--accent-rgb), .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.logo-mark.big { width: 84px; height: 84px; border-radius: 26px; font-size: 42px; }

.auth-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.auth-bg::before, .auth-bg::after {
  content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .35;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .9), transparent 60%);
  top: -25vmax; left: -15vmax; animation: float 18s ease-in-out infinite alternate;
}
.auth-bg::after { background: radial-gradient(circle, rgba(34, 211, 238, .7), transparent 60%); top: auto; left: auto; bottom: -30vmax; right: -20vmax; opacity: .22; animation-duration: 22s; }
@keyframes float { to { transform: translate(8vmax, 6vmax) scale(1.1); } }

.auth-card {
  position: relative; width: 100%; max-width: 420px; padding: 32px 30px 24px; border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line);
  box-shadow: var(--shadow); backdrop-filter: blur(20px); animation: rise .45s var(--ease);
}
#screen-offline .auth-card { text-align: center; }
#screen-offline h1 { font-size: 1.35em; margin: 14px 0 8px; }
#screen-offline p { line-height: 1.55; margin-bottom: 8px; }
#screen-offline .input { text-align: center; }
#screen-offline .btn { margin-top: 14px; }
.offline-icon { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: rgba(240, 85, 106, .12); color: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.auth-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.auth-brand h1 { font-size: 1.55em; letter-spacing: -.02em; }
.auth-brand p { font-size: .9em; margin-top: 2px; }
.auth-form { animation: fade .25s; }
.auth-form .btn { margin-top: 6px; height: 46px; }
@keyframes fade { from { opacity: 0; } }
.seg { display: flex; background: var(--panel-2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 6px; }
.seg-btn { flex: 1; height: 36px; border-radius: 9px; font-weight: 600; font-size: .92em; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s; }
.seg-btn.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.small .seg-btn { height: 32px; font-size: .86em; }

/* ---------------------------------------------------------------- layout */
#screen-main { position: relative; }
#sidebar {
  width: var(--sidebar-w); min-width: 300px; max-width: 460px; flex-shrink: 0; height: 100%;
  display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); position: relative; z-index: 2;
}
#pane { flex: 1; min-width: 0; height: 100%; position: relative; background: var(--chat-bg); }
.pane-view { position: absolute; inset: 0; display: none; flex-direction: column; }
.pane-view.active { display: flex; animation: paneIn .22s var(--ease); }
@keyframes paneIn { from { opacity: 0; transform: translateX(10px); } }
#pane-page { background: var(--bg); }
#pane-empty { align-items: center; justify-content: center; }
.empty-hero { text-align: center; max-width: 380px; padding: 24px; animation: rise .5s var(--ease); }
.empty-hero h2 { margin: 22px 0 8px; font-size: 1.35em; letter-spacing: -.01em; }
.empty-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- sidebar */
.sb-header { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px; }
.sb-title { flex: 1; font-weight: 700; font-size: 1.12em; letter-spacing: -.01em; padding-left: 4px; min-width: 0; display: flex; align-items: center; }
.conn-status { display: flex; align-items: center; gap: 8px; font-size: .82em; color: var(--text-2); font-weight: 600; }
.conn-status .spin { width: 14px; height: 14px; border-width: 2px; }
.sb-search { position: relative; margin: 2px 12px 8px; }
.sb-search input { width: 100%; height: 40px; border-radius: 20px; border: 1.5px solid transparent; background: var(--panel-2); padding: 0 38px 0 40px; outline: none; transition: all .15s; }
.sb-search input:focus { border-color: var(--accent); background: var(--panel); }
.sb-search-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.sb-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.sb-search-clear:hover { background: var(--hover); color: var(--text); }
.sb-tabs { display: flex; position: relative; padding: 0 8px; border-bottom: 1px solid var(--line); }
.sb-tab { flex: 1; height: 42px; font-weight: 600; font-size: .92em; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 6px; transition: color .15s; border-radius: 10px 10px 0 0; }
.sb-tab:hover { color: var(--text); background: var(--hover); }
.sb-tab.active { color: var(--accent); }
.sb-tab-ink { position: absolute; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transition: transform .25s var(--ease), width .25s var(--ease); }
.tab-badge { min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sb-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 90px; }
.fab {
  position: absolute; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 18px; z-index: 3;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), .45); transition: transform .15s var(--ease), box-shadow .15s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(var(--accent-rgb), .5); }
.fab:active { transform: scale(.94); }
.mini-player.visible ~ .fab { bottom: 84px; }

/* stories strip */
.stories-strip { padding: 10px 0 4px; }
.stories-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 14px 6px; scrollbar-width: none; }
.stories-scroll::-webkit-scrollbar { display: none; }
.story-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; width: 66px; flex-shrink: 0; }
.story-ring { padding: 3px; border-radius: 50%; background: conic-gradient(from 200deg, var(--accent), #22d3ee, #f0556a, var(--accent)); transition: transform .15s; }
.story-ring .avatar { border: 2.5px solid var(--panel); }
.story-ring.seen { background: var(--line-2); }
.story-ring.none { background: transparent; }
.story-item:hover .story-ring { transform: scale(1.05); }
.story-add { position: absolute; right: 4px; top: 42px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; border: 2.5px solid var(--panel); display: flex; align-items: center; justify-content: center; }
.story-name { font-size: .75em; color: var(--text-2); max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chips { display: flex; gap: 6px; padding: 4px 12px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--panel-2); color: var(--text-2); font-size: .84em; font-weight: 600; white-space: nowrap; transition: all .15s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); color: #fff; }

/* lists */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 0 6px; border-radius: 12px;
  cursor: pointer; transition: background .12s; min-height: 64px; position: relative; user-select: none;
}
.list-item:hover { background: var(--hover); }
.list-item.active { background: var(--accent); color: #fff; }
.list-item.active .li-sub, .list-item.active .li-time, .list-item.active .pv-who, .list-item.active .pv-kind, .list-item.active .pv-service, .list-item.active .li-kind, .list-item.active .li-muted, .list-item.active .li-pin, .list-item.active .pv-typing, .list-item.active .pv-draft { color: rgba(255, 255, 255, .85) !important; }
.list-item.active .badge { background: #fff; color: var(--accent); }
.list-item.active .tick { color: #fff !important; }
.list-item.active .verified path:first-child { fill: #fff; }
.list-item.active .verified path:last-child { stroke: var(--accent); }
.list-item.active .online-dot { border-color: var(--accent); }
.list-item.compact { min-height: 52px; padding: 6px 10px; }
body.compact .list-item { min-height: 54px; padding: 5px 10px; }
body.compact .list-item .avatar { --s: 42px !important; }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.li-top, .li-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.li-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.li-title.accent { color: var(--accent); }
.li-kind { color: var(--text-2); display: inline-flex; }
.li-muted { color: var(--text-3); display: inline-flex; margin-left: 2px; }
.li-time { font-size: .78em; color: var(--text-3); white-space: nowrap; display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.li-sub { flex: 1; min-width: 0; font-size: .9em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub.online { color: var(--accent); }
.li-pin { color: var(--text-3); display: inline-flex; transform: rotate(45deg); }
.pv-who { color: var(--text); font-weight: 500; }
.pv-kind { color: var(--accent); }
.pv-service { color: var(--text-3); font-style: italic; }
.pv-typing, .pv-draft { color: var(--accent); }
.pv-draft { color: var(--danger); }
.badge { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge.muted { background: var(--text-3); }
.tick { color: var(--text-3); display: inline-flex; }
.tick.read { color: var(--accent); }
.list-section { padding: 14px 18px 6px; font-size: .78em; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.list-head { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-weight: 700; }
.tag { font-size: .7em; font-weight: 700; color: var(--accent); background: var(--active); padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
.action-row { min-height: 54px; }
.empty { text-align: center; color: var(--text-3); padding: 36px 24px; line-height: 1.5; font-size: .92em; }
.empty.small { padding: 18px; }
.empty.big { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 50px 30px; }
.empty.big b { color: var(--text); font-size: 1.05em; }
.empty.big .btn { margin-top: 10px; }
.empty-ic { width: 84px; height: 84px; border-radius: 50%; background: var(--active); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }

/* avatar */
.avatar {
  --s: 48px; width: var(--s); height: var(--s); border-radius: 50%; flex-shrink: 0; position: relative; display: inline-flex;
  align-items: center; justify-content: center; background: var(--panel-3); color: #fff;
}
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.saved { background: linear-gradient(135deg, #4f8cff, #22d3ee); }
.avatar.archive { background: var(--text-3); }
.avatar.action { background: var(--active); color: var(--accent); }
.online-dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 11px; min-height: 11px; border-radius: 50%; background: var(--success); border: 2.5px solid var(--panel); }
.verified { display: inline-flex; flex-shrink: 0; }
.bot-badge { font-size: .62em; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--active); padding: 2px 5px; border-radius: 5px; margin-left: 2px; }

/* ---------------------------------------------------------------- pane headers */
.pane-header {
  display: flex; align-items: center; gap: 6px; height: 60px; padding: 0 10px; flex-shrink: 0; z-index: 5;
  background: color-mix(in srgb, var(--panel) 90%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px);
}
.ph-title { flex: 1; font-weight: 700; font-size: 1.08em; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.ph-actions { display: flex; align-items: center; gap: 4px; }
.page-body { flex: 1; overflow-y: auto; }
.page-inner { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; animation: fade .2s; }
.page-loading { display: flex; justify-content: center; padding: 50px; }
.page-lead { color: var(--text-2); margin-bottom: 12px; font-size: .92em; }
.page-btns { margin: 14px 0; display: flex; gap: 10px; justify-content: center; }

/* ---------------------------------------------------------------- chat */
.chat-header { gap: 4px; }
.back-btn { display: none; }
.ch-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 8px; border-radius: 12px; }
.ch-peer:hover { background: var(--hover); }
.ch-text { min-width: 0; }
.ch-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.ch-sub { font-size: .82em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; }
.dots b { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.dots b:nth-child(2) { animation-delay: .15s; }
.dots b:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.chat-search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--text-3); z-index: 4; animation: fade .15s; }
.chat-search input { flex: 1; border: 0; outline: none; background: none; height: 32px; color: var(--text); }
.cs-count { font-size: .82em; white-space: nowrap; }
.pinned-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 4; }
.pb-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pb-line { width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); flex-shrink: 0; }
.pb-title { font-size: .8em; font-weight: 700; color: var(--accent); }
.pb-text { font-size: .88em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column;
  background-color: var(--chat-bg);
  background-image: radial-gradient(circle at 20% 0%, rgba(var(--accent-rgb), .10), transparent 45%), radial-gradient(circle at 100% 100%, rgba(34, 211, 238, .06), transparent 40%),
    radial-gradient(var(--pattern) 1.2px, transparent 1.3px);
  background-size: 100% 100%, 100% 100%, 22px 22px;
}
body.no-wallpaper .chat-body { background-image: none; }
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 8px 0 12px; }
.msgs-inner, .posts-inner { max-width: 820px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; min-height: 100%; justify-content: flex-end; }
.msgs-loading { flex: 1; display: flex; align-items: center; justify-content: center; }
.msgs-more { display: flex; justify-content: center; padding: 12px; }

.day-sep { position: sticky; top: 6px; z-index: 2; display: flex; justify-content: center; margin: 12px 0 8px; pointer-events: none; }
.day-sep span, .service-msg span {
  font-size: .8em; font-weight: 600; padding: 4px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--text-2); backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.service-msg { display: flex; justify-content: center; margin: 8px 0; text-align: center; }
.service-msg span { font-weight: 500; max-width: 80%; line-height: 1.4; }
.unread-sep { margin: 10px -16px; padding: 5px; text-align: center; background: color-mix(in srgb, var(--panel) 75%, transparent); font-size: .82em; font-weight: 600; color: var(--accent); }

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; position: relative; }
.msg-row.first { margin-top: 8px; }
.msg-row.out { justify-content: flex-end; }
.msg-row.appear { animation: msgIn .25s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.msg-row.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .7); } 100% { box-shadow: 0 0 0 3px transparent; } }
.msg-av, .msg-av-space { width: 34px; flex-shrink: 0; cursor: pointer; }
.msg-row.pending .bubble { opacity: .85; }
.msg-row.failed .bubble { box-shadow: inset 0 0 0 1.5px var(--danger); }
.retry-btn { width: 30px; height: 30px; border-radius: 50%; background: var(--danger); color: #fff; display: flex; align-items: center; justify-content: center; align-self: center; }

.bubble {
  position: relative; max-width: min(560px, 78%); padding: 7px 11px 7px; border-radius: var(--bubble-r);
  background: var(--bubble-in); box-shadow: 0 1px 1.5px rgba(0, 0, 0, .12); word-wrap: break-word; overflow-wrap: anywhere; min-width: 60px;
}
.msg-row.in.first .bubble { border-top-left-radius: var(--bubble-r); }
.msg-row.in .bubble { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.msg-row.in.first .bubble { border-top-left-radius: var(--bubble-r); }
.msg-row.in.last .bubble { border-bottom-left-radius: 4px; }
.msg-row.out .bubble { background: var(--bubble-out); color: var(--out-text); border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.msg-row.out.first .bubble { border-top-right-radius: var(--bubble-r); }
.msg-row.out.last .bubble { border-bottom-right-radius: 4px; }
.bubble.emoji-only { background: none !important; box-shadow: none; padding: 0 2px; }
.bubble.emoji-only .b-meta { background: color-mix(in srgb, var(--panel) 70%, transparent); color: var(--text-2) !important; padding: 2px 7px; border-radius: 10px; }
.bubble.emoji-only .b-text { font-size: 2.6em; line-height: 1.15; }
.bubble.emoji-only .b-meta { font-size: calc(var(--fs) * .72); margin-top: 18px; }
.bubble.emoji-only.e2 .b-text { font-size: 2.2em; }
.bubble.emoji-only.e3 .b-text { font-size: 1.9em; }
.bubble.has-media { padding: 3px; }
.bubble.has-media .b-text { padding: 5px 8px 3px; }
.bubble.has-media .b-name, .bubble.has-media .b-fwd, .bubble.has-media .b-reply { margin: 4px 8px 6px; }
.bubble.media-only .b-meta { position: absolute; right: 10px; bottom: 9px; background: rgba(0, 0, 0, .45); color: #fff !important; padding: 2px 7px; border-radius: 10px; backdrop-filter: blur(6px); }
.bubble.media-only .b-meta .tick { color: #fff !important; }
.bubble.poll { min-width: 280px; }
.b-name { font-size: .85em; font-weight: 700; margin-bottom: 2px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.b-fwd { font-size: .82em; opacity: .85; display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.b-fwd b { cursor: pointer; }
.b-reply {
  --rc: var(--accent); display: flex; align-items: center; gap: 8px; margin: 2px 0 5px; padding: 5px 9px 5px 10px; border-radius: 8px; cursor: pointer;
  background: color-mix(in srgb, var(--rc) 14%, transparent); border-left: 3px solid var(--rc); font-size: .87em; min-width: 0; max-width: 100%;
}
.b-reply > div { min-width: 0; display: flex; flex-direction: column; }
.b-reply b { color: var(--rc); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-reply span { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-reply img { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; }
.b-reply.deleted { cursor: default; opacity: .6; }
.msg-row.out .b-reply { --rc: #fff; background: rgba(255, 255, 255, .16); }
.b-reply.story { cursor: default; }
.b-text { white-space: pre-wrap; line-height: 1.42; }
.b-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg-row.in .b-text a { color: var(--accent); text-decoration: none; }
.msg-row.in .b-text a:hover { text-decoration: underline; }
.b-text code { background: rgba(0, 0, 0, .18); }
.msg-row.in .b-text code { background: var(--panel-3); color: var(--accent); }
.code-block { font-family: var(--mono); font-size: .86em; background: rgba(0, 0, 0, .22); padding: 8px 10px; border-radius: 8px; margin: 4px 0; overflow-x: auto; white-space: pre; }
.msg-row.in .code-block { background: var(--panel-3); }
.spoiler { background: currentColor; border-radius: 4px; cursor: pointer; transition: background .2s; filter: blur(.5px); }
.spoiler.shown { background: rgba(127, 127, 127, .2); filter: none; }
.mention { font-weight: 600; }
.b-meta {
  float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 10px; font-size: .72em; color: var(--text-3);
  white-space: nowrap; user-select: none; position: relative; top: 3px;
}
.msg-row.out .b-meta { color: var(--out-meta); }
.msg-row.out .b-meta .tick { color: var(--out-meta); }
.msg-row.out .b-meta .tick.read { color: #fff; }
.b-edited { font-style: italic; }
.clock { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid currentColor; position: relative; display: inline-block; }
.clock::after { content: ""; position: absolute; left: 4px; top: 1.5px; width: 1.5px; height: 4px; background: currentColor; transform-origin: bottom; animation: spin 1.5s linear infinite; }

.b-photo { position: relative; border-radius: calc(var(--bubble-r) - 3px); overflow: hidden; cursor: zoom-in; max-width: 420px; max-height: 480px; min-width: 120px; background: var(--panel-3); }
.b-photo img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 480px; }
.b-video { position: relative; border-radius: calc(var(--bubble-r) - 3px); overflow: hidden; max-width: 420px; background: #000; }
.b-video video { width: 100%; max-height: 420px; display: block; }
.upload-progress { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .35); }
.upload-progress svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.upload-progress circle { fill: none; stroke: rgba(255, 255, 255, .25); stroke-width: 3; }
.upload-progress .up-fill { stroke: #fff; stroke-dasharray: 100; stroke-linecap: round; transition: stroke-dashoffset .2s; }
.voice .upload-progress { border-radius: 12px; }

.voice { --p: 0%; display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px 0; min-width: 240px; position: relative; }
.v-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform .1s; }
.v-btn:active { transform: scale(.92); }
.msg-row.out .v-btn { background: #fff; color: var(--bubble-out-solid); }
.v-body { flex: 1; min-width: 0; }
.v-name { font-weight: 600; font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.v-wave { display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; }
.v-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--text-3) 60%, transparent); transition: background .15s; }
.v-wave i.on { background: var(--accent); }
.msg-row.out .v-wave i { background: rgba(255, 255, 255, .4); }
.msg-row.out .v-wave i.on { background: #fff; }
.v-time { font-size: .75em; opacity: .75; margin-top: 2px; }
.voice.audio { min-width: 260px; }

.file-card { display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px 2px; color: inherit !important; text-decoration: none !important; min-width: 220px; max-width: 360px; }
.file-card.static { padding: 8px; background: var(--panel-2); border-radius: 12px; min-width: 0; max-width: none; }
.fc-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .72em; font-weight: 800; flex-shrink: 0; }
.msg-row.out .fc-icon { background: rgba(255, 255, 255, .22); }
.fc-meta { min-width: 0; display: flex; flex-direction: column; }
.fc-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-size { font-size: .8em; opacity: .7; }
.file-card:hover .fc-name { text-decoration: underline; }

.b-reactions, .post-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; clear: both; }
.reaction {
  height: 28px; padding: 0 9px; border-radius: 14px; display: inline-flex; align-items: center; gap: 4px; font-size: .9em;
  background: var(--active); color: var(--accent); font-weight: 700; transition: transform .1s, background .15s;
}
.reaction:hover { transform: scale(1.05); }
.reaction.mine { background: var(--accent); color: #fff; }
.msg-row.out .reaction { background: rgba(255, 255, 255, .2); color: #fff; }
.msg-row.out .reaction.mine { background: #fff; color: var(--bubble-out-solid); }
.reaction .r-e { font-size: 1.05em; line-height: 1; }
.reaction .r-n { font-size: .85em; }
.reaction.add { color: var(--text-3); background: var(--panel-2); padding: 0 8px; }

.bot-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; clear: both; }
.kb-row { display: flex; gap: 4px; }
.kb-row button { flex: 1; min-height: 36px; padding: 6px 10px; border-radius: 10px; background: var(--active); color: var(--accent); font-weight: 600; font-size: .9em; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s; }
.kb-row button:hover { background: rgba(var(--accent-rgb), .26); }

.scroll-down {
  position: absolute; right: 22px; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; z-index: 5;
  background: var(--panel); color: var(--text-2); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; animation: pop .2s var(--ease);
}
.scroll-down:hover { color: var(--accent); }
.scroll-down .badge { position: absolute; top: -6px; right: -4px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.drop-overlay { position: absolute; inset: 12px; border-radius: 20px; border: 2.5px dashed var(--accent); background: rgba(var(--accent-rgb), .12); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 8; pointer-events: none; }
.drop-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--accent); font-size: 1.1em; }
.chat-body.dragging .drop-overlay { display: flex; }

.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; }
.ce-card { max-width: 320px; text-align: center; padding: 28px 24px; border-radius: 22px; background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-2); box-shadow: var(--shadow-sm); animation: rise .35s var(--ease); }
.ce-card > .ic { color: var(--accent); margin-bottom: 4px; }
.ce-card b { color: var(--text); font-size: 1.05em; }
.ce-card span { font-size: .9em; line-height: 1.5; }
.ce-card .btn { margin-top: 8px; }
.ce-quick { display: flex; gap: 8px; margin-top: 10px; }
.ce-quick button { font-size: 1.6em; width: 50px; height: 50px; border-radius: 14px; background: var(--panel-2); transition: transform .15s; }
.ce-quick button:hover { transform: scale(1.12) rotate(-6deg); }

/* composer */
.composer-wrap { position: relative; flex-shrink: 0; padding: 8px 16px 14px; background: transparent; z-index: 4; }
.composer-wrap > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.composer, .recording { display: flex; align-items: flex-end; gap: 6px; }
.input-wrap {
  flex: 1; display: flex; align-items: flex-end; background: var(--panel); border-radius: 22px; min-height: 48px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 3px 4px 3px 6px; transition: border-color .15s;
}
.input-wrap:focus-within { border-color: rgba(var(--accent-rgb), .5); }
.input-wrap textarea {
  flex: 1; border: 0; outline: none; background: none; resize: none; padding: 10px 8px; max-height: 200px; line-height: 1.4; min-height: 40px; font-size: 1em;
}
.input-wrap .icon-btn.sm { width: 38px; height: 38px; margin-bottom: 1px; }
.cmd-btn { font-weight: 800; color: var(--accent) !important; font-size: 1.15em; }
.composer > .icon-btn { width: 48px; height: 48px; background: var(--panel); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.send-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(var(--accent-rgb), .4); transition: transform .12s, background .15s;
}
.send-btn:hover { transform: scale(1.05); }
.send-btn:active { transform: scale(.94); }
.send-btn .ic { animation: pop .18s var(--ease); }
.send-btn.mic { background: var(--panel); color: var(--text-2); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.send-btn.mic:hover { color: var(--accent); }
.composer-ctx {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; margin-bottom: 6px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-sm); animation: rise .2s var(--ease);
}
.cc-ic { color: var(--accent); }
.cc-body { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 10px; cursor: pointer; display: flex; flex-direction: column; }
.cc-body b { font-size: .85em; color: var(--accent); }
.cc-body span { font-size: .88em; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recording { align-items: center; background: var(--panel); border-radius: 26px; padding: 4px 4px 4px 6px; box-shadow: var(--shadow-sm); animation: rise .2s var(--ease); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; margin-left: 4px; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 42px; }
.rec-hint { flex: 1; color: var(--text-3); font-size: .9em; }
.composer-blocked { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; background: var(--panel); border-radius: 16px; color: var(--text-2); font-size: .92em; }

.emoji-pop {
  position: absolute; right: 16px; bottom: calc(100% - 4px); width: 360px; max-width: calc(100vw - 24px); height: 360px; z-index: 20;
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; overflow: hidden; animation: rise .18s var(--ease);
  margin: 0 !important;
}
.ep-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); }
.ep-tabs button { flex: 1; height: 34px; border-radius: 8px; font-size: 1.15em; opacity: .55; transition: all .15s; }
.ep-tabs button.active, .ep-tabs button:hover { opacity: 1; background: var(--hover); }
.ep-body { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.ep-title { font-size: .75em; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 4px 4px; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-grid button { height: 38px; font-size: 1.45em; border-radius: 8px; transition: transform .1s, background .1s; }
.ep-grid button:hover { background: var(--hover); transform: scale(1.18); }

/* ---------------------------------------------------------------- channel */
.posts-inner { max-width: 680px; padding-bottom: 8px; }
.post { background: var(--bubble-in); border-radius: 18px; margin: 6px 0; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); animation: fade .25s; }
.post-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; font-size: .9em; color: var(--accent); }
.post-media { max-height: 560px; overflow: hidden; background: #000; cursor: zoom-in; margin-top: 6px; }
.post-media img, .post-media video { width: 100%; display: block; max-height: 560px; object-fit: contain; }
.post-pad { padding: 6px 12px 0; }
.post-text { padding: 8px 14px 2px; white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.post-foot { display: flex; align-items: flex-end; gap: 10px; padding: 4px 12px 10px; }
.post-reactions { flex: 1; margin-top: 4px; }
.post-meta { display: flex; align-items: center; gap: 4px; font-size: .76em; color: var(--text-3); white-space: nowrap; padding-bottom: 5px; }
.channel-join { padding: 0; }
.channel-join .btn { height: 48px; border-radius: 16px; }

/* polls */
.poll-card { min-width: 260px; padding: 4px 2px 2px; }
.poll-q { font-weight: 700; margin-bottom: 2px; line-height: 1.35; }
.poll-kind { font-size: .78em; opacity: .7; margin-bottom: 10px; }
.poll-opt {
  --pct: 0%; position: relative; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 10px 12px; margin-bottom: 4px; border-radius: 10px;
  transition: background .15s; min-height: 40px;
}
.poll-opt:not(:disabled):hover { background: rgba(127, 127, 127, .1); }
.poll-opt:disabled { cursor: default; }
.po-mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid currentColor; opacity: .55; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.poll-opt.results .po-mark { border: 0; opacity: 1; width: 0; margin-right: -8px; }
.poll-opt.voted.results .po-mark { width: 18px; height: 18px; margin-right: 0; background: var(--accent); color: #fff; border-radius: 50%; }
.msg-row.out .poll-opt.voted.results .po-mark { background: #fff; color: var(--bubble-out-solid); }
.po-pct { font-weight: 800; font-size: .88em; min-width: 38px; }
.po-text { flex: 1; min-width: 0; }
.po-bar { position: absolute; left: 10px; bottom: 4px; height: 4px; border-radius: 3px; width: calc((100% - 20px) * var(--pct) / 100%); background: var(--accent); transition: width .5s var(--ease); }
.poll-opt.results .po-bar { width: calc(var(--pct) - 20px * var(--pct) / 100%); }
.msg-row.out .po-bar { background: #fff; }
.poll-foot { font-size: .8em; opacity: .75; text-align: center; margin-top: 6px; }
.msg-row.out .poll-foot .link { color: #fff; text-decoration: underline; }

/* ---------------------------------------------------------------- context menu */
.ctx-menu {
  position: fixed; z-index: 1000; min-width: 220px; max-width: 320px; padding: 6px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 97%, transparent);
  border: 1px solid var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(20px); opacity: 0; transform: scale(.96); transform-origin: top left; transition: opacity .12s, transform .12s var(--ease);
}
.ctx-menu.show { opacity: 1; transform: none; }
.ctx-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: 10px; font-size: .93em; font-weight: 500; text-align: left; color: var(--text); }
.ctx-item .ic { color: var(--text-2); }
.ctx-item:hover { background: var(--hover); }
.ctx-item.danger, .ctx-item.danger .ic { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.ctx-reactions { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.ctx-reactions button { width: 36px; height: 36px; border-radius: 50%; font-size: 1.35em; transition: transform .12s; }
.ctx-reactions button:hover { transform: scale(1.25); background: var(--hover); }
.ctx-html { cursor: pointer; border-radius: 10px; }
.ctx-html:hover { background: var(--hover); }
.menu-profile { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.menu-profile b { display: block; }
.menu-profile span { font-size: .85em; color: var(--text-2); }
.main-menu { min-width: 260px; }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; max-width: min(460px, 92vw); padding: 11px 18px; border-radius: 14px; pointer-events: auto;
  background: color-mix(in srgb, #1b1c24 94%, transparent); color: #fff; font-size: .92em; box-shadow: var(--shadow); backdrop-filter: blur(16px);
  opacity: 0; transform: translateY(12px) scale(.96); transition: all .22s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast button { color: color-mix(in srgb, var(--accent) 70%, #fff); font-weight: 700; text-transform: uppercase; font-size: .85em; letter-spacing: .03em; }

/* ---------------------------------------------------------------- dialogs */
.dlg-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(5, 6, 10, .55); display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity .16s; backdrop-filter: blur(3px); }
.dlg-overlay.show { opacity: 1; }
.dlg {
  width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border-radius: 22px; padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--line); transform: translateY(12px) scale(.97); transition: transform .2s var(--ease);
}
.dlg.wide { max-width: 520px; }
.dlg-overlay.show .dlg { transform: none; }
.dlg-overlay.hide { opacity: 0; }
.dlg h3 { font-size: 1.15em; margin-bottom: 6px; letter-spacing: -.01em; }
.dlg-sub { color: var(--text-2); font-size: .9em; margin-bottom: 6px; }
.dlg-msg { line-height: 1.5; margin: 4px 0 6px; }
.dlg-body { margin-top: 8px; }
.dlg-body > input, .dlg-body > textarea, .dlg-body > select { margin-bottom: 4px; }
.dlg-check { display: flex; align-items: center; gap: 10px; margin: 12px 0 2px; cursor: pointer; font-size: .94em; }
.dlg-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.dlg-list { display: flex; flex-direction: column; gap: 6px; }
.dlg-add { margin-top: 8px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.dlg-actions .btn { min-width: 96px; }
.send-preview { display: grid; gap: 4px; margin-bottom: 10px; border-radius: 14px; overflow: hidden; }
.send-preview.multi { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.send-preview img, .send-preview video { width: 100%; max-height: 320px; object-fit: cover; display: block; border-radius: 10px; background: #000; }
.send-preview.multi img, .send-preview.multi video { height: 110px; }
.fwd-list { max-height: 50vh; overflow-y: auto; margin: 10px -12px 0; }
.dlg-picker .picker-list { max-height: 46vh; overflow-y: auto; }
.about { text-align: center; line-height: 1.55; }
.about .logo-mark { margin: 6px auto 14px; }
.about p { margin-bottom: 10px; }
.big-emoji { font-size: 1.4em; }

/* story composer */
.story-dlg { max-width: 440px; }
.st-stage { margin: 12px 0 10px; }
.st-text { height: 300px; border-radius: 18px; display: flex; align-items: center; justify-content: center; padding: 20px; transition: background .2s; }
.st-text textarea { width: 100%; background: none !important; border: 0 !important; box-shadow: none !important; color: #fff !important; text-align: center; font-size: 1.35em; font-weight: 700; resize: none; outline: none; height: 100% !important; padding-top: 22% !important; }
.st-text textarea::placeholder { color: rgba(255, 255, 255, .6); }
.st-media { position: relative; border-radius: 18px; overflow: hidden; background: #000; }
.st-media img, .st-media video { width: 100%; max-height: 340px; object-fit: contain; display: block; }
.st-change { position: absolute; right: 10px; bottom: 10px; }
.st-pick { width: 100%; height: 220px; border-radius: 18px; border: 2px dashed var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-2); transition: all .15s; }
.st-pick:hover { border-color: var(--accent); color: var(--accent); background: var(--active); }
.st-pick span { font-size: .85em; color: var(--text-3); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches.small { gap: 8px; margin-bottom: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: var(--c); position: relative; transition: transform .15s; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.swatches.small .swatch { width: 28px; height: 28px; }
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--c); }
.swatch.custom { background: var(--panel-2); border: 1.5px dashed var(--line-2); cursor: pointer; overflow: hidden; }
.swatch.custom input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 2500; background: rgba(0, 0, 0, .9); display: flex; flex-direction: column; opacity: 0; transition: opacity .18s; }
.lightbox.show { opacity: 1; }
.lb-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; color: #fff; }
.lb-bar span { flex: 1; font-size: .92em; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .icon-btn { color: #fff; }
.lb-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 20px 30px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: zoomIn .22s var(--ease); }
@keyframes zoomIn { from { transform: scale(.94); opacity: 0; } }

/* story viewer */
.story-viewer { position: fixed; inset: 0; z-index: 2400; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.story-viewer.show { opacity: 1; }
.sv-frame { position: relative; width: min(420px, 100vw); height: min(92vh, 760px); border-radius: 18px; overflow: hidden; background: #111; display: flex; flex-direction: column; animation: zoomIn .25s var(--ease); }
.sv-bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 3; }
.sv-bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.sv-bars b { display: block; height: 100%; background: #fff; width: 0; }
.sv-head { position: absolute; top: 20px; left: 8px; right: 6px; display: flex; align-items: center; gap: 2px; z-index: 4; color: #fff; }
.sv-head .icon-btn { color: #fff; }
.sv-head .icon-btn:hover { background: rgba(255, 255, 255, .15); }
#sv-user { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 0; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
#sv-user b { display: block; font-size: .95em; }
#sv-user span { font-size: .78em; opacity: .8; }
.sv-content { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.sv-content img, .sv-content video { width: 100%; height: 100%; object-fit: contain; }
.sv-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 60px 28px; }
.sv-text p { color: #fff; font-size: 1.5em; font-weight: 700; text-align: center; line-height: 1.35; overflow-wrap: anywhere; text-shadow: 0 2px 12px rgba(0, 0, 0, .2); }
.sv-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 18px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); color: #fff; text-align: center; }
.sv-nav { position: absolute; inset: 70px 0 70px; display: flex; z-index: 2; }
.sv-nav button { flex: 1; }
.sv-prev { flex: .4 !important; }
.sv-foot { position: relative; z-index: 3; padding: 10px 12px 14px; display: flex; align-items: center; gap: 8px; background: linear-gradient(transparent, rgba(0, 0, 0, .5)); }
.sv-foot input { flex: 1; height: 42px; border-radius: 21px; border: 1.5px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .25); color: #fff; padding: 0 16px; outline: none; }
.sv-foot input::placeholder { color: rgba(255, 255, 255, .7); }
.sv-quick { display: flex; }
.sv-quick button { font-size: 1.35em; width: 36px; height: 36px; border-radius: 50%; transition: transform .15s; }
.sv-quick button:hover, .sv-quick button.pop { transform: scale(1.3); }
.sv-views { display: flex; align-items: center; gap: 8px; color: #fff; padding: 8px 14px; border-radius: 20px; background: rgba(255, 255, 255, .12); margin: 0 auto; font-weight: 600; font-size: .9em; }

/* mini apps */
.miniapp-overlay { position: fixed; inset: 0; z-index: 2200; background: rgba(0, 0, 0, .55); display: none; align-items: center; justify-content: center; padding: 16px; }
.miniapp-overlay.visible { display: flex; }
.miniapp-frame { width: min(440px, 100%); height: min(720px, 100%); background: var(--panel); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: rise .25s var(--ease); }
.miniapp-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.miniapp-frame iframe { flex: 1; border: 0; width: 100%; background: #fff; }

/* mini player */
.mini-player { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4; display: none; align-items: center; gap: 2px; padding: 6px 6px 6px 8px; border-radius: 16px; background: var(--panel-2); box-shadow: var(--shadow); border: 1px solid var(--line); }
.mini-player.visible { display: flex; animation: rise .25s var(--ease); }
.mp-play { color: var(--accent) !important; }
.mp-info { flex: 1; min-width: 0; padding: 0 6px; }
.mp-title { font-size: .82em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.mp-title b { color: var(--text); }
.mp-bar { height: 4px; border-radius: 2px; background: var(--panel-3); margin-top: 5px; cursor: pointer; position: relative; }
.mp-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--accent); }
.mp-time { font-size: .72em; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- pages */
.s-group { margin-bottom: 20px; }
.s-group h4 { display: flex; align-items: center; justify-content: space-between; font-size: .78em; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px 8px; }
.s-card { background: var(--panel); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.s-card.pad { padding: 16px; }
.s-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 56px; position: relative; }
.s-row + .s-row::before { content: ""; position: absolute; top: 0; right: 0; left: 64px; height: 1px; background: var(--line); }
.s-row.clickable { cursor: pointer; transition: background .12s; }
.s-row.clickable:hover { background: var(--hover); }
.s-row.danger .s-label { color: var(--danger); font-weight: 600; }
.s-ic { --ic: var(--accent); width: 34px; height: 34px; border-radius: 10px; background: var(--ic); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.s-row.danger .s-ic { background: rgba(240, 85, 106, .14); color: var(--danger); }
.s-text { flex: 1; min-width: 0; }
.s-label { font-weight: 500; overflow-wrap: anywhere; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.s-sub { font-size: .82em; color: var(--text-2); margin-top: 2px; }
.s-value { font-size: .88em; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.s-arrow { color: var(--text-3); display: flex; }
.s-foot { font-size: .8em; color: var(--text-3); padding: 8px 8px 0; line-height: 1.45; }
.s-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: .9em; }
.s-version { text-align: center; color: var(--text-3); font-size: .8em; margin-top: 10px; }
.me-card { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--panel); border-radius: 20px; margin-bottom: 20px; border: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.me-card:hover { background: color-mix(in srgb, var(--panel) 92%, var(--accent)); }
.me-card > div { flex: 1; min-width: 0; }
.me-name { font-size: 1.2em; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.me-sub { color: var(--text-2); font-size: .88em; margin-top: 2px; }

.hero { text-align: center; padding: 14px 0 18px; }
.hero h2 { font-size: 1.45em; margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero-sub { color: var(--text-2); margin-top: 4px; font-size: .92em; }
.hero-avatar { display: inline-block; position: relative; border-radius: 50%; cursor: pointer; }
.hero-avatar .avatar { box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.hero-cam { position: absolute; inset: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.hero-avatar.editable:hover .hero-cam { opacity: 1; }
.hero-links { margin-top: 10px; }
.hero-actions { display: flex; justify-content: center; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.hero-action { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 88px; padding: 12px 10px 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); color: var(--accent); font-size: .8em; font-weight: 600; transition: all .15s; }
.hero-action:hover { background: var(--active); transform: translateY(-1px); }
.hero-action span { color: var(--text); }
.hero-action.on { background: var(--active); }
.hero-action.danger, .hero-action.danger-on { color: var(--danger); }
.hero-action.danger-on { background: rgba(240, 85, 106, .12); }
.form .input { margin-bottom: 2px; }
.form .btn { margin-top: 14px; }
.counter { float: right; font-weight: 500; color: var(--text-3); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; margin: 0; }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { padding: 10px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.theme-card.active { border-color: var(--accent); }
.theme-card span { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: .86em; font-weight: 600; }
.tc-preview { height: 70px; width: 100%; border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.tc-preview i { display: block; }
.tc-preview i { height: 10px; border-radius: 5px; width: 60%; }
.tc-preview i:nth-child(2) { align-self: flex-end; width: 50%; background: var(--accent) !important; }
.t-dark .tc-preview { background: #121319; }
.t-dark .tc-preview i { background: #2a2c37; }
.t-light .tc-preview { background: #e9ebf2; }
.t-light .tc-preview i { background: #fff; }
.t-system .tc-preview { background: linear-gradient(90deg, #121319 50%, #e9ebf2 50%); }
.t-system .tc-preview i { background: #777c8a; }
.preview-bubbles { margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--chat-bg); display: flex; flex-direction: column; gap: 6px; }
.pb { max-width: 75%; padding: 8px 12px; border-radius: 16px; }
.pb.in { background: var(--bubble-in); border-bottom-left-radius: 4px; }
.pb.out { background: var(--bubble-out); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.cli { background: #0b0c10; border-radius: 16px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .08); font-family: var(--mono); font-size: .86em; }
.cli-out { height: 55vh; overflow-y: auto; padding: 16px; white-space: pre-wrap; color: #c9d1d9; line-height: 1.55; }
.cli-out .info { color: #8ab4ff; }
.cli-out .ok { color: #4ade80; }
.cli-out .err { color: #ff6b81; }
.cli-out .cmd { color: #9aa0ab; }
.cli-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255, 255, 255, .08); color: #4ade80; }
.cli-in input { flex: 1; background: none; border: 0; outline: none; color: #fff; font-family: inherit; font-size: 1em; }
.audit-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.audit-row code { font-size: .85em; overflow-wrap: anywhere; }
.audit-res { font-size: .7em; font-weight: 800; padding: 3px 7px; border-radius: 6px; background: var(--panel-3); flex-shrink: 0; margin-top: 2px; }
.audit-res.success { background: rgba(53, 196, 124, .15); color: var(--success); }
.audit-res.error { background: rgba(240, 85, 106, .15); color: var(--danger); }
.audit-res.report { background: rgba(245, 165, 36, .15); color: var(--warn); }
.role-tag { font-size: .75em; font-weight: 700; color: var(--accent); background: var(--active); padding: 3px 8px; border-radius: 8px; }

.create-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.create-head .grow { display: flex; flex-direction: column; gap: 8px; }
.avatar-pick { width: 84px; height: 84px; border-radius: 50%; background: var(--active); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; transition: transform .15s; }
.avatar-pick:hover { transform: scale(1.04); }
.avatar-pick img { width: 100%; height: 100%; object-fit: cover; }
.sub-title { font-size: .78em; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin: 10px 4px 10px; }
.radio-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); margin-bottom: 8px; cursor: pointer; transition: border-color .15s; background: var(--panel); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--active); }
.radio-card input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; }
.radio-card b { display: block; }
.radio-card span { font-size: .85em; color: var(--text-2); }
.search-field { position: relative; margin-bottom: 10px; }
.search-field .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-field .input { padding-left: 42px; border-radius: 22px; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.picker-chips:empty { display: none; }
.pchip { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 3px; border-radius: 15px; background: var(--active); color: var(--accent); font-size: .85em; font-weight: 600; }
.pchip:hover { background: rgba(240, 85, 106, .15); color: var(--danger); }
.list-item.pick { margin: 0; cursor: pointer; }
.track { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; transition: background .12s; }
.track:hover { background: var(--hover); }
.track.playing .s-label { color: var(--accent); }
.track-cover { width: 44px; height: 44px; border-radius: 10px; background: var(--active); color: var(--accent); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; flex-shrink: 0; }
.track-cover img { width: 100%; height: 100%; object-fit: cover; }
.track-play { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.track:hover .track-play, .track.playing .track-play { opacity: 1; }
mark { background: rgba(var(--accent-rgb), .3); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------------------------------------------------------------- electron */
body.electron { user-select: none; }
body.electron input, body.electron textarea, body.electron .b-text, body.electron .post-text, body.electron .s-label, body.electron .cli-out, body.electron .dlg-msg { user-select: text; }

body.android { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
body.android input, body.android textarea { user-select: text; -webkit-user-select: text; }

/* ---------------------------------------------------------------- no animations */
body.no-anim *, body.no-anim *::before, body.no-anim *::after { animation-duration: 0s !important; transition-duration: 0s !important; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) { :root { --sidebar-w: 340px; } }
@media (max-width: 859px) {
  #sidebar { width: 100%; max-width: none; min-width: 0; border-right: 0; }
  #pane { position: absolute; inset: 0; z-index: 10; transform: translateX(100%); transition: transform .28s var(--ease); visibility: hidden; }
  body.pane-open #pane { transform: none; visibility: visible; }
  body.no-anim #pane { transition: none; }
  .back-btn { display: inline-flex; }
  .msgs-inner, .posts-inner { padding: 0 10px; }
  .composer-wrap { padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
  .bubble { max-width: 86%; }
  .dlg { border-radius: 20px; padding: 18px; }
  .theme-cards { gap: 6px; }
  .hero-action { min-width: 74px; }
  .emoji-pop { right: 8px; left: 8px; width: auto; }
  .sv-frame { width: 100vw; height: 100%; border-radius: 0; }
  .page-inner { padding: 16px 12px 60px; }
  .fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (hover: none) {
  .list-item:hover, .s-row.clickable:hover, .icon-btn:hover { background: transparent; }
}

/* ---------------------------------------------------------------- email code step */
.forgot-link { display: block; margin: 14px auto 0; }
.code-head { text-align: center; margin: 4px 0 18px; }
.code-ic { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; background: var(--active); color: var(--accent); }
.code-head h2 { font-size: 1.25em; margin-bottom: 6px; }
.code-head p { font-size: .9em; line-height: 1.5; }
.code-input { height: 58px; text-align: center; font-size: 1.8em; font-weight: 800; letter-spacing: .5em; padding-left: .5em; font-variant-numeric: tabular-nums; }
.code-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.code-actions .link:disabled { color: var(--text-3); cursor: default; text-decoration: none; }
.chips.wrap { flex-wrap: wrap; padding: 0; }

/* ---------------------------------------------------------------- calls */
.call-bubble { padding: 8px 10px 8px 8px !important; min-width: 230px; }
.call-msg { display: flex; align-items: center; gap: 12px; }
.cm-ic { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(53, 196, 124, .16); color: var(--success); flex-shrink: 0; }
.msg-row.out .cm-ic { background: rgba(255, 255, 255, .2); color: #fff; }
.cm-ic.missed { background: rgba(240, 85, 106, .15); color: var(--danger); }
.cm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-text b { font-weight: 600; }
.cm-text span { font-size: .8em; opacity: .75; }
.cm-again { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--accent); transition: background .15s; }
.cm-again:hover { background: var(--active); }
.msg-row.out .cm-again { color: #fff; }
.msg-row.out .cm-again:hover { background: rgba(255, 255, 255, .15); }
.pv-kind.danger { color: var(--danger); }

.call-overlay {
  position: fixed; inset: 0; z-index: 2600; background: #0b0c10; color: #fff; display: flex; flex-direction: column; align-items: center; overflow: hidden; overflow: clip;
  touch-action: manipulation; overscroll-behavior: none; user-select: none; -webkit-user-select: none;
  opacity: 0; transform: scale(1.02); transition: opacity .22s, transform .22s var(--ease);
}
.call-overlay.show { opacity: 1; transform: none; }
.call-overlay.closing { opacity: 0; transform: scale(.98); }
.call-bg { position: absolute; inset: 0; transform: scale(1.25); background-size: cover; background-position: center; filter: blur(50px) brightness(.45) saturate(1.3); opacity: .9; }
.call-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), .35), transparent 60%), linear-gradient(transparent 50%, rgba(0, 0, 0, .6)); }
#call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .3s; }
#call-remote.on { opacity: 1; }
.call-overlay.has-remote-video .call-center { top: auto; bottom: 150px; }
.call-overlay.has-remote-video .call-avatar { display: none; }
.call-overlay.has-remote-video .call-center h2 { font-size: 1.1em; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.call-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; z-index: 3; }
.call-top .icon-btn { color: #fff; background: rgba(255, 255, 255, .1); }
.call-top .icon-btn:hover { background: rgba(255, 255, 255, .2); }
.call-e2e { display: flex; align-items: center; gap: 5px; font-size: .75em; opacity: .7; padding: 5px 10px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.call-center { position: absolute; top: 16%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 2; text-align: center; padding: 0 20px; }
.call-avatar { border-radius: 50%; position: relative; margin-bottom: 10px; }
.call-avatar .avatar { box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.call-overlay.incoming .call-avatar::before, .call-overlay:not(.active) .call-avatar::before {
  content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); animation: callPulse 1.8s ease-out infinite;
}
@keyframes callPulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.call-center h2 { font-size: 1.6em; font-weight: 700; letter-spacing: -.01em; }
.call-status { font-size: .95em; opacity: .8; font-variant-numeric: tabular-nums; }
#call-local { position: absolute; right: 16px; top: 64px; width: 150px; aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; z-index: 3; background: #222;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5); transform: scaleX(-1); display: none; }
#call-local.rear { transform: none; }
.call-overlay video { pointer-events: none; }
#call-local.on { display: block; }
.call-controls { position: absolute; bottom: calc(34px + env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: center; gap: 22px; z-index: 3; flex-wrap: wrap; padding: 0 12px; }
.cc { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .78em; opacity: .95; min-width: 64px; }
.call-btn { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px); transition: transform .12s, background .15s; }
.call-btn:hover { background: rgba(255, 255, 255, .26); }
.call-btn:active { transform: scale(.92); }
.call-btn.on { background: #fff; color: #111; }
.call-btn.decline { background: #f0445a; }
.call-btn.decline:hover { background: #ff5a6f; }
.call-btn.accept { background: #2fbf71; }
.call-btn.accept:hover { background: #38d17f; }
.call-btn.pulse { animation: acceptPulse 1.4s infinite; }
@keyframes acceptPulse { 0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, .6); } 100% { box-shadow: 0 0 0 22px rgba(47, 191, 113, 0); } }
.call-pill { display: none; }
.call-overlay.minimized { inset: auto; top: 12px; left: 50%; transform: translateX(-50%); width: auto; height: auto; background: transparent; overflow: visible; }
.call-overlay.minimized > *:not(.call-pill):not(audio) { display: none !important; }
.call-overlay.minimized .call-pill {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 22px; background: #2fbf71; color: #fff; font-weight: 600; font-size: .88em;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35); white-space: nowrap; animation: rise .25s var(--ease);
}
@media (max-width: 520px) {
  .ch-search-btn { display: none; }   /* search stays in the ⋮ menu; room for both call buttons */
}
@media (max-width: 859px) {
  #call-local { width: 110px; top: 60px; right: 12px; }
  .call-controls { gap: 14px; }
  .call-btn { width: 58px; height: 58px; }
}

/* ---------------------------------------------------------------- QR login */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--text-3); font-size: .82em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#qr-login-btn { gap: 8px; }
.qr-wrap { display: flex; justify-content: center; margin: 6px 0 12px; }
.qr-box { width: 232px; height: 232px; padding: 12px; border-radius: 20px; background: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 40px rgba(var(--accent-rgb), .25); transition: opacity .2s, filter .2s; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-box.dim { opacity: .35; filter: blur(2px); }
.qr-status { min-height: 1.3em; text-align: center; font-size: .9em; color: var(--text-2); margin-bottom: 10px; }
.qr-status.ok { color: var(--success); font-weight: 600; }
.qr-status.bad { color: var(--danger); }
.qr-steps { margin: 4px 0 16px 20px; color: var(--text-2); font-size: .9em; line-height: 1.7; }
.qr-steps b { color: var(--text); }
.qr-connect { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; margin-bottom: 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.qr-connect > div:nth-child(2) { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 3px; }
.qr-connect span { font-size: .85em; color: var(--text-2); }
.qr-connect .btn { gap: 8px; }
.qc-ic { width: 52px; height: 52px; border-radius: 16px; background: var(--active); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qr-scanner { position: fixed; inset: 0; z-index: 2700; background: #000; opacity: 0; transition: opacity .2s; overflow: hidden; overflow: clip; touch-action: manipulation; }
.qr-scanner.show { opacity: 1; }
.qr-scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.qs-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 12px; color: #fff;
  background: linear-gradient(rgba(0, 0, 0, .6), transparent); z-index: 2; }
.qs-top .icon-btn { color: #fff; background: rgba(255, 255, 255, .15); }
.qs-frame { position: absolute; left: 50%; top: 50%; width: min(66vw, 300px); aspect-ratio: 1; transform: translate(-50%, -55%); border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .5); z-index: 1; }
.qs-frame i { position: absolute; width: 38px; height: 38px; border: 4px solid #fff; }
.qs-frame i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 22px 0 0 0; }
.qs-frame i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-radius: 0 22px 0 0; }
.qs-frame i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 22px; }
.qs-frame i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 22px 0; }
.qs-hint { position: absolute; left: 20px; right: 20px; bottom: calc(40px + env(safe-area-inset-bottom)); text-align: center; color: #fff; z-index: 2; font-size: .95em; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
