/* Inter (variable: weights 100–900 + optical size 14–32), self-hosted. Declaring the full weight
   range makes 400/500/600/700/800 use the real instances instead of synthesized bold. */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Italic-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
body { font-optical-sizing: auto; font-synthesis: none; }

/* Twemoji color font (mozilla/twemoji-colr) so emoji look like Twemoji even inside text boxes,
   placeholders and tooltips. Restricted to emoji code points: letters, digits, arrows, ©/®/™ keep
   their normal font. Rendered messages still use the SVG images (newest emoji set). */
@font-face {
  font-family: 'Twemoji';
  src: url('/fonts/Twemoji.Mozilla.ttf') format('truetype');
  font-display: swap;
  unicode-range: U+200D, U+203C, U+2049, U+2139, U+231A-231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FA, U+24C2,
    U+25AA-25AB, U+25FB-25FE, U+2600-26FF, U+2702-27BF, U+2934-2935, U+2B1B-2B1C, U+2B50, U+2B55, U+3030, U+303D,
    U+3297, U+3299, U+FE0F, U+1F000-1FAFF, U+E0020-E007F;
}

/* ==========================================================================
   UnTidl — dark theme modelled on Discord's UI kit
   ========================================================================== */
:root {
  /* UnTidl default: "Graphite Olive" — graphite grays + olive accent (#87A330 · #A1C349 · #CAD593) */
  --bg-1: #25272a;          /* chat (a step lighter than #2A3C24) */
  --bg-2: #1e1f21;          /* sidebar / members */
  --bg-3: #161718;          /* server rail, title bar */
  --bg-4: #1a1b1d;          /* user panel */
  --bg-float: #101112;      /* menus, popouts (a step darker than #243010) */
  --bg-modal: #32462b;
  --bg-input: #2d3033;
  --bg-input-dark: #161718;
  --tint: #c9cfbc;           /* hover / selection / divider tint */
  --tint-rgb: 201, 207, 188;
  --hover: rgba(var(--tint-rgb), .08);
  --hover-2: rgba(var(--tint-rgb), .13);
  --selected: rgba(var(--tint-rgb), .17);
  --msg-hover: rgba(0, 0, 0, .09);
  --line: rgba(var(--tint-rgb), .16);
  --line-soft: rgba(var(--tint-rgb), .08);
  --text: #dfe3d6;
  --text-strong: #f3f5ee;
  --muted: #9ca191;
  --faint: #80857a;
  --icon: #b4b9a9;
  --icon-hover: #e6ecd0;
  --brand: #87a330;
  --brand-hover: #74902a;
  --brand-text: #cad593;
  --on-brand: #17210a;
  --brand-rgb: 135, 163, 48;
  --on-brand-rgb: 23, 33, 10;      /* dark text on the olive accent (white would be too low-contrast) */
  --link: #a1c349;
  --green: #a1c349;
  --green-btn: #5f7f1f;
  --green-btn-hover: #4d6918;
  --green-rgb: 161, 195, 73;
  --green-btn-rgb: 95, 127, 31;
  --red: #f23f43;
  --red-btn: #da373c;
  --red-btn-hover: #a12828;
  --yellow: #f0b232;
  --mention-bg: rgba(240, 178, 50, .1);
  --mention-bar: #f0b132;
  --radius: 8px;
  --font: 'Twemoji', 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', monospace;
  --shadow: 0 8px 16px rgba(0, 0, 0, .3);
  --cut: var(--bg-2);
  /* surfaces derived from the base colors */
  --bg-hover: color-mix(in srgb, var(--bg-2) 90%, var(--tint));
  --bg-hover-2: color-mix(in srgb, var(--bg-2) 83%, var(--tint));
  --btn-grey: color-mix(in srgb, var(--bg-1) 72%, var(--tint));
  --btn-grey-hover: color-mix(in srgb, var(--bg-1) 58%, var(--tint));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-3);
  color: var(--text);
  font: 16px/1.375 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, p { margin: 0; }
kbd { font: 600 11px var(--font); background: var(--bg-3); border: 1px solid var(--bg-float); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; color: var(--text); }
[hidden] { display: none !important; }
.ic { flex-shrink: 0; display: block; }
.ic.red { color: var(--red); }
.grow { flex: 1; }
.mt { margin-top: 16px; }
::selection { background: rgba(var(--brand-rgb), .5); }

::-webkit-scrollbar { width: 16px; height: 16px; }
::-webkit-scrollbar-thumb { background: var(--bg-float); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; min-height: 40px; }
::-webkit-scrollbar-track { background: var(--bg-2); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }
.thin-scroll::-webkit-scrollbar, .sb-scroll::-webkit-scrollbar, .side-panel::-webkit-scrollbar, .settings-nav::-webkit-scrollbar, .ctx-menu::-webkit-scrollbar { width: 8px; }
.sb-scroll::-webkit-scrollbar-thumb, .side-panel::-webkit-scrollbar-thumb, .settings-nav::-webkit-scrollbar-thumb { border-width: 2px; background-color: transparent; }
.sb-scroll:hover::-webkit-scrollbar-thumb, .side-panel:hover::-webkit-scrollbar-thumb, .settings-nav:hover::-webkit-scrollbar-thumb { background-color: var(--bg-float); }
.sb-scroll::-webkit-scrollbar-track, .side-panel::-webkit-scrollbar-track, .settings-nav::-webkit-scrollbar-track { background: none; }

