:root {
  --bg0: #0f1012;      /* rail */
  --bg1: #17181b;      /* sidebar */
  --bg2: #1e1f23;      /* main */
  --bg3: #26282d;      /* inputs, hovers */
  --bg4: #30333a;
  --line: #2c2e34;
  --ink: #e6e7ea;
  --ink2: #b4b7bf;
  --ink3: #80848e;
  --dissent-orange: #ff4b1f;
  --dissent-white: #fff6ea;
  --dissent-ink: #171311;
  --accent: var(--dissent-orange);
  --accent-ink: var(--dissent-white);
  --live: #e5484d;
  --ok: #3fb950;
  --warn: #d29922;
  --radius: 10px;
  --rail-w: 72px;
  --side-w: 248px;
  --members-w: 232px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --hover: #1a1b1f;
  --hover2: #3a3d45;
  --bg-bar: #141518;
  --bg-deep: #111214;
  --ink-body: #dcdde1;
  --link: #7ab0ff;
  --danger-ink: #ff8a8a;
  --warn-bg: #4d3b17;
  --warn-bg2: #2a2416;
  --warn-text: #ffd27a;
  --accent-bg: color-mix(in srgb, var(--accent) 26%, var(--bg2));
  --accent-text: color-mix(in srgb, var(--accent) 45%, var(--ink));
  --chat: 15px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg2); color: var(--ink); font-size: 15px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--link); }
.muted { color: var(--ink3); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error { color: var(--danger-ink); margin: 4px 0; }
.boot { display: grid; place-items: center; height: 100%; color: var(--ink3); }
.boot-in { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; }
.boot-word { font-size: 40px; color: var(--ink); }
.boot-msg { font-size: 13px; }
/* brand idle animation: large inline marks only, off under reduced motion */
.dz-anim .dz-brow, .dz-anim .dz-eye-r { transform-box: fill-box; transform-origin: center; }
.dz-anim .dz-brow { animation: dz-brow 5s ease-in-out infinite; }
.dz-anim .dz-eye-r { animation: dz-blink 5s ease-in-out infinite; }
@keyframes dz-brow { 0%, 60%, 84%, 100% { transform: none; } 66%, 78% { transform: translateY(-5px) rotate(-7deg); } }
@keyframes dz-blink { 0%, 88%, 94%, 100% { transform: none; } 91% { transform: scaleY(.12); } }
@media (prefers-reduced-motion: reduce) { .dz-anim .dz-brow, .dz-anim .dz-eye-r { animation: none; } }

/* ---------- buttons, fields ---------- */
.btn { background: var(--bg4); border: 0; border-radius: 8px; padding: 8px 14px; color: var(--ink); }
.btn:hover { background: var(--hover2); }
a.btn { display: inline-block; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #8a2c2f; color: #fff; }
.btn.wide { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--ink3); text-align: left; }
.link:hover { color: var(--ink); text-decoration: underline; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2);
  display: inline-grid; place-items: center; padding: 0; flex: none; }
.icon-btn:hover { background: var(--bg3); color: var(--ink); }
.icon-btn.on { color: var(--live); }
.icon-btn.active { color: var(--ok); }
.icon-btn.danger:hover { color: var(--live); }
.icon-btn svg { width: 20px; height: 20px; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink3); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--bg0); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-bg) 0%, transparent 60%), var(--bg1); }
.auth-card { width: min(400px, 100%); background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px #0008; }
/* brand lockup: mark ~0.9x font-size wide, gap 0.2x mark width; 36px type keeps the mark >= 32px */
.dz-word { font-weight: 800; letter-spacing: -0.045em; text-transform: lowercase; line-height: 1; }
.dz-lockup { display: flex; align-items: center; font-size: 36px; gap: calc(0.9em * 0.2); }
.dz-lockup img { width: 0.9em; height: auto; flex: none; }
.auth h1 { margin: 18px 0 4px; font-size: 22px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) var(--side-w) 1fr auto; height: 100%; overflow: hidden; }
.rail { background: var(--bg0); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 2px; }
.srv { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--bg3); color: var(--ink);
  font-weight: 700; font-size: 16px; transition: border-radius .15s, background .15s; flex: none; }
