/* ==========================================================================
   VoChat stylesheet — themes, layout, components. RTL-first via logical props.
   ========================================================================== */

/* ---------- theme tokens ---------- */
:root, [data-theme="dark"] {
  --bg: #100f1f; --bg2: #181731; --panel: #17162b; --panel2: #201e38; --panel3: #2a2848;
  --line: #2b2947; --text: #ecebf7; --muted: #9a97b8; --faint: #6d6a8c;
  --accent: #7c5cff; --accent2: #4fb3ff; --on-accent: #fff; --accent-text: #fff;
  --ok: #3fd18b; --warn: #ffb547; --danger: #ff5d6c;
  --bubble: #1f1d36; --mine: #2b2559; --mention: rgba(255, 181, 71, .12);
  --topbar-bg: #14122b; --appbar-bg: #121025; --hover: rgba(255, 255, 255, .055);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(124, 92, 255, .07), transparent 60%), radial-gradient(700px 500px at 0 100%, rgba(79, 179, 255, .05), transparent 60%);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f4fb; --bg2: #f7f7fd; --panel: #ffffff; --panel2: #f1f2f9; --panel3: #e7e8f3;
  --line: #e3e4f0; --text: #1b1a2e; --muted: #6b6a86; --faint: #9c9bb3;
  --accent: #6a4cf0; --accent2: #1f8de6; --on-accent: #fff; --accent-text: #fff;
  --ok: #1fa86a; --warn: #d98a00; --danger: #e5384a;
  --bubble: #ffffff; --mine: #ece8ff; --mention: rgba(255, 170, 0, .13);
  --topbar-bg: #ffffff; --appbar-bg: #f8f8fd; --hover: rgba(20, 20, 60, .05);
  --shadow: 0 18px 50px rgba(30, 30, 80, .16); --shadow-sm: 0 4px 14px rgba(30, 30, 80, .08);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(106, 76, 240, .06), transparent 60%);
  color-scheme: light;
}
[data-theme="ocean"] {
  --bg: #071b27; --bg2: #0b2534; --panel: #0b2a3d; --panel2: #10364d; --panel3: #16425c;
  --line: #17465f; --text: #e3f4fb; --muted: #86aec2; --faint: #5d8599;
  --accent: #22b8cf; --accent2: #3b82f6; --on-accent: #fff; --accent-text: #fff;
  --ok: #3fd18b; --warn: #ffc15e; --danger: #ff6b7a;
  --bubble: #0f3247; --mine: #114a5e; --mention: rgba(255, 193, 94, .12);
  --topbar-bg: #0b2a3d; --appbar-bg: #092333; --hover: rgba(255, 255, 255, .06);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(34, 184, 207, .08), transparent 60%);
  color-scheme: dark;
}
[data-theme="forest"] {
  --bg: #0b1a14; --bg2: #0f2219; --panel: #10261d; --panel2: #163226; --panel3: #1c3d2e;
  --line: #1f4232; --text: #e6f4ec; --muted: #8fb3a0; --faint: #628571;
  --accent: #34c27a; --accent2: #a3d65c; --on-accent: #06210f; --accent-text: #06210f;
  --ok: #4ade80; --warn: #fbbf24; --danger: #f87171;
  --bubble: #143024; --mine: #1a4431; --mention: rgba(251, 191, 36, .12);
  --topbar-bg: #10261d; --appbar-bg: #0d2018; --hover: rgba(255, 255, 255, .055);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(52, 194, 122, .07), transparent 60%);
  color-scheme: dark;
}
[data-theme="sunset"] {
  --bg: #1c0d16; --bg2: #24111c; --panel: #2a1420; --panel2: #361a29; --panel3: #432034;
  --line: #4a2437; --text: #fbe9ef; --muted: #c49aab; --faint: #8e6878;
  --accent: #ff6b6b; --accent2: #ffb347; --on-accent: #fff; --accent-text: #fff;
  --ok: #4ade80; --warn: #ffcf5c; --danger: #ff5470;
  --bubble: #331826; --mine: #4a1f33; --mention: rgba(255, 207, 92, .12);
  --topbar-bg: #2a1420; --appbar-bg: #22101a; --hover: rgba(255, 255, 255, .06);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .25);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(255, 107, 107, .08), transparent 60%), radial-gradient(700px 500px at 0 100%, rgba(255, 179, 71, .05), transparent 60%);
  color-scheme: dark;
}
[data-theme="rose"] {
  --bg: #fff0f5; --bg2: #fff7fa; --panel: #ffffff; --panel2: #fff5f8; --panel3: #fde6ee;
  --line: #f6d5e1; --text: #3a1f2b; --muted: #9a6b7e; --faint: #c49aab;
  --accent: #e84a8a; --accent2: #ff8a65; --on-accent: #fff; --accent-text: #fff;
  --ok: #18a368; --warn: #d97706; --danger: #dc2f4a;
  --bubble: #ffffff; --mine: #ffe1ec; --mention: rgba(255, 170, 0, .14);
  --topbar-bg: #fff5f8; --appbar-bg: #fff8fb; --hover: rgba(160, 30, 80, .06);
  --shadow: 0 18px 50px rgba(120, 30, 70, .14); --shadow-sm: 0 4px 14px rgba(120, 30, 70, .08);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(232, 74, 138, .07), transparent 60%);
  color-scheme: light;
}
[data-theme="grape"] {
  --bg: #140a24; --bg2: #1a0e2e; --panel: #1d1033; --panel2: #271644; --panel3: #321c56;
  --line: #36205a; --text: #f1e9ff; --muted: #a993cc; --faint: #7b6699;
  --accent: #b057ff; --accent2: #ff5fd2; --on-accent: #fff; --accent-text: #fff;
  --ok: #4ade80; --warn: #ffc857; --danger: #ff5c7c;
  --bubble: #241441; --mine: #35195e; --mention: rgba(255, 200, 87, .12);
  --topbar-bg: #1d1033; --appbar-bg: #180d2b; --hover: rgba(255, 255, 255, .06);
  --shadow: 0 18px 50px rgba(0, 0, 0, .5); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
  --logbg: radial-gradient(900px 500px at 100% 0, rgba(176, 87, 255, .1), transparent 60%), radial-gradient(700px 500px at 0 100%, rgba(255, 95, 210, .06), transparent 60%);
  color-scheme: dark;
}
[data-theme="mono"] {
  --bg: #0f0f11; --bg2: #151518; --panel: #18181b; --panel2: #222226; --panel3: #2c2c31;
  --line: #2e2e33; --text: #ededf0; --muted: #9a9aa3; --faint: #6b6b73;
  --accent: #e4e4e7; --accent2: #a1a1aa; --on-accent: #111113; --accent-text: #111113;
  --ok: #4ade80; --warn: #facc15; --danger: #f87171;
  --bubble: #1f1f23; --mine: #2c2c31; --mention: rgba(250, 204, 21, .1);
  --topbar-bg: #18181b; --appbar-bg: #141416; --hover: rgba(255, 255, 255, .06);
  --shadow: 0 18px 50px rgba(0, 0, 0, .5); --shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
  --logbg: none;
  color-scheme: dark;
}
/* layout tokens derived for every colour theme (the default "sky" theme sets its own below) */
:root {
  --bar-grad: linear-gradient(180deg, color-mix(in srgb, var(--accent) 30%, var(--topbar-bg)), var(--topbar-bg));
  --bar-text: var(--text); --bar-hover: var(--hover); --bar-badge-ring: var(--topbar-bg);
  --tabs-grad: linear-gradient(180deg, var(--panel2), var(--panel3)); --tab-text: var(--muted);
  --log-bg: var(--bg); --row-bg: transparent; --row-alt: color-mix(in srgb, var(--panel) 55%, transparent); --row-hover: var(--hover); --row-line: color-mix(in srgb, var(--line) 55%, transparent);
  --av-ring: color-mix(in srgb, var(--accent) 55%, transparent); --welcome-bg: color-mix(in srgb, var(--accent) 12%, var(--panel));
  --composer-bg: var(--panel); --input-bg: var(--bg2); --input-line: var(--line);
  --orange: #ff8a1f; --send-grad: linear-gradient(135deg, var(--accent), var(--accent2));
  --topic-grad: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #c4479d), var(--accent2));
  --card-grad: linear-gradient(160deg, var(--panel3), var(--panel2)); --card-text: var(--text); --card-btn: var(--hover); --card-btn-hover: var(--panel); --card-ic: var(--accent);
  --land-bg: var(--bg); --land-panel: linear-gradient(160deg, color-mix(in srgb, var(--accent) 75%, var(--bg)), color-mix(in srgb, var(--accent) 30%, var(--bg)));
  --toggle-bg: var(--bg2); --btn-grad: linear-gradient(90deg, var(--accent2), var(--accent));
}
/* default theme ("sky"): bright blue bars, white panels, orange accents */
[data-theme="sky"], :root:not([data-theme]) {
  --bg: #e9f0fa; --bg2: #f4f7fc; --panel: #ffffff; --panel2: #f2f6fc; --panel3: #e4ecf8;
  --line: #dce6f4; --text: #24324a; --muted: #687892; --faint: #9aa8bd;
  --accent: #3670c4; --accent2: #2f8be6; --on-accent: #fff; --accent-text: #fff;
  --ok: #22b46e; --warn: #f0a020; --danger: #e5484d;
  --bubble: #ffffff; --mine: #eaf2fe; --mention: rgba(255, 150, 40, .12);
  --topbar-bg: #4f86d6; --appbar-bg: #ffffff; --hover: rgba(54, 112, 196, .07);
  --shadow: 0 18px 50px rgba(30, 60, 120, .18); --shadow-sm: 0 4px 14px rgba(30, 60, 120, .1);
  --logbg: none;
  --bar-grad: linear-gradient(180deg, #b7d2f7 0%, #7ea7e3 22%, #6091d9 48%, #3670c4 100%);
  --bar-text: #fff; --bar-hover: rgba(255, 255, 255, .16); --bar-badge-ring: #3d76c8;
  --tabs-grad: linear-gradient(180deg, #e6effc, #cfdff6); --tab-text: #24324a;
  --log-bg: #ffffff; --row-bg: #ffffff; --row-alt: #f6f9fe; --row-hover: #eef4fd; --row-line: #edf2f9;
  --av-ring: #8db4ea; --welcome-bg: linear-gradient(135deg, rgba(47, 111, 228, .09), rgba(192, 106, 255, .09));
  --composer-bg: #f3f6fb; --input-bg: #fbfcfe; --input-line: #d6e1f0;
  --orange: #ff8a1f; --send-grad: linear-gradient(135deg, #ffb24a, #ff7a14);
  --topic-grad: linear-gradient(90deg, #c4479d 0%, #9b56c9 40%, #5c87da 100%);
  --card-grad: linear-gradient(160deg, #1f3a73, #2b5aa8); --card-text: #fff; --card-btn: rgba(255, 255, 255, .12); --card-btn-hover: rgba(255, 255, 255, .22); --card-ic: #8fc1ff;
  --land-bg: #eef3fb; --land-panel: linear-gradient(160deg, #6a9de3 0%, #4a7fd0 40%, #3463b3 75%, #2b4f96 100%);
  --toggle-bg: #edf2fa; --btn-grad: linear-gradient(90deg, #6f9fe3, #3670c4);
  color-scheme: light;
}
:root {
  --radius: 14px; --radius-sm: 10px;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
  --brand-grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #3fa9f5 100%);
  --top-h: 50px; --bot-h: 48px; --side-w: 300px;
  --font: "Baloo Bhaijaan 2", system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Roboto, sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 40px; cursor: pointer; }
input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--accent); box-shadow: none; }
::placeholder { color: var(--faint); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
svg { width: 22px; height: 22px; flex: none; }
.ic { width: 22px; height: 22px; flex: none; }
.ic-img { width: 22px; height: 22px; object-fit: contain; flex: none; }
[dir=rtl] .flip-rtl, [dir=rtl] .send-btn .ic, [dir=rtl] .pm-form .send .ic, [dir=rtl] .pm-back .ic, [dir=rtl] .reply-bar > .ic { transform: scaleX(-1); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 30%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 35%, transparent) transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel2); font-weight: 600; white-space: nowrap; line-height: 1.3;
  transition: transform .08s, border-color .15s, background .15s, filter .15s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: var(--on-accent); border: 0; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.warn { color: var(--warn); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.danger-fill { background: var(--danger); color: #fff; border: 0; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.big { padding: 12px 18px; font-size: 16px; }
.btn:disabled, .btn.loading { opacity: .65; }
.btn.loading { pointer-events: none; position: relative; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 0; background: transparent; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn.pop-open { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.icon-btn.send { color: var(--accent); }
.badge {
  position: absolute; inset-block-start: 2px; inset-inline-end: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-style: normal;
  box-shadow: 0 0 0 2px var(--topbar-bg); pointer-events: none;
}
.count { position: absolute; inset-block-end: 1px; inset-inline-end: 0; font-size: 10.5px; font-weight: 800; color: var(--text); background: var(--panel3); border-radius: 8px; padding: 0 5px; line-height: 15px; }
.pill { display: inline-block; min-width: 20px; padding: 0 7px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.chip .ic { width: 15px; height: 15px; }
.chip-mini { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--panel3); color: var(--muted); margin-inline-start: 6px; }
.spinner { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.spinner-wrap { display: grid; place-items: center; padding: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; color: var(--muted); text-align: center; }
.empty .ic { width: 38px; height: 38px; opacity: .5; }
.empty p { margin: 0; font-size: 14px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field, .auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.field-hint { color: var(--faint); font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; }
.inline, .inline-row { display: flex; gap: 8px; align-items: flex-end; }
.inline-row input { flex: 1; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; cursor: pointer; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text b { font-weight: 600; font-size: 14px; }
.toggle-text small { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--panel3); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; inset-block-start: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
[dir=rtl] .switch input:checked + span::before { transform: translateX(-20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.seg { display: inline-flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.warn-box { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); font-size: 13.5px; }

/* ---------- status dots / avatars / names ---------- */
.avatar { border-radius: 50%; object-fit: cover; background: var(--panel3); display: block; }
.av-wrap { position: relative; display: inline-block; flex: none; line-height: 0; }
.st-dot { position: absolute; inset-block-end: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--panel); background: var(--faint); }
.st-dot.inline { position: static; display: inline-block; border: 0; width: 9px; height: 9px; }
.st-dot.st1 { background: var(--ok); } .st-dot.st2 { background: var(--warn); } .st-dot.st3 { background: var(--danger); } .st-dot.st0 { background: var(--faint); }
.rank-ic { width: 17px; height: 17px; flex: none; vertical-align: -3px; }
.uname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uname.link { cursor: pointer; }
.uname.link:hover { text-decoration: underline; }
.r-owner { color: #ff5f87; } .r-super { color: #ff8a4c; } .r-admin { color: #f5a524; } .r-mod { color: #2fc07e; } .r-vip { color: #b77cff; } .r-bot { color: #3aa8f0; } .r-guest { color: var(--muted); }
[data-theme=light] .r-admin, [data-theme=rose] .r-admin { color: #d48806; }
.verified-ic { width: 16px; height: 16px; color: var(--accent2); }
.ubadges { display: inline-flex; gap: 3px; align-items: center; }
.ubadges img { width: 16px; height: 16px; }
.flag { font-size: 15px; line-height: 1; }

/* ==========================================================================
   Chat app layout — top bar / side panel (start side) / chat / bottom bar
   ========================================================================== */
.vc-chat { overflow: hidden; }
.app {
  height: 100vh; height: 100dvh; display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr) var(--bot-h);
  grid-template-areas: "top top" "side main" "bot bot";
}
body.panel-hidden .app { grid-template-columns: 0 minmax(0, 1fr); }
body.panel-hidden .sidepanel { display: none; }
.grow { flex: 1; }

/* ---------- shared bar buttons (top + bottom bars) ---------- */
.bar-btn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 54px; height: 100%; padding: 3px 6px 2px; border: 0; background: transparent; color: var(--bar-text);
  font-size: 11.5px; font-weight: 700; line-height: 1.15; white-space: nowrap; transition: background .15s;
}
.bar-btn:hover, .bar-btn.pop-open, .bar-btn.active { background: var(--bar-hover); }
.bar-btn .bar-ic { position: relative; display: grid; place-items: center; height: 24px; }
.bar-btn .ic, .bar-btn .ic-img { width: 22px; height: 22px; }
.bar-label { max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
.bar-btn .badge { inset-block-start: -5px; inset-inline-end: -11px; box-shadow: none; border: 2px solid var(--bar-badge-ring); line-height: 14px; }
.bar-btn .count { position: absolute; inset-block-start: -5px; inset-inline-end: -14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; font-style: normal; border: 2px solid var(--bar-badge-ring); line-height: 14px; }

/* ---------- top bar ---------- */
.topbar {
  grid-area: top; position: relative; z-index: 65; display: flex; align-items: stretch; min-width: 0; padding: 0 4px;
  background: var(--bar-grad); color: var(--bar-text); box-shadow: 0 2px 10px rgba(20, 50, 100, .18);
}
.top-buttons { display: flex; align-items: stretch; min-width: 0; }
.top-btn.ovf { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.topbar .brand { padding: 0 8px; }
.topbar .brand img { width: auto; height: 38px; max-width: 170px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18)); }
.avatar-btn { position: relative; flex: none; align-self: center; margin: 0 6px; padding: 0; border: 0; background: none; border-radius: 50%; line-height: 0; }
.avatar-btn img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 2px 8px rgba(0, 0, 0, .25); }
.avatar-btn .st-dot { border-color: #fff; }
.drawer-btn { flex: none; }
.only-mobile { display: none !important; }

/* ---------- menu dropdown (#appbar) ---------- */
.appbar {
  position: fixed; z-index: 70; inset-block-start: calc(var(--top-h) + 4px); inset-inline-end: 6px; width: 300px; max-width: calc(100vw - 12px);
  max-height: calc(100dvh - var(--top-h) - var(--bot-h) - 12px); overflow-y: auto; display: flex; flex-direction: column;
  background: var(--panel); color: var(--text); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line);
  visibility: hidden; opacity: 0; transform: translateY(-6px); transition: opacity .15s, transform .15s, visibility 0s .15s;
}
body.drawer-open .appbar { visibility: visible; opacity: 1; transform: none; transition: opacity .15s, transform .15s; }
.ab-room { display: flex; align-items: center; gap: 4px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.room-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px; border: 0; background: transparent; border-radius: 12px; text-align: start; color: var(--text); }
.room-title:hover { background: var(--hover); }
.room-ic { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex: none; background: var(--panel2); }
.room-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.room-txt small { color: var(--muted); font-size: 12px; }
.room-txt strong { display: flex; align-items: center; gap: 4px; font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-lock { width: 15px; height: 15px; color: var(--muted); }
.ab-me { margin: 8px; padding: 12px; border-radius: 14px; background: var(--card-grad); color: var(--card-text); box-shadow: var(--shadow-sm); }
.ab-me-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ab-me-head .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.ab-me-txt { min-width: 0; display: flex; flex-direction: column; }
.ab-me-txt .uname { font-size: 16px; }
.ab-me-txt small { display: flex; align-items: center; gap: 4px; opacity: .85; font-size: 12.5px; }
.ab-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ab-quick .ab-item { flex-direction: column; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; background: var(--card-btn); color: inherit; font-size: 11.5px; font-weight: 700; }
.ab-quick .ab-item:hover { background: var(--card-btn-hover); }
.ab-quick .ab-ic { width: auto; height: 24px; color: var(--card-ic); }
.appbar-items { display: flex; flex-direction: column; padding: 2px 6px 8px; }
.ab-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 600; text-align: start; transition: background .12s;
}
.ab-item:hover { background: var(--hover); text-decoration: none; }
.ab-item.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.ab-ic { position: relative; display: grid; place-items: center; width: 26px; height: 26px; flex: none; color: var(--accent); }
.ab-ic .ic, .ab-ic .ic-img { width: 22px; height: 22px; }
.ab-ic .badge { inset-block-start: -6px; inset-inline-end: -8px; box-shadow: 0 0 0 2px var(--panel); }
.ab-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-chev { width: 16px; height: 16px; color: var(--faint); }
.ab-quick .ab-label { flex: none; max-width: 100%; text-align: center; }
.appbar-brand { display: none; }

/* ---------- side panel ---------- */
.sidepanel { grid-area: side; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border-inline-end: 1px solid var(--line); z-index: 25; }
.sp-top { display: flex; align-items: stretch; height: 40px; flex: none; background: var(--tabs-grad); border-bottom: 1px solid var(--line); }
.sp-tabs { flex: 1; min-width: 0; display: flex; overflow-x: auto; scrollbar-width: none; }
.sp-tabs::-webkit-scrollbar { display: none; }
.sp-tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 50px; flex: 0 0 auto; padding: 2px 6px 0;
  border: 0; background: transparent; color: var(--tab-text); font-size: 11px; font-weight: 700; line-height: 1.1;
}
.sp-tab .bar-ic { position: relative; display: grid; place-items: center; height: 20px; }
.sp-tab .ic { width: 18px; height: 18px; }
.sp-tab:hover { background: var(--hover); }
.sp-tab.active { background: color-mix(in srgb, var(--panel) 55%, transparent); color: var(--accent); }
.sp-tab.active::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -1px; height: 3px; background: var(--accent); }
.sp-tab .badge { inset-block-start: -6px; inset-inline-end: -10px; box-shadow: 0 0 0 2px var(--panel); }
.sp-tab-label { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-close { display: grid; place-items: center; width: 38px; flex: none; border: 0; background: transparent; color: var(--text); margin-inline-start: auto; }
.sp-close .ic { width: 16px; height: 16px; }
.sp-close:hover { background: var(--hover); }
.sp-head { display: none; }
.sp-body { flex: 1; min-height: 0; position: relative; }
.sp-box { position: absolute; inset: 0; overflow-y: auto; padding: 10px 10px 16px; }
.welcome-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; margin-bottom: 6px; border-radius: 12px; background: var(--welcome-bg); }
.wc-line { display: flex; align-items: center; gap: 6px; font-size: 15px; flex-wrap: wrap; }
.wc-line b { font-weight: 800; }
.wc-line .rank-ic { width: 20px; height: 20px; }
.wc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.wc-chip .ic { width: 15px; height: 15px; color: var(--orange); }
.search-wrap { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; margin: 2px 0 8px; padding: 0 10px; border-radius: 11px; background: var(--bg2); border: 1px solid var(--line); }
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap .ic { width: 17px; height: 17px; color: var(--faint); }
.search-wrap input { border: 0; background: transparent; padding: 8px 0; box-shadow: none !important; }
.list-group { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 6px; font-size: 14px; font-weight: 800; color: var(--text); }
.list-group span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-group b { font-size: 13px; color: var(--muted); font-weight: 700; }
.list-group.off { padding-top: 16px; }
.ulist { display: flex; flex-direction: column; gap: 4px; }
/* user rows keep the classic order (rank, avatar, name … gender, flag) in both directions */
.urow { direction: ltr; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 5px 8px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; color: var(--text); transition: background .12s; }
.urow:hover { background: var(--hover); }
.urow.ignored { opacity: .45; }
.urow.self { background: var(--row-alt); border-color: var(--line); }
.urow.off .avatar { filter: grayscale(.85); opacity: .75; }
.urow.off .uname { opacity: .7; }
.urow-rank { width: 20px; display: grid; place-items: center; flex: none; }
.urow-rank .rank-ic { width: 20px; height: 20px; }
.urow .avatar { width: 38px; height: 38px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.urow-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.urow-name { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 14px; }
.urow-info small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.urow-room { display: inline-flex; align-items: center; gap: 3px; }
.urow-room .ic { width: 12px; height: 12px; }
.urow-end { display: flex; align-items: center; gap: 6px; flex: none; }
.sex-ic { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; }
.sex-ic .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.sex-ic.s1 { background: #4c9be8; } .sex-ic.s2 { background: #e957a5; }
.urow .flag { font-size: 17px; }
.muted-ic { width: 16px; height: 16px; color: var(--danger); }
.presence { font-size: 11px; color: var(--faint); }
.presence.on { color: var(--ok); font-weight: 700; }
.panel-actions { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding: 2px 0 10px; }
.room-list { display: flex; flex-direction: column; gap: 0; }
.room-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: start; color: var(--text); }
.room-card:hover { background: var(--hover); }
.room-card.active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.room-card-ic { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; background: var(--panel3); }
.room-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.room-card-info b { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 800; }
.room-card-info b .ic.tiny { width: 13px; height: 13px; color: var(--muted); }
.room-card-info small { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room-count { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: var(--panel3); color: var(--muted); font-size: 12px; font-weight: 700; flex: none; }
.room-count .ic { width: 13px; height: 13px; }
.room-count.live { color: #fff; background: var(--ok); }
.conv-list { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.conv { display: flex; align-items: center; border-radius: 12px; }
.conv:hover { background: var(--hover); }
.conv-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; text-align: start; color: var(--text); }
.conv-main .avatar { width: 42px; height: 42px; }
.conv-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top time { font-size: 11px; color: var(--faint); flex: none; }
.conv-info small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conv.unread .conv-info small { color: var(--text); font-weight: 600; }
.conv-del { opacity: 0; margin-inline-end: 4px; }
.conv:hover .conv-del { opacity: 1; }

/* ---------- chat main ---------- */
.chat-main { grid-area: main; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--log-bg); }
.chat-log { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 0 0 8px; }
.boot { display: grid; place-items: center; height: 100%; }
.boot-error { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; color: var(--muted); text-align: center; }
.boot-error .ic { width: 40px; height: 40px; color: var(--danger); }
.log-intro { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 6px; }
.room-hero { display: flex; align-items: center; gap: 12px; padding: 2px; }
.room-hero img { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: var(--panel2); box-shadow: var(--shadow-sm); }
.room-hero h2 { margin: 0; font-size: 19px; font-weight: 800; }
.room-hero p { margin: 0; color: var(--muted); font-size: 13.5px; }
.room-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.room-note .ic { width: 19px; height: 19px; color: var(--accent); margin-top: 1px; }
.room-note.welcome { background: var(--welcome-bg); }
.room-note.warn .ic { color: var(--warn); }

/* day / unread separators */
.day-sep, .unread-sep { display: flex; align-items: center; gap: 12px; margin: 10px 14px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.day-sep::before, .day-sep::after, .unread-sep::before, .unread-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day-sep span { padding: 2px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.day-sep.sm { margin: 10px 0 6px; font-size: 11px; }
.unread-sep { color: var(--danger); }
.unread-sep::before, .unread-sep::after { background: color-mix(in srgb, var(--danger) 55%, transparent); }

/* system lines */
.msg-sys { display: flex; justify-content: center; margin: 6px 10px; }
.sys-pill { display: inline-flex; align-items: center; gap: 7px; max-width: 92%; padding: 3px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.sys-pill .ic { width: 14px; height: 14px; flex: none; }
.sys-pill time { color: var(--faint); font-size: 11px; }
.msg-sys.t4 .sys-pill .ic { color: var(--ok); }
.msg-sys.t5 .sys-pill .ic { color: var(--faint); }
.msg-sys.custom { display: block; }
.sys-card { max-width: 640px; margin: 4px auto; }

/* messages: full-width rows, avatar on the left, time and menu on the right (classic order in both directions) */
.msg {
  direction: ltr; position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; column-gap: 10px;
  padding: 9px 12px 9px 10px; background: var(--row-bg); border-bottom: 1px solid var(--row-line);
}
.msg:nth-child(even of .msg) { background: var(--row-alt); }
.msg:hover { background: var(--row-hover); }
.msg.cont { padding-top: 2px; }
.msg.cont .msg-av { visibility: hidden; height: 0; }
.msg.cont .msg-head { display: none; }
.msg-av { border: 0; padding: 0; background: none; align-self: start; line-height: 0; border-radius: 50%; }
.msg-av .avatar { width: 44px; height: 44px; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--av-ring); transition: transform .15s; }
.msg-av:hover .avatar { transform: scale(1.05); }
.msg-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg-head { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; min-height: 24px; margin-bottom: 2px; font-size: 15px; }
.msg-head .rank-ic { width: 16px; height: 16px; }
.msg-name { font-size: 15.5px; }
.msg-meta { display: flex; align-items: flex-start; gap: 4px; padding-top: 3px; color: var(--faint); font-size: 11px; white-space: nowrap; }
.msg-meta time { direction: ltr; line-height: 20px; }
.msg-more { display: grid; place-items: center; width: 24px; height: 20px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--faint); }
.msg-more .ic { width: 15px; height: 15px; }
.msg-more:hover, .msg-more.pop-open { background: var(--hover); color: var(--text); }
.msg-bubble { --msg-color: inherit; position: relative; max-width: 100%; padding: 0; border-radius: 0; background: transparent; overflow-wrap: anywhere; word-break: break-word; }
.msg-bubble[class*="bub-"] { padding: 6px 12px; border-radius: 4px 14px 14px 14px; }
.msg.mention { box-shadow: inset 3px 0 0 var(--orange); }
.msg.mention .msg-bubble { background: transparent; }
.msg-text { display: inline-block; max-width: 100%; white-space: pre-wrap; text-align: start; color: var(--msg-color, inherit); font-size: 15px; }
.msg-bubble.tc .msg-text { color: var(--msg-color); }
.msg-bubble.tb .msg-text { font-weight: 700; }
.msg-bubble.ti .msg-text { font-style: italic; }
.msg-text.big-emo { font-size: 34px; line-height: 1.2; }
.msg-text.big-emo .emo { width: 44px; height: 44px; }
.msg-bubble.action { display: flex; gap: 8px; font-style: italic; color: var(--muted); }
.act-star { color: var(--accent); font-style: normal; }
.msg-bubble.custom { padding: 0; max-width: min(100%, 560px); }
.reply-quote { display: flex; flex-direction: column; align-items: flex-start; width: 100%; margin: 0 0 6px; padding: 5px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); text-align: start; font-size: 12.5px; color: var(--text); }
.reply-quote b { color: var(--accent); font-size: 12px; }
.reply-quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.msg.flash { animation: flash 1.4s ease-out; }
.msg.removing { opacity: 0; transition: .2s; }
@keyframes flash { 0%, 40% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* rich content */
.emo { width: 22px; height: 22px; vertical-align: -5px; display: inline-block; }
.link { color: var(--accent2); overflow-wrap: anywhere; }
.mention-tag { color: var(--accent); font-weight: 700; cursor: pointer; background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 0 4px; border-radius: 5px; }
.mention-tag.me { color: #1a1300; background: var(--warn); }
.inline-media { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.media-thumb { border: 0; padding: 0; background: var(--panel2); border-radius: 10px; overflow: hidden; line-height: 0; max-width: 100%; }
.media-thumb img { max-width: min(320px, 100%); max-height: 240px; object-fit: cover; display: block; }

/* hover tools (reply / mention) */
.msg-tools {
  position: absolute; inset-block-start: 4px; right: 84px; display: none; gap: 2px; padding: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); z-index: 2;
}
.msg-tools button { display: grid; place-items: center; width: 28px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.msg-tools button:hover { background: var(--hover); color: var(--text); }
.msg-tools .ic { width: 16px; height: 16px; }
.msg-tools:empty { display: none !important; }
.msg:hover .msg-tools { display: flex; }

/* style options */
.font-sans .msg-text, .font-card.font-sans { font-family: "Segoe UI", Roboto, Arial, sans-serif; }
.font-serif .msg-text, .font-card.font-serif { font-family: Georgia, "Times New Roman", "Amiri", serif; }
.font-mono .msg-text, .font-card.font-mono { font-family: ui-monospace, Consolas, "Courier New", monospace; }
.font-round .msg-text, .font-card.font-round { font-family: "Trebuchet MS", "Varela Round", "Comic Neue", sans-serif; }
.font-hand .msg-text, .font-card.font-hand { font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; }
.font-kufi .msg-text, .font-card.font-kufi { font-family: "Noto Kufi Arabic", "Droid Arabic Kufi", "Segoe UI", Tahoma, sans-serif; }
.font-naskh .msg-text, .font-card.font-naskh { font-family: "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", serif; }
.font-narrow .msg-text, .font-card.font-narrow { font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", sans-serif; letter-spacing: -.2px; }
.bub-sky { background: color-mix(in srgb, #4fb3ff 22%, var(--bubble)) !important; }
.bub-mint { background: color-mix(in srgb, #2fd19a 22%, var(--bubble)) !important; }
.bub-lemon { background: color-mix(in srgb, #ffd43b 24%, var(--bubble)) !important; }
.bub-peach { background: color-mix(in srgb, #ff9f6b 24%, var(--bubble)) !important; }
.bub-pink { background: color-mix(in srgb, #ff6fae 22%, var(--bubble)) !important; }
.bub-lilac { background: color-mix(in srgb, #a57bff 26%, var(--bubble)) !important; }
.bub-sand { background: color-mix(in srgb, #c9a36b 24%, var(--bubble)) !important; }
.bub-slate { background: color-mix(in srgb, #7d8ba6 26%, var(--bubble)) !important; }

/* new messages pill / offline bar */
.new-pill {
  position: absolute; inset-block-end: 70px; left: 50%; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.new-pill .ic { width: 17px; height: 17px; }
.new-pill.has-new { background: var(--accent); color: var(--on-accent); border: 0; }
.offline-bar { display: none; position: absolute; inset-block-start: 10px; left: 50%; transform: translateX(-50%); z-index: 6; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 99px; background: var(--warn); color: #241600; font-weight: 700; font-size: 13px; box-shadow: var(--shadow-sm); }
body.offline .offline-bar { display: inline-flex; }

/* ---------- room topic (above the composer) ---------- */
.topic-box {
  direction: ltr; position: relative; display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 12px 40px 12px 10px; flex: none;
  background: var(--topic-grad); color: #fff; border-radius: 12px 12px 0 0; box-shadow: 0 -2px 12px rgba(40, 40, 90, .12);
}
.topic-ic { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #8a96ad; }
.topic-ic .ic { width: 24px; height: 24px; }
.topic-ic b { position: absolute; inset: 0; display: grid; place-items: center; padding-bottom: 3px; color: #ffb21f; font-size: 15px; font-weight: 900; }
.topic-txt { min-width: 0; flex: 1; }
.topic-txt b { display: block; font-size: 14.5px; font-weight: 800; }
.topic-txt p { margin: 2px 0 0; font-size: 14px; line-height: 1.5; max-height: 4.5em; overflow-y: auto; overflow-wrap: anywhere; }
.topic-txt .emo { width: 18px; height: 18px; vertical-align: -4px; }
.topic-txt .link, .topic-txt .mention-tag { color: #fff; text-decoration: underline; background: none; }
.topic-x { position: absolute; inset-block-start: 8px; right: 10px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: #fff; }
.topic-x .ic { width: 13px; height: 13px; }
.topic-x:hover { background: rgba(255, 255, 255, .2); }

/* ---------- composer ---------- */
.composer-wrap { position: relative; padding: 4px 6px; background: var(--composer-bg); border-top: 1px solid var(--line); flex: none; }
.composer { display: flex; align-items: flex-end; gap: 4px; }
.composer.disabled { opacity: .7; }
.send-btn { order: 0; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: 10px; background: var(--send-grad); color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--orange) 40%, transparent); transition: transform .1s, filter .15s; }
.send-btn:hover { filter: brightness(1.06); }
.send-btn:active { transform: scale(.94); }
.send-btn.loading { opacity: .6; }
.send-btn .ic { width: 20px; height: 20px; }
.input-wrap { order: 1; position: relative; flex: 1; min-width: 0; display: flex; background: var(--input-bg); border: 1px solid var(--input-line); border-radius: 22px; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
#msg-input { border: 0; background: transparent; box-shadow: none; resize: none; padding: 9px 16px; max-height: 140px; min-height: 40px; line-height: 1.45; overflow-y: auto; border-radius: 22px; }
#msg-input:focus { box-shadow: none; }
.cbtn { order: 2; width: 40px; height: 40px; border-radius: 10px; color: var(--accent); }
.cbtn .ic, .cbtn .ic-img { width: 24px; height: 24px; }
#btn-emoji { order: 2; }
.composer-mod { order: 3; display: flex; align-items: flex-end; gap: 0; }
.composer-mod .icon-btn { color: var(--accent); }
#btn-style { order: 4; }
#composer-more { order: 5; }
.char-count { position: absolute; inset-inline-end: 8px; inset-block-start: -20px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel); padding: 0 6px; border-radius: 6px; }
.char-count.danger { color: var(--danger); }
.reply-bar, .guest-cta { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-inline-start: 3px solid var(--accent); }
.reply-bar > .ic { color: var(--accent); width: 19px; height: 19px; }
.reply-info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.reply-info b { color: var(--accent); }
.reply-info span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guest-cta { justify-content: space-between; border-inline-start-color: var(--warn); font-size: 14px; }
.suggest { position: absolute; inset-inline: 10px; inset-block-end: calc(100% + 2px); z-index: 8; max-height: 280px; overflow-y: auto; padding: 5px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sugg-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 9px; background: transparent; text-align: start; color: var(--text); }
.sugg-item small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-item.active, .sugg-item:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.sugg-item .avatar { width: 22px; height: 22px; }

/* ---------- bottom bar ---------- */
.bottombar { grid-area: bot; position: relative; z-index: 30; display: flex; align-items: stretch; padding: 0 4px; padding-bottom: env(safe-area-inset-bottom); background: var(--bar-grad); color: var(--bar-text); box-shadow: 0 -2px 10px rgba(20, 50, 100, .14); }
.bottom-buttons { display: flex; align-items: stretch; }
.bottombar .bar-btn { min-width: 58px; }
body:not(.panel-hidden) #btn-panel, body.panel-overlay-open #btn-panel { background: var(--bar-hover); }
.scrim { display: none; }
body.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 60; background: transparent; }

/* ==========================================================================
   Popovers, menus, modals, toasts
   ========================================================================== */
.popover {
  position: fixed; z-index: 120; min-width: 200px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .14s, transform .14s;
}
.popover.in { opacity: 1; transform: none; }
.menu-list { display: flex; flex-direction: column; padding: 6px; max-height: 70vh; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: start; font-size: 14px; font-weight: 500; }
.menu-item:hover { background: var(--hover); text-decoration: none; }
.menu-item .ic, .menu-item .ic-img { width: 19px; height: 19px; color: var(--muted); }
.menu-item span { flex: 1; }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.ic-gap { width: 19px; flex: none; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.menu-pop.wide { width: 280px; }
.mm-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 10px; }
.mm-head .avatar { width: 46px; height: 46px; }
.mm-name { display: flex; align-items: center; gap: 5px; font-size: 15px; }
.mm-head small { color: var(--muted); }
.status-seg { display: flex; gap: 4px; margin: 0 10px 4px; padding: 4px; border-radius: 12px; background: var(--bg2); }
.status-seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 4px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.status-seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.status-seg .st-dot { position: static; border: 0; width: 8px; height: 8px; }

/* user card */
.ucard-pop { width: 300px; overflow: hidden; }
.ucard { position: relative; padding-bottom: 12px; }
.ucard-cover, .profile-cover { height: 70px; background: var(--brand-grad); background: linear-gradient(135deg, var(--ucol, #8b5cf6), color-mix(in srgb, var(--ucol, #3fa9f5) 40%, #3fa9f5)); }
.ucard-top { display: flex; align-items: flex-end; gap: 12px; padding: 0 14px; margin-top: -32px; }
.ucard-top .avatar { width: 64px; height: 64px; box-shadow: 0 0 0 4px var(--panel); }
.ucard-top .st-dot { width: 14px; height: 14px; border-width: 3px; }
.ucard-name { min-width: 0; padding-bottom: 2px; }
.ucard-line { display: flex; align-items: center; gap: 5px; font-size: 16px; }
.ucard-name small { color: var(--muted); font-size: 12.5px; }
.ucard-mood { margin: 10px 14px 0; padding: 8px 10px; border-radius: 10px; background: var(--panel2); font-size: 13.5px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.ucard-actions { display: flex; gap: 6px; padding: 12px 14px 0; flex-wrap: wrap; }
.ucard-actions .btn { flex: 1; }
.ucard-actions .btn:last-child:not(.primary) { flex: 0 0 auto; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(8, 6, 20, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); opacity: 0; transition: opacity .16s; }
.modal.in { opacity: 1; }
.modal.out { opacity: 0; }
.modal-card {
  position: relative; width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
  transform: translateY(10px) scale(.98); transition: transform .18s;
}
.modal.in .modal-card { transform: none; }
.modal-card.sm { width: min(420px, 100%); }
.modal-card.md { width: min(560px, 100%); }
.modal-card.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-ic { width: 22px; height: 22px; color: var(--accent); }
.modal-x.floating { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; z-index: 3; background: rgba(0, 0, 0, .28); color: #fff; }
.modal-x.floating:hover { background: rgba(0, 0, 0, .45); color: #fff; }
.modal-body { padding: 18px 20px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--panel2); flex: none; }
.confirm-text { margin: 0; font-size: 15px; }
.target-line { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel2); }
.target-line .avatar { width: 32px; height: 32px; }
.lightbox .modal-card { width: auto; max-width: min(96vw, 1100px); background: transparent; border: 0; box-shadow: none; }
.lightbox .modal-body { padding: 0; display: grid; place-items: center; }
.lightbox img { max-width: 100%; max-height: 86dvh; border-radius: 14px; display: block; }

/* profile */
.profile-modal .modal-body { padding: 0; }
.profile { padding-bottom: 18px; }
.profile-cover { height: 120px; }
.profile-head { display: flex; align-items: flex-end; gap: 16px; padding: 0 22px; margin-top: -52px; }
.profile-av { border: 0; padding: 0; background: none; line-height: 0; border-radius: 50%; }
.profile-av .avatar { width: 104px; height: 104px; box-shadow: 0 0 0 5px var(--panel); }
.profile-av .st-dot { width: 20px; height: 20px; border-width: 4px; inset-block-end: 6px; inset-inline-end: 6px; }
.profile-id { min-width: 0; padding-bottom: 4px; }
.profile-id h2 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 22px; }
.profile-id h2 .rank-ic { width: 22px; height: 22px; }
.profile-rank { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.rank-chip { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, currentColor 14%, transparent); }
.rank-chip.r-user { color: var(--muted); }
.profile-mood { margin: 6px 0 0; color: var(--muted); font-style: italic; font-size: 14px; overflow-wrap: anywhere; }
.fact-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 22px 0; }
.fact-chips .chip { background: color-mix(in srgb, var(--panel) 92%, transparent); border-color: var(--line); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.fact-chips .chip .ic { color: var(--accent); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 22px 0; }
.profile-mod { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 22px 0; padding: 10px 12px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 5%, transparent); }
.mod-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--warn); text-transform: uppercase; letter-spacing: .3px; }
.mod-label .ic { width: 15px; height: 15px; }
.mod-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-tabs { display: flex; gap: 4px; margin: 18px 22px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.seg-tabs button { position: relative; padding: 9px 14px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.seg-tabs button.active { color: var(--text); }
.seg-tabs button.active::after { content: ""; position: absolute; inset-inline: 10px; inset-block-end: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); }
.profile-tab-body { padding: 14px 22px 0; min-height: 90px; }
.about-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.info-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-list > div { padding: 9px 12px; border-radius: 12px; background: var(--panel2); }
.info-list dt { font-size: 11.5px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.info-list dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }

/* settings */
.settings-modal .modal-body { padding: 0; display: flex; }
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); width: 100%; min-height: min(560px, 70dvh); }
.set-nav { display: flex; flex-direction: column; gap: 3px; padding: 14px 10px; border-inline-end: 1px solid var(--line); background: var(--panel2); }
.set-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; text-align: start; }
.set-nav button .ic { width: 19px; height: 19px; }
.set-nav button:hover { background: var(--hover); color: var(--text); }
.set-nav button.active { background: var(--panel); color: var(--accent); box-shadow: var(--shadow-sm); }
.set-content { padding: 18px 22px 22px; overflow-y: auto; max-height: calc(100dvh - 120px); }
.set-title { margin: 0 0 14px; font-size: 18px; }
.set-body { display: flex; flex-direction: column; gap: 6px; }
.set-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-section:last-of-type { border-bottom: 0; }
.set-section h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.set-actions { display: flex; justify-content: flex-end; padding-top: 14px; position: sticky; bottom: -22px; background: linear-gradient(transparent, var(--panel) 30%); padding-bottom: 4px; }
.avatar-edit { display: flex; align-items: center; gap: 18px; padding: 4px 0 6px; }
.avatar-edit .avatar { width: 96px; height: 96px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.avatar-edit .avatar.loading { opacity: .4; }
.avatar-edit-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.avatar-edit-btns small { flex-basis: 100%; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { position: relative; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); padding: 0; display: grid; place-items: center; background: var(--panel2); color: var(--muted); }
.swatch .ic { width: 16px; height: 16px; }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
.swatch.custom { cursor: pointer; overflow: hidden; background: conic-gradient(#ff5d6c, #ffb547, #3fd18b, #4fb3ff, #7c5cff, #ff5d6c); color: #fff; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-card { display: flex; flex-direction: column; gap: 7px; padding: 6px 6px 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel2); font-weight: 600; font-size: 13px; }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.theme-prev { position: relative; display: block; height: 70px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.theme-prev i { position: absolute; display: block; }
.tp-top { inset: 0 0 auto 0; height: 13px; background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
.tp-side { inset-block: 13px 0; inset-inline-start: 0; width: 14px; background: var(--appbar-bg); }
.tp-msg { height: 10px; border-radius: 6px; inset-inline-start: 22px; }
.tp-msg.a { top: 22px; width: 55%; background: var(--bubble); border: 1px solid var(--line); }
.tp-msg.b { top: 37px; width: 40%; background: var(--mine); }
.tp-msg.c { top: 52px; width: 30%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.theme-name { text-align: center; }
.preview-box { padding: 14px; border-radius: 14px; background: var(--bg); background-image: var(--logbg); border: 1px solid var(--line); margin-bottom: 4px; }
.style-preview { margin: 0; animation: none; }
.style-preview:hover { background: transparent; }
.font-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.font-card { padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); font-size: 15px; }
.font-card.active, .bubble-sw.active { border-color: var(--accent); }
.bubble-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bubble-sw { width: 46px; height: 32px; border-radius: 10px 10px 10px 3px; border: 2px solid var(--line); background: var(--bubble); display: grid; place-items: center; color: var(--muted); }
.bubble-sw .ic { width: 15px; height: 15px; }
.sound-kinds { display: flex; flex-direction: column; padding-inline-start: 10px; border-inline-start: 2px solid var(--line); margin: 6px 0; }
.sound-kind { display: flex; align-items: center; gap: 8px; }
.sound-kind .toggle-row { flex: 1; padding: 6px 0; }
.danger-zone { padding: 12px 14px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger) 6%, transparent); }
.danger-zone p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.help-list { display: flex; flex-direction: column; gap: 6px; }
.help-list h4 { margin: 12px 0 2px; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.help-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: var(--panel2); }
.help-row code { flex: none; min-width: 150px; color: var(--accent); font-weight: 700; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.help-row span { color: var(--muted); font-size: 14px; }

/* emoji picker */
.emoji-pop { width: 344px; }
.emoji-picker { display: flex; flex-direction: column; height: 340px; }
.emoji-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.emoji-tabs button { display: grid; place-items: center; width: 36px; height: 32px; flex: none; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.emoji-tabs button .ic { width: 19px; height: 19px; }
.emoji-tabs button.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 6px; align-content: start; }
.emoji-grid.emoticons { grid-template-columns: repeat(7, 1fr); }
.emoji-btn { display: grid; place-items: center; aspect-ratio: 1; border: 0; border-radius: 9px; background: transparent; font-size: 23px; line-height: 1; padding: 0; transition: transform .08s, background .1s; }
.emoji-btn:hover { background: var(--hover); transform: scale(1.15); }
.emoji-btn img { width: 32px; height: 32px; }

/* toasts */
.toasts { position: fixed; inset-block-start: calc(var(--top-h) + 10px); inset-inline-end: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); animation: toast-in .22s ease-out; transition: opacity .25s, transform .25s;
}
.toast.clickable { cursor: pointer; }
.toast.out { opacity: 0; transform: translateY(-6px); }
.toast-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; flex: none; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.toast-ic .ic { width: 18px; height: 18px; }
.toast.ok .toast-ic { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.toast.err .toast-ic { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.toast-img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; overflow-wrap: anywhere; }
.toast-text b { font-size: 13.5px; }
.toast-text b + span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-x { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border: 0; border-radius: 8px; background: transparent; color: var(--faint); }
.toast-x .ic { width: 15px; height: 15px; }
.toast-x:hover { background: var(--hover); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Private message windows
   ========================================================================== */
.pm-dock { position: fixed; inset-block-end: var(--bot-h); inset-inline-end: 16px; z-index: 60; display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }
.pm-win {
  pointer-events: auto; width: 330px; height: 450px; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: var(--shadow); overflow: hidden;
  animation: pm-in .2s ease-out;
}
@keyframes pm-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-win.min { height: auto; width: 240px; }
.pm-win.min .pm-log, .pm-win.min .pm-form { display: none; }
.pm-head { display: flex; align-items: center; gap: 8px; padding: 7px 6px 7px 10px; background: var(--brand-grad); color: #fff; flex: none; cursor: default; }
.pm-win.min .pm-head { cursor: pointer; }
.pm-head .icon-btn { color: rgba(255, 255, 255, .85); }
.pm-head .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.pm-head .avatar { width: 34px; height: 34px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.pm-head .st-dot { border-color: #6366f1; }
.pm-back { display: none; }
.pm-who { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; color: #fff; padding: 0; text-align: start; line-height: 1.25; }
.pm-name { display: flex; align-items: center; gap: 4px; max-width: 100%; font-size: 14px; }
.pm-name .uname { color: #fff !important; }
.pm-status { font-size: 11.5px; opacity: .85; }
.pm-log { flex: 1; overflow-y: auto; padding: 10px 10px 6px; background: var(--bg); background-image: var(--logbg); display: flex; flex-direction: column; gap: 3px; }
.pm-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); }
.pm-empty .avatar { width: 64px; height: 64px; }
.pm-msg { display: flex; animation: msg-in .18s ease-out; }
.pm-msg.mine { justify-content: flex-end; }
.pm-bubble { max-width: 82%; padding: 7px 11px 5px; border-radius: 16px; background: var(--bubble); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); overflow-wrap: anywhere; }
.pm-msg.theirs .pm-bubble { border-end-start-radius: 5px; }
.pm-msg.mine .pm-bubble { background: var(--grad); color: var(--on-accent); border: 0; border-end-end-radius: 5px; }
.pm-msg.mine .link, .pm-msg.mine .mention-tag { color: inherit; text-decoration: underline; }
.pm-msg.custom .pm-bubble { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.pm-text { white-space: pre-wrap; font-size: 14.5px; }
.pm-text.big-emo { font-size: 30px; }
.pm-text.big-emo .emo { width: 38px; height: 38px; }
.pm-meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: 10.5px; opacity: .7; margin-top: 1px; }
.seen-ic { width: 14px; height: 14px; }
.seen-ic.seen { color: #9ff0c9; opacity: 1; }
.pm-form { display: flex; align-items: flex-end; gap: 2px; padding: 6px; border-top: 1px solid var(--line); background: var(--panel); flex: none; }
.pm-tools { display: flex; }
.pm-input { flex: 1; border: 0; background: var(--bg2); border-radius: 12px; resize: none; padding: 7px 10px; max-height: 110px; min-height: 34px; line-height: 1.4; }
/* PM reply quote / reply bar (core) */
.pm-quote { border-left: 0; border-inline-start: 3px solid var(--accent); margin-bottom: 4px; }
.pm-msg.mine .pm-quote { background: rgba(255, 255, 255, .18); color: inherit; border-inline-start-color: rgba(255, 255, 255, .75); }
.pm-msg.mine .pm-quote b, .pm-msg.mine .pm-quote span { color: inherit; opacity: .92; }
.pm-reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); border-inline-start: 3px solid var(--accent); background: var(--panel2); font-size: 12.5px; color: var(--muted); flex: none; }
.pm-reply-bar[hidden] { display: none; }
.pm-reply-bar svg { width: 14px; height: 14px; flex: none; color: var(--accent); }
.pm-reply-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* extra presence states */
.st-dot.st4 { background: #8b5cf6; }
.st-dot.st5 { background: #f59e0b; }
.status-seg { flex-wrap: wrap; }
.status-seg button { flex: 1 1 30%; min-width: 0; }
.pm-unread { box-shadow: 0 0 0 2px rgba(255,255,255,.6); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1099px) {
  .app, body.panel-hidden .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "bot"; }
  .sidepanel, body.panel-hidden .sidepanel {
    display: flex; position: fixed; inset-block: var(--top-h) var(--bot-h); inset-inline-start: 0; width: min(330px, 88vw); z-index: 55;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); border-radius: 0 0 14px 0;
  }
  [dir=rtl] .sidepanel, [dir=rtl] body.panel-hidden .sidepanel { transform: translateX(105%); border-radius: 0 0 0 14px; }
  body.panel-overlay-open .sidepanel { transform: none !important; }
  body.panel-overlay-open .scrim { display: block; position: fixed; inset: var(--top-h) 0 var(--bot-h); z-index: 50; background: rgba(15, 25, 45, .35); }
}
@media (max-width: 760px) {
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 0; }
  .topbar .brand { display: none; }
  .bar-btn { min-width: 44px; padding-inline: 3px; font-size: 10.5px; }
  .bar-label { max-width: 58px; }
  .bottombar .bar-btn { min-width: 54px; }
  .avatar-btn { margin: 0 4px; }
  .avatar-btn img { width: 36px; height: 36px; }
  .appbar { inset-inline: 8px; width: auto; }
  .msg { grid-template-columns: 42px minmax(0, 1fr) auto; column-gap: 8px; padding: 8px 8px 8px 6px; }
  .msg-av .avatar { width: 40px; height: 40px; }
  .msg-tools { display: none !important; }
  .composer-wrap { padding: 4px; padding-bottom: 4px; }
  .composer-mod .icon-btn:nth-child(n+2) { display: none; }
  .cbtn { width: 38px; }
  #btn-style { display: none !important; }
  .topic-box { border-radius: 10px 10px 0 0; }
  .new-pill { inset-block-end: 64px; }
  .toasts { inset-inline: 10px; width: auto; inset-block-start: calc(var(--top-h) + 6px); }
  .modal { padding: 0; align-items: end; }
  .modal-card, .modal-card.sm, .modal-card.md, .modal-card.wide { width: 100%; max-height: 94dvh; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(40px); }
  .modal.in .modal-card { transform: none; }
  .lightbox.modal { align-items: center; padding: 10px; }
  .lightbox .modal-card { border-radius: 0; }
  .settings { grid-template-columns: 1fr; min-height: 0; }
  .set-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .set-nav button { flex: none; padding: 8px 12px; }
  .set-content { max-height: none; padding: 14px 16px 18px; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :last-child { grid-column: 1 / -1; }
  .info-list { grid-template-columns: 1fr; }
  .profile-head { padding: 0 16px; }
  .fact-chips, .profile-actions, .profile-tab-body { padding-inline: 16px; }
  .profile-mod, .seg-tabs { margin-inline: 16px; }
  .profile-actions .btn { flex: 1 1 auto; }
  .emoji-pop { width: calc(100vw - 16px); }
  .emoji-picker { height: 300px; }
  .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
  .pm-dock { inset: auto 10px calc(var(--bot-h) + 70px) auto !important; flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
  [dir=rtl] .pm-dock { inset: auto auto calc(var(--bot-h) + 70px) 10px !important; }
  .pm-win:not(.min) { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; border: 0; z-index: 95; }
  .pm-win.min { width: 54px; height: 54px; border-radius: 50%; border: 0; overflow: visible; box-shadow: var(--shadow); }
  .pm-win.min .pm-head { padding: 0; width: 54px; height: 54px; border-radius: 50%; justify-content: center; background: var(--brand-grad); }
  .pm-win.min .pm-head > :not(.pm-av):not(.pm-unread) { display: none; }
  .pm-win.min .pm-av .avatar { width: 48px; height: 48px; }
  .pm-win.min .pm-unread { position: absolute; inset-block-start: -4px; inset-inline-end: -4px; }
  .pm-win:not(.min) .pm-back { display: inline-grid; }
  .pm-win:not(.min) .pm-min { display: none; }
  .pm-win:not(.min) .pm-head { padding-top: max(7px, env(safe-area-inset-top)); }
  .pm-win:not(.min) .pm-form { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .pm-bubble { max-width: 86%; }
  .conv-del { opacity: 1; }
}
@media (hover: none) {
  .msg-tools { display: none !important; }
  .msg:hover { background: var(--row-bg); }
  .msg:nth-child(even of .msg):hover { background: var(--row-alt); }
  .conv-del { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Landing / login page — live panel (start side) + login card
   ========================================================================== */
.vc-auth { min-height: 100%; background: var(--land-bg); }
.landing { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.land-info {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 26px; padding: 30px clamp(20px, 5vw, 56px) 34px;
  background: var(--land-panel); color: #fff;
}
.land-info::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(rgba(255, 255, 255, .13) 1px, transparent 1.4px); background-size: 22px 22px; opacity: .6; }
.land-info::after { content: ""; position: absolute; width: 360px; height: 360px; inset-block-end: -140px; inset-inline-end: -120px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 160, 70, .45), transparent); pointer-events: none; }
.land-info > * { position: relative; z-index: 1; }
.land-brand { display: flex; align-items: center; gap: 12px; }
.land-logo img { display: block; width: auto; height: 48px; max-width: 190px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .2)); }
.land-brand-txt { min-width: 0; display: flex; flex-direction: column; }
.land-brand h1 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.land-brand small { font-size: 13px; opacity: .85; }
.land-live { display: flex; align-items: center; gap: 22px; margin-top: 30px; }
.live-orb { position: relative; display: grid; place-items: center; width: 150px; height: 150px; flex: none; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 14px rgba(255, 255, 255, .04); }
.live-orb::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid rgba(255, 175, 90, .45); animation: orb 2.6s ease-out infinite; }
.live-orb span { display: grid; place-items: center; width: 116px; height: 116px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffc06b, #ff8a1f 60%, #f0700e); box-shadow: 0 10px 30px rgba(255, 120, 20, .45), inset 0 -6px 14px rgba(180, 70, 0, .25); }
.live-orb .ic { width: 46px; height: 46px; color: #fff; }
@keyframes orb { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.12); opacity: 0; } }
.live-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.live-n { font-size: 84px; line-height: .95; font-weight: 600; letter-spacing: -1px; text-shadow: 0 4px 18px rgba(0, 0, 0, .15); }
.live-lbl { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: #ffb35a; font-size: 22px; font-weight: 800; }
.live-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff8a1f; box-shadow: 0 0 0 4px rgba(255, 138, 31, .28); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 138, 31, 0); } }
.live-txt small { margin-top: 4px; font-size: 14px; opacity: .9; }
.land-rooms { padding: 18px 20px 8px; border-radius: 20px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 10px 30px rgba(10, 30, 80, .15); backdrop-filter: blur(4px); }
.lr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.lr-head b { font-size: 15px; }
.lr-head small { font-size: 12px; opacity: .8; }
.lr-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(60px, 150px) 48px; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.lr-row:last-child { border-bottom: 0; }
.lr-tile { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; overflow: hidden; box-shadow: 0 4px 10px rgba(0, 0, 0, .15); }
.lr-tile img { width: 28px; height: 28px; object-fit: cover; border-radius: 7px; }
.lr-tile.t1 { background: linear-gradient(135deg, #a8c4f0, #6d97de); } .lr-tile.t2 { background: linear-gradient(135deg, #ffb357, #ff8a1f); }
.lr-tile.t3 { background: linear-gradient(135deg, #c264d6, #8d3fb3); } .lr-tile.t4 { background: linear-gradient(135deg, #ffd08a, #ffa94a); }
.lr-tile.t5 { background: linear-gradient(135deg, #6fd3b8, #2fa98a); } .lr-tile.t6 { background: linear-gradient(135deg, #ff9db5, #e8507a); }
.lr-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-bar { height: 7px; border-radius: 6px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.lr-bar i { display: block; height: 100%; min-width: 0; border-radius: 6px; background: linear-gradient(90deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .7)); }
[dir=rtl] .lr-bar i { margin-inline-start: auto; }
.lr-n { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; font-weight: 800; font-size: 15px; direction: ltr; }
.lr-n .ic { width: 13px; height: 13px; opacity: .75; }
.lr-empty { margin: 8px 0 12px; opacity: .8; }
.land-chips { display: flex; flex-direction: column; gap: 10px; }
.chips-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.land-chips .chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .1); color: #fff; font-size: 14.5px; font-weight: 700; white-space: nowrap; transition: background .3s, box-shadow .3s, transform .3s; }
.land-chips .chip .ic { width: 18px; height: 18px; }
.land-chips .chip:hover { background: rgba(255, 255, 255, .18); }
.land-chips .chip.on { background: linear-gradient(135deg, #ffb04f, #ff8216); border-color: transparent; box-shadow: 0 8px 22px rgba(255, 130, 22, .4); transform: translateY(-2px); }
.chips-dots { display: flex; justify-content: flex-end; gap: 6px; }
.chips-dots i { width: 7px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .35); transition: width .3s, background .3s; }
.chips-dots i.on { width: 22px; background: #ff9a3c; }

.land-side {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 40px 20px 24px;
  background: radial-gradient(420px 380px at 0% 8%, rgba(120, 165, 235, .28), transparent 70%), radial-gradient(360px 320px at 100% 92%, rgba(255, 168, 80, .3), transparent 70%), var(--land-bg);
}
.auth-card { position: relative; width: min(410px, 100%); padding: 32px 28px 26px; border-radius: 26px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(40, 70, 130, .16); text-align: center; }
.auth-title { margin: 0; font-size: 27px; font-weight: 800; color: var(--text); }
.auth-sub { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 15px; background: var(--toggle-bg); }
.tabs.single { display: none; }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 800; font-size: 15px; }
.tabs .tab.active { background: var(--btn-grad); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.auth-form { display: none; flex-direction: column; gap: 12px; text-align: start; }
.auth-form.active { display: flex; }
.inp { position: relative; display: flex; align-items: center; }
.auth-form label.inp, .auth-modal label.inp { flex-direction: row; gap: 0; }
.inp > .ic { position: absolute; inset-block-start: 50%; margin-top: -8.5px; inset-inline-start: 16px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.inp input { height: 48px; padding-inline-start: 44px; border-radius: 14px; background: var(--input-bg); border-color: var(--input-line); font-size: 15px; }
.inp input[type=password], .inp input[name=password] { padding-inline-end: 44px; }
.pw-eye { position: absolute; inset-block-start: 50%; margin-top: -16px; inset-inline-end: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--faint); cursor: pointer; }
.pw-eye:hover, .pw-eye.on { color: var(--accent); background: var(--hover); }
.pw-eye .ic { width: 18px; height: 18px; }
.auth-go { width: 100%; height: 52px; margin-top: 2px; border-radius: 15px; background: var(--btn-grad) !important; font-size: 17px; font-weight: 800; box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent) !important; }
.auth-go .ic { width: 20px; height: 20px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; }
.forgot-slot a, .auth-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.forgot-slot a { margin: 0 !important; line-height: 1.4; }
.forgot-slot a:hover, .auth-link:hover { color: var(--accent); text-decoration: none; }
.auth-link .ic { width: 15px; height: 15px; }
.auth-error { margin-top: 12px; padding: 10px 12px; border-radius: 11px; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); font-weight: 600; font-size: 14px; text-align: start; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; color: var(--faint); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { display: flex; gap: 10px; }
.auth-alt .btn { flex: 1; height: 48px; border-radius: 14px; font-size: 15px; font-weight: 800; }
.auth-alt .btn .ic { width: 19px; height: 19px; }
.alt-guest { background: var(--toggle-bg); border-color: var(--input-line); color: var(--text); }
.alt-reg { background: linear-gradient(135deg, #ffb04f, #ff8216) !important; color: #fff !important; border: 0; box-shadow: 0 10px 22px rgba(255, 130, 22, .35); }
.alt-reg.active { box-shadow: 0 0 0 3px rgba(255, 130, 22, .35); }
.auth-feat { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 0; border: 0; background: none; color: var(--orange); font-weight: 800; font-size: 14.5px; }
.auth-feat .ic { width: 17px; height: 17px; }
.auth-feat:hover { text-decoration: underline; }
.land-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; text-align: center; }
.land-foot p { margin: 0; }
.land-foot a { color: var(--muted); }
.land-foot p:first-child a { color: var(--accent); font-weight: 700; }
.land-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.land-foot nav a, .land-foot .auth-link { font-size: 13.5px; color: var(--muted); }
.land-foot .powered { font-size: 12px; opacity: .85; }
.land-foot .powered a { font-weight: 700; }
.vc-ac-contact-link { position: static !important; }
/* modal dialogs (register / language / features) */
.auth-modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 16px; background: rgba(20, 35, 70, .45); backdrop-filter: blur(3px); }
.auth-modal.in { display: grid; animation: fade-in .15s ease-out; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.auth-modal-card { position: relative; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px 22px 22px; border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); text-align: start; }
.auth-modal-card.sm { width: min(320px, 100%); }
.auth-modal-card h3 { margin: 0 0 16px; font-size: 18px; font-weight: 800; }
.auth-modal .auth-form { display: flex; }
.auth-x { position: absolute; inset-block-start: 14px; inset-inline-end: 14px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text); }
.auth-x:hover { background: var(--hover); }
.auth-x .ic { width: 16px; height: 16px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
.fld input, .fld select { height: 46px; border-radius: 12px; background: var(--input-bg); border-color: var(--input-line); }
.lang-list { display: flex; flex-direction: column; }
.lang-list a { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; }
.lang-list a:last-child { border-bottom: 0; }
.lang-list a:hover { background: var(--hover); text-decoration: none; }
.lang-list a.on { color: var(--accent); }
.lang-list .ic { width: 18px; height: 18px; margin-inline-start: auto; }
.lang-code { display: grid; place-items: center; width: 34px; height: 24px; border-radius: 6px; background: var(--panel3); color: var(--muted); font-size: 11.5px; font-weight: 800; }
.feat-list { display: flex; flex-direction: column; gap: 14px; }
.feat-item { display: flex; gap: 12px; align-items: flex-start; }
.feat-item b { display: block; font-size: 15px; }
.feat-item p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.feat-ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--btn-grad); color: #fff; }
.feat-ic .ic { width: 21px; height: 21px; }
/* phones + centered layout: live panel on top, card below */
@media (max-width: 900px) {
  .landing { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) { .landing .land-info { padding: 18px 16px 40px; } }
.landing.layout-center { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) {
  .land-info { gap: 14px; border-radius: 0 0 30px 30px; }
  .land-logo img { height: 40px; }
  .land-brand h1 { font-size: 19px; }
  .land-live { margin-top: 0; justify-content: center; gap: 14px; }
  .live-orb { width: 90px; height: 90px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 8px rgba(255, 255, 255, .04); }
  .live-orb span { width: 70px; height: 70px; }
  .live-orb .ic { width: 30px; height: 30px; }
  .live-n { font-size: 50px; }
  .live-lbl { font-size: 17px; }
  .live-txt small { display: none; }
  .land-rooms { padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; }
  .lr-head { display: none; }
  .lr-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .lr-list::-webkit-scrollbar { display: none; }
  .lr-row { display: flex; flex: none; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 14px; background: rgba(255, 255, 255, .12); }
  .lr-bar { display: none; }
  .lr-tile { width: 32px; height: 32px; border-radius: 9px; }
  .lr-tile img { width: 22px; height: 22px; }
  .lr-name { font-size: 14px; max-width: 140px; }
  .lr-n { font-size: 14px; }
  .chips-row { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 4px 16px; }
  .chips-row::-webkit-scrollbar { display: none; }
  .land-chips .chip { padding: 9px 15px; font-size: 14px; }
  .chips-dots { display: none; }
  .land-side { justify-content: flex-start; padding: 0 16px 24px; margin-top: -26px; background: transparent; gap: 22px; }
  .auth-card { padding: 26px 18px 22px; border-radius: 22px; }
  .auth-title { font-size: 24px; }
  .auth-modal { padding: 0; align-items: end; }
  .auth-modal-card { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; }
}
.landing.layout-center .land-info { border-radius: 0 0 30px 30px; padding-bottom: 48px; }
.landing.layout-center .land-info > * { width: min(720px, 100%); margin-inline: auto; }
.landing.layout-center .land-live { margin-top: 0; justify-content: center; }
.landing.layout-center .land-side { justify-content: flex-start; margin-top: -30px; background: transparent; }
@media (min-width: 901px) {
  .landing.layout-split .land-info { min-height: 100vh; min-height: 100dvh; justify-content: flex-start; }
  .landing.layout-split .land-live { justify-content: flex-start; }
}

/* ---------- static pages / install / maintenance ---------- */
.land-nav.slim { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: var(--top-h); padding: 4px 16px; background: var(--bar-grad); color: var(--bar-text); box-shadow: 0 2px 10px rgba(20, 50, 100, .18); }
.land-nav.slim .brand { color: var(--bar-text); font-size: 17px; }
.land-nav.slim .brand img { width: auto; height: 36px; }
.land-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 14px; }
.land-links > a { padding: 6px 12px; border-radius: 99px; color: var(--bar-text); font-weight: 700; opacity: .88; }
.land-links > a:hover, .land-links > a.active { opacity: 1; background: var(--bar-hover); text-decoration: none; }
@media (max-width: 560px) { .land-nav.slim .brand span { display: none; } .land-links > a { padding: 5px 8px; font-size: 13px; } }
.vc-page { min-height: 100%; background: var(--bg); background-image: var(--logbg); }
.page-wrap { width: min(860px, 100%); margin: 0 auto; padding: 32px 16px 48px; }
.page-wrap.center { text-align: center; padding-top: 14vh; }
.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-title h1 { margin: 0; font-size: 30px; }
.page-content { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px 26px; line-height: 1.75; box-shadow: var(--shadow-sm); overflow-wrap: anywhere; }
.page-back { margin-top: 18px; }
.auth-logo { width: 84px; height: 84px; }
.maint-art { position: relative; display: inline-block; margin-bottom: 8px; }
.gear-spin { position: absolute; inset-block-end: -6px; inset-inline-end: -14px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); color: var(--accent); animation: spin 6s linear infinite; }
.install-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.install-head h1 { flex: 1; margin: 0; }
.install-head .auth-logo { width: 56px; height: 56px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--danger); }
@media (max-width: 760px) {
  .row2 { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr; }
}

/* ---------- admin ---------- */
.vc-admin { min-height: 100%; }
.adm { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.adm-nav { background: var(--panel); border-inline-end: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.adm-nav .brand { padding: 6px 8px 16px; }
.adm-nav > a:not(.brand) { padding: 9px 12px; border-radius: 9px; color: var(--text); }
.adm-nav > a:not(.brand):hover { background: var(--panel2); text-decoration: none; }
.adm-nav > a.active { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 700; }
.adm-nav .back { margin-top: auto; color: var(--muted) !important; }
.adm-nav .ver { color: var(--muted); padding: 6px 12px; }
.adm-main { padding: 22px 26px; min-width: 0; }
.adm-main h1 { margin: 0 0 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }
details.card summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.card[open] summary { margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stat b { font-size: 28px; }
.stat span { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
table.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.u { display: inline-flex; align-items: center; gap: 8px; }
.u img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel2); margin-inline-start: 4px; }
.tag.red { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.tag.orange { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tag.green { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.toolbar, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; flex-direction: row; }
.toolbar input, .inline-form input, .inline-form select, .toolbar select { width: auto; flex: 1; min-width: 140px; }
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.flash.err { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav a { padding: 7px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.subnav a.active { border-color: var(--accent); color: var(--accent); }
.set-row { display: grid; grid-template-columns: 280px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.set-row label { display: flex; flex-direction: column; }
.set-row small { color: var(--muted); font-weight: 400; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; inset-block-start: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
[dir=rtl] .switch input:checked + span::before { transform: translateX(-20px); }
.user-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.user-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.user-head h2 { margin: 0; }
.action-forms { display: flex; flex-direction: column; gap: 8px; }
.action-forms form { display: flex; gap: 8px; align-items: center; }
.action-forms input { width: 120px; flex: none; }
.action-forms input[name=reason] { flex: 1; width: auto; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a { padding: 5px 11px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.pager a.active { background: var(--accent); color: var(--accent-text); }
@media (max-width: 860px) {
  .adm { grid-template-columns: 1fr; }
  .adm-nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .adm-nav .back, .adm-nav .ver { margin-top: 0; }
  .grid2, .set-row { grid-template-columns: 1fr; }
  .adm-main { padding: 16px; }
  table.list { display: block; overflow-x: auto; }
}
.profile-cover.has-img { background-size: cover; background-position: center; height: 150px; }
/* login layout: centered variant */
.maint-text { max-width: 560px; margin-inline: auto; }
.pm-msg { position: relative; align-items: center; gap: 2px; }
.pm-more { order: 2; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--faint); opacity: 0; transition: opacity .12s; }
.pm-msg.mine .pm-more { order: 0; }
.pm-msg.theirs .pm-bubble { order: 1; }
.pm-more .ic { width: 15px; height: 15px; }
.pm-msg:hover .pm-more, .pm-more.pop-open { opacity: 1; }
.pm-more:hover { background: var(--hover); color: var(--text); }
@media (hover: none) { .pm-more { opacity: .6; } }
/* name blocks sit below the cover banner */
.ucard-top { align-items: flex-start; }
.ucard-name { margin-top: 36px; }
.profile-head { align-items: flex-start; }
.profile-id { margin-top: 58px; }
.profile-actions { gap: 6px; }
.profile-actions .btn:not(.primary) { padding: 6px 11px; font-size: 13px; }
.toasts { inset-inline-end: auto; left: 50%; transform: translateX(-50%); align-items: center; }
.conv-info small .emo, .reply-quote .emo, .reply-info .emo { width: 16px; height: 16px; vertical-align: -3px; }
.conv-info small .mention-tag, .reply-quote .mention-tag { pointer-events: none; }
@media (max-width: 760px) { .toasts { left: 10px; right: 10px; transform: none; } }
@media (max-width: 760px) { .pm-dock { z-index: 96; } }

/* ==========================================================================
   Admin › Display layouts (body.menu-* / body.msgs-*). Default: menu-bar + msgs-rows = sky layout.
   ========================================================================== */
/* menu "icons": compact bars without labels */
.menu-icons .topbar .bar-label, .menu-icons .bottombar .bar-label { display: none; }
.menu-icons .topbar .bar-btn, .menu-icons .bottombar .bar-btn { min-width: 46px; }
.menu-icons .bar-btn .bar-ic { height: 26px; }
/* menu "rail": the menu stays open as a column at the start side on large screens */
@media (min-width: 1100px) {
  .menu-rail .app { grid-template-columns: 250px var(--side-w) minmax(0, 1fr); grid-template-areas: "top top top" "rail side main" "bot bot bot"; }
  body.menu-rail.panel-hidden .app { grid-template-columns: 250px 0 minmax(0, 1fr); }
  .menu-rail .appbar {
    grid-area: rail; position: relative; inset: auto; z-index: 20; width: auto; max-width: none; max-height: none; min-height: 0;
    visibility: visible; opacity: 1; transform: none; transition: none; border: 0; border-inline-end: 1px solid var(--line); border-radius: 0; box-shadow: none;
  }
  .menu-rail .drawer-btn { display: none; }
}
/* messages "bubbles": rounded speech bubbles, own messages tinted */
.msgs-bubbles .msg, .msgs-bubbles .msg:nth-child(even of .msg) { background: transparent; border-bottom: 0; padding-block: 5px; }
.msgs-bubbles .msg:hover { background: transparent; }
.msgs-bubbles .msg-bubble:not(.custom):not(.action) { padding: 7px 13px; border-radius: 4px 16px 16px 16px; background: var(--panel); box-shadow: 0 1px 2px rgba(20, 40, 80, .12); }
.msgs-bubbles .msg.mine .msg-bubble:not(.custom):not(.action):not([class*="bub-"]) { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.msgs-bubbles .msg.mention .msg-bubble:not(.custom) { box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 55%, transparent); }
/* messages "compact": one line per message, small avatars, no stripes */
.msgs-compact .msg, .msgs-compact .msg:nth-child(even of .msg) { grid-template-columns: 26px minmax(0, 1fr) auto; column-gap: 8px; padding: 3px 10px; background: transparent; border-bottom: 0; }
.msgs-compact .msg:hover { background: var(--row-hover); }
.msgs-compact .msg-av .avatar { width: 24px !important; height: 24px !important; box-shadow: none; }
.msgs-compact .msg-main { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 6px; }
.msgs-compact .msg-head { margin: 0; min-height: 0; font-size: 14px; }
.msgs-compact .msg-name { font-size: 14px; }
.msgs-compact .msg-head::after { content: ":"; color: var(--faint); }
.msgs-compact .msg-text { font-size: 14px; }
.msgs-compact .msg.cont { padding-top: 0; }
.msgs-compact .msg-meta { padding-top: 0; }

/* ---------- room lobby (room chooser) ---------- */
.lobby { max-width: 920px; margin: 0 auto; padding: 18px 14px 28px; }
.lobby-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lobby-head > .ic { width: 42px; height: 42px; padding: 8px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); flex: none; }
.lobby-head h2 { margin: 0 0 2px; font-size: 20px; }
.lobby-head p { margin: 0; }
.lobby-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.lobby-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.lobby-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-align: start; transition: border-color .15s, transform .15s; }
.lobby-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.lobby-card.pinned { border-inline-start: 4px solid var(--accent); }
.lobby-ic { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; flex: none; background: var(--panel2); }
.lobby-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.lobby-info b { display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lobby-info small { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
body.in-lobby .topic-box, body.in-lobby #room-edit { display: none !important; }
.pin-ic { color: var(--accent); }
.room-card.pinned .room-card-info b { color: var(--text); }
@media (max-width: 760px) { .lobby-grid { grid-template-columns: 1fr; } .lobby { padding: 12px 10px 20px; } }