/* ------------------------------------------------------------------ electron title bar */
#titlebar { height: 32px; flex-shrink: 0; display: flex; align-items: center; background: var(--bg-3); -webkit-app-region: drag; position: relative; z-index: 100; }
.tb-title { padding-left: 12px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.tb-title .ic { color: var(--brand); }
.tb-controls { margin-left: auto; display: flex; height: 100%; -webkit-app-region: no-drag; }
.tb-controls button { width: 46px; height: 32px; display: grid; place-items: center; color: var(--icon); }
.tb-controls button:hover { background: var(--bg-hover); color: var(--text); }
.tb-controls .tb-close:hover { background: var(--red-btn); color: #fff; }
body.electron #root, body.electron #connecting { height: calc(100% - 32px); }
/* keep popups/modals below the title bar so window buttons stay clickable */
body.electron #layers > .layer:not(#incoming), body.electron #connecting { top: 32px; }
body.electron #connecting { position: fixed; inset: 32px 0 0 0; }
body.electron .settings-layer { top: 32px; }

#root { height: 100%; }

/* ------------------------------------------------------------------ avatar & status */
.avatar { --s: 32px; width: var(--s); height: var(--s); position: relative; flex-shrink: 0; border-radius: 50%; }
.avatar > img, .avatar > .avatar-default { width: 100%; height: 100%; border-radius: 50%; display: block; object-fit: cover; }
.avatar-default { display: grid !important; place-items: center; color: #fff; }
.avatar::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; pointer-events: none; transition: border-color .08s; }
.avatar.speaking::after { border-color: var(--green); }

.status { position: absolute; right: -2px; bottom: -2px; width: max(10px, calc(var(--s) * .3)); height: max(10px, calc(var(--s) * .3)); border-radius: 50%; box-shadow: 0 0 0 max(3px, calc(var(--s) * .08)) var(--cut); background: var(--faint); z-index: 1; }
.status.inline { position: relative; right: auto; bottom: auto; display: inline-block; width: 10px; height: 10px; box-shadow: none; flex-shrink: 0; --cut: var(--bg-float); }
.status.s-online { background: var(--green); }
.status.s-idle { background: radial-gradient(circle at 22% 22%, var(--cut) 0 32%, transparent 33%), var(--yellow); }
.status.s-dnd { background: var(--red); }
.status.s-dnd::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 22%; transform: translateY(-50%); background: var(--cut); border-radius: 4px; }
.status.s-offline { background: radial-gradient(circle, var(--cut) 0 30%, transparent 31%), var(--faint); }
.status.s-streaming { background: #593695; }

/* ------------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 96px; padding: 2px 16px; border-radius: 4px; font-size: 14px; font-weight: 500; color: #fff; transition: background .17s, color .17s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; min-width: 60px; padding: 2px 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-brand { background: var(--brand); color: var(--on-brand); }
.btn-brand:hover:not(:disabled) { background: var(--brand-hover); }
.btn-green { background: var(--green-btn); }
.btn-green:hover:not(:disabled) { background: var(--green-btn-hover); }
.btn-red { background: var(--red-btn); }
.btn-red:hover:not(:disabled) { background: var(--red-btn-hover); }
.btn-grey { background: var(--btn-grey); }
.btn-grey:hover:not(:disabled) { background: var(--btn-grey-hover); }
.btn-green-outline { border: 1px solid var(--green-btn); color: var(--text); }
.btn-green-outline:hover:not(:disabled) { background: var(--green-btn); color: #fff; }
.btn-red-outline { border: 1px solid var(--red-btn); color: var(--text); }
.btn-red-outline:hover { background: var(--red-btn); color: #fff; }
.btn.icon-only { min-width: 32px; width: 32px; padding: 0; }
.btn-link { color: var(--text); font-size: 14px; font-weight: 500; padding: 2px 4px; display: inline-flex; gap: 6px; align-items: center; }
.btn-link:hover { text-decoration: underline; }

.input { width: 100%; background: var(--bg-input-dark); border: 0; border-radius: 4px; padding: 10px; font-size: 16px; color: var(--text); outline: none; resize: none; user-select: text; }
.input:focus { outline: none; }
.input.big { height: 40px; }
textarea.input { line-height: 1.375; }
select.input { appearance: none; cursor: pointer; background: var(--bg-input-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23b5bac1'%3E%3Cpath d='M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z'/%3E%3C/svg%3E") no-repeat right 8px center; padding-right: 36px; }
.field-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--icon); margin: 20px 0 8px; }
.field-label:first-child { margin-top: 0; }
.field-label.error { color: #fa777c; }
.field-err { font-weight: 500; font-style: italic; text-transform: none; margin-left: 4px; }
.field-hint { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.3; }
.req { color: var(--red); }
.badge { background: var(--red); color: #fff; font-size: 12px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; display: inline-grid; place-items: center; line-height: 1; }
.live-badge { background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 8px; height: 16px; display: inline-grid; place-items: center; letter-spacing: .02em; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin: 0 4px 0 8px; }
.dot.green { background: var(--green); }
.dot:first-child { margin-left: 0; }

/* ------------------------------------------------------------------ connecting & toasts */
#connecting { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 24px; background: var(--bg-1); transition: opacity .25s; }
#connecting.out { opacity: 0; pointer-events: none; }
.spinner-logo { color: var(--brand); animation: bob 1.4s ease-in-out infinite; }
.connecting-text { font-size: 14px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }

#toasts { position: fixed; left: 50%; top: 32px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--bg-float); color: var(--text); padding: 10px 16px; border-radius: 6px; font-size: 14px; box-shadow: var(--shadow); animation: toastIn .2s ease-out; transition: opacity .3s, transform .3s; max-width: 480px; }
.toast.error { background: var(--red-btn); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.tooltip { position: fixed; z-index: 3000; background: var(--bg-float); color: var(--text-strong); font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 5px; pointer-events: none; box-shadow: var(--shadow); max-width: 260px; animation: tipIn .1s ease-out; white-space: pre-wrap; }
.tooltip.tip-right { font-size: 16px; padding: 8px 12px; }
@keyframes tipIn { from { opacity: 0; transform: scale(.96); } }

/* ------------------------------------------------------------------ auth */
/* minmax(0, 1fr): the column is the screen width, not the card's content width, so the card
   shrinks on phones; tall cards (saved accounts) scroll instead of being cut off */
.auth { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; position: relative; overflow-x: hidden; overflow-y: auto; padding: 24px 0; }
.auth-bg { position: fixed; inset: 0; background:
  radial-gradient(1200px 600px at 10% 110%, var(--brand) 0, transparent 60%),
  radial-gradient(900px 500px at 100% -10%, var(--link) 0, transparent 55%),
  linear-gradient(135deg, var(--bg-2) 0%, var(--bg-3) 100%); }
.auth-bg::after { content: ''; position: absolute; inset: 0; opacity: .12; background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 28px 28px; }
.auth-card { position: relative; width: 480px; max-width: calc(100% - 32px); background: var(--bg-1); border-radius: 5px; padding: 32px; box-shadow: 0 2px 10px 0 rgba(0, 0, 0, .2); display: flex; flex-direction: column; animation: pop .25s ease-out; }
.auth-logo { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--text-strong); font-weight: 800; font-size: 22px; margin-bottom: 16px; }
.auth-logo .ic { color: var(--brand); }
.auth-card h1 { text-align: center; font-size: 24px; font-weight: 600; color: var(--text-strong); margin-bottom: 8px; }
.auth-sub { text-align: center; color: var(--icon); margin-bottom: 12px; }
.auth-submit { margin-top: 24px; height: 44px; font-size: 16px; }
.auth-switch { margin-top: 8px; font-size: 14px; color: var(--muted); }
@media (max-width: 520px) {
  .auth-card { padding: 24px 18px; }
  .auth-card h1 { font-size: 22px; }
  .auth-acc .btn { padding: 0 12px; }
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

/* ------------------------------------------------------------------ layout */
.app { display: flex; height: 100%; }
.rail { width: 72px; flex-shrink: 0; background: var(--bg-3); padding: 12px 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; align-items: center; gap: 8px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.sidebar-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.main { flex: 1; min-width: 0; background: var(--bg-1); display: flex; flex-direction: column; }

/* ------------------------------------------------------------------ rail */
.rail-item { position: relative; width: 72px; display: flex; justify-content: center; cursor: pointer; flex-shrink: 0; }
.rail-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-1); display: grid; place-items: center; overflow: hidden; color: var(--text); transition: border-radius .15s ease-out, background .15s ease-out, color .15s; }
.rail-icon img { width: 100%; height: 100%; object-fit: cover; }
.rail-icon .avatar { --s: 48px !important; }
.rail-initials { font-weight: 500; white-space: nowrap; }
.rail-item:hover .rail-icon, .rail-item.active .rail-icon { border-radius: 16px; background: var(--brand); color: var(--on-brand); }
.rail-item:hover .rail-icon.has-img, .rail-item.active .rail-icon.has-img { background: none; }
.rail-icon.home { background: var(--bg-1); color: var(--text); }
.rail-item.active .rail-icon.home, .rail-item:hover .rail-icon.home { background: var(--brand); color: var(--on-brand); }
.rail-icon.green { color: var(--green); }
.rail-item:hover .rail-icon.green { background: var(--green); color: #fff; }
.rail-item.dm .rail-icon { background: none; }
.pill { position: absolute; left: 0; top: 50%; width: 8px; height: 0; margin-top: 0; margin-left: -4px; background: #fff; border-radius: 0 4px 4px 0; transition: height .15s, margin-top .15s; }
.rail-item.unread .pill { height: 8px; margin-top: -4px; }
.rail-item:hover .pill { height: 20px; margin-top: -10px; }
.rail-item.active .pill { height: 40px; margin-top: -20px; }
.rail-item .badge { position: absolute; right: 12px; bottom: -2px; box-shadow: 0 0 0 4px var(--bg-3); min-width: 16px; }
.rail-voice { position: absolute; right: 12px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg-3); }
.rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--bg-input); flex-shrink: 0; }

/* ------------------------------------------------------------------ sidebar */
.sb-header { height: 48px; flex-shrink: 0; display: flex; align-items: center; padding: 0 10px; box-shadow: 0 1px 0 rgba(4, 4, 5, .2), 0 1.5px 0 rgba(6, 6, 7, .05), 0 2px 0 rgba(4, 4, 5, .05); position: relative; z-index: 2; }
.sb-header.server { padding: 0 16px; cursor: pointer; font-weight: 600; color: var(--text-strong); transition: background .1s; }
.sb-header.server:hover, .sb-header.server.open { background: var(--hover); }
.sb-header.server.open .ic { transform: rotate(180deg); }
.sb-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-btn { width: 100%; height: 28px; border-radius: 4px; background: var(--bg-3); color: var(--muted); font-size: 14px; text-align: left; padding: 0 6px; font-weight: 500; }
.sb-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 8px 16px; }
.server-scroll { padding: 16px 8px 16px 8px; }
.sb-nav { height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 8px; border-radius: 4px; color: var(--muted); font-weight: 500; cursor: pointer; margin-bottom: 2px; }
.sb-nav:hover { background: var(--hover); color: var(--text); }
.sb-nav.active { background: var(--selected); color: #fff; }
.sb-nav .badge { margin-left: auto; }
.sb-section { display: flex; align-items: center; justify-content: space-between; padding: 18px 8px 4px 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.sb-section:hover { color: var(--text); }
.sb-section button { color: var(--icon); }
.sb-section button:hover { color: var(--text); }
.dm-item { height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 8px; border-radius: 4px; color: var(--muted); cursor: pointer; margin: 1px 0; --cut: var(--bg-2); }
.dm-item:hover { background: var(--hover); color: var(--text); --cut: var(--bg-hover); }
.dm-item.active { background: var(--selected); color: #fff; --cut: var(--bg-hover-2); }
.dm-item.unread { color: #fff; }
.dm-item.unread .dm-name { font-weight: 600; }
.dm-text { flex: 1; min-width: 0; }
.dm-name { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 20px; }
.dm-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 16px; }
.dm-call { color: var(--green); }
.dm-close { color: var(--icon); opacity: 0; }
.dm-item:hover .dm-close { opacity: 1; }
.dm-close:hover { color: var(--text); }

.cat { display: flex; align-items: center; padding: 16px 8px 4px 0; cursor: pointer; color: var(--muted); }
.cat:first-child { padding-top: 0; }
.cat:hover { color: var(--text); }
.cat-name { flex: 1; display: flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; overflow: hidden; white-space: nowrap; }
.cat-name .ic { transition: transform .1s; }
.cat.collapsed .cat-name .ic { transform: rotate(-90deg); }
.cat button { color: var(--icon); display: none; }
.cat:hover button { display: block; }
.cat button:hover { color: var(--text); }
.ch-item { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 8px; margin: 1px 0; border-radius: 4px; color: var(--faint); cursor: pointer; position: relative; }
.ch-item:hover { background: var(--hover); color: var(--text); }
.ch-item.active { background: var(--selected); color: #fff; }
.ch-item.unread { color: #fff; }
.ch-item.unread .ch-name { font-weight: 600; }
.ch-item.unread::before { content: ''; position: absolute; left: -8px; width: 8px; height: 8px; border-radius: 0 4px 4px 0; background: #fff; }
.ch-icon { color: var(--faint); display: flex; }
.ch-item.connected .ch-icon { color: var(--green); }
.ch-name { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-actions { display: none; gap: 4px; }
.ch-actions button { color: var(--icon); }
.ch-actions button:hover { color: var(--text); }
.ch-item:hover .ch-actions, .ch-item.active .ch-actions { display: flex; }
.vc-users { padding: 0 0 6px 36px; }
.vc-user { height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 4px; color: var(--muted); cursor: pointer; font-size: 14px; }
.vc-user:hover { background: var(--hover); color: var(--text); }
.vc-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.vc-icons { display: flex; gap: 4px; align-items: center; color: var(--icon); }

.user-panel { height: 52px; flex-shrink: 0; background: var(--bg-4); display: flex; align-items: center; padding: 0 8px; gap: 2px; --cut: var(--bg-4); }
.up-user { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 4px 4px 2px; margin-left: -2px; border-radius: 4px; cursor: pointer; }
.up-user:hover { background: var(--hover-2); --cut: var(--bg-hover-2); }
.up-names { min-width: 0; line-height: 1.2; }
.up-name { font-size: 14px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { font-size: 12px; color: var(--muted); height: 15px; overflow: hidden; position: relative; }
.up-sub span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .2s; }
.up-user:hover .up-sub span { transform: translateY(-100%); }
.up-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 4px; color: var(--icon); flex-shrink: 0; }
.up-btn:hover { background: var(--hover-2); color: var(--text); }
.up-btn.red { color: var(--red); }

.voice-panel { background: var(--bg-4); border-bottom: 1px solid var(--line-soft); padding: 8px; }
.vp-row { display: flex; align-items: center; }
.vp-info { flex: 1; min-width: 0; }
.vp-title { display: flex; align-items: center; gap: 4px; color: var(--green); font-size: 14px; font-weight: 600; }
.vp-where { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-where:hover { color: var(--text); }
.vp-buttons { display: flex; gap: 8px; margin-top: 8px; }
.vp-btn { flex: 1; height: 32px; border-radius: 4px; background: var(--bg-2); display: grid; place-items: center; color: var(--text); }
.vp-btn:hover { background: var(--bg-hover); }
.vp-btn.on { background: var(--green-btn); color: #fff; }

/* ------------------------------------------------------------------ chat header */
.chat-header { height: 48px; flex-shrink: 0; display: flex; align-items: center; padding: 0 8px 0 16px; gap: 8px; box-shadow: 0 1px 0 rgba(4, 4, 5, .2), 0 1.5px 0 rgba(6, 6, 7, .05), 0 2px 0 rgba(4, 4, 5, .05); position: relative; z-index: 2; --cut: var(--bg-1); }
.hdr-left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.hdr-left h1 { font-size: 16px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.hdr-left h1.clickable { cursor: pointer; }
.hdr-icon { color: var(--faint); }
.hdr-divider { width: 1px; height: 24px; background: var(--line); margin: 0 8px; flex-shrink: 0; }
.hdr-topic { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.hdr-right { display: flex; align-items: center; gap: 4px; }
.hdr-btn { width: 32px; height: 32px; display: grid; place-items: center; color: var(--icon); margin: 0 4px; }
.hdr-btn:hover, .hdr-btn.on { color: var(--text-strong); }

.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-col { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-col.dropping::after { content: 'Drop images to upload'; position: absolute; inset: 16px; border: 2px dashed var(--brand); border-radius: 12px; background: rgba(var(--brand-rgb), .12); display: grid; place-items: center; font-size: 20px; font-weight: 700; color: #fff; z-index: 5; }

/* ------------------------------------------------------------------ messages */
.messages { flex: 1; min-height: 0; overflow-y: scroll; overflow-x: hidden; overflow-anchor: none; }
.messages-inner { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding-bottom: 24px; }
.load-more { text-align: center; padding: 16px; color: var(--muted); font-size: 14px; }
.welcome { margin: 16px 16px 8px; padding-top: 16px; --cut: var(--bg-1); }
.welcome h1 { font-size: 32px; font-weight: 700; color: var(--text-strong); margin: 8px 0; line-height: 1.25; }
.welcome p { color: var(--muted); }
.welcome p b { color: var(--text); }
.welcome .btn-link { margin-top: 12px; color: var(--link); }
.welcome-icon { width: 68px; height: 68px; border-radius: 50%; background: var(--btn-grey); display: grid; place-items: center; color: #fff; }
.welcome-username { font-size: 24px; color: var(--text-strong); margin: -4px 0 16px; font-weight: 500; }
.welcome-actions { display: flex; gap: 8px; margin-top: 16px; }
.day-divider { display: flex; align-items: center; margin: 24px 16px 8px 16px; height: 0; border-top: 1px solid var(--line); justify-content: center; }
.day-divider span { background: var(--bg-1); padding: 2px 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: -1px; transform: translateY(-50%); }

.msg { position: relative; padding: 2px 48px 2px 72px; min-height: 22px; user-select: text; word-wrap: break-word; }
.msg:hover { background: var(--msg-hover); }
.msg.msg-head { margin-top: 17px; min-height: 44px; }
.msg.mentioned, .msg.replying { background: var(--mention-bg); }
.msg.mentioned::before, .msg.replying::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--mention-bar); }
.msg.replying { background: rgba(var(--brand-rgb), .08); }
.msg.replying::before { background: var(--brand); }
.msg.flash { animation: flash 1.5s ease-out; }
@keyframes flash { 0%, 40% { background: rgba(var(--brand-rgb), .2); } }
.msg.pending .msg-content { color: var(--muted); }
.msg.failed .msg-content { color: var(--red); }
.msg-avatar { position: absolute; left: 16px; top: 2px; cursor: pointer; --cut: var(--bg-1); }
.msg-reply + .msg-avatar { top: 24px; }
.msg-avatar .avatar::after { display: none; }
.msg-avatar:active { transform: translateY(1px); }
.msg-header { font-size: 16px; font-weight: 500; line-height: 22px; display: flex; align-items: baseline; gap: 8px; }
.msg-author { color: var(--text-strong); cursor: pointer; font-weight: 500; }
.msg-author:hover { text-decoration: underline; }
.msg-header time, .sys-text time { font-size: 12px; color: var(--muted); font-weight: 500; }
.msg-hover-time { position: absolute; left: 0; width: 56px; text-align: right; font-size: 11px; color: var(--muted); line-height: 22px; display: none; }
.msg:hover .msg-hover-time { display: block; }
.msg-content { line-height: 1.375; color: var(--text); white-space: pre-wrap; }
.msg-content.jumbo { font-size: 48px; line-height: 1.2; }
.msg-content a { word-break: break-all; }
.edited { font-size: 10px; color: var(--muted); margin-left: 4px; user-select: none; }
.msg-reply { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); margin-bottom: 4px; position: relative; cursor: pointer; min-width: 0; --cut: var(--bg-1); }
.msg-reply::before { content: ''; position: absolute; left: -36px; top: 50%; width: 33px; height: 12px; border-left: 2px solid var(--btn-grey); border-top: 2px solid var(--btn-grey); border-top-left-radius: 6px; }
.msg-reply .avatar::after { display: none; }
.msg-reply-name { color: var(--text-strong); font-weight: 500; white-space: nowrap; opacity: .85; }
.msg-reply-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-reply:hover .msg-reply-text { color: var(--text); }
.msg-accessories { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0; }
.attachment { display: block; border-radius: 8px; overflow: hidden; cursor: zoom-in; max-width: 400px; line-height: 0; }
.attachment img { max-width: 100%; height: auto; display: block; }
.embed-img { max-height: 300px; max-width: 400px; }
.invite-embed { background: var(--bg-2); border-radius: 8px; padding: 16px; width: 432px; max-width: 100%; min-height: 110px; user-select: none; }
.invite-embed h5 { font-size: 12px; font-weight: 700; color: var(--icon); text-transform: uppercase; margin-bottom: 12px; }
.ie-row { display: flex; align-items: center; gap: 16px; }
.ie-icon { width: 50px; height: 50px; border-radius: 16px; background: var(--bg-1); display: grid; place-items: center; overflow: hidden; font-weight: 600; flex-shrink: 0; color: var(--text); }
.ie-icon img { width: 100%; height: 100%; object-fit: cover; }
.ie-icon.bad { color: var(--red); }
.ie-info { flex: 1; min-width: 0; }
.ie-name { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ie-name.bad { color: var(--red); }
.ie-sub { font-size: 14px; color: var(--muted); display: flex; align-items: center; white-space: nowrap; }
.ie-sub.center { justify-content: center; margin-top: 8px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 2px; user-select: none; }
.reaction { height: 24px; display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; border-radius: 8px; background: var(--bg-2); border: 1px solid transparent; font-size: 14px; }
.reaction:hover { border-color: var(--btn-grey); }
.reaction.me { background: rgba(var(--brand-rgb), .15); border-color: var(--brand); }
.reaction .r-count { font-size: 14px; font-weight: 600; color: var(--icon); }
.reaction.me .r-count { color: var(--brand-text); }
.reaction.add { color: var(--icon); opacity: 0; }
.msg:hover .reaction.add { opacity: 1; }
.msg-actions { position: absolute; right: 14px; top: -16px; display: none; background: var(--bg-1); border: 1px solid var(--line-soft); border-radius: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 4px 8px rgba(0, 0, 0, .1); overflow: hidden; z-index: 3; }
.msg:hover .msg-actions { display: flex; }
.msg-actions button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--icon); }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.msg-actions button.danger:hover { color: var(--red); }
.msg.system { display: flex; align-items: center; gap: 0; padding-left: 72px; min-height: 26px; margin-top: 8px; color: var(--muted); }
.sys-icon { position: absolute; left: 28px; top: 5px; }
.sys-icon.green { color: var(--green); }
.sys-icon.red { color: var(--red); }
.sys-text { font-size: 15px; }
.sys-text .msg-author { color: var(--text-strong); }
.join-call { margin-left: 4px; }
.edit-box { padding: 4px 0; }
.edit-input { width: 100%; background: var(--bg-input); border: 0; border-radius: 8px; padding: 11px 16px; outline: none; resize: none; color: var(--text); line-height: 1.375; max-height: 50vh; }
.edit-hint { font-size: 12px; color: var(--text); margin-top: 4px; }
.skeleton { pointer-events: none; opacity: .6; }
.sk-bar { display: inline-block; height: 14px; border-radius: 7px; background: var(--bg-hover-2); vertical-align: middle; }
.sk-circle { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-hover-2); }

.codeblock { background: var(--bg-2); border: 1px solid var(--bg-3); border-radius: 4px; padding: 8px; margin: 6px 0 0; max-width: 90%; font: 14px/1.125rem var(--mono); white-space: pre-wrap; color: var(--text); overflow-x: auto; }
code.inline { background: var(--bg-2); border: 1px solid var(--bg-3); border-radius: 4px; padding: 0 .2em; font: 85% var(--mono); }
blockquote { margin: 0; padding: 0 8px 0 12px; border-left: 4px solid var(--btn-grey); border-radius: 4px; }
.mention { background: rgba(var(--brand-rgb), .3); color: var(--brand-text); border-radius: 3px; padding: 0 2px; font-weight: 500; cursor: pointer; }
.mention:hover { background: var(--brand); color: var(--on-brand); }
.spoiler { background: var(--bg-3); color: transparent; border-radius: 3px; cursor: pointer; transition: all .1s; }
.spoiler.revealed { background: rgba(255, 255, 255, .1); color: inherit; cursor: text; }

/* ------------------------------------------------------------------ composer */
.composer { padding: 0 16px; flex-shrink: 0; position: relative; }
.composer-box { display: flex; align-items: flex-start; background: var(--bg-input); border-radius: 8px; padding: 0 12px 0 0; }
.composer.has-top .composer-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer-btn { width: 40px; height: 44px; display: grid; place-items: center; color: var(--icon); flex-shrink: 0; padding: 0 8px; }
.composer-btn:first-child { width: 56px; padding: 0 16px; }
.composer-btn:hover { color: var(--text); }
#composer-input { flex: 1; background: none; border: 0; outline: none; resize: none; padding: 11px 0; line-height: 22px; max-height: 50vh; color: var(--text); user-select: text; }
#composer-input::placeholder { color: var(--btn-grey-hover); }
.composer-blocked { background: var(--bg-input); border-radius: 8px; padding: 12px 16px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; }
.attach-tray { display: flex; gap: 24px; padding: 20px 10px 10px; background: var(--bg-input); border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.attach-item { width: 216px; background: var(--bg-2); border-radius: 4px; padding: 8px; position: relative; flex-shrink: 0; }
.attach-item img { width: 100%; height: 150px; object-fit: contain; border-radius: 3px; display: block; }
.attach-name { font-size: 12px; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-item button { position: absolute; top: -12px; right: -12px; width: 32px; height: 32px; border-radius: 4px; background: var(--bg-1); color: var(--red); display: grid; place-items: center; box-shadow: 0 0 0 1px var(--line); }
.reply-bar { display: flex; align-items: center; justify-content: space-between; background: var(--bg-2); border-radius: 8px 8px 0 0; padding: 8px 16px; font-size: 14px; color: var(--muted); }
.reply-bar b { color: var(--text); font-weight: 600; }
.reply-bar button { color: var(--icon); }
.attach-tray + .reply-bar { border-radius: 0; }
.typing { height: 24px; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 4px; padding-left: 2px; }
.typing b { font-weight: 700; }
.typing-dots { display: inline-flex; gap: 3px; margin-right: 4px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text); animation: dots 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 60%, 100% { opacity: .3; transform: scale(.8); } 30% { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------------------------ side panel (members / DM profile) */
.side-panel { width: 240px; flex-shrink: 0; background: var(--bg-2); overflow-y: auto; overflow-x: hidden; --cut: var(--bg-2); }
.side-panel.members { padding: 0 8px 20px; }
.side-panel.dm-profile { width: 340px; background: var(--bg-3); --cut: var(--bg-3); }
.members-h { padding: 24px 8px 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.member { height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 8px; border-radius: 4px; cursor: pointer; margin: 1px 0; }
.member:hover { background: var(--hover); --cut: var(--bg-hover); }
.member.offline { opacity: .3; }
.member.offline:hover { opacity: 1; }
.member-text { min-width: 0; flex: 1; }
.member-name { font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.member:hover .member-name { color: var(--text); }
.member-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 4px; align-items: center; }
.crown { color: var(--yellow); display: inline-flex; }
.mutual { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.mutual:hover { background: var(--hover); }
.mutual img, .mutual span { width: 32px; height: 32px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: var(--bg-1); font-size: 14px; flex-shrink: 0; }

/* ------------------------------------------------------------------ profile card */
.profile-card { width: 340px; background: var(--bg-float); border-radius: 8px; overflow: hidden; --cut: var(--bg-float); user-select: text; }
.side-panel .profile-card { border-radius: 0; background: var(--bg-3); --cut: var(--bg-3); min-height: 100%; }
.pc-banner { height: 60px; background: var(--banner); }
.profile-card.full .pc-banner { height: 120px; }
.pc-avatar { margin: -40px 0 0 16px; width: max-content; border-radius: 50%; padding: 6px; background: var(--cut); position: relative; }
.profile-card.full .pc-avatar { margin-top: -46px; }
.pc-avatar .avatar::after { display: none; }
.pc-body { padding: 0 16px 16px; }
.pc-names { background: var(--bg-2); border-radius: 8px; padding: 12px; margin-top: 12px; }
.side-panel .pc-names, .side-panel .pc-section { background: var(--bg-2); }
.pc-display { font-size: 20px; font-weight: 700; color: var(--text-strong); line-height: 1.2; word-break: break-word; }
.pc-username { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.pc-owner { color: var(--yellow); display: inline-flex; }
.pc-custom { font-size: 14px; margin-top: 8px; color: var(--text); }
.pc-section { background: var(--bg-2); border-radius: 8px; padding: 12px; margin-top: 8px; }
.pc-section h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-strong); margin: 12px 0 6px; }
.pc-section h4:first-child { margin-top: 0; }
.pc-about, .pc-since { font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.pc-actions:empty { display: none; }
.pc-actions { margin-top: 12px; }
.pc-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.pc-buttons .btn:first-child:not(.icon-only) { flex: 1; }
.pc-message { width: 100%; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; outline: none; font-size: 14px; }
.pc-actions .btn { width: 100%; }
.pc-actions .pc-buttons .btn { width: auto; }

/* ------------------------------------------------------------------ friends */
.friends-header { gap: 0; }
.friends-header .hdr-left { gap: 8px; overflow: hidden; }
.tab { padding: 2px 8px; border-radius: 4px; font-size: 16px; font-weight: 500; color: var(--icon); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; margin: 0 4px; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: var(--selected); color: #fff; }
.tab.add { background: var(--green-btn); color: #fff; }
.tab.add.active { background: none; color: var(--link); }
.friends { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.friend-search { margin: 16px 20px 8px 30px; position: relative; flex-shrink: 0; }
.friend-search input { width: 100%; height: 34px; background: var(--bg-3); border: 0; border-radius: 4px; padding: 0 36px 0 10px; outline: none; font-size: 15px; }
.friend-search .ic { position: absolute; right: 8px; top: 7px; color: var(--icon); }
.friend-list { flex: 1; overflow-y: auto; padding: 0 20px 16px 30px; }
.list-h { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; margin: 16px 0 8px; }
.friend-row { height: 62px; display: flex; align-items: center; gap: 12px; padding: 0 10px; margin: 0 -10px; border-top: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer; --cut: var(--bg-1); }
.friend-row:hover { background: var(--hover); border-top-color: transparent; --cut: var(--bg-input); }
.friend-row:hover + .friend-row { border-top-color: transparent; }
.friend-text { flex: 1; min-width: 0; }
.friend-name { font-weight: 600; color: var(--text-strong); display: flex; gap: 6px; align-items: baseline; }
.friend-username { font-size: 14px; color: var(--muted); font-weight: 500; opacity: 0; transition: opacity .1s; }
.friend-row:hover .friend-username { opacity: 1; }
.friend-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-actions { display: flex; gap: 10px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-2); color: var(--icon); display: grid; place-items: center; }
.friend-row:hover .round-btn { background: var(--bg-3); }
.round-btn:hover { color: var(--text); }
.round-btn.green:hover { color: var(--green); }
.round-btn.red:hover { color: var(--red); }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; gap: 16px; color: var(--muted); padding: 32px; }
.empty-art { width: 200px; height: 160px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, var(--bg-hover-2), transparent 70%); color: var(--btn-grey-hover); }
.add-friend { padding: 20px 30px; border-bottom: 1px solid var(--line-soft); flex: 1; display: flex; flex-direction: column; }
.add-friend h2 { font-size: 16px; font-weight: 600; text-transform: uppercase; color: var(--text-strong); margin-bottom: 8px; }
.add-friend > p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.add-friend-box { display: flex; align-items: center; background: var(--bg-3); border: 1px solid var(--bg-3); border-radius: 8px; padding: 0 12px; height: 52px; }
.add-friend-box:focus-within { border-color: var(--link); }
.add-friend-box.ok { border-color: var(--green); }
.add-friend-box.err { border-color: var(--red); }
.add-friend-box input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; height: 100%; }
.add-friend-msg { font-size: 14px; margin-top: 8px; }
.add-friend-msg.ok { color: var(--link); }
.add-friend-msg.err { color: #fa777c; }
.add-friend-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--btn-grey); }
.add-friend-empty p { color: var(--muted); font-size: 14px; }
.active-now { width: 360px; flex-shrink: 0; border-left: 1px solid var(--line-soft); padding: 16px; overflow-y: auto; }
.active-now h2 { font-size: 20px; font-weight: 800; color: var(--text-strong); margin: 8px 0 16px; }
.active-empty { text-align: center; padding: 16px; }
.active-empty h4 { font-size: 16px; font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.active-empty p { font-size: 14px; color: var(--muted); }
.active-card { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 16px; margin-bottom: 8px; cursor: pointer; --cut: var(--bg-2); }
.active-card:hover { background: var(--bg-hover); }
.ac-top { display: flex; gap: 12px; align-items: center; }
.ac-name { font-weight: 600; color: var(--text-strong); }
.ac-sub { font-size: 14px; color: var(--muted); }
.ac-voice { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.ac-avatars { display: flex; }
.ac-avatars .avatar { margin-right: -4px; box-shadow: 0 0 0 2px var(--bg-2); border-radius: 50%; }

/* ------------------------------------------------------------------ voice & calls */
.stage { position: relative; display: flex; flex-direction: column; min-height: 0; background: #000; overflow: hidden; --cut: var(--bg-3); }
.stage::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 0%, var(--bg-2) 0%, var(--bg-float) 70%); pointer-events: none; }
.voice-stage { flex: 1; }
.call-area { flex-shrink: 0; border-bottom: 1px solid #000; }
.call-area.resizing { user-select: none; }
.call-area.resizing * { pointer-events: none; }
.call-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; z-index: 6; }
.call-resize::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(255, 255, 255, .15); opacity: 0; transition: opacity .15s; }
.call-area:hover .call-resize::after { opacity: 1; }

.stage-top { position: relative; z-index: 5; height: 48px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; opacity: .92; }
.stage-title { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 15px; min-width: 0; }
.stage-title > span:first-of-type { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.stage-title .ic { color: var(--icon); }
.stage-timer { font-size: 13px; font-weight: 600; color: var(--icon); font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, .08); padding: 2px 8px; border-radius: 10px; }
.stage-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--text); }
.stage-icon:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.tiles { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 10px; padding: 10px; --tw: 320px; --th: 180px; }
.tile { position: relative; width: var(--tw); height: var(--th); flex: 0 0 auto; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg-3); isolation: isolate; transition: box-shadow .15s; --av: clamp(40px, calc(var(--th) * .36), 112px); }
.tile-bg { position: absolute; inset: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--tile) 62%, var(--bg-float)), color-mix(in srgb, var(--tile) 34%, #000)); }
.tile-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .08), rgba(0, 0, 0, .25) 75%); }
.tile-avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.tile-avatar .avatar { width: var(--av); height: var(--av); box-shadow: 0 4px 24px rgba(0, 0, 0, .35); }
.tile-avatar .avatar::after { inset: -4px; border-width: 3px; }
.tile::after { content: ''; position: absolute; inset: 0; border-radius: 10px; box-shadow: inset 0 0 0 0 transparent; pointer-events: none; transition: box-shadow .1s; z-index: 4; }
.tile.speaking::after { box-shadow: inset 0 0 0 3px var(--green), inset 0 0 0 5px rgba(0, 0, 0, .35); }
.tile.speaking .tile-avatar .avatar::after { border-color: var(--green); }
.tile:hover .tile-foot { opacity: 1; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile video.screen { object-fit: contain; }
video.mirror { transform: scaleX(-1); }
.tile-foot { position: absolute; left: 8px; bottom: 8px; right: 60px; z-index: 3; display: flex; }
.tile-name { max-width: 100%; background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile-state { position: absolute; right: 8px; bottom: 8px; z-index: 3; display: flex; gap: 4px; }
.tile-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: var(--red); backdrop-filter: blur(6px); }
.tile-live { position: absolute; top: 8px; left: 8px; z-index: 3; }
.tile-full { position: absolute; top: 8px; right: 8px; z-index: 3; width: 32px; height: 32px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-full { opacity: 1; }
.tile.ringing { cursor: default; }
.tile.ringing .tile-avatar .avatar { opacity: .75; }
.tile-calling { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 600; z-index: 3; animation: blink 1.6s ease-in-out infinite; }
.tile.ringing .tile-foot { bottom: auto; top: 8px; }
.ring-pulse { position: absolute; width: var(--av, 88px); height: var(--av, 88px); border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); animation: ringOut 1.8s ease-out infinite; pointer-events: none; }
.ring-pulse.two { animation-delay: .9s; }
@keyframes ringOut { from { transform: scale(1); opacity: .8; } to { transform: scale(1.7); opacity: 0; } }
@keyframes blink { 50% { opacity: .45; } }
.tiles.has-focus { align-content: flex-end; }
.tiles.has-focus .tile:not(.focused) { width: 160px; height: 90px; --av: 36px; }
.tiles.has-focus .tile.focused { order: -1; margin: 0 calc((100% - var(--tw)) / 2 - 1px); }

.stage-controls { position: relative; z-index: 5; flex-shrink: 0; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 12px 16px 18px; }
.cc-group { display: flex; align-items: stretch; height: 52px; border-radius: 14px; background: var(--bg-2); overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); transition: background .15s; }
.cc-group:hover { background: var(--bg-hover); }
.cc-btn { width: 56px; display: grid; place-items: center; color: #fff; }
.cc-caret { width: 26px; display: grid; place-items: center; color: var(--icon); border-left: 1px solid rgba(255, 255, 255, .06); }
.cc-caret .ic { transform: rotate(180deg); }
.cc-caret:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.cc-group.active { background: #fff; }
.cc-group.active .cc-btn, .cc-group.active .cc-caret { color: var(--bg-float); }
.cc-group.active.live { background: var(--green-btn); }
.cc-group.active.live .cc-btn { color: #fff; }
.cc-group.danger .cc-btn { color: var(--red); }
.cc-group.danger { background: #3a2527; }
.cc-group.danger:hover { background: #4a2a2d; }
.cc-hangup { width: 72px; height: 52px; border-radius: 14px; background: var(--red-btn); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(218, 55, 60, .35); transition: background .15s, transform .1s; }
.cc-hangup:hover { background: var(--red-btn-hover); }
.cc-hangup:active, .cc-btn:active { transform: translateY(1px); }
.join-btn { height: 48px; padding: 0 28px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.stage-empty { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); text-align: center; padding: 16px; }
.stage-empty h2 { color: var(--text-strong); font-size: 22px; }
.stage-empty-icon { width: 88px; height: 88px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; color: var(--icon); margin-bottom: 8px; }
.stage:fullscreen { background: #000; }
.stage:fullscreen .call-resize { display: none; }

/* incoming call card */
#incoming { position: fixed; inset: auto 24px 24px auto; z-index: 900; }
#incoming.out { opacity: 0; transform: translateY(12px); transition: all .18s; }
.incoming { position: relative; width: 264px; background: var(--bg-float); border-radius: 16px; padding: 28px 16px 16px; display: flex; flex-direction: column; align-items: center; overflow: hidden; box-shadow: 0 16px 48px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .05); animation: incomingIn .3s cubic-bezier(.2, 1.3, .5, 1); --cut: var(--bg-float); }
.incoming-glow { position: absolute; inset: 0 0 auto 0; height: 130px; background: radial-gradient(80% 100% at 50% 0%, color-mix(in srgb, var(--c) 55%, transparent), transparent); pointer-events: none; }
.incoming-avatar { position: relative; display: grid; place-items: center; --av: 88px; }
.incoming-avatar .avatar { position: relative; z-index: 1; }
.incoming-avatar .ring-pulse { border-color: color-mix(in srgb, var(--c) 70%, #fff); }
.incoming-name { position: relative; margin-top: 16px; font-size: 20px; font-weight: 700; color: var(--text-strong); text-align: center; word-break: break-word; }
.incoming-sub { position: relative; color: var(--muted); font-size: 14px; margin-top: 2px; animation: blink 1.6s ease-in-out infinite; }
.incoming-actions { position: relative; display: flex; gap: 20px; margin-top: 22px; text-align: center; }
.incoming-actions > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.incoming-actions kbd { background: none; border: 0; color: var(--muted); font-size: 11px; min-height: 16px; }
.call-btn { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: filter .15s, transform .15s; }
.call-btn:hover { filter: brightness(1.12); transform: scale(1.06); }
.call-btn.accept { background: var(--green-btn); box-shadow: 0 4px 16px rgba(var(--green-btn-rgb), .45); }
.call-btn.decline { background: var(--red-btn); box-shadow: 0 4px 16px rgba(218, 55, 60, .4); }
.call-btn.video { background: var(--bg-2); }
@keyframes incomingIn { from { opacity: 0; transform: translateY(20px) scale(.96); } }

/* ------------------------------------------------------------------ layers: modal */
.layer { position: fixed; inset: 0; z-index: 500; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .7); animation: fade .15s; }
.backdrop.dark { background: rgba(0, 0, 0, .85); }
@keyframes fade { from { opacity: 0; } }
.modal-layer { display: grid; place-items: center; }
.modal-layer.closing { opacity: 0; transition: opacity .12s; }
.modal { position: relative; width: 440px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px); display: flex; flex-direction: column; background: var(--bg-modal); border-radius: 8px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1), var(--shadow); animation: pop .15s ease-out; --cut: var(--bg-modal); }
.modal-x { position: absolute; top: 12px; right: 12px; color: var(--icon); opacity: .7; z-index: 1; }
.modal-x:hover { opacity: 1; }
.modal-head { padding: 16px; }
.modal-head h2 { font-size: 20px; font-weight: 600; color: var(--text-strong); padding-right: 24px; }
.modal-head p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.modal-center .modal-head { text-align: center; padding: 24px 24px 0; }
.modal-center .modal-head h2 { font-size: 24px; font-weight: 700; padding: 0; }
.modal-center .modal-head p { font-size: 16px; }
.modal-body { padding: 0 16px 20px; overflow-y: auto; }
.modal-center .modal-body { padding: 24px 16px 16px; }
.modal-text { color: var(--text); line-height: 1.4; }
.modal-error { margin: -8px 16px 12px; color: #fa777c; font-size: 14px; }
.modal-foot { display: flex; align-items: center; gap: 8px; background: var(--bg-2); padding: 16px; border-radius: 0 0 8px 8px; }
.confirm-preview { margin-top: 12px; background: var(--bg-2); padding: 12px; border-radius: 4px; font-size: 14px; white-space: pre-wrap; word-break: break-word; box-shadow: 0 0 0 1px var(--line-soft); }
.option-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; font-size: 16px; color: var(--text-strong); text-align: left; }
.option-card:hover { background: var(--hover); }
.option-card span { flex: 1; }
.opt-icon { color: var(--green); background: var(--bg-2); border-radius: 50%; padding: 6px; width: 48px; height: 48px; }
.modal-alt { background: var(--bg-2); margin: 16px -16px -16px; padding: 16px; text-align: center; }
.modal-alt h3 { font-size: 20px; font-weight: 600; color: var(--text-strong); margin-bottom: 8px; }
.upload-circle { width: 80px; height: 80px; margin: 0 auto 8px; border-radius: 50%; border: 2px dashed var(--icon); display: grid; place-items: center; position: relative; cursor: pointer; }
.upload-circle.big { width: 100px; height: 100px; border-style: solid; border-color: transparent; background: var(--brand); margin: 0; flex-shrink: 0; }
.upload-circle img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.upload-inner { display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 700; color: var(--icon); gap: 2px; }
.big-initials { font-size: 28px; color: #fff; font-weight: 500; }
.upload-plus { position: absolute; top: -2px; right: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; }
.settings-row { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.settings-row p { margin: 0 0 8px; }
.danger-zone { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-top: 20px; padding: 12px; border: 1px solid rgba(242, 63, 67, .4); border-radius: 8px; }
.danger-zone p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.radio-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-2); border-radius: 4px; margin-bottom: 8px; cursor: pointer; color: var(--icon); }
.radio-card:hover { background: var(--bg-input); }
.radio-card input { display: none; }
.radio-card div { flex: 1; display: flex; flex-direction: column; }
.radio-card b { color: var(--text-strong); font-weight: 500; }
.radio-card small { font-size: 12px; color: var(--muted); }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--icon); flex-shrink: 0; }
.radio-card:has(input:checked) { background: var(--bg-hover-2); color: var(--text); }
.radio-card input:checked ~ .radio { border: 6px solid #fff; }
.input-prefix { display: flex; align-items: center; background: var(--bg-input-dark); border-radius: 4px; padding-left: 10px; color: var(--icon); }
.input-prefix .input { padding-left: 6px; }
.invite-modal .modal-body { padding-top: 4px; }
.invite-modal .search { margin-bottom: 8px; }
.invite-list { max-height: 200px; overflow-y: auto; margin: 0 -8px 12px; }
.invite-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; }
.invite-row:hover { background: var(--hover); }
.invite-row span { font-weight: 500; }
.invite-row small { color: var(--muted); flex: 1; }
.copy-box { display: flex; align-items: center; background: var(--bg-input-dark); border-radius: 4px; padding-right: 4px; }
.copy-box .input { background: none; }
.invite-accept .modal-body { text-align: center; }
.ia-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px; background: var(--brand); display: grid; place-items: center; font-weight: 600; font-size: 20px; overflow: hidden; color: var(--on-brand); }
.ia-icon img { width: 100%; height: 100%; object-fit: cover; }
.ia-sub { color: var(--muted); font-size: 14px; }
.invite-accept h2 { font-size: 24px; color: var(--text-strong); margin-top: 4px; }
.invite-accept .modal-foot { justify-content: center; }
.invite-accept .modal-foot .btn { width: 100%; }
.invite-accept .modal-foot .grow { display: none; }

/* quick switcher */
.quick-switcher { width: 570px; background: var(--bg-2); }
.quick-switcher .modal-x { display: none; }
.quick-switcher .modal-body { padding: 24px 32px 16px; }
.qs-input { width: 100%; height: 70px; background: var(--bg-3); border: 0; border-radius: 5px; padding: 0 16px; font-size: 22px; outline: none; }
.qs-list { margin-top: 12px; max-height: 320px; overflow-y: auto; }
.qs-list h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
.qs-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 4px; cursor: pointer; color: var(--muted); --cut: var(--bg-2); }
.qs-item.sel { background: var(--hover-2); color: var(--text); --cut: var(--bg-input); }
.qs-label { font-weight: 500; color: var(--text); }
.qs-sub { font-size: 12px; margin-left: auto; font-weight: 600; text-transform: uppercase; }
.qs-server { width: 20px; height: 20px; border-radius: 6px; background: var(--bg-1); font-size: 9px; display: grid; place-items: center; color: var(--text); }
.qs-empty { color: var(--muted); padding: 16px; text-align: center; }
.qs-tip { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-soft); margin-top: 16px; padding-top: 12px; }
.qs-tip b { color: var(--green); }

/* lightbox */
.lightbox { display: grid; place-items: center; }
.lb-inner { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 90vw; max-height: 90vh; }
.lb-inner img { max-width: 90vw; max-height: 82vh; border-radius: 4px; object-fit: contain; }
.lb-open { color: #fff; opacity: .6; font-size: 14px; }
.lb-open:hover { opacity: 1; }

/* ------------------------------------------------------------------ context menu & popouts */
.ctx-menu { position: fixed; z-index: 1500; min-width: 188px; max-width: 320px; background: var(--bg-float); border-radius: 4px; padding: 6px 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, .24), 0 0 0 1px rgba(255, 255, 255, .04); animation: pop .1s ease-out; --cut: var(--bg-float); }
.ctx-item { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 8px; margin: 2px 0; border-radius: 2px; font-size: 14px; font-weight: 500; color: var(--icon); cursor: pointer; }
.ctx-item:hover { background: var(--brand); color: var(--on-brand); }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: var(--red-btn); color: #fff; }
.ctx-item.brand { color: var(--link); }
.ctx-item.brand:hover { color: #fff; }
.ctx-item.disabled { opacity: .5; cursor: not-allowed; }
.ctx-item.disabled:hover { background: none; color: var(--icon); }
.ctx-label { flex: 1; }
.ctx-hint { font-size: 12px; opacity: .7; }
.ctx-sep { height: 1px; background: rgba(var(--tint-rgb), .16); margin: 4px 4px; }
.ctx-sub { display: none; position: absolute; left: 100%; top: -6px; margin-left: 8px; }
.ctx-item:hover > .ctx-sub { display: block; }
.ctx-custom { padding: 0; }
.ctx-slider { padding: 6px 8px; }
.ctx-slider label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.ctx-slider input { width: 100%; accent-color: var(--brand); }
.quick-reacts { display: flex; gap: 4px; padding: 4px; }
.quick-reacts button { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-2); font-size: 18px; display: grid; place-items: center; }
.quick-reacts button:hover { background: var(--bg-1); transform: scale(1.1); }
.server-dropdown { animation: dropIn .12s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.status-menu { width: 300px; max-width: 300px; }
.status-row { display: flex; gap: 10px; padding: 8px; border-radius: 2px; font-size: 14px; font-weight: 500; color: var(--icon); cursor: pointer; align-items: flex-start; }
.status-row .status { margin-top: 4px; }
.status-row small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.3; margin-top: 2px; }
.status-row:hover { background: var(--brand); color: var(--on-brand); }
.status-row:hover small { color: rgba(var(--on-brand-rgb), .75); }
.status-profile { display: flex; gap: 12px; align-items: center; padding: 8px; cursor: pointer; border-radius: 4px; font-size: 14px; color: var(--muted); }
.status-profile b { color: var(--text-strong); font-size: 16px; }
.status-profile:hover { background: var(--hover); }

.popout { position: fixed; z-index: 1400; background: var(--bg-float); border-radius: 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, .24), 0 0 0 1px rgba(255, 255, 255, .04); padding: 12px; animation: pop .12s ease-out; --cut: var(--bg-float); }
.popout.no-pad { padding: 0; }

/* emoji picker */
.emoji-picker { width: 408px; height: 380px; display: flex; flex-direction: column; background: var(--bg-2); border-radius: 8px; overflow: hidden; }
.emoji-search { margin: 12px; height: 32px; border: 0; background: var(--bg-3); border-radius: 4px; padding: 0 8px; outline: none; font-size: 15px; }
.emoji-grid { flex: 1; overflow-y: auto; padding: 0 8px 8px 12px; display: grid; grid-template-columns: repeat(9, 40px); grid-auto-rows: 40px; align-content: start; }
.emoji-btn { font-size: 26px; border-radius: 4px; line-height: 1; }
.emoji-btn:hover { background: var(--hover-2); }
.emoji-empty { grid-column: 1 / -1; color: var(--muted); padding: 24px; text-align: center; }
.emoji-footer { height: 48px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--bg-float); font-weight: 600; color: var(--text-strong); }
.emoji-preview { font-size: 28px; }

/* group picker */
.group-picker { width: 440px; padding: 16px 16px 0; }
.group-picker h3 { font-size: 20px; font-weight: 600; color: var(--text-strong); }
.gp-count { font-size: 12px; color: var(--muted); margin: 4px 0 16px; }
.gp-search { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: var(--bg-3); border-radius: 4px; padding: 4px; }
.gp-search input { flex: 1; min-width: 120px; background: none; border: 0; outline: none; height: 30px; padding: 0 4px; font-size: 14px; }
.gp-chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg-2); padding: 2px 6px; border-radius: 4px; font-size: 14px; cursor: pointer; }
.chip:hover { background: var(--bg-hover-2); }
.gp-list { max-height: 260px; overflow-y: auto; margin: 8px -8px 0; padding: 0 0 8px; border-bottom: 1px solid var(--line-soft); }
.gp-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; cursor: pointer; margin: 0 8px; --cut: var(--bg-float); }
.gp-row:hover { background: var(--hover); --cut: var(--bg-hover); }
.gp-user { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.gp-user span { font-weight: 500; }
.gp-user small { color: var(--muted); }
.gp-row input { display: none; }
.checkbox { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--faint); display: grid; place-items: center; color: transparent; }
.gp-row input:checked + .checkbox { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.gp-empty { color: var(--muted); padding: 20px; text-align: center; font-size: 14px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.gp-foot { padding: 16px 0; }

/* ------------------------------------------------------------------ settings */
.settings-layer { z-index: 400; background: var(--bg-1); animation: settingsIn .2s ease-out; }
@keyframes settingsIn { from { opacity: 0; transform: scale(1.04); } }
.settings { display: flex; height: 100%; }
.settings-nav { flex: 1 0 218px; background: var(--bg-2); display: flex; justify-content: flex-end; overflow-y: auto; }
.settings-nav-inner { width: 218px; padding: 60px 6px 60px 20px; }
.settings-nav h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 10px; letter-spacing: .02em; }
.sn-item { padding: 6px 10px; margin-bottom: 2px; border-radius: 4px; color: var(--icon); font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.sn-item:hover { background: var(--hover); color: var(--text); }
.sn-item.active { background: var(--selected); color: #fff; }
.sn-item.danger { color: var(--red); }
.sn-sep { height: 1px; background: var(--line-soft); margin: 8px 10px; }
.sn-version { font-size: 12px; color: var(--muted); padding: 8px 10px; }
.settings-content { flex: 1 1 800px; display: flex; overflow-y: auto; position: relative; }
.settings-page { flex: 1; max-width: 740px; padding: 60px 40px 80px; user-select: text; }
.settings-page h2 { font-size: 20px; font-weight: 600; color: var(--text-strong); margin-bottom: 20px; }
.settings-page h3 { font-size: 16px; font-weight: 600; color: var(--text-strong); margin-bottom: 12px; }
.settings-close { position: sticky; top: 60px; height: max-content; padding: 0 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; color: var(--icon); font-size: 13px; font-weight: 600; }
.settings-close button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--icon); display: grid; place-items: center; color: var(--icon); }
.settings-close button:hover { background: var(--hover); color: var(--text); border-color: var(--text); }
.settings-divider { height: 1px; background: var(--line-soft); margin: 32px 0; }
.account-card { background: var(--bg-3); border-radius: 8px; overflow: hidden; --cut: var(--bg-3); }
.ac-banner { height: 100px; background: var(--banner); }
.ac-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 16px; margin-top: -36px; }
.ac-head .avatar { box-shadow: 0 0 0 7px var(--bg-3); }
.ac-head .avatar::after { display: none; }
.ac-name { flex: 1; font-size: 20px; font-weight: 600; color: var(--text-strong); padding-bottom: 4px; }
.ac-fields { background: var(--bg-2); margin: 16px; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 24px; }
.ac-field { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ac-fields .ac-field { margin: 0; }
.ac-field h5 { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.profile-editor { display: flex; gap: 32px; align-items: flex-start; }
.pe-form { flex: 1; min-width: 0; }
.pe-preview { position: sticky; top: 0; }
.pe-card .profile-card { box-shadow: var(--shadow); }
.row-gap { display: flex; gap: 12px; align-items: center; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 4px; display: grid; place-items: center; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.swatch.none { background: var(--bg-3); color: var(--icon); }
.swatch.on { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px #fff; }
.swatch-custom { width: 40px; height: 40px; border: 0; padding: 0; background: none; cursor: pointer; }
.save-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(700px, calc(100vw - 40px)); background: var(--bg-float); border-radius: 8px; padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); animation: saveIn .25s cubic-bezier(.2, 1.4, .5, 1); z-index: 5; }
.save-bar span { flex: 1; font-weight: 500; }
@keyframes saveIn { from { transform: translate(-50%, 80px); } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 .field-label { margin-top: 0; }
.mic-test { display: flex; align-items: center; gap: 16px; }
.meter { flex: 1; height: 10px; border-radius: 5px; background: var(--btn-grey); position: relative; overflow: hidden; }
.meter-fill { height: 100%; width: 0; background: var(--yellow); transition: width .05s linear; }
.meter-fill.hot { background: var(--green); }
.meter-th { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.range { width: 100%; accent-color: var(--brand); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.toggle-row input { display: none; }
.tr-label { font-weight: 500; color: var(--text-strong); }
.tr-desc { font-size: 14px; color: var(--muted); margin-top: 4px; }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--faint); position: relative; flex-shrink: 0; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle-row input:checked + .switch { background: var(--green); }
.toggle-row input:checked + .switch::after { transform: translateX(16px); }
.video-preview { position: relative; aspect-ratio: 16 / 9; background: var(--bg-3); border-radius: 8px; overflow: hidden; margin-bottom: 8px; max-width: 520px; }
.video-preview video { width: 100%; height: 100%; object-fit: cover; }
.vp-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--btn-grey); }
.notice { display: flex; gap: 12px; align-items: center; background: rgba(var(--brand-rgb), .1); border: 1px solid var(--brand); border-radius: 8px; padding: 12px 16px; font-size: 14px; margin-bottom: 16px; color: var(--text); }
.pos-picker { display: flex; gap: 12px; }
.pos { width: 96px; height: 60px; border-radius: 6px; background: var(--bg-3); position: relative; border: 2px solid transparent; }
.pos span { position: absolute; width: 28px; height: 16px; border-radius: 3px; background: var(--btn-grey); }
.pos.top-left span { top: 6px; left: 6px; }
.pos.top-right span { top: 6px; right: 6px; }
.pos.bottom-left span { bottom: 6px; left: 6px; }
.pos.bottom-right span { bottom: 6px; right: 6px; }
.pos.on { border-color: var(--brand); }
.pos.on span { background: var(--brand); }
.keybinds { display: flex; flex-direction: column; }
.kb-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.kb-row span:first-child { flex: 1; color: var(--text-strong); font-weight: 500; }
.kb-scope { font-size: 12px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.kb-row kbd { font-size: 13px; padding: 3px 8px; min-width: 60px; text-align: center; }

/* screen share picker (desktop) */
.screen-picker { width: 640px; }
.sp-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; max-height: 50vh; overflow-y: auto; }
.sp-item { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 8px; border: 2px solid transparent; background: var(--bg-2); text-align: left; }
.sp-item:hover { background: var(--bg-hover-2); }
.sp-item.on { border-color: var(--brand); }
.sp-item > img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 4px; }
.sp-item span { font-size: 13px; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sp-item span img { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ profiles */
.pf { --pf-bg: var(--bg-4); --pf-card: var(--bg-hover); --pf-card-hover: var(--bg-input); --cut: var(--pf-bg); background: var(--pf-bg); color: var(--text); user-select: text; position: relative; }
.pf-popout { width: 300px; border-radius: 10px; overflow: visible; }
.pf-popout .pf-banner { border-radius: 10px 10px 0 0; }
.pf-fly.flip { left: auto; right: calc(100% + 12px); }
.pf-fly.flip::before { left: auto; right: -14px; }
.pf-wrap { border-radius: 10px; overflow: visible; }
.pf-head { position: relative; }
.pf-banner { height: 106px; background: var(--banner) center / cover no-repeat; }
.pf-banner.has-img { background-color: var(--banner); }
.pf-panel .pf-banner { height: 120px; }
.pf-full .pf-banner { height: 212px; }
.pf-avatar-row { position: relative; height: 44px; padding-left: 16px; }
.pf-avatar { position: absolute; left: 14px; top: -46px; border-radius: 50%; padding: 6px; background: var(--pf-bg); cursor: pointer; }
.pf-avatar .avatar::after { display: none; }
.pf-avatar .status { box-shadow: 0 0 0 5px var(--pf-bg); }
.pf-avatar:hover .avatar > img, .pf-avatar:hover .avatar > .avatar-default { filter: brightness(.85); }
.pf-full .pf-avatar-row { height: 76px; padding-left: 20px; }
.pf-full .pf-avatar { top: -70px; left: 16px; padding: 7px; }

/* thought-bubble custom status */
.pf-bubble { position: absolute; left: 104px; top: -34px; max-width: calc(100% - 118px); display: flex; align-items: flex-start; text-align: left; z-index: 2; }
.pf-full .pf-bubble { left: 150px; top: -48px; }
.pf-bubble-body { display: inline-flex; align-items: center; gap: 6px; background: var(--pf-card); border-radius: 18px; padding: 8px 12px; font-size: 14px; color: var(--text); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); max-width: 100%; }
.pf-bubble-body > span:last-child { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.pf-bubble-emoji { font-size: 18px; line-height: 1; flex-shrink: 0; }
.pf-bubble-dots { position: absolute; left: -12px; top: 22px; width: 14px; height: 14px; }
.pf-bubble-dots i { position: absolute; border-radius: 50%; background: var(--pf-card); }
.pf-bubble-dots i:first-child { width: 12px; height: 12px; right: -2px; top: -6px; }
.pf-bubble-dots i:last-child { width: 6px; height: 6px; left: -2px; top: 6px; }
button.pf-bubble:hover .pf-bubble-body, button.pf-bubble:hover .pf-bubble-dots i { background: var(--pf-card-hover); }
.pf-bubble.empty .pf-bubble-body { color: var(--muted); font-weight: 500; opacity: 0; transition: opacity .15s; }
.pf-bubble.empty .pf-bubble-dots { opacity: 0; transition: opacity .15s; }
.pf-head:hover .pf-bubble.empty .pf-bubble-body, .pf-head:hover .pf-bubble.empty .pf-bubble-dots { opacity: 1; }

.pf-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.pf-full .pf-body { padding: 0 20px 20px; }
.pf-names { display: flex; flex-direction: column; gap: 2px; }
.pf-display { font-size: 20px; font-weight: 700; color: var(--text-strong); line-height: 1.25; word-break: break-word; }
.pf-display.big { font-size: 24px; }
.pf-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 14px; color: var(--text); }
.pf-dot { color: var(--muted); }
.pf-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--pf-card); font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--text-strong); }
.pf-tag span { font-size: 13px; }
.pf-badges { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; }
.pf-badges.inline { margin: 0 0 0 2px; display: inline-flex; }
.pf-badge { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; cursor: default; }
.pf-badge:hover { background: rgba(255, 255, 255, .06); }
.pf-bio { font-size: 14px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.pf-bio .mention { cursor: default; }
.pf-meta h4, .pf-section h4, .pf-tabpane h4 { font-size: 12px; font-weight: 700; color: var(--text-strong); margin: 0 0 4px; }
.pf-meta div, .pf-since { font-size: 14px; }
.pf-tabpane h4 { margin-top: 16px; }
.pf-tabpane h4:first-child { margin-top: 4px; }
.pf-card { background: var(--pf-card); border-radius: 8px; }
.pf-section { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.pf-section h4:not(:first-child) { margin-top: 10px; }
.pf-games { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; font-size: 14px; font-weight: 600; color: var(--text-strong); text-align: left; width: 100%; }
.pf-games:hover { background: var(--pf-card-hover); }
.pf-game-icons { display: flex; gap: 4px; align-items: center; }
.pf-game-ic { border-radius: 6px; object-fit: cover; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.pf-game-more { height: 30px; min-width: 30px; padding: 0 4px; border-radius: 6px; background: var(--bg-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text); }
.pf-game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 6px; }
.pf-game { display: flex; align-items: center; gap: 10px; background: var(--pf-card); border-radius: 8px; padding: 8px; font-size: 14px; font-weight: 600; min-width: 0; }
.pf-game span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-actions { display: flex; gap: 8px; align-items: center; }
.pf-actions .btn { height: 32px; }
.pf-actions .btn.icon-only { width: 36px; min-width: 36px; }
.pf-popout .pf-actions .btn:first-child:not(.icon-only) { flex: 1; }
.pf-message { width: 100%; background: transparent; border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px; padding: 10px 12px; outline: none; font-size: 14px; }
.pf-message:focus { border-color: rgba(255, 255, 255, .18); }

/* self popout menu */
.pf-menu { padding: 4px; }
.pf-row { position: relative; width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text); text-align: left; cursor: pointer; }
.pf-row:hover { background: var(--pf-card-hover); color: var(--text-strong); }
.pf-row > span:not(.status):not(.pf-new) { flex: 1; }
.pf-row .ic { color: var(--icon); }
.pf-chev { margin-left: auto; }
.pf-new { background: var(--red-btn); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 8px; letter-spacing: .03em; }
.pf-sep { height: 1px; background: rgba(255, 255, 255, .06); margin: 4px 8px; }
.pf-fly { display: none; position: absolute; left: calc(100% + 12px); top: -8px; width: 240px; background: var(--bg-float); border-radius: 8px; padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4), 0 0 0 1px rgba(255, 255, 255, .04); z-index: 5; --cut: var(--bg-float); cursor: default; }
.pf-fly::before { content: ''; position: absolute; left: -14px; top: 0; bottom: 0; width: 14px; }
.has-fly:hover > .pf-fly { display: block; }
.pf-flyrow { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 4px; text-align: left; font-size: 14px; font-weight: 500; color: var(--icon); }
.pf-flyrow > span:not(.status) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pf-flyrow small { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.3; }
.pf-flyrow:hover { background: var(--brand); color: var(--on-brand); }
.pf-flyrow:hover small { color: rgba(var(--on-brand-rgb), .75); }
.pf-flyrow.danger { color: var(--red); }
.pf-flyrow.danger:hover { background: var(--red-btn); color: #fff; }
.pf-flyrow .status.inline { --cut: var(--bg-float); }
.pf-flyrow:hover .status.inline { --cut: var(--brand); }
.pf-check { color: var(--green); }

/* DM side panel */
.side-panel.dm-profile { width: 340px; background: var(--bg-4); --cut: var(--bg-4); }
.pf-panel { min-height: 100%; }
.pf-panel .pf-body { padding-bottom: 20px; }
.pf-list-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.pf-list-row:hover { background: var(--pf-card-hover); }
.pf-srv { width: 32px; height: 32px; border-radius: 10px; background: var(--bg-3); display: grid; place-items: center; overflow: hidden; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.pf-srv img { width: 100%; height: 100%; object-fit: cover; }
.pf-full-link { padding: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--text); width: 100%; }
.pf-full-link:hover { background: var(--pf-card-hover); }

/* full profile modal */
.modal.pf-modal { width: 600px; max-width: calc(100vw - 32px); background: var(--bg-4); overflow: hidden; }
.pf-modal .modal-body { padding: 0; }
.pf-modal .modal-x { color: #fff; opacity: .9; background: rgba(0, 0, 0, .35); border-radius: 50%; padding: 4px; top: 12px; right: 12px; }
.pf-modal .modal-x .ic { width: 20px; height: 20px; }
.pf-full-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pf-full-top .pf-actions { margin-top: 4px; }
.pf-tabs { display: flex; gap: 24px; border-bottom: 1px solid rgba(255, 255, 255, .08); margin-top: 4px; }
.pf-tab { padding: 10px 0; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pf-tab:hover { color: var(--text); }
.pf-tab.active { color: var(--text-strong); border-bottom-color: var(--text-strong); }
.pf-tabpane { min-height: 140px; max-height: 44vh; overflow-y: auto; }
.pf-empty { color: var(--muted); font-size: 14px; padding: 24px 0; text-align: center; }

/* settings preview */
.pf-popout.preview { box-shadow: var(--shadow); }
.pe-preview { width: 300px; flex-shrink: 0; }

/* emoji input, textarea, games editor, sound preview */
.emoji-input { display: flex; align-items: center; gap: 8px; background: var(--bg-input-dark); border-radius: 4px; padding: 0 6px; }
.emoji-input .input { background: none; padding-left: 4px; }
.emoji-input.small { width: 200px; }
.emoji-input-btn { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-size: 20px; color: var(--icon); flex-shrink: 0; }
.emoji-input-btn:hover { background: var(--hover); color: var(--text); }
.emoji-input-clear { color: var(--icon); }
.textarea-wrap { position: relative; }
.textarea-wrap textarea { padding-right: 40px; }
.textarea-emoji { position: absolute; right: 8px; top: 8px; color: var(--icon); }
.textarea-emoji:hover { color: var(--text); }
.textarea-count { position: absolute; right: 10px; bottom: 6px; font-size: 12px; color: var(--muted); }
.games-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.game-row { display: flex; align-items: center; gap: 8px; }
.game-ic-btn { width: 40px; height: 40px; border-radius: 8px; background: var(--bg-input-dark); display: grid; place-items: center; color: var(--icon); overflow: hidden; flex-shrink: 0; }
.game-ic-btn img { width: 100%; height: 100%; object-fit: cover; }
.game-ic-btn:hover { outline: 2px solid var(--brand); }
.game-rm { color: var(--icon); padding: 6px; border-radius: 4px; }
.game-rm:hover { color: var(--red); background: var(--hover); }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.sound-btn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 6px; background: var(--bg-2); font-size: 14px; font-weight: 500; text-align: left; }
.sound-btn:hover { background: var(--bg-input); }
.sound-btn .ic { color: var(--brand); }

/* saved accounts on login */
.auth-accounts { margin: 8px 0 4px; }
.auth-acc { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; background: var(--bg-2); margin-bottom: 8px; --cut: var(--bg-2); }
.auth-acc > div:not(.avatar) { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.auth-acc b { color: var(--text-strong); }
.auth-acc small { color: var(--muted); font-size: 13px; }
.auth-acc-x { color: var(--muted); padding: 4px 6px; border-radius: 4px; }
.auth-acc-x:hover { color: var(--red); background: var(--hover); }
.auth-or { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin: 12px 0 4px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ==========================================================================
   Motion
   ========================================================================== */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* smooth hover/active states everywhere */
.dm-item, .ch-item, .member, .friend-row, .sb-nav, .ctx-item, .vc-user, .pf-row, .pf-flyrow, .qs-item,
.tab, .hdr-btn, .up-btn, .vp-btn, .round-btn, .composer-btn, .msg-actions button, .reaction, .option-card,
.sn-item, .mutual, .pf-list-row, .gp-row, .invite-row, .sound-btn, .emoji-btn, .stage-icon, .pf-games, .pf-full-link {
  transition: background-color .15s ease, color .15s ease, opacity .15s ease, transform .15s var(--ease-out), border-color .15s ease;
}
.msg { transition: background-color .1s ease; }
.btn { transition: background-color .17s ease, color .17s ease, transform .12s var(--ease-out), box-shadow .17s ease; }
.btn:active:not(:disabled), .round-btn:active, .up-btn:active, .vp-btn:active, .hdr-btn:active, .cc-btn:active, .cc-hangup:active, .call-btn:active { transform: scale(.94); }
.emoji-btn:hover { transform: scale(1.18); }
.quick-reacts button { transition: transform .15s var(--ease-spring), background-color .15s; }
.status { transition: background-color .25s ease; }

/* rail: springy press + badge pop */
.rail-icon { transition: border-radius .2s var(--ease-out), background-color .2s ease, color .2s ease, transform .15s var(--ease-out); }
.rail-item:active .rail-icon { transform: translateY(1px) scale(.96); }
.pill { transition: height .2s var(--ease-out), margin-top .2s var(--ease-out); }

/* view switches: main area & sidebar fade/slide in */
.main.view-in > * { animation: viewIn .22s var(--ease-out); }
#sidebar.view-in > * { animation: sideIn .22s var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes sideIn { from { opacity: 0; transform: translateX(-8px); } }

/* messages */
.msg.msg-new { animation: msgIn .32s var(--ease-out); }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.msg.msg-out { overflow: hidden; animation: msgOut .22s ease forwards; pointer-events: none; }
@keyframes msgOut { to { opacity: 0; height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 0; transform: translateX(-12px); } }
.msg.pending .msg-content { transition: color .3s ease; }
.msg-actions { animation: fadeUp .12s var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } }
.reaction.bump { animation: bump .45s var(--ease-spring); }
@keyframes bump { 30% { transform: scale(1.25); } }
.reactions .reaction .r-emoji { display: inline-block; transition: transform .15s var(--ease-spring); }
.reaction:hover .r-emoji { transform: scale(1.2) rotate(-6deg); }
.typing:not(:empty) { animation: fadeUp .2s var(--ease-out); }
.reply-bar, .attach-tray { animation: slideUpIn .2s var(--ease-out); }
@keyframes slideUpIn { from { opacity: 0; transform: translateY(8px); } }
.attach-item { animation: popIn .25s var(--ease-spring); }

/* skeleton shimmer while loading */
.sk-bar, .sk-circle { background: linear-gradient(90deg, var(--bg-hover-2) 0%, var(--bg-hover-2) 45%, var(--bg-hover-2) 90%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* voice & calls */
.vc-user.anim-in { animation: vcIn .3s var(--ease-out); }
@keyframes vcIn { from { opacity: 0; transform: translateX(-10px); } }
.tile.anim-in { animation: tileIn .45s var(--ease-spring); }
@keyframes tileIn { from { opacity: 0; transform: scale(.85); } }
.tile { transition: width .3s var(--ease-out), height .3s var(--ease-out), box-shadow .15s ease; }
.tile-avatar .avatar { transition: transform .2s var(--ease-out); }
.tile.speaking .tile-avatar .avatar { transform: scale(1.04); }
.avatar.speaking::after { animation: speakGlow 1.4s ease-in-out infinite; }
@keyframes speakGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(var(--green-rgb), .5); } 50% { box-shadow: 0 0 0 4px rgba(var(--green-rgb), 0); } }
.voice-panel.slide-up { animation: panelUp .3s var(--ease-out); }
@keyframes panelUp { from { opacity: 0; transform: translateY(100%); } }
.cc-group, .cc-hangup { transition: background-color .15s ease, transform .15s var(--ease-out), box-shadow .15s ease; }
.cc-group:hover, .cc-hangup:hover { transform: translateY(-2px); }
.call-area { animation: callOpen .35s var(--ease-out); }
@keyframes callOpen { from { opacity: 0; clip-path: inset(0 0 100% 0); } }

/* friends list rows cascade in on tab switch */
.friends.stagger .friend-row { animation: rowIn .3s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 28ms); }
.friends.stagger .empty-state { animation: popIn .35s var(--ease-out); }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }

/* popouts, menus, tooltips */
.popout { animation: popIn .16s var(--ease-out); transform-origin: left center; }
.popout[data-side="top"] { transform-origin: bottom left; animation-name: popUp; }
.popout[data-side="bottom"] { transform-origin: top left; animation-name: popDown; }
.popout[data-side="left"] { transform-origin: right center; }
.popout.out, .ctx-menu.out { animation: popOutFade .11s ease forwards; }
.ctx-menu { animation: popDown .13s var(--ease-out); transform-origin: top left; }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } }
@keyframes popUp { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes popDown { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes popOutFade { to { opacity: 0; transform: scale(.97); } }
.pf-fly { animation: flyIn .14s var(--ease-out); }
@keyframes flyIn { from { opacity: 0; transform: translateX(-6px); } }
.pf-fly.flip { animation-name: flyInL; }
@keyframes flyInL { from { opacity: 0; transform: translateX(6px); } }
.tooltip { animation: tipIn .12s var(--ease-out); }
.pf-avatar .avatar { transition: transform .2s var(--ease-out); }
.pf-avatar:hover .avatar { transform: scale(1.03); }

/* modals & settings */
.modal { animation: modalIn .22s var(--ease-spring); }
@keyframes modalIn { from { opacity: 0; transform: scale(.9); } }
.modal-layer.closing { opacity: 1; }
.modal-layer.closing .modal { animation: modalOut .12s ease forwards; }
.modal-layer.closing .backdrop { animation: fadeOutBg .12s ease forwards; }
@keyframes modalOut { to { opacity: 0; transform: scale(.94); } }
@keyframes fadeOutBg { to { opacity: 0; } }
.settings-layer.closing { animation: settingsOut .16s ease forwards; }
@keyframes settingsOut { to { opacity: 0; transform: scale(1.04); } }
.settings-page > * { animation: fadeUp .22s var(--ease-out); }
.lightbox .lb-inner img { animation: popIn .25s var(--ease-out); }

/* auth screen */
.auth-card > * { animation: fadeUp .35s var(--ease-out) both; }
.auth-card > *:nth-child(2) { animation-delay: .03s; }
.auth-card > *:nth-child(3) { animation-delay: .06s; }
.auth-card > *:nth-child(n+4) { animation-delay: .09s; }
.auth-bg { animation: bgDrift 24s ease-in-out infinite alternate; background-size: 140% 140%; }
@keyframes bgDrift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }

/* toasts & incoming call */
.toast { animation: toastIn .3s var(--ease-spring); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
.toast.out { opacity: 0; transform: translateY(-8px); }
.call-btn.accept { animation: acceptPulse 1.6s ease-in-out infinite; }
@keyframes acceptPulse { 0%, 100% { box-shadow: 0 4px 16px rgba(var(--green-btn-rgb), .45), 0 0 0 0 rgba(var(--green-btn-rgb), .5); } 50% { box-shadow: 0 4px 16px rgba(var(--green-btn-rgb), .45), 0 0 0 10px rgba(var(--green-btn-rgb), 0); } }

/* anyone who prefers less motion gets near-instant transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* voice connection status */
.vp-title.connecting { color: var(--yellow); }
.vp-title.failed { color: var(--red); }
.vp-title.connecting .ic { animation: blink 1.2s ease-in-out infinite; }
.vp-warn { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--red); margin-top: 2px; }

/* ------------------------------------------------------------------ responsive: tablets */
@media (max-width: 1100px) {
  .active-now { display: none; }
  .side-panel.dm-profile { width: 280px; }
}
@media (min-width: 769px) and (max-width: 900px) {
  .side-panel { display: none; }
}

/* ------------------------------------------------------------------ phones */
.hdr-back, .drawer-backdrop, .settings-back { display: none; }

body.mobile { --gutter: 12px; }
html:has(body.mobile), body.mobile, body.mobile #root { height: 100dvh; }
body.mobile .app { height: 100dvh; position: relative; overflow: clip; }
body.mobile, body.mobile #root { overflow: clip; }

/* two screens: list (rail + sidebar) and main; main slides over */
body.mobile .rail { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
body.mobile .sidebar { flex: 1; width: auto; min-width: 0; padding-top: env(safe-area-inset-top); }
body.mobile .main {
  position: absolute; inset: 0; z-index: 20;
  transform: translateX(100%); visibility: hidden;
  transition: transform .3s var(--ease-out, ease), visibility 0s linear .3s;
  box-shadow: -8px 0 24px rgba(0, 0, 0, .35);
  padding-top: env(safe-area-inset-top);
}
body.mobile.show-main .main { transform: none; visibility: visible; transition: transform .3s var(--ease-out, ease), visibility 0s; }
body.mobile.show-main .rail, body.mobile.show-main .sidebar { pointer-events: none; }
body.mobile .main.view-in > * { animation: none; }

/* back button in every main header */
body.mobile .hdr-back { display: grid; place-items: center; width: 36px; height: 36px; margin: 0 2px 0 -8px; border-radius: 8px; color: var(--icon); flex-shrink: 0; }
body.mobile .hdr-back:active { background: var(--hover); }
body.mobile .call-area .hdr-back { display: none; }

/* headers */
body.mobile .chat-header { padding: 0 6px 0 12px; }
body.mobile .hdr-left { min-width: 0; overflow: hidden; }
body.mobile .hdr-left h1 { overflow: hidden; text-overflow: ellipsis; }
body.mobile .hdr-topic, body.mobile .chat-header .hdr-divider { display: none; }
body.mobile .hdr-btn { margin: 0; width: 40px; height: 40px; }
body.mobile .hdr-btn[data-act="add-group"], body.mobile .hdr-btn[data-act="invite"] { display: none; }
body.mobile .friends-header .hdr-left { overflow-x: auto; scrollbar-width: none; gap: 4px; }
body.mobile .friends-header .hdr-left::-webkit-scrollbar { display: none; }
body.mobile .friends-header .hdr-divider { display: none; }
body.mobile .friends-header h1 { display: none; }
body.mobile .friends-header .hdr-icon { display: none; }
body.mobile .tab { margin: 0; padding: 4px 10px; font-size: 15px; flex-shrink: 0; }

/* messages & composer */
body.mobile .msg { padding: 2px 12px 2px 60px; }
body.mobile .msg-avatar { left: 12px; }
body.mobile .msg-avatar .avatar { --s: 36px !important; }
body.mobile .msg.system { padding-left: 60px; }
body.mobile .sys-icon { left: 22px; }
body.mobile .msg-reply::before { left: -30px; width: 27px; }
body.mobile .msg-hover-time { width: 48px; }
body.mobile .welcome { margin: 16px 12px 8px; }
body.mobile .welcome h1 { font-size: 26px; }
body.mobile .day-divider { margin-left: 12px; margin-right: 12px; }
body.mobile .attachment, body.mobile .embed-img, body.mobile .invite-embed { max-width: 100%; }
body.mobile .attachment img { max-width: 100%; height: auto; }
body.mobile .codeblock { max-width: 100%; }
body.mobile .composer { padding: 0 8px calc(2px + env(safe-area-inset-bottom)); }
body.mobile .composer-btn:first-child { width: 44px; padding: 0 10px; }
body.mobile .composer-box { border-radius: 22px; }
body.mobile .composer.has-top .composer-box { border-radius: 0 0 22px 22px; }
body.mobile .typing { height: 20px; font-size: 13px; }
body.mobile .attach-item { width: 150px; }
body.mobile .attach-item img { height: 100px; }

/* members / DM profile: slide-in drawer from the right */
body.mobile .side-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(86vw, 340px) !important; display: block;
  transform: translateX(100%); transition: transform .28s var(--ease-out, ease);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
body.mobile.drawer-open .side-panel { transform: none; box-shadow: -12px 0 32px rgba(0, 0, 0, .45); }
body.mobile .drawer-backdrop { display: block; position: absolute; inset: 0; z-index: 29; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
body.mobile.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
body.mobile .chat-body { position: relative; }

/* friends */
body.mobile .friend-search { margin: 12px 12px 4px; }
body.mobile .friend-list { padding: 0 12px 16px; }
body.mobile .friend-row { margin: 0 -6px; padding: 0 6px; height: 60px; }
body.mobile .friend-username { display: none; }
body.mobile .add-friend { padding: 16px 12px; }
body.mobile .add-friend-box { flex-wrap: wrap; height: auto; padding: 8px; gap: 8px; }
body.mobile .add-friend-box input { width: 100%; height: 36px; }
body.mobile .add-friend-box .btn { width: 100%; }
body.mobile .add-friend-empty svg { width: 80px; height: 80px; }

/* sidebar list items get bigger touch targets */
body.mobile .dm-item, body.mobile .sb-nav { height: 48px; }
body.mobile .ch-item { height: 40px; }
body.mobile .ch-actions { display: none !important; }
body.mobile .dm-close { display: none; }
body.mobile .user-panel { height: calc(56px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
body.mobile .up-btn { width: 40px; height: 40px; }

/* calls */
body.mobile .call-area { height: min(42dvh, 340px) !important; }
body.mobile .stage-top { height: 44px; padding: 0 8px 0 12px; }
body.mobile .tiles { padding: 6px; gap: 6px; }
body.mobile .stage-controls { gap: 8px; padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); }
body.mobile .cc-group { height: 48px; border-radius: 24px; }
body.mobile .cc-btn { width: 52px; }
body.mobile .cc-caret { display: none; }
body.mobile .cc-hangup { width: 64px; height: 48px; border-radius: 24px; }
body.mobile .cc-group:hover, body.mobile .cc-hangup:hover { transform: none; }
body.mobile .tiles.has-focus .tile:not(.focused) { width: 110px; height: 62px; }
body.mobile #incoming { inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px; }
body.mobile .incoming { width: 100%; }

/* popouts become bottom sheets */
body.mobile .popout {
  left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
  width: 100% !important; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp .28s var(--ease-out, ease) !important;
}
body.mobile .popout.out { animation: sheetDown .18s ease forwards !important; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
body.mobile .popout::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: 8px auto 0; position: absolute; left: 50%; transform: translateX(-50%); z-index: 3; }
body.mobile .pf-popout, body.mobile .emoji-picker, body.mobile .group-picker { width: 100%; }
body.mobile .pf-popout { border-radius: 16px 16px 0 0; }
body.mobile .pf-popout .pf-banner { border-radius: 16px 16px 0 0; }
body.mobile .emoji-picker { height: 50dvh; border-radius: 16px 16px 0 0; }
body.mobile .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); grid-auto-rows: 44px; }
/* profile submenus expand inline on tap */
body.mobile .has-fly { flex-wrap: wrap; }
body.mobile .pf-fly { position: static; display: none; width: 100%; box-shadow: none; background: var(--bg-float); margin: 8px 0 0; animation: none; }
body.mobile .has-fly:hover > .pf-fly { display: none; }
body.mobile .has-fly.open > .pf-fly { display: block; }
body.mobile .has-fly.open .pf-chev { transform: rotate(90deg); }
body.mobile .pf-chev { transition: transform .2s; }

/* context menus: bigger rows, stay on screen */
body.mobile .ctx-menu { min-width: 220px; max-width: calc(100vw - 16px); max-height: 80dvh; overflow-y: auto; }
body.mobile .ctx-item { min-height: 44px; font-size: 15px; }
body.mobile .ctx-sub { position: static; display: block; margin: 0 0 0 8px; box-shadow: none; padding: 0; background: none; }
body.mobile .ctx-item:has(> .ctx-sub) { flex-wrap: wrap; }

/* modals */
body.mobile .modal { width: calc(100vw - 20px); max-height: calc(100dvh - 40px); }
body.mobile .modal.pf-modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
body.mobile .pf-full .pf-banner { height: 150px; }
body.mobile .pf-full-top { flex-direction: column; }
body.mobile .pf-game-grid { grid-template-columns: 1fr 1fr; }
body.mobile .quick-switcher .modal-body { padding: 16px; }
body.mobile .qs-input { height: 52px; font-size: 18px; }
body.mobile .screen-picker { width: calc(100vw - 20px); }

/* settings: list first, then the page */
body.mobile .settings { flex-direction: column; }
body.mobile .settings-nav { flex: 1; justify-content: stretch; padding-top: env(safe-area-inset-top); }
body.mobile .settings-nav-inner { width: 100%; padding: 56px 12px 24px; }
body.mobile .sn-item { padding: 12px; font-size: 16px; }
body.mobile .settings-content { display: none; flex-direction: column; padding-top: env(safe-area-inset-top); }
body.mobile .settings-layer.page-open .settings-nav { display: none; }
body.mobile .settings-layer.page-open .settings-content { display: flex; flex: 1; }
body.mobile .settings-back { display: flex; align-items: center; gap: 6px; padding: 14px 12px 4px; color: var(--text); font-weight: 600; font-size: 15px; }
body.mobile .settings-page { padding: 12px 14px 96px; max-width: none; }
body.mobile .settings-close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 5; padding: 0; }
body.mobile .settings-close span { display: none; }
body.mobile .profile-editor { flex-direction: column; }
body.mobile .pe-preview { width: 100%; position: static; }
body.mobile .grid-2 { grid-template-columns: 1fr; }
body.mobile .save-bar { bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); }
body.mobile .ac-field { flex-wrap: wrap; }