.srv:hover, .srv.current { border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.srv.add { color: var(--ok); font-size: 26px; font-weight: 400; }
.srv.add:hover { background: var(--ok); color: #06210d; }
.srv .pip { position: absolute; left: -12px; top: 50%; width: 6px; height: 8px; margin-top: -4px; border-radius: 0 4px 4px 0; background: var(--ink); }
.srv.current .pip { height: 36px; margin-top: -18px; }
.srv .badge { position: absolute; right: -4px; bottom: -4px; }

.side { background: var(--bg1); display: flex; flex-direction: column; min-width: 0; }
.side-head { height: 52px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.server-name { flex: 1; height: 100%; border: 0; background: none; text-align: left; padding: 0 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.server-name span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-name:hover { background: var(--bg3); }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--ink2); border-bottom: 2px solid var(--ink2); transform: rotate(45deg) translateY(-3px); }
.channels { flex: 1; overflow-y: auto; padding: 10px 8px; }
.cat { display: flex; align-items: center; margin: 14px 4px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink3); }
.cat:first-child { margin-top: 2px; }
.cat span { flex: 1; }
.cat .icon-btn { width: 22px; height: 22px; }
.cat .icon-btn svg { width: 16px; height: 16px; }
.ch { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; color: var(--ink3); padding: 6px 8px; border-radius: 6px; text-align: left; }
.ch:hover { background: var(--bg3); color: var(--ink2); }
.ch.current { background: var(--bg4); color: var(--ink); }
.ch.unread { color: var(--ink); font-weight: 600; }
.ch svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.ch .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch .gear { opacity: 0; width: 22px; height: 22px; }
.ch:hover .gear, .ch.current .gear { opacity: 1; }
.badge { background: var(--live); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center; }
.live-tag { background: var(--live); color: #fff; border-radius: 4px; font-size: 10px; font-weight: 800; padding: 1px 5px; letter-spacing: .04em; }
.vp { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 30px; color: var(--ink2); font-size: 14px; border-radius: 6px; }
.vp .av { width: 24px; height: 24px; font-size: 11px; }
.vp .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp svg { width: 15px; height: 15px; color: var(--ink3); }
.vp.speaking .av { box-shadow: 0 0 0 2px var(--bg1), 0 0 0 4px var(--ok); }
.stream-row { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; color: var(--ink2); text-align: left; }
.stream-row:hover { background: var(--bg3); color: var(--ink); }
.stream-row.current { background: var(--bg4); color: var(--ink); }
.stream-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.av { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; color: #fff; flex: none; position: relative; user-select: none; }
.av .dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--bg1); background: var(--ink3); }
.av .dot.on { background: var(--ok); }

.voice-bar { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; gap: 6px; background: var(--bg-bar); }
.voice-bar-info { flex: 1; min-width: 0; }
.voice-status { color: var(--ok); font-weight: 700; font-size: 13px; }
.voice-status.warn { color: var(--warn); }
.voice-bar-btns { display: flex; }
.me-bar { display: flex; align-items: center; gap: 4px; padding: 8px; background: var(--bg-bar); }
.me-card { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: 8px; padding: 4px; text-align: left; }
.me-card:hover { background: var(--bg3); }
.me-card .av { width: 32px; height: 32px; font-size: 13px; }
.me-card .who { min-width: 0; line-height: 1.15; }
.me-card .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.me-card .who span { font-size: 12px; color: var(--ink3); }
.me-btns { display: flex; }
.me-btns .icon-btn { width: 32px; height: 32px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg2); }
.main-head { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.main-head h2 { font-size: 16px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-icon { color: var(--ink3); display: inline-grid; }
.main-icon svg { width: 22px; height: 22px; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- messages ---------- */
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; overflow-anchor: none; }
.msg { display: grid; grid-template-columns: 56px 1fr; padding: 2px 48px 2px 0; position: relative; }
.msg:hover { background: var(--hover); }
.msg.head { margin-top: 14px; }
.msg .gutter { display: flex; justify-content: center; padding-top: 2px; }
.msg .gutter time { visibility: hidden; font-size: 10.5px; color: var(--ink3); padding-top: 4px; }
.msg:hover .gutter time { visibility: visible; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .meta b { font-weight: 600; }
.msg .meta time { font-size: 12px; color: var(--ink3); }
.msg .body { font-size: var(--chat); line-height: 1.42; white-space: normal; overflow-wrap: anywhere; color: var(--ink-body); }
.msg .body .edited { font-size: 11px; color: var(--ink3); margin-left: 4px; }
.msg .body pre { background: var(--bg0); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; margin: 4px 0; white-space: pre; }
.msg .body code { background: var(--bg0); border-radius: 4px; padding: 1px 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.msg .body pre code { padding: 0; background: none; }
.msg .mention { background: var(--accent-bg); color: var(--accent-text); border-radius: 4px; padding: 0 2px; }
.msg .mention.me { background: var(--warn-bg); color: var(--warn-text); }
.msg.mentions-me { background: var(--warn-bg2); box-shadow: inset 2px 0 var(--warn); }
.msg .spoiler { background: #000; color: transparent; border-radius: 4px; cursor: pointer; }
.msg .spoiler.shown { background: var(--bg3); color: inherit; }
.msg .att { margin-top: 6px; }
.msg .att img, .msg .att video { max-width: min(480px, 100%); max-height: 360px; border-radius: 8px; display: block; cursor: zoom-in; background: var(--bg0); }
.msg .att video { cursor: auto; }
.msg .att audio { width: min(420px, 100%); }
.msg .att .file { display: inline-flex; align-items: center; gap: 10px; background: var(--bg1); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; text-decoration: none; color: var(--ink); }
.msg .tools { position: absolute; right: 12px; top: -14px; display: none; background: var(--bg1); border: 1px solid var(--line); border-radius: 8px; }
.msg:hover .tools, .msg.touched .tools { display: flex; }
.msg.touched { background: var(--hover); }
.msg .tools .icon-btn { width: 30px; height: 30px; }
.msg .tools svg { width: 16px; height: 16px; }
.msg textarea.edit { width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; }
.day { display: flex; align-items: center; gap: 10px; margin: 18px 16px 4px; color: var(--ink3); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chan-start { padding: 16px; }
.chan-start h3 { font-size: 24px; margin: 0 0 6px; }
.more { text-align: center; padding: 10px; }
.typing { height: 22px; padding: 0 16px; font-size: 12.5px; color: var(--ink2); display: flex; align-items: center; gap: 6px; }
.typing-mood { width: 18px; height: auto; flex: none; }
.composer { margin: 0 16px 16px; display: flex; align-items: flex-end; gap: 4px; background: var(--bg3); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; }
.composer > .icon-btn, .comp-right .icon-btn { flex: none; }
.comp-plus svg { width: 22px; height: 22px; }
.composer textarea { padding-left: 8px; }
.comp-right { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.mi-ico { display: inline-flex; width: 18px; height: 18px; margin-right: 10px; vertical-align: -4px; }
.mi-ico svg { width: 18px; height: 18px; }
.composer textarea { flex: 1; background: none; border: 0; outline: none; resize: none; padding: 7px 4px; max-height: 40vh; line-height: 1.4; }
.composer.drag { outline: 2px dashed var(--accent); }
.uploads { padding: 0 16px; }
.upload { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink2); margin-bottom: 8px; }
.upload progress { flex: 1; max-width: 240px; }

/* ---------- voice stage ---------- */
.stage { flex: 1; min-height: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: auto; background: var(--bg-deep); }
.stage-empty { margin: auto; text-align: center; color: var(--ink3); }
.stage-empty h2 { color: var(--ink); }
.focus { flex: 1; min-height: 240px; display: flex; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-content: center; flex: 1; }
.strip { display: flex; gap: 10px; overflow-x: auto; flex: none; }
.strip .tile { width: 180px; flex: none; }
.tile { position: relative; background: var(--bg3); border-radius: 12px; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; min-height: 0; }
.focus .tile { aspect-ratio: auto; width: 100%; height: 100%; }
.tile.speaking { box-shadow: 0 0 0 3px var(--ok) inset; }
.tile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.self-share-msg { display: grid; justify-items: center; gap: 10px; color: var(--ink3); text-align: center; }
.self-share-msg svg { width: 40px; height: 40px; color: var(--live); }
.self-share-msg p { margin: 0; color: var(--ink); }
.tile .cam { object-fit: cover; }
.tile .av { width: 72px; height: 72px; font-size: 28px; }
.strip .tile .av { width: 48px; height: 48px; font-size: 18px; }
.tile .label { position: absolute; left: 8px; bottom: 8px; background: #000a; border-radius: 6px; padding: 3px 8px; font-size: 13px; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); }
.tile .label svg { width: 14px; height: 14px; color: var(--live); }
.tile .tile-tools { position: absolute; right: 8px; top: 8px; display: none; gap: 6px; align-items: center; background: #000a; border-radius: 8px; padding: 4px 6px; }
.tile:hover .tile-tools { display: flex; }
.tile .tile-tools input[type=range] { width: 90px; }
.tile .tile-tools .icon-btn { width: 28px; height: 28px; }
.tile.screen { cursor: pointer; }
.audio-unlock { position: absolute; inset: auto 0 24px 0; display: flex; justify-content: center; }
.view-voice { position: relative; }

/* ---------- stream viewer ---------- */
.view-stream { background: #000; }
.stream-wrap { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; }
.stream-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stream-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink2); text-align: center; padding: 20px; background: #000c; }
.stream-tools { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--bg1); border-top: 1px solid var(--line); }

/* ---------- members ---------- */
.members { width: var(--members-w); background: var(--bg1); overflow-y: auto; padding: 12px 8px; border-left: 1px solid var(--line); }
.members.collapsed { display: none; }
.members h4 { margin: 12px 8px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; width: 100%; border: 0; background: none; text-align: left; color: var(--ink2); }
.member:hover { background: var(--bg3); color: var(--ink); }
.member.off { opacity: .45; }
.member .av { width: 32px; height: 32px; font-size: 13px; }
.member .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .nm small { display: block; color: var(--ink3); font-size: 11.5px; }

/* ---------- modal, menu, toasts ---------- */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px #000a; }
.modal-card.wide { width: min(760px, 100%); }
.modal-card h2 { margin: 0 0 4px; font-size: 20px; }
.modal-card h3 { margin: 22px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-card ol { padding-left: 20px; line-height: 1.6; }
.modal-card .lightbox { max-width: 100%; max-height: 80vh; display: block; margin: auto; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; }
.swatch.sel { border-color: var(--ink); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.seg button.sel { border-color: var(--accent); background: var(--accent-bg); }
.inv-list { margin: 0; padding: 0; list-style: none; }
.inv-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.inv-list code { flex: 1; }
.menu { position: fixed; z-index: 60; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 200px; box-shadow: 0 12px 40px #000a; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; color: var(--ink2); }
.menu button:hover { background: var(--accent); color: var(--accent-ink); }
.menu button.danger { color: var(--danger-ink); }
.menu button.danger:hover { background: var(--live); color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast { background: var(--bg3); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; max-width: 360px; box-shadow: 0 8px 24px #0008; }
.toast.err { border-left-color: var(--live); display: flex; align-items: center; gap: 10px; }
.toast-mood { width: 24px; height: auto; flex: none; }
.st-pre { display: inline-flex; align-items: center; gap: 6px; }
.st-mood { width: 16px; height: auto; }
.scrim { position: fixed; inset: 0; background: #0009; z-index: 20; }
.only-mobile { display: none; }

/* ---------- phones / narrow ---------- */
@media (max-width: 1100px) {
  .members { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; box-shadow: -10px 0 30px #0008; }
  .members.collapsed { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: inline-grid; }
  .rail, .side { position: fixed; top: 0; bottom: 0; z-index: 30; transform: translateX(calc(-100% - var(--rail-w) - 24px)); transition: transform .18s; }
  .rail { left: 0; width: var(--rail-w); }
  .side { left: var(--rail-w); width: min(var(--side-w), calc(100vw - var(--rail-w) - 24px)); }
  .app.nav-open .rail, .app.nav-open .side { transform: none; }
  .msg { padding-right: 12px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .stream-tools .btn { padding: 6px 10px; }
}

/* empty view + small stream rows */
.empty { margin: auto; text-align: center; padding: 24px; max-width: 420px; }
.empty img { width: 74px; height: auto; }
.empty .row { justify-content: center; }
.stream-row .av { width: 24px; height: 24px; font-size: 11px; }

/* desktop app section in Settings */
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.small.warn { color: var(--warn); }

/* ---- batch 1: pictures, replies, reactions, mention badges ---- */
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; pointer-events: none; }
.av-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.av-edit .av { width: 56px; height: 56px; font-size: 20px; }
.ch .badge { flex: none; }

.msg .reply-quote { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 0 2px 56px;
  font-size: 13px; color: var(--ink2); cursor: pointer; position: relative; }
.msg .reply-quote .reply-spine { position: absolute; left: 27px; top: 9px; width: 24px; height: 10px; border-left: 2px solid var(--bg4);
  border-top: 2px solid var(--bg4); border-top-left-radius: 6px; }
.msg .reply-quote .av { width: 16px; height: 16px; font-size: 8px; }
.msg .reply-quote b { font-weight: 600; flex: none; }
.msg .reply-quote .reply-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg .reply-quote:hover .reply-text { color: var(--ink); }
.msg .reply-quote.gone { cursor: default; color: var(--ink3); }
.msg.flash { animation: msgflash 1.6s ease-out; }
@keyframes msgflash { 0%, 30% { background: var(--accent-bg); } 100% { background: transparent; } }

.reply-bar { margin: 0 16px; display: flex; align-items: center; gap: 8px; background: var(--bg1); border-radius: var(--radius) var(--radius) 0 0;
  padding: 4px 6px 4px 14px; font-size: 13px; color: var(--ink2); }
.reply-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .icon-btn { width: 26px; height: 26px; }
.reply-bar .icon-btn svg { width: 14px; height: 14px; }
.composer.replying { border-top-left-radius: 0; border-top-right-radius: 0; }

.msg .reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 7px; border-radius: 8px; border: 1px solid transparent;
  background: var(--bg3); color: var(--ink2); font-size: 13px; line-height: 1; }
.react:hover { border-color: var(--ink3); }
.react.mine { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }
.react .emo { font-size: 15px; }
.react .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.react.add { opacity: 0; padding: 0 5px; }
.react.add svg { width: 15px; height: 15px; }
.msg:hover .react.add, .react.add:focus-visible { opacity: 1; }
@media (hover: none) { .react.add { opacity: 1; } }

.menu.emoji-menu { min-width: 0; display: grid; grid-template-columns: repeat(5, 40px); gap: 2px; }
.menu.emoji-menu button { width: 40px; height: 40px; padding: 0; text-align: center; font-size: 22px; line-height: 40px; }
.menu.emoji-menu button:hover { background: var(--bg3); }

/* ---- direct messages ---- */
.srv.home { display: grid; place-items: center; }
.srv.home img { width: 32px; height: auto; grid-area: 1 / 1; }   /* 8px clear space each side in the 48px button */
.srv.home .mk-w, .srv.home:hover .mk, .srv.home.current .mk { display: none; }
.srv.home:hover .mk-w, .srv.home.current .mk-w { display: block; }
.srv.home:hover, .srv.home.current { background: var(--dissent-orange); }
.server-name.home { cursor: default; }
.server-name.home:hover { background: none; }
.server-name.home .chev { display: none; }
.ch.dm { gap: 10px; padding: 5px 8px; }
.ch.dm .av { width: 32px; height: 32px; font-size: 13px; }
.ch.dm .av .dot { width: 11px; height: 11px; border-width: 2px; }
.ch.dm:hover .av .dot { border-color: var(--bg3); }
.ch.dm.current .av .dot { border-color: var(--bg4); }
.dm-none { margin: 6px 8px; font-size: 13px; color: var(--ink3); line-height: 1.4; }
.composer textarea:disabled { cursor: not-allowed; }

/* ---- batch 3: search, pinned messages, jumping to old messages ---- */
.icon-btn.sel { color: var(--ink); background: var(--bg3); }
.msg .tools .icon-btn.sel { color: var(--accent); background: none; }
.app.panel-open .members { display: none; }
.panel { width: 380px; background: var(--bg1); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); }
.panel-head > svg { width: 18px; height: 18px; color: var(--ink3); flex: none; }
.search-form { margin: 12px 12px 4px; display: flex; align-items: center; gap: 8px; background: var(--bg0); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; flex: none; }
.search-form:focus-within { border-color: var(--accent); }
.search-form svg { width: 16px; height: 16px; color: var(--ink3); flex: none; }
.search-form input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 9px 0; }
.search-scope { margin: 8px 12px 0; flex: none; }
.search-scope .seg { flex-wrap: nowrap; }
.search-scope .seg button { padding: 5px 10px; font-size: 13px; min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hint { margin: 8px 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: none; }
.chip { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink2); }
.chip:hover { color: var(--ink); border-color: var(--ink3); }
.panel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 10px 12px; }
.panel-note { margin: 14px 4px; font-size: 13.5px; }
.panel-count { margin: 8px 4px 2px; }
.panel-empty { text-align: center; padding: 36px 16px; color: var(--ink2); }
.panel-empty svg { width: 34px; height: 34px; color: var(--ink3); }
.hit { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: pointer; }
.hit:hover, .hit:focus-visible { border-color: var(--bg4); background: var(--hover); outline: none; }
.hit-where { display: flex; align-items: center; gap: 3px; margin-bottom: 4px; font-weight: 600; }
.hit-where svg { width: 12px; height: 12px; flex: none; }
.hit-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hit-meta .av { width: 22px; height: 22px; font-size: 10px; flex: none; }
.hit-meta b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hit-meta time { font-size: 12px; color: var(--ink3); white-space: nowrap; }
.hit-body { margin-top: 4px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; color: var(--ink-body); max-height: 8.4em; overflow: hidden; }
.hit-body pre { background: var(--bg0); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin: 4px 0; white-space: pre-wrap; }
.hit-body code { background: var(--bg0); border-radius: 4px; padding: 1px 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.hit-body pre code { padding: 0; background: none; }
.hit-body mark { background: var(--warn-bg); color: var(--warn-text); border-radius: 3px; padding: 0 1px; }
.hit .mention { background: var(--accent-bg); color: var(--accent-text); border-radius: 4px; padding: 0 2px; }
.hit .spoiler { background: #000; color: transparent; border-radius: 4px; }
.hit-file { display: flex; align-items: center; gap: 6px; margin-top: 4px; min-width: 0; overflow-wrap: anywhere; }
.hit-file svg { width: 14px; height: 14px; flex: none; }
.hit-thumb { display: block; margin-top: 6px; max-width: 100%; max-height: 140px; border-radius: 6px; background: var(--bg0); }
.hit-actions { position: absolute; top: 6px; right: 6px; display: none; gap: 4px; }
.hit:hover .hit-actions, .hit:focus-within .hit-actions { display: flex; }
@media (hover: none) { .hit-actions { display: flex; } }
.hit-actions .btn { padding: 3px 9px; font-size: 12.5px; }
.msg .body .pinned { color: var(--ink3); }
.msg .body .pinned svg { width: 13px; height: 13px; vertical-align: -2px; margin-left: 5px; }
.pinned-line { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink3); }
.pinned-line svg { width: 13px; height: 13px; }
.jump-bar { margin: 0 16px 6px; display: flex; align-items: center; gap: 8px; background: var(--accent-bg); border: 1px solid var(--accent); border-radius: 8px; padding: 4px 5px 4px 12px; font-size: 13px; color: var(--accent-text); }
.jump-bar .btn { padding: 4px 10px; font-size: 12.5px; }
@media (max-width: 1100px) {
  .panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; width: min(380px, 100vw); box-shadow: -10px 0 30px #0008; }
}
@media (max-width: 760px) {
  .panel { width: 100vw; border-left: 0; }
  .main-head #main-sub { display: none; }
}

/* ---------- batch 4: status, mutes, new-messages line, topics ---------- */
.av .dot.idle { background: #f0b232; }
.av .dot.dnd { background: #f23f43; }
.av .dot.dnd::after { content: ""; position: absolute; left: 1px; right: 1px; top: 50%; height: 2px; margin-top: -1px; background: var(--bg1); border-radius: 1px; }
.me-card .status-btn { cursor: pointer; }
.me-card .status-btn:hover { box-shadow: 0 0 0 2px var(--accent); }
.me-card .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 10px; vertical-align: -1px; background: var(--ok); }
.sdot.idle { background: #f0b232; }
.sdot.dnd { background: #f23f43; }
.sdot.invisible { background: none; box-shadow: inset 0 0 0 2.5px var(--ink3); }
.ch.muted, .ch.muted.unread { opacity: .5; font-weight: 400; }
.ch.muted.current { opacity: .8; }
.srv.muted { opacity: .55; }
.srv.muted:hover, .srv.muted.current { opacity: 1; }
.new-div { display: flex; align-items: center; margin: 10px 16px 2px; color: #f23f43; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.new-div::before { content: ""; flex: 1; height: 1px; background: #f23f43; }
.new-div span { margin-left: 6px; }
.main-head #main-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---- batch 5: themes ---- */
html[data-theme="ash"] { --bg0: #1e1f22; --bg1: #2b2d31; --bg2: #313338; --bg3: #383a40; --bg4: #41434a; --line: #3f4147;
  --hover: #2e3035; --hover2: #4a4d55; --bg-bar: #232428; --bg-deep: #1e1f22; }
html[data-theme="midnight"] { --bg0: #000; --bg1: #060607; --bg2: #000; --bg3: #151517; --bg4: #202024; --line: #1b1b1e;
  --hover: #0d0d0f; --hover2: #2a2a2f; --bg-bar: #060607; --bg-deep: #0a0a0b; }
html[data-theme="light"] { --bg0: #e3e5e8; --bg1: #f2f3f5; --bg2: #fff; --bg3: #e9ebee; --bg4: #d5d8dc; --line: #dcdfe3;
  --ink: #1f2328; --ink2: #4e5058; --ink3: #6d717a; --ink-body: #2e3338; --hover: #f4f5f7; --hover2: #cfd3d8;
  --bg-bar: #ebedf0; --bg-deep: #fff; --link: #1f6feb; --danger-ink: #c62828; --warn-bg: #fbe3a4; --warn-bg2: #fff6dc;
  --warn-text: #6b4e00; --accent-text: color-mix(in srgb, var(--accent) 75%, #000); --accent-bg: color-mix(in srgb, var(--accent) 16%, #fff);
  color-scheme: light; }
html[data-theme="light"] .menu, html[data-theme="light"] .toast { box-shadow: 0 8px 28px #0003; }
html[data-theme="tint"] { --bg0: hsl(var(--h) calc(32% * var(--k, 1)) 6%); --bg1: hsl(var(--h) calc(26% * var(--k, 1)) 9%); --bg2: hsl(var(--h) calc(22% * var(--k, 1)) 12%);
  --bg3: hsl(var(--h) calc(20% * var(--k, 1)) 17%); --bg4: hsl(var(--h) calc(18% * var(--k, 1)) 22%); --line: hsl(var(--h) calc(18% * var(--k, 1)) 19%); --hover: hsl(var(--h) calc(22% * var(--k, 1)) 14.5%);
  --hover2: hsl(var(--h) calc(18% * var(--k, 1)) 26%); --bg-bar: hsl(var(--h) calc(26% * var(--k, 1)) 7.5%); --bg-deep: hsl(var(--h) calc(30% * var(--k, 1)) 7%); --ink2: hsl(var(--h) calc(12% * var(--k, 1)) 76%); --ink3: hsl(var(--h) calc(9% * var(--k, 1)) 56%); }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.theme-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; background: var(--bg3); border: 2px solid transparent; border-radius: 10px; font-size: 12.5px; color: var(--ink2); }
.theme-tile .chip { width: 100%; height: 30px; border-radius: 6px; border: 1px solid #8884; }
.theme-tile.sel { border-color: var(--accent); color: var(--ink); }
.swatch.def { background: var(--bg3); color: var(--ink2); font-weight: 700; font-size: 12px; border: 2px dashed var(--bg4); }
.swatch.def.sel { border: 2px solid var(--ink); }
.swatches input[type="color"] { width: 34px; height: 30px; padding: 0; border: none; background: none; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---- compact messages ---- */
html.compact .msg { grid-template-columns: 64px 1fr; padding-top: 1px; padding-bottom: 1px; }
html.compact .msg.head { margin-top: 6px; }
html.compact .msg .gutter { justify-content: flex-end; padding-right: 8px; }
html.compact .msg .gutter time { visibility: visible; padding-top: 3px; font-size: 11px; }
html.compact .msg .content { display: block; }
html.compact .msg .meta { display: inline; margin-right: 6px; }
html.compact .msg .body { display: inline; }
html.compact .msg .reply-quote { margin-left: 64px; }

/* ---- profile card ---- */
.clicky { cursor: pointer; }
.msg .meta b.clicky:hover { text-decoration: underline; }
.menu.pcard { width: 300px; padding: 0; overflow: hidden; }
.pc { position: relative; }
.pc-banner { height: 64px; }
.pc .av.big { width: 76px; height: 76px; font-size: 28px; position: absolute; top: 24px; left: 14px; border: 5px solid var(--bg-deep); box-sizing: content-box; }
.pc .av.big .dot { width: 16px; height: 16px; right: 1px; bottom: 1px; border-width: 3px; }
.pc-main { padding: 46px 16px 12px; }
.pc-name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.pc-sub { color: var(--ink2); font-size: 13px; overflow-wrap: anywhere; }
.pc-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--ink2); }
.pc-sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.pc-sec h5 { margin: 0 0 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.pc-about { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-body); }
.pc-dates { display: flex; gap: 20px; flex-wrap: wrap; }
.pc-actions { display: flex; gap: 6px; padding: 0 16px 14px; }
.pc-actions .btn { flex: none; width: auto; min-width: 0; padding-left: 12px; padding-right: 12px; }
.pc-actions .btn.primary { flex: 1; }
.pc-preview { max-width: 300px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-deep); }
.field textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
@media (max-width: 640px) { .menu.pcard { width: calc(100vw - 16px); } }
.field input[type="range"] { padding: 0; background: none; border: none; }
/* batch 6: roles & permissions */
.ch .lock svg { width: 13px; height: 13px; opacity: .6; }
.msg .mention.role, .hit .mention.role { font-weight: 600; }
.rdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.role-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg3); border: 0; border-radius: 6px; padding: 3px 7px; font-size: 12px; color: var(--ink2); }
.role-chip i { width: 9px; height: 9px; border-radius: 50%; }
.role-chip .x { border: 0; background: none; color: var(--ink3); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.role-chip .x:hover { color: var(--ink); }
.role-chip.add { font-size: 14px; font-weight: 700; padding: 1px 9px; cursor: pointer; }
.role-checks { display: flex; flex-direction: column; gap: 0; max-height: 240px; overflow-y: auto; margin: 6px 0; }
.role-checks .check { margin: 5px 0; }
.role-checks .av { width: 24px; height: 24px; font-size: 10px; }
.role-rows { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.role-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: var(--bg2); border-radius: 8px; padding: 10px 12px; color: var(--ink); text-align: left; }
.role-row:hover:not(:disabled) { background: var(--bg3); }
.role-row:disabled { opacity: .6; cursor: default; }
.role-row .nm { font-weight: 600; }
.role-row small { margin-left: auto; text-align: right; }
.role-row svg { width: 14px; height: 14px; flex: none; }
.perm-list { display: flex; flex-direction: column; }
.check.perm { align-items: flex-start; padding: 6px 0; margin: 0; border-bottom: 1px solid var(--line); }
.check.perm input { margin-top: 3px; }
.check.perm small { display: block; color: var(--ink3); font-size: 12px; margin-top: 1px; }
.check.perm.danger b { color: #e5534b; }
.btn.link.back { background: none; padding: 4px 0; color: var(--ink3); }
.btn.link.back:hover { color: var(--ink); }

/* batch 7: server look */
.srv.has-img { overflow: hidden; padding: 0; }
.srv-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; pointer-events: none; }
.srv.big { width: 64px; height: 64px; font-size: 20px; flex: none; }
.icon-row { align-items: center; gap: 12px; margin: 6px 0 14px; }
.side-head.bannered { background: linear-gradient(180deg, var(--banner) 0%, color-mix(in srgb, var(--banner) 55%, var(--bg2)) 100%); }
.side-head.bannered #server-menu-btn { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.cat.kat { cursor: pointer; user-select: none; }
.cat.kat .kchev { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; margin-right: 2px; transition: transform .12s; flex: none; }
.cat.kat.shut .kchev { transform: rotate(-90deg); }
.cat.kat:hover { color: var(--ink); }
.cemoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -6px; }
.body.jumbo .cemoji { width: 48px; height: 48px; vertical-align: middle; }
.react .emo .cemoji { width: 18px; height: 18px; vertical-align: -4px; }
.react .emo.gone { opacity: .6; font-weight: 700; }
.menu.emoji-menu .emoji-sec { grid-column: 1 / -1; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); padding: 6px 4px 2px; }
.menu.emoji-menu .cemo img { width: 26px; height: 26px; object-fit: contain; }
.menu.emoji-menu { max-height: 320px; overflow-y: auto; }
.msg.system .gutter { display: flex; justify-content: center; align-items: flex-start; }
.msg.system .sys-ico { color: var(--ok, #57ab5a); font-size: 18px; line-height: 22px; font-weight: 700; }
.msg.system .sys-line { color: var(--ink2); line-height: 22px; }
.msg.system .sys-line b { color: var(--ink); }
.msg.system .sys-line time { margin-left: 8px; font-size: 12px; color: var(--ink3, var(--ink2)); }
#composer { position: relative; }
.slow-hint { position: absolute; right: 12px; top: -20px; font-size: 12px; color: var(--ink2); background: var(--bg1); padding: 0 6px; border-radius: 6px; pointer-events: auto; }
.slow-hint.wait { color: var(--warn, #c69026); font-weight: 600; }
.role-row.sel { outline: 2px solid var(--accent); }
.role-row .block, .block { display: block; }
.emoji-rows { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; max-height: 50vh; overflow-y: auto; }
.emoji-row { display: flex; align-items: center; gap: 6px; background: var(--bg2); border-radius: 8px; padding: 6px 10px; }
.emoji-row img { width: 32px; height: 32px; object-fit: contain; margin-right: 6px; }
.emoji-row input { flex: 1; min-width: 0; }
.emoji-row .colon { color: var(--ink2); }
.emoji-row .icon-btn { margin-left: 6px; }
.audit-rows { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; max-height: 55vh; overflow-y: auto; }
.audit-row { display: flex; align-items: center; gap: 10px; background: var(--bg2); border-radius: 8px; padding: 8px 10px; }
.audit-row .av { width: 28px; height: 28px; flex: none; }
.audit-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.audit-row time { flex: none; }

/* batch 8: messaging */
.body blockquote, .fwd-body blockquote, .edit-body blockquote, .hit-body blockquote { margin: 2px 0; padding: 0 0 0 10px; border-left: 4px solid var(--line); color: var(--ink2); }
.md-h1 { font-size: 1.5em; font-weight: 700; margin: 6px 0 2px; line-height: 1.25; }
.md-h2 { font-size: 1.25em; font-weight: 700; margin: 5px 0 2px; line-height: 1.25; }
.md-h3 { font-size: 1.08em; font-weight: 700; margin: 4px 0 1px; }
.md-sub { font-size: .8em; color: var(--ink3); }
.body ul, .body ol, .fwd-body ul, .fwd-body ol, .edit-body ul, .edit-body ol, .hit-body ul, .hit-body ol { margin: 2px 0; padding-left: 22px; }
.msg .body button.edited { background: none; border: 0; padding: 0; cursor: pointer; }
.msg .body button.edited:hover { text-decoration: underline; color: var(--ink2); }
.ch.thread { padding: 3px 8px 3px 18px; font-size: 13.5px; }
.ch.thread .spine { width: 10px; height: 12px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 6px; margin-top: -8px; flex: none; }
.thread-up { color: var(--ink2); text-decoration: none; }
.thread-up:hover { color: var(--ink); text-decoration: underline; }
.thread-start .hit { margin-top: 10px; text-align: left; }
.thread-chip { display: flex; align-items: center; gap: 8px; max-width: 460px; margin-top: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); color: var(--ink); text-align: left; cursor: pointer; }
.thread-chip:hover { background: var(--bg3); }
.thread-chip svg { width: 16px; height: 16px; color: var(--ink3); flex: none; }
.thread-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thread-chip .muted { white-space: nowrap; }
.fwd { margin-top: 4px; padding: 4px 0 4px 10px; border-left: 3px solid var(--line); max-width: 560px; }
.fwd-tag { display: flex; align-items: center; gap: 5px; }
.fwd-tag svg { width: 13px; height: 13px; }
.fwd-body { overflow-wrap: anywhere; margin: 2px 0; }
.fwd-from a { color: var(--ink2); }
.fwd-preview { background: var(--bg2); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; overflow-wrap: anywhere; }
.fwd-list { max-height: 280px; overflow-y: auto; }
.fwd-list .role-row.sel, .role-row.sel { outline: 2px solid var(--accent); }
.fwd-list .nm svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.poll { margin-top: 6px; max-width: 460px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.poll-q { font-weight: 700; font-size: 1.05em; overflow-wrap: anywhere; }
.poll-sub { margin: 2px 0 8px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; margin: 5px 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg1); color: var(--ink); text-align: left; overflow: hidden; cursor: pointer; }
.poll-opt:hover:not(:disabled) { border-color: var(--ink3); }
.poll-opt:disabled { cursor: default; }
.poll-opt.sel { border-color: var(--accent); }
.poll-opt.win .poll-text { font-weight: 700; }
.poll-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 22%, transparent); transition: width .3s; pointer-events: none; }
.poll-box { position: relative; width: 16px; height: 16px; flex: none; border: 2px solid var(--ink3); border-radius: 50%; }
.poll.multi .poll-box { border-radius: 4px; }
.poll-opt.sel .poll-box { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--bg1); }
.poll-text { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.poll-pct { position: relative; font-size: 12.5px; color: var(--ink2); white-space: nowrap; }
.poll-foot { margin-top: 6px; }
.poll-foot a { color: var(--ink2); }
.poll-edit-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.poll-edit-row input { flex: 1; }
.edits { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.edit-row { background: var(--bg2); border-radius: 8px; padding: 8px 12px; }
.edit-row.now { outline: 1px solid var(--accent); }
.edit-body { overflow-wrap: anywhere; margin-top: 2px; }
.thread-item { display: flex; align-items: center; gap: 10px; width: 100%; margin: 4px 0; padding: 9px 10px; border: 0; border-radius: 8px; background: var(--bg2); color: var(--ink2); text-align: left; }
.thread-item:hover { background: var(--bg3); }
.thread-item.current { background: var(--bg4); color: var(--ink); }
.thread-item.unread b { color: var(--ink); }
.thread-item > svg { width: 18px; height: 18px; color: var(--ink3); flex: none; }
.thread-item .ti-main { flex: 1; min-width: 0; }
.thread-item b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-start .hit-body { max-height: 14em; }

/* batch 9: voice & play */
.vlim { font-size: 11px; color: var(--ink3, var(--ink2)); background: var(--bg3); border-radius: 4px; padding: 0 5px; font-variant-numeric: tabular-nums; }
.vlim.full { color: var(--live); }
.vstatus { margin: -2px 8px 2px 34px; font-size: 12px; color: var(--ink3, var(--ink2)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vstatus-edit { margin-left: 8px; font-size: 12px; }
.ev-row { margin-bottom: 6px; border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.ev-row.live .name { color: var(--ink); font-weight: 600; }
.lim-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.lim-row input { flex: 1; }
.lim-out { min-width: 80px; text-align: right; }
.pc-game-row { display: flex; gap: 10px; align-items: center; }
.pc-game-row svg { width: 28px; height: 28px; color: var(--accent-text); flex: none; }
.block { display: block; }
.menu.sb-menu { width: 300px; max-width: calc(100vw - 16px); }
.sb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.menu .sb-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; text-align: center; background: var(--bg3); border-radius: 8px; }
.menu .sb-btn.busy { outline: 2px solid var(--accent); }
.sb-emo { font-size: 22px; line-height: 1.1; }
.sb-nm { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-none { padding: 6px 8px; margin: 0; }
.sb-flash { animation: sbflash .9s ease-out; }
@keyframes sbflash { 0% { box-shadow: 0 0 0 3px var(--accent) inset; } 100% { box-shadow: 0 0 0 3px transparent inset; } }
.sound-rows { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; max-height: 50vh; overflow: auto; }
.sound-row { display: flex; gap: 6px; align-items: center; }
.sound-row input { flex: 1; min-width: 0; }
.sound-row .sound-emo { flex: 0 0 52px; text-align: center; }
.stream-vol { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.stream-vol input { width: 110px; }
.ev-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; max-height: 60vh; overflow: auto; }
.ev-card { background: var(--bg3); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.ev-card.live { border-color: var(--live); }
.ev-when { font-size: 13px; color: var(--accent-text); font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ev-name { font-size: 17px; font-weight: 700; }
.ev-desc { color: var(--ink2); white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.ev-where { display: inline-flex; gap: 4px; align-items: center; }
.ev-where svg { width: 14px; height: 14px; }
.ev-who { display: inline-flex; align-items: center; gap: 2px; }
.ev-who .av { width: 20px; height: 20px; font-size: 10px; }
.ev-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.ev-none { padding: 12px 0; }
@media (max-width: 760px) { .stream-vol input { width: 80px; } .menu.sb-menu { width: auto; left: 8px !important; right: 8px; } }

/* batch 10: friends & safety */
.friends-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin: 2px 0 6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink2); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.friends-row:hover { background: var(--hover, rgba(255,255,255,.06)); color: var(--ink); }
.friends-row.current { background: var(--sel, rgba(255,255,255,.1)); color: var(--ink); }
.friends-row .name { flex: 1; }
.friends-row svg { width: 20px; height: 20px; }
.view-friends { overflow-y: auto; }
.fr-wrap { max-width: 760px; padding: 16px 20px; }
.fr-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.fr-tab { border: 0; background: transparent; color: var(--ink2); font: inherit; padding: 5px 12px; border-radius: 6px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.fr-tab:hover { background: var(--hover, rgba(255,255,255,.06)); color: var(--ink); }
.fr-tab.sel { background: var(--sel, rgba(255,255,255,.12)); color: var(--ink); }
.fr-tab .badge { position: static; }
.fr-add { display: flex; gap: 8px; margin-bottom: 16px; }
.fr-add input { flex: 1; min-width: 0; }
.fr-count { margin: 6px 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); }
.fr-none { padding: 24px 0; }
.fr-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line, rgba(255,255,255,.07)); border-radius: 6px; cursor: pointer; }
.fr-row:hover { background: var(--hover, rgba(255,255,255,.05)); }
.fr-row .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-row .nm small { color: var(--ink3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-acts { display: flex; gap: 6px; align-items: center; }
.tmo-tag { margin-left: auto; font-size: 13px; opacity: .8; }
.blocked-msg .content { padding: 2px 0; }
.blocked-msg .linkish { background: none; border: 0; padding: 0; color: var(--ink3); font: inherit; font-style: italic; cursor: pointer; }
.blocked-msg .linkish:hover { text-decoration: underline; color: var(--ink2); }
.ban-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; margin: 8px 0; }
.ban-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--line, rgba(255,255,255,.07)); }
.ban-row .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ban-row .nm small { color: var(--ink3); }
.pw-show { width: 100%; font-family: ui-monospace, monospace; font-size: 18px; letter-spacing: .04em; margin: 8px 0; }
@media (max-width: 700px) { .fr-wrap { padding: 12px; } .fr-row { flex-wrap: wrap; } .fr-acts { width: 100%; justify-content: flex-end; } }

/* batch 11: group DMs, calls, voice messages */
.gdm-ico { width: 32px; height: 32px; border-radius: 50%; background: var(--accent, #5865f2); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; flex: none; }
.gdm-ico svg { width: 18px; height: 18px; }
.ch.dm .name { display: flex; flex-direction: column; min-width: 0; }
.ch.dm .gdm-n { font-size: 11px; opacity: .7; font-weight: 400; }
.call-tag { color: #3ba55d; display: inline-flex; margin-left: auto; }
.call-tag svg { width: 15px; height: 15px; }
#btn-call.live { color: #3ba55d; }
.sys-ico.call { color: #3ba55d; }
.sys-ico.call svg { width: 16px; height: 16px; }
.gdm-list { max-height: 300px; overflow-y: auto; margin: 8px 0; }
.gdm-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.gdm-row:hover { background: rgba(255, 255, 255, .05); }
.gdm-row input { width: auto; margin: 0; }
.ring-card { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center;
  gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--bg2, #2b2d31); box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  border: 1px solid rgba(59, 165, 93, .6); animation: ring-pulse 1.2s ease-in-out infinite; max-width: calc(100vw - 24px); }
.ring-txt { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.ring-txt small { opacity: .75; }
.ring-accept { background: #3ba55d !important; border-color: #3ba55d !important; display: inline-flex; align-items: center; gap: 4px; }
.ring-accept svg { width: 16px; height: 16px; }
@keyframes ring-pulse { 50% { box-shadow: 0 8px 30px rgba(0, 0, 0, .5), 0 0 0 6px rgba(59, 165, 93, .25); } }
.composer.recording #composer-input { visibility: hidden; }
.composer.recording #btn-voice { color: #ed4245; }
.vm-bar { position: absolute; left: 52px; right: 132px; top: 50%; transform: translateY(-50%); display: flex; align-items: center;
  gap: 10px; pointer-events: auto; }
.composer { position: relative; }
.vm-dot { width: 10px; height: 10px; border-radius: 50%; background: #ed4245; animation: vm-blink 1s steps(2) infinite; flex: none; }
.vm-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.vm-hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes vm-blink { 50% { opacity: .25; } }
.att-vm { max-width: 340px; }
.vm { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 20px; background: rgba(255, 255, 255, .06); }
.vm-play { flex: none; }
.vm-prog { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .15); cursor: pointer; overflow: hidden; min-width: 80px; }
.vm-prog i { display: block; height: 100%; width: 0; background: var(--accent, #5865f2); }
.vm-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; min-width: 34px; text-align: right; }

/* batch 12 */
.mic-row { display: flex; align-items: center; gap: 10px; }
.mic-meter { flex: 1; height: 10px; border-radius: 5px; background: var(--bg3); border: 1px solid var(--line); overflow: hidden; }
.mic-fill { height: 100%; width: 0; background: var(--ok, #3ba55d); transition: width 60ms linear; }
.mic-meter.hot .mic-fill { background: var(--danger, #e5534b); }


/* batch 13 */
.thumb-pop { position: fixed; z-index: 70; width: 320px; height: 180px; border-radius: 8px; overflow: hidden;
  background: #000; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); pointer-events: none; }
.thumb-pop img { display: block; width: 100%; height: 100%; object-fit: contain; }
.vp .live-tag { cursor: default; }
.vp .live-tag.watch { cursor: pointer; }
.tile.bb-tile { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--live) 22%, var(--bg3)), var(--bg3) 70%); }
.bb-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.strip .bb-card .btn, .strip .bb-card .muted { display: none; }
.clip-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; max-height: 50vh; overflow: auto; }

/* ---------- batch 14: shop cosmetics ---------- */
.av.deco { --rw: 3px; --ri: -4px; box-shadow: 0 0 10px -2px var(--glow, transparent); }
.av.deco::before { content: ""; position: absolute; inset: var(--ri); border-radius: 50%; background: var(--ring); pointer-events: none; z-index: 1;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + .5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--rw)), #000 calc(100% - var(--rw) + .5px)); }
.av.deco.spin::before { animation: deco-spin var(--spin, 6s) linear infinite; }
.pc .av.big.deco, .av.big.deco { --rw: 5px; --ri: -9px; }
.av.deco .dot { z-index: 2; }
.deco-badge { position: absolute; top: -7px; right: -7px; font-size: 13px; line-height: 1; z-index: 2; pointer-events: none; filter: drop-shadow(0 1px 1px #0008); }
.av.big .deco-badge { font-size: 24px; top: -12px; right: -12px; }
@keyframes deco-spin { to { transform: rotate(1turn); } }
.grad-name { background-image: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.member.plated { background: var(--plate); position: relative; }
.member.plated:hover { background: var(--plate); filter: brightness(1.12); }
.plate-mark { margin-left: auto; font-size: 14px; opacity: .85; pointer-events: none; }
.pc.themed { background: linear-gradient(180deg, var(--pc-a), var(--pc-b)); box-shadow: inset 0 0 0 2px var(--pc-edge); color: #f2f3f5; }
.pc.themed .pc-sub, .pc.themed h5, .pc.themed .muted { color: #fffc; }
.pc.themed .av.big { border-color: var(--pc-a); }
.pc-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.pc-fx span { position: absolute; opacity: 0; animation: fx-twinkle 6s ease-in-out infinite; will-change: transform, opacity; }
.fx-fall span { animation-name: fx-fall; }
.fx-rise span { animation-name: fx-rise; }
.fx-drift span { animation-name: fx-drift; }
@keyframes fx-twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .95; transform: scale(1); } }
@keyframes fx-fall { 0% { opacity: 0; transform: translateY(-120px) rotate(0); } 15%, 80% { opacity: .9; } 100% { opacity: 0; transform: translateY(160px) rotate(220deg); } }
@keyframes fx-rise { 0% { opacity: 0; transform: translateY(120px); } 15%, 80% { opacity: .9; } 100% { opacity: 0; transform: translateY(-160px); } }
@keyframes fx-drift { 0% { opacity: 0; transform: translateX(-40px); } 50% { opacity: .85; } 100% { opacity: 0; transform: translateX(70px); } }
html.reduce-motion .pc-fx span { opacity: .55; }
@media (prefers-reduced-motion: reduce) { .pc-fx span, .av.deco.spin::before { animation: none !important; } .pc-fx span { opacity: .55; } }

/* shop */
.srv.shop-rail { display: grid; place-items: center; margin-top: 8px; color: var(--ok, #3ba55d); }
.srv.shop-rail svg { width: 22px; height: 22px; }
.modal-card.shop-card { width: min(1180px, 100%); height: min(860px, calc(100vh - 32px)); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.shop-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; }
.shop-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.shop-head h2 svg { width: 22px; height: 22px; }
.shop-free { background: var(--ok, #3ba55d); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.shop-search { margin-left: auto; width: min(260px, 40vw); }
.shop-tabs { display: flex; gap: 4px; padding: 0 18px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); flex: none; }
.shop-tab { background: none; border: 0; color: var(--ink2); padding: 7px 12px; border-radius: 8px; white-space: nowrap; font: inherit; cursor: pointer; }
.shop-tab:hover { background: var(--hover); color: var(--ink); }
.shop-tab.sel { background: var(--bg4); color: var(--ink); font-weight: 600; }
.shop-body { flex: 1; min-height: 0; display: flex; }
.shop-body > .shop-grid, .shop-body > .shop-cols { flex: 1; overflow-y: auto; padding: 16px 18px; align-content: start; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.shop-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.shop-hero, .shop-col-head, .shop-mine-head, .shop-empty { grid-column: 1 / -1; }
.shop-hero { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; background: linear-gradient(120deg, var(--accent), #b45cff 60%, #ff5ca8); color: #fff; }
.shop-hero b { font-size: 20px; }
.shop-col { display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: var(--bg3); cursor: pointer; border: 1px solid var(--line); }
.shop-col:hover { border-color: var(--accent); }
.shop-col-hero { height: 110px; display: grid; place-items: center; font-size: 46px; }
.shop-col-info { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 6px; flex: 1; }
.shop-col > .btn { margin: 0 12px 12px; align-self: flex-start; }
.shop-col-head { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; color: #fff; }
.shop-col-title { font-size: 19px; font-weight: 700; flex: 1; text-shadow: 0 1px 3px #000a; }
.shop-mine-head { display: flex; align-items: center; justify-content: space-between; }
.shop-item { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--bg3); border: 2px solid transparent; cursor: pointer; }
.shop-item:hover { border-color: var(--bg4); }
.shop-item.sel { border-color: var(--accent); }
.shop-thumb { height: 104px; border-radius: 8px; background: var(--bg-deep); display: grid; place-items: center; overflow: hidden; position: relative; }
.shop-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.shop-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-price { color: var(--ok, #3ba55d); font-weight: 700; font-size: 13px; }
.shop-price.owned { color: var(--ink3); }
.shop-item .shop-btn { align-self: stretch; }
.shop-av { width: 56px; height: 56px; font-size: 20px; }
.shop-av.deco { --rw: 4px; --ri: -6px; }
.shop-fx { position: absolute; inset: 0; display: grid; place-items: center; }
.shop-plate { width: 90%; pointer-events: none; }
.shop-banner { position: absolute; inset: 0; }
.shop-ptheme { position: absolute; inset: 8px; border-radius: 8px; display: flex; align-items: center; gap: 8px; padding: 10px; }
.shop-ptheme .av { width: 36px; height: 36px; }
.shop-name { font-size: 20px; padding: 0 8px; text-align: center; overflow-wrap: anywhere; }
.shop-theme { position: absolute; inset: 0; }
.shop-theme.big { position: relative; height: 140px; border-radius: 10px; }
.shop-prev { width: 330px; flex: none; border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--bg1); }
.shop-prev-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-prev-head b { font-size: 16px; }
.shop-prev .pc-preview { max-width: none; position: relative; }
.shop-prev-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shop-prev .linkish, .linkish.small { background: none; border: 0; padding: 0; color: var(--link, var(--accent)); cursor: pointer; font: inherit; text-align: left; }
.theme-tile.more .chip { display: grid; place-items: center; background: var(--bg4); }
.theme-tile.more .chip svg { width: 18px; height: 18px; }
@media (max-width: 760px) {
  .modal-card.shop-card { height: calc(100vh - 16px); border-radius: 10px; }
  .modal:has(.shop-card) { padding: 8px; }
  .shop-head { flex-wrap: wrap; padding: 12px 12px 6px; }
  .shop-search { order: 5; width: 100%; margin: 0; }
  .shop-tabs { padding: 0 12px 8px; }
  .shop-body { flex-direction: column; overflow-y: auto; }
  .shop-body > .shop-grid, .shop-body > .shop-cols { overflow: visible; padding: 12px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shop-prev { width: auto; border-left: 0; border-bottom: 1px solid var(--line); order: -1; overflow: visible; }
  .shop-thumb { height: 84px; }
}

/* GIF / sticker picker */
.menu.gifpick { width: min(420px, calc(100vw - 16px)); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.gp-tabs { display: flex; gap: 4px; }
.gp-tab { background: none; border: 0; color: var(--ink2); padding: 6px 10px; border-radius: 6px; font: inherit; cursor: pointer; }
.gp-tab.sel { background: var(--bg4); color: var(--ink); font-weight: 600; }
.gp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-height: min(340px, 50vh); overflow-y: auto; align-content: start; }
.gp-sec { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--ink3); margin-top: 4px; }
.gp-empty { grid-column: 1 / -1; padding: 16px 4px; text-align: center; }
.gp-tile { position: relative; border-radius: 6px; overflow: hidden; background: var(--bg3); aspect-ratio: 1; }
.gp-tile.st { background: transparent; }
.gp-img { display: block; width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.gp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gp-tile.st .gp-img img { object-fit: contain; }
.gp-name { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 2px 4px; background: linear-gradient(transparent, #000b); color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: 0; transition: opacity .12s; }
.gp-tile:hover .gp-name { opacity: 1; }
.gp-star, .gp-del { position: absolute; top: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #000a; color: #fff; cursor: pointer; font-size: 14px; line-height: 24px; padding: 0; opacity: 0; }
.gp-star { right: 3px; }
.gp-star.on { color: #ffd34d; opacity: 1; }
.gp-del { left: 3px; }
.gp-tile:hover .gp-star, .gp-tile:hover .gp-del, .gp-tile:focus-within .gp-star { opacity: 1; }
.gp-foot:empty { display: none; }
@media (hover: none) { .gp-star, .gp-del { opacity: 1; } .gp-name { opacity: 1; } }
.att.has-star { position: relative; display: inline-block; min-width: 44px; min-height: 44px; }
.att-star { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #000a; color: #ffd34d; font-size: 17px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.att.has-star:hover .att-star, .att-star:focus { opacity: 1; }
@media (hover: none) { .att-star { opacity: .85; } }
.msg .att.sticker img { width: 160px; height: 160px; max-width: 160px; object-fit: contain; background: none; cursor: default; border-radius: 0; }

/* reminders + requests */
.toast.act { display: flex; align-items: center; gap: 8px; pointer-events: auto; }
.toast.act .icon-btn svg { width: 16px; height: 16px; }
.saved-tabs { padding: 4px 4px 10px; }
.saved-tabs .btn.sel { border-color: var(--accent); background: var(--accent-bg); }
.rem-row { border-bottom: 1px solid var(--line); padding: 6px 0 8px; }
.rem-row.fired { opacity: .7; }
.rem-when { display: flex; justify-content: space-between; gap: 8px; padding: 0 6px 4px; color: var(--ink2); }
.rem-when .linkish { background: none; border: 0; color: var(--link, var(--accent)); cursor: pointer; font: inherit; padding: 0; }
.req-kinds { margin: 10px 0 4px; }
.req-kinds .btn.sel { border-color: var(--accent); background: var(--accent-bg); }

/* ---- batch 15: security, devices, quick switcher, shortcut sheet */
.av.deleted { filter: grayscale(1); opacity: .6; }
.tfa-on { display: flex; align-items: center; gap: 6px; color: var(--ok); margin: 4px 0 10px; }
.tfa-on svg { width: 18px; height: 18px; flex: none; }
.qr-wrap { display: flex; justify-content: center; margin: 10px 0; }
.qr-wrap canvas.qr { width: 200px; height: 200px; image-rendering: pixelated; border-radius: 8px; }
.tfa-code { font-size: 22px; letter-spacing: .25em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.rec-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; padding: 12px; margin: 10px 0; background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; }
.rec-codes code { font-size: 15px; letter-spacing: .05em; text-align: center; }
.sess-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.sess-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; }
.sess-row > svg { width: 22px; height: 22px; flex: none; color: var(--ink2); }
.sess-row.current { border-color: var(--accent); }
.modal-card.qs-card { width: min(560px, 100%); padding: 14px; align-self: start; margin-top: 10vh; }
.qs-input { width: 100%; font-size: 17px; padding: 12px 14px; }
.qs-list { display: flex; flex-direction: column; margin-top: 8px; max-height: min(420px, 60vh); overflow-y: auto; }
.qs-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; background: none; border: 0; color: var(--ink2); text-align: left; cursor: pointer; font: inherit; min-height: 40px; }
.qs-row.sel { background: var(--hover2); color: var(--ink); }
.qs-row.unread .qs-label { color: var(--ink); font-weight: 600; }
.qs-row > svg { width: 18px; height: 18px; flex: none; color: var(--ink3); }
.qs-row .av { width: 24px; height: 24px; font-size: 10px; flex: none; }
.qs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qs-sub { margin-left: auto; padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.qs-hint, .qs-empty { margin: 8px 4px 0; }
table.keys { width: 100%; border-collapse: collapse; margin: 12px 0; }
table.keys td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.keys td:first-child { white-space: nowrap; width: 1%; padding-right: 18px; color: var(--ink3); }
kbd { display: inline-block; min-width: 22px; padding: 2px 7px; border-radius: 5px; background: var(--bg1); border: 1px solid var(--line); border-bottom-width: 2px; font: 12px ui-monospace, Menlo, Consolas, monospace; color: var(--ink); text-align: center; }

/* ---------- batch 16: Shop 2.0 (animated SVG art, fonts, voice frames, join sounds, custom items) ---------- */
.av img.deco-art { position: absolute; inset: -22%; width: 144%; height: 144%; max-width: none; border-radius: 0; object-fit: contain; z-index: 2; pointer-events: none; }
.av.deco.deco-has-art { box-shadow: none; }
.av.deco.deco-has-art::before { display: none; }
.av.deco-has-art .dot { z-index: 3; }
.pc-fx.fx-art-box { z-index: 3; }
.fx-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.pc-banner.art { height: 100px; }
.pc-banner.art ~ .av.big { top: 60px; }
.member.plated.plate-art .nm, .member.plated.plate-art .nm-t { text-shadow: 0 1px 2px #000c; }
.member.plated.plate-art .grad-name { text-shadow: none; }
.grad-name.grad-anim { background-size: 300% 100%; animation: name-sweep 6s linear infinite; }
@keyframes name-sweep { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
.grad-name.name-glow { filter: drop-shadow(0 0 3px var(--nglow)); }
.pc.themed { background-image: var(--pc-art, none), linear-gradient(180deg, var(--pc-a), var(--pc-b)); }
.messages { background-image: var(--theme-art, none); }
.tile-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.tile-frame.sliced { overflow: hidden; }
.tile-frame.sliced > i { position: absolute; background-repeat: no-repeat; }
.tile.framed .label, .tile.framed .tile-tools { z-index: 3; }
.tile.shop-frame { height: 100%; width: auto; aspect-ratio: 16 / 9; border-radius: 8px; pointer-events: none; }
.tile.shop-frame .av { width: 40px; height: 40px; font-size: 16px; }
.tile.shop-frame .label { font-size: 10px; padding: 1px 5px; left: 5px; bottom: 5px; }
.shop-prev .tile.shop-frame { width: 100%; height: auto; }
.shop-prev .tile.shop-frame .av { width: 64px; height: 64px; font-size: 24px; }
.shop-sound { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg4); color: var(--ink); border: 0; border-radius: 50%;
  width: 72px; height: 72px; justify-content: center; cursor: pointer; font: inherit; font-size: 12px; }
.shop-sound:hover { background: var(--accent); color: var(--accent-ink, #fff); }
.shop-sound svg { width: 22px; height: 22px; }
.shop-sound-big { display: grid; place-items: center; padding: 18px; background: var(--bg-deep); border-radius: 10px; }
.shop-item.legendary { background: linear-gradient(var(--bg3), var(--bg3)) padding-box, linear-gradient(135deg, #ffd166, #ff5ca8, #7b5cff) border-box; border-color: transparent; }
.shop-item.legendary.sel { background: linear-gradient(var(--bg3), var(--bg3)) padding-box, linear-gradient(135deg, var(--accent), var(--accent)) border-box; }
.shop-del { position: absolute; top: 4px; right: 4px; background: #000a; z-index: 4; }
html.reduce-motion .grad-name.grad-anim { animation: none; }
@media (prefers-reduced-motion: reduce) { .grad-name.grad-anim { animation: none; } }

/* ---- batch 17: Shop nav (Featured · Browse ▾ · Collections ▾), spotlight, FREE badges */
.shop-tabs { overflow: visible; flex-wrap: wrap; align-items: center; }
.shop-dd { position: relative; }
.shop-nav::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.shop-dd.open .shop-nav::after { transform: translateY(1px) rotate(-135deg); }
.shop-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 210px; max-height: 60vh; overflow-y: auto;
  background: var(--bg-deep, #111214); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgb(0 0 0 / .45);
  display: flex; flex-direction: column; }
.shop-mi { background: none; border: 0; color: var(--ink2); text-align: left; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; white-space: nowrap; }
.shop-mi:hover, .shop-mi:focus-visible { background: var(--hover); color: var(--ink); }
.shop-mi.sel { color: var(--ink); font-weight: 600; }
.shop-sec-title { grid-column: 1 / -1; font-size: 16px; font-weight: 700; margin: 6px 2px 0; }
.shop-badge { position: absolute; top: 6px; right: 6px; z-index: 3; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: #fff; background: #23a55a; box-shadow: 0 2px 6px rgb(0 0 0 / .35); pointer-events: none; }
.shop-badge.owned { background: rgb(0 0 0 / .6); color: #dbdee1; }
.shop-badge.owned.on { background: var(--accent); color: #fff; }
.shop-item .shop-del { left: 6px; right: auto; }
.shop-col-hero { position: relative; }
.shop-spot { grid-column: 1 / -1; position: relative; border-radius: 14px; overflow: hidden; min-height: 220px; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 16px; padding: 20px; background-size: cover !important; }
.shop-spot::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(0 0 0 / .78), rgb(0 0 0 / .25) 60%, transparent); }
.shop-spot-info { position: relative; display: flex; flex-direction: column; gap: 6px; max-width: 46%; color: #fff; }
.shop-spot-info small { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .8; }
.shop-spot-info b { font-size: 26px; line-height: 1.1; }
.shop-spot-info .btn { align-self: flex-start; margin-top: 6px; }
.shop-spot-items { position: relative; display: grid; grid-template-columns: repeat(2, 132px); gap: 10px; }
.shop-spot-items .shop-thumb { height: 92px; cursor: pointer; background: rgb(0 0 0 / .45); backdrop-filter: blur(4px); }
@media (max-width: 700px) {
  .shop-spot { flex-direction: column; align-items: stretch; min-height: 0; padding: 14px; }
  .shop-spot-info { max-width: none; }
  .shop-spot-items { grid-template-columns: repeat(2, 1fr); }
  .shop-menu { position: fixed; left: 12px; right: 12px; top: auto; min-width: 0; }
}
.shop-cols { grid-auto-rows: max-content; }
.shop-col-hero, .shop-col-info { flex: none; }
.shop-col-info small:first-of-type { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* batch 18: site admin health */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.health-svc { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--bg2, rgba(127,127,127,.08)); }
.health-svc small { margin-left: auto; opacity: .7; }
.health-svc .dot { width: 10px; height: 10px; border-radius: 50%; background: #888; flex: none; }
.health-svc.ok .dot { background: #3ba55d; }
.health-svc.bad .dot { background: #ed4245; }
.health-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.health-stat { padding: 8px 10px; border-radius: 8px; background: var(--bg2, rgba(127,127,127,.08)); display: flex; flex-direction: column; }
.health-stat small { opacity: .7; }
.health-stat b { font-size: 1.2em; }
.health-bar { height: 10px; border-radius: 5px; background: rgba(127,127,127,.2); overflow: hidden; margin: 4px 0; }
.health-bar i { display: block; height: 100%; background: var(--accent, #5b8def); }
.health-bar.bad i { background: #ed4245; }
/* whole-collection buttons + My items collection picker */
.shop-col-btns { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.shop-col-head { flex-wrap: wrap; }
.shop-mine-head { gap: 8px; flex-wrap: wrap; }
.shop-mine-head .muted { margin-right: auto; }
.shop-mine-col { max-width: 260px; }

/* ---- batch 19: game night ---- */
.cmd-card { margin-top: 4px; max-width: 460px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--bg2); }
.cmd-head { font-size: 13px; color: var(--ink2); margin-bottom: 6px; }
.cmd-dice { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.cmd-dice .die { min-width: 30px; height: 30px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg3); border: 1px solid var(--line); font-weight: 700; }
.cmd-dice .die.mod { background: transparent; border-style: dashed; }
.cmd-total { font-size: 15px; }
.cmd-total.big { font-size: 22px; margin: 2px 0 4px; }
.cmd-choices { margin-bottom: 4px; }
.cmd-team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 6px; }
.cmd-team { background: var(--bg3); border-radius: 8px; padding: 8px; }
.cmd-team h5 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; color: var(--ink2); }
.cmd-member { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 2px 0; }
.cmd-member .av { width: 20px; height: 20px; font-size: 10px; }
.cmd-src { font-family: var(--mono, monospace); font-size: 11px; }
.lfg-card { margin-top: 6px; max-width: 460px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.lfg-card.ended { opacity: .65; }
.lfg-top { display: flex; align-items: center; gap: 10px; }
.lfg-ico { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--bg3); color: var(--accent); }
.lfg-ico svg { width: 22px; height: 22px; }
.lfg-game { font-weight: 700; font-size: 15px; }
.lfg-count { font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--bg3); }
.lfg-count.full { background: var(--accent); color: #fff; }
.lfg-people { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 6px; }
.lfg-av .av, .lfg-slot { width: 28px; height: 28px; }
.lfg-slot { display: inline-block; border-radius: 50%; border: 2px dashed var(--line); box-sizing: border-box; }
.lfg-plays { margin-bottom: 6px; }
.lfg-btns { display: flex; align-items: center; gap: 8px; }
.slash-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 20; }
.slash-opt { padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.slash-opt.sel, .slash-opt:hover { background: var(--bg3); }
.pc-game { display: flex; gap: 8px; font-size: 13px; padding: 2px 0; }
.stats-body { min-height: 200px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.stats-board { background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.stats-board h4, .stats-top h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink2); }
.stats-board ol { list-style: none; margin: 0; padding: 0; }
.stats-board li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.stats-board li.me { color: var(--accent); }
.stats-board .rank { width: 18px; text-align: right; color: var(--ink3); font-variant-numeric: tabular-nums; }
.stats-board li .av { width: 22px; height: 22px; font-size: 10px; }
.stats-top { margin-top: 12px; }
.stats-top-msg { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.stats-top-msg .av { width: 24px; height: 24px; }
.recap-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 4px; }
.recap-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px; background: linear-gradient(135deg, var(--bg2), var(--bg3)); }
.recap-tile b { font-size: 22px; }
.recap-tile span { color: var(--ink2); font-size: 13px; }
.recap-tile small { color: var(--accent); }

/* floating call controls over the voice stage */
.stage-ctl { position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 12px); display: flex; gap: 10px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 5; }
.view-voice.ctl-show .stage-ctl, .stage-ctl:has(:focus-visible) { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.stage-ctl-group { display: flex; gap: 2px; padding: 5px; border-radius: 12px; background: rgba(12, 12, 16, .88); border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 6px 24px rgba(0, 0, 0, .45); backdrop-filter: blur(6px); }
.stage-ctl-group[hidden] { display: none; }
.stage-ctl .stage-btn { width: 42px; height: 40px; border-radius: 9px; }
.stage-ctl .stage-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.stage-ctl .stage-btn svg { width: 22px; height: 22px; }
.stage-ctl-group.end { padding: 0; background: none; border: 0; box-shadow: none; }
.stage-ctl-group.end .stage-btn { width: 64px; height: 50px; border-radius: 12px; background: #da373c; color: #fff; }
.stage-ctl-group.end .stage-btn:hover { background: #b52b30; color: #fff; }
.view-voice.ctl-show .audio-unlock { bottom: 90px; }

/* batch 20: forums, announcements, webhooks */
.app-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); margin-left: 6px; vertical-align: 1px; }
.wh-name { color: var(--ink); }
.av.wh-av { background: var(--bg3); color: var(--accent); display: grid; place-items: center; }
.av.wh-av svg { width: 60%; height: 60%; }
.forum-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 8px; }
.forum-head h3 { margin: 0 0 2px; font-size: 20px; }
.forum-head p { margin: 0; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.forum-head + .tag-chips { padding: 0 16px 8px; }
.tag-chip { font: inherit; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: inherit; cursor: pointer; }
.tag-chip.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.forum-post .tag-chip { cursor: inherit; font-size: 11px; padding: 0 8px; }
.forum-post { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: calc(100% - 32px); margin: 0 16px 8px;
  padding: 12px 14px; text-align: left; font: inherit; color: inherit; background: var(--bg3);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.forum-post:hover { border-color: var(--accent); }
.fp-title { font-size: 15px; }
.fp-body { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.forum-none { padding: 24px 16px; }
.hook-row { margin: 8px 0 12px; }
.hook-top { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.hook-top b { flex: 1; }
.hook-top svg { width: 16px; height: 16px; }
/* batch 21: KLIPY GIFs (media streams straight from KLIPY to each viewer; only the link is stored) */
.att.kgif { position: relative; display: inline-block; max-width: min(300px, 100%); border-radius: 8px; overflow: hidden; line-height: 0; background: var(--bg3); }
.kgif-v { display: block; max-width: 100%; height: auto; max-height: 320px; }
.kgif-mark { position: absolute; left: 6px; bottom: 6px; font: 700 9px/1 system-ui, sans-serif; letter-spacing: .08em; color: #fff; background: #0008; padding: 3px 5px; border-radius: 4px; pointer-events: none; }
.gp-powered { margin-left: auto; }
.menu.gifpick .gp-star, .menu.gifpick .gp-del { display: block; width: 24px; padding: 0; text-align: center; border-radius: 50%; background: #000a; color: #fff; }
.menu.gifpick .gp-star.on { color: #ffd34d; }
.menu.gifpick .gp-star:hover, .menu.gifpick .gp-del:hover { background: #000d; color: #ffd34d; }
.menu.gifpick .gp-img:hover { background: none; }
.menu.gifpick .gp-tab { width: auto; white-space: nowrap; text-align: center; padding: 6px 10px; }
.menu.gifpick .gp-tab:hover { background: var(--bg4); color: var(--ink); }
.att.kgif.kst { background: none; border-radius: 0; }
.kgif-st { display: block; max-width: 160px; max-height: 160px; width: auto; height: auto; object-fit: contain; }

/* Voice channel chat beside the voice stage (v=30) */
.main.vsplit { display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto minmax(0, 1fr); }
.main.vsplit > .main-head { grid-column: 1 / -1; }
.main.vsplit > #view-voice { grid-column: 1; grid-row: 2; }
.main.vsplit > #view-text { grid-column: 2; grid-row: 2; border-left: 1px solid var(--line); min-width: 0; }
.main.vsplit > .view[hidden] { display: none; }
.ch .vchat svg { width: 16px; height: 16px; }
@media (max-width: 900px) {
  .main.vsplit { grid-template-columns: minmax(0, 1fr); }
  .main.vsplit > #view-voice { display: none; }
  .main.vsplit > #view-text { grid-column: 1; border-left: 0; }
}

/* Desktop app without the OS title bar (v=31): window buttons sit in the top-right corner (36px tall) */
.wco { --wco-r: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw)); --wco-h: env(titlebar-area-height, 0px); }
.wco .main-head, .wco .side-head, .wco .panel-head { -webkit-app-region: drag; }
.wco .main-head :is(button, input, a, select, [role=button], #main-sub),
.wco .side-head :is(button, input, a, [role=button]), .wco .panel-head :is(button, input, a, select, [role=button]) { -webkit-app-region: no-drag; }
.wco .members { padding-top: calc(var(--wco-h) + 8px); }
.wco .panel-head { padding-right: calc(var(--wco-r) + 8px); }
.wco .app:not(.panel-open):has(.members.collapsed) .main-head { padding-right: calc(var(--wco-r) + 8px); }
.wco body:has(.app:not([hidden]):not(.panel-open) .members:not(.collapsed))::after {
  content: ''; position: fixed; top: 0; right: 0; width: var(--members-w); height: var(--wco-h); -webkit-app-region: drag; }
.wco body:has(#app[hidden])::after { content: ''; position: fixed; inset: 0 0 auto 0; height: var(--wco-h); -webkit-app-region: drag; }
.wco.wctl { --wco-r: 138px; --wco-h: 36px; }
#wctl { position: fixed; top: 0; right: 0; display: flex; z-index: 9000; -webkit-app-region: no-drag; }
#wctl button { width: 46px; height: 36px; border: 0; background: transparent; color: var(--ink2); display: grid; place-items: center; cursor: pointer; }
#wctl button svg { width: 16px; height: 16px; }
#wctl button:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
#wctl .wctl-close:hover { background: #e5484d; color: #fff; }

/* Full emoji picker (v=32) */
.menu.emoji-pick { width: min(400px, calc(100vw - 16px)); height: min(440px, calc(100vh - 80px)); padding: 0; display: grid;
  grid-template-columns: 40px 1fr; grid-template-rows: auto 1fr auto; overflow: hidden; }
.emoji-pick .emo-q { grid-column: 1 / -1; margin: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg1); color: var(--ink); font: inherit; outline: none; }
.emoji-pick .emo-q:focus { border-color: var(--accent); }
.emoji-pick .emo-tabs { grid-row: 2 / 4; display: flex; flex-direction: column; gap: 2px; padding: 4px; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg1); }
.emoji-pick .emo-tabs button { width: 32px; height: 32px; padding: 0; text-align: center; font-size: 18px; line-height: 32px; border-radius: 6px; filter: grayscale(.6); }
.emoji-pick .emo-tabs button:hover { background: var(--bg3); color: inherit; filter: none; }
.emoji-pick .emo-tabs img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }
.emoji-pick .emo-body { overflow-y: auto; padding: 0 8px 8px; min-height: 0; position: relative; }
.emoji-pick .emo-sec { position: sticky; top: 0; background: var(--bg-deep); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); padding: 8px 4px 4px; z-index: 1; }
.emoji-pick .emo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.emoji-pick .emo-grid button { width: 40px; height: 40px; padding: 0; text-align: center; font-size: 26px; line-height: 40px; border-radius: 6px; }
.emoji-pick .emo-grid button:hover { background: var(--bg3); color: inherit; }
.emoji-pick .emo-grid img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
.emoji-pick .emo-foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg1); min-height: 48px; overflow: hidden; }
.emoji-pick .emo-big { font-size: 28px; line-height: 1; } .emoji-pick .emo-big img { width: 28px; height: 28px; object-fit: contain; }
.emoji-pick .emo-name { color: var(--ink2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emoji-pick .emo-none { color: var(--ink3); padding: 24px 8px; text-align: center; }

/* batch 22: rules screen + AutoMod */
.rules-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 16px 8px; padding: 10px 12px;
  border-radius: 8px; background: var(--bg3); color: var(--ink2); font-size: 14px; flex-wrap: wrap; }
.rules-body { max-height: 55vh; overflow: auto; line-height: 1.5; padding: 4px 2px 8px; }
.am-tag { color: var(--live); }
.am-text { display: block; margin-top: 4px; padding: 6px 8px; border-left: 3px solid var(--live); background: var(--bg3); border-radius: 4px;
  white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--ink2); }
.msg.system .sys-ico.am { color: var(--live); }
.am-roles { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* batch 23: code highlighting + markdown tables */
.hl .hl-k { color: #c678dd; }
.hl .hl-s { color: #98c379; }
.hl .hl-n { color: #d19a66; }
.hl .hl-c { color: var(--ink3); font-style: italic; }
.hl .hl-f { color: #61afef; }
.hl .hl-add { color: #98c379; background: rgba(46, 160, 67, .15); display: inline-block; min-width: 100%; }
.hl .hl-del { color: #e06c75; background: rgba(248, 81, 73, .15); display: inline-block; min-width: 100%; }
html[data-theme="light"] .hl .hl-k { color: #a626a4; }
html[data-theme="light"] .hl .hl-s { color: #50a14f; }
html[data-theme="light"] .hl .hl-n { color: #986801; }
html[data-theme="light"] .hl .hl-f { color: #4078f2; }
html[data-theme="light"] .hl .hl-add { color: #2b7a3b; }
html[data-theme="light"] .hl .hl-del { color: #b3261e; }
.md-table { overflow-x: auto; margin: 4px 0; max-width: 100%; }
.md-table table { border-collapse: collapse; font-size: .95em; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; vertical-align: top; }
.md-table th { background: var(--bg3); font-weight: 600; }
.md-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bg3) 40%, transparent); }

/* batch 23: media gallery, scheduled messages, imported messages */
.media-tabs { margin: 4px 0 10px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; max-height: 60vh; overflow-y: auto; }
.media-tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--bg0); cursor: zoom-in; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.media-tile .media-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; filter: drop-shadow(0 1px 3px #000); }
.media-tile .media-play svg { width: 34px; height: 34px; fill: currentColor; }
.media-tile .media-jump { position: absolute; right: 4px; bottom: 4px; font-size: 11px; padding: 2px 7px; border-radius: 4px; border: 0;
  background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; opacity: 0; transition: opacity .12s; }
.media-tile:hover .media-jump, .media-tile:focus-within .media-jump { opacity: 1; }
@media (hover: none) { .media-tile .media-jump { opacity: 1; } }
.media-files { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.media-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.media-file > svg { width: 22px; height: 22px; flex: none; color: var(--ink3); }
.media-file a { word-break: break-all; }
.sched-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; padding: 4px 0 2px; color: var(--ink-body); }
.av.imp-av { color: #fff; font-weight: 600; }
.app-tag.imp-tag { background: var(--bg4); color: var(--ink2); }

/* batch 24: create button, drag-and-drop channels/categories, private categories */
#btn-new-ch { margin-right: 8px; flex: none; }
.side-head.bannered #btn-new-ch { color: #fff; }
.cat .klock { display: inline-flex; margin-right: 4px; opacity: .8; }
.cat .klock svg { width: 12px; height: 12px; }
.ch.dragging, .cat.dragging { opacity: .4; }
.ch.drop-above, .cat.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.ch.drop-below, .cat.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.ch.drop-into, .cat.drop-into { outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: 6px; }