/* inputs at 16px stop iOS Safari from zooming the page on focus */
body.mobile input, body.mobile textarea, body.mobile select, body.mobile .input { font-size: 16px !important; }

/* touch screens: no hover-only UI */
@media (hover: none) {
  .msg-actions { display: none !important; }
  .msg:hover { background: none; }
  .msg:active { background: var(--msg-hover); }
  .msg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .msg .edit-input { -webkit-user-select: text; user-select: text; }
  .reaction.add { opacity: 1; }
  .tile-full { opacity: 1; }
  .up-user:hover .up-sub span { transform: none; }
  * { -webkit-tap-highlight-color: transparent; }
}


/* call fullscreen */
.stage:fullscreen { width: 100vw; height: 100vh; }
.stage:fullscreen .stage-top { position: absolute; top: 0; left: 0; right: 0; z-index: 6; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.stage:fullscreen .tiles { padding-top: 52px; }
.stage:fullscreen .stage-icon { background: rgba(255, 255, 255, .08); }
.vp-shield { color: var(--green); display: inline-flex; margin-left: 2px; }

/* keybind editor */
.kb-row { gap: 12px; }
.kb-key { min-width: 150px; height: 36px; padding: 0 12px; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--line); font: 600 13px var(--font); color: var(--text-strong); text-align: center; transition: border-color .15s, background .15s; }
.kb-key:hover { border-color: var(--icon); }
.kb-key em { font-style: normal; color: var(--muted); font-weight: 500; }
.kb-key.recording { border-color: var(--red); background: rgba(242, 63, 67, .1); animation: kbPulse 1s ease-in-out infinite; }
.kb-key.recording em { color: var(--red); }
@keyframes kbPulse { 50% { box-shadow: 0 0 0 3px rgba(242, 63, 67, .25); } }
.kb-reset { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--icon); }
.kb-reset:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.kb-reset:disabled { opacity: .25; cursor: default; }
.kb-row.fixed kbd { min-width: 150px; text-align: center; margin-right: 44px; }
.kb-row.fixed { opacity: .75; }

/* language picker */
.lang-list { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.lang-card { padding: 14px 16px; }
.lang-flag { font-size: 24px; line-height: 1; }

/* click-to-edit avatar & banner */
.avatar-edit { position: relative; border-radius: 50%; cursor: pointer; }
.avatar-edit-overlay, .edit-overlay { position: absolute; display: grid; place-items: center; gap: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; font-weight: 700; opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 2; }
.avatar-edit-overlay { inset: 0; border-radius: 50%; }
.avatar-edit:hover .avatar-edit-overlay { opacity: 1; }
/* note: .pf-avatar is already absolutely positioned — don't override it */
.pe-card .pf-avatar { cursor: pointer; }
.pe-card .pf-banner { cursor: pointer; position: relative; }
.edit-overlay { inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.edit-overlay.round { inset: 6px; border-radius: 50%; }
.pe-card .pf-avatar:hover .edit-overlay, .pe-card .pf-banner:hover .edit-overlay { opacity: 1; }
.kb-row { flex-wrap: wrap; }
.kb-warn { flex-basis: 100%; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--red); margin-top: -4px; }

/* voice panel: shield with a hover card */
.vp-shield { position: relative; display: inline-grid; place-items: center; margin-left: 4px; color: var(--green); cursor: help; }
.vp-shield-pop { position: absolute; left: -12px; bottom: calc(100% + 10px); z-index: 50; display: none; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 6px; background: var(--bg-float); box-shadow: var(--shadow); white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--text-strong); cursor: default; animation: popUp .14s var(--ease-out, ease); }
.vp-shield-pop::after { content: ''; position: absolute; left: 0; right: 0; bottom: -12px; height: 12px; } /* hover bridge so the link stays reachable */
.vp-shield-pop a { color: var(--link); font-weight: 600; font-size: 12px; }
.vp-shield:hover .vp-shield-pop, .vp-shield:focus-within .vp-shield-pop { display: flex; }

/* GIF button + picker */
.composer-btn.gif-btn { width: auto; padding: 0 6px; }
.gif-btn span { font: 800 11px var(--font); letter-spacing: .04em; border: 2px solid currentColor; border-radius: 5px; padding: 1px 4px; line-height: 1.2; }
.gif-picker { width: 420px; height: 460px; display: flex; flex-direction: column; background: var(--bg-2); border-radius: 8px; overflow: hidden; }
.gif-search { display: flex; align-items: center; gap: 8px; margin: 12px 12px 6px; padding: 0 10px; height: 36px; background: var(--bg-3); border-radius: 6px; color: var(--icon); }
.gif-search input { flex: 1; background: none; border: 0; outline: none; font-size: 15px; color: var(--text); }
.gif-heading { padding: 4px 14px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.gif-scroll { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.gif-cols { display: flex; gap: 6px; align-items: flex-start; }
.gif-col { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gif-item { width: 100%; border-radius: 6px; overflow: hidden; background: var(--bg-3); display: block; position: relative; animation: fadeIn .25s ease; }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-item:hover { outline: 2px solid var(--brand); outline-offset: -2px; }
.gif-item:hover img { filter: brightness(1.08); }
.gif-status { text-align: center; color: var(--muted); font-size: 13px; padding: 12px; min-height: 20px; }
.gif-footer { flex-shrink: 0; padding: 6px 12px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: right; background: var(--bg-float); }
.gif-attachment { position: relative; }
.gif-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); color: #fff; font: 800 10px var(--font); letter-spacing: .05em; padding: 2px 5px; border-radius: 4px; opacity: 0; transition: opacity .15s; line-height: 1.3; }
.gif-attachment:hover .gif-badge { opacity: 1; }
body.mobile .gif-picker { width: 100%; height: 60dvh; border-radius: 16px 16px 0 0; }

/* Twemoji */
img.emoji { width: 1.375em; height: 1.375em; vertical-align: -0.3em; margin: 0 .05em; object-fit: contain; display: inline-block; }
.msg-content.jumbo img.emoji { width: 48px; height: 48px; vertical-align: -12px; }
.reaction img.emoji { width: 16px; height: 16px; vertical-align: middle; margin: 0; }
.pf-bubble-emoji img.emoji, .emoji-input-btn img.emoji { width: 20px; height: 20px; vertical-align: middle; }

/* emoji picker */
.emoji-picker { width: 440px; height: 420px; display: flex; flex-direction: column; background: var(--bg-2); border-radius: 8px; overflow: hidden; }
.emoji-top { display: flex; gap: 8px; padding: 10px 12px; box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.emoji-top .emoji-search { flex: 1; margin: 0; }
.emoji-tone { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; }
.emoji-tone:hover { background: var(--hover); }
.emoji-tone img.emoji { width: 22px; height: 22px; margin: 0; }
.emoji-main { flex: 1; display: flex; min-height: 0; }
.emoji-cats { width: 44px; flex-shrink: 0; background: var(--bg-3); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; overflow-y: auto; scrollbar-width: none; }
.emoji-cats button { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--icon); filter: grayscale(.6); opacity: .8; }
.emoji-cats button:hover { background: var(--hover); filter: none; opacity: 1; }
.emoji-cats img.emoji { width: 20px; height: 20px; margin: 0; }
.emoji-grid { flex: 1; display: block; overflow-y: auto; padding: 0 8px 8px; }
.emoji-sec-title { position: sticky; top: 0; z-index: 1; background: var(--bg-2); padding: 10px 4px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.emoji-sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-btn { height: 40px; border-radius: 6px; display: grid; place-items: center; }
.emoji-btn img.emoji { width: 30px; height: 30px; margin: 0; transition: transform .12s var(--ease-spring, ease); }
.emoji-btn:hover { background: var(--hover-2); }
.emoji-btn:hover img.emoji { transform: scale(1.15); }
.emoji-footer img.emoji { width: 28px; height: 28px; margin: 0; }
.emoji-preview { display: grid; place-items: center; min-width: 28px; }

/* :shortcode: autocomplete above the message box */
.composer { position: relative; }
.emoji-ac { position: absolute; left: 16px; right: 16px; bottom: calc(100% + 4px); z-index: 20; background: var(--bg-2); border-radius: 8px; padding: 8px; box-shadow: var(--shadow); animation: fadeUp .12s var(--ease-out, ease); }
.emoji-ac-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 8px 6px; }
.emoji-ac-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 15px; color: var(--text); }
.emoji-ac-row img.emoji { width: 22px; height: 22px; margin: 0; }
.emoji-ac-row.sel, .emoji-ac-row:hover { background: var(--hover-2); color: var(--text-strong); }

/* delete-message preview */
.confirm-preview img { display: block; max-width: 100%; max-height: 200px; border-radius: 6px; margin-top: 6px; }
.confirm-text { white-space: pre-wrap; }
body.mobile .emoji-picker { width: 100%; height: 55dvh; }

/* settings: credits */
.credits { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.credit { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.credit-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.credit-top b { color: var(--text-strong); font-weight: 700; }
.credit-what { font-size: 12px; color: var(--muted); text-align: right; }
.credit-by { font-size: 13px; color: var(--text); }
.credit-links { display: flex; gap: 12px; font-size: 13px; font-weight: 600; margin-top: 2px; }
.credit-license a { color: var(--brand-text); }

/* settings: developer / theme editor */
.theme-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.theme-preset { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line-soft); text-align: left; }
.theme-preset:hover { border-color: var(--brand); }
.tp-swatches { display: flex; height: 28px; border-radius: 6px; overflow: hidden; }
.tp-swatches i { flex: 1; }
.tp-name { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.theme-group { margin-top: 22px; }
.theme-rows { display: flex; flex-direction: column; gap: 6px; }
.theme-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; }
.theme-row:hover { background: var(--hover); }
.theme-row.changed .theme-label { color: var(--text-strong); }
.theme-swatch { position: relative; width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), 0 1px 4px rgba(0, 0, 0, .3); }
.theme-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.theme-label { flex: 1; display: flex; flex-direction: column; font-size: 14px; font-weight: 500; color: var(--text); }
.theme-label small { font: 12px var(--mono); color: var(--faint); }
.theme-hex { width: 110px; height: 34px; font: 13px var(--mono) !important; text-transform: lowercase; }
.theme-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
