/* Layout: a switchboard. The join screen is a jack field with lamps lighting up; the room is a grid of
   participant "lines" whose lamps glow while someone talks, a chat strip on the right, a control dock along the bottom. */
:root {
  --bg: #11151d;
  --panel: #181d27;
  --panel-2: #222937;
  --field: #0d1118;
  --line: #2d3545;
  --fg: #ece6d9;
  --dim: #98a1b1;
  --lamp: #f4a62a;
  --lamp-ink: #f6b04a;
  --lamp-glow: rgba(244, 166, 42, .42);
  --on-lamp: #1b1305;
  --danger: #e2574c;
  --danger-soft: rgba(226, 87, 76, .16);
  --on-danger: #fff7f5;
  --ok: #4cbb86; --on-ok: #08140e;
  --jack: #0a0d13;
  --stage-bg: #07090d;
  --scrim: rgba(5, 7, 11, .62);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --lb-bg: rgba(6, 8, 12, .94); --lb-fg: #f3eee4; --lb-line: rgba(243, 238, 228, .3);
  --av-s: 42%; --av-l: 34%; --av-fg: #f3eee4;
  --name-s: 72%; --name-l: 70%;
  --font-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e8ebf0; --panel: #f7f8fa; --panel-2: #e0e4eb; --field: #ffffff; --line: #c8ced9;
    --fg: #151a23; --dim: #576071; --lamp: #f0a020; --lamp-ink: #965700; --lamp-glow: rgba(240, 160, 32, .45);
    --on-lamp: #1b1305; --danger: #c43d33; --danger-soft: rgba(196, 61, 51, .12); --on-danger: #fff7f5; --ok: #1f8a5b; --on-ok: #f4fff9;
    --jack: #c3c9d4; --stage-bg: #10131a; --scrim: rgba(20, 24, 32, .45); --shadow: 0 18px 50px rgba(20, 26, 40, .2);
    --av-s: 55%; --av-l: 80%; --av-fg: #151a23; --name-s: 62%; --name-l: 36%;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #e8ebf0; --panel: #f7f8fa; --panel-2: #e0e4eb; --field: #ffffff; --line: #c8ced9;
  --fg: #151a23; --dim: #576071; --lamp: #f0a020; --lamp-ink: #965700; --lamp-glow: rgba(240, 160, 32, .45);
  --on-lamp: #1b1305; --danger: #c43d33; --danger-soft: rgba(196, 61, 51, .12); --on-danger: #fff7f5; --ok: #1f8a5b; --on-ok: #f4fff9;
  --jack: #c3c9d4; --stage-bg: #10131a; --scrim: rgba(20, 24, 32, .45); --shadow: 0 18px 50px rgba(20, 26, 40, .2);
  --av-s: 55%; --av-l: 80%; --av-fg: #151a23; --name-s: 62%; --name-l: 36%;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--lamp-ink); }

/* ---------- shared form bits ---------- */
.flabel { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.field { display: block; border: 0; padding: 0; margin: 0; min-width: 0; }
.input, select, .field input[type="text"] {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--field); color: var(--fg);
}
select { appearance: auto; }
.row { display: flex; gap: 8px; }
.row > :first-child { flex: 1; min-width: 0; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--dim); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--dim); }
.btn.primary { background: var(--lamp); color: var(--on-lamp); border-color: transparent; height: 50px; font-size: 16px; font-weight: 700; width: 100%; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: .7; cursor: progress; }
.btn.small { height: 34px; padding: 0 10px; font-size: 13px; }
.icon-btn { width: 44px; padding: 0; }
.meter { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.check, .radio { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input, .radio input { margin-top: 4px; accent-color: var(--lamp); width: 16px; height: 16px; flex: none; }
.check b, .radio b { display: block; font-weight: 600; }
.check small, .radio small { display: block; color: var(--dim); font-size: 13px; }

/* ---------- join screen ---------- */
.join {
  min-height: 100%; max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px); align-items: center;
  padding-block: clamp(24px, 6vh, 64px); padding-inline: max(16px, 4vw);
}
.wordmark { margin: 0; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; line-height: .84; letter-spacing: .01em; font-size: clamp(72px, 12vw, 156px); }
.wordmark span { display: block; }
.wordmark .lit { color: var(--lamp-ink); }
.lede { max-width: 34ch; font-size: clamp(17px, 1.6vw, 20px); margin: 22px 0 28px; text-wrap: pretty; }
.jackfield { display: grid; grid-template-columns: repeat(8, 28px); gap: 14px 18px; }
.jack { width: 28px; height: 28px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--jack) 0 38%, var(--panel-2) 40% 100%); box-shadow: inset 0 0 0 2px var(--line); position: relative; }
.jack::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: transparent; transition: background .35s, box-shadow .35s; }
.jack.lit::after { background: var(--lamp); box-shadow: 0 0 12px 3px var(--lamp-glow); }
.strip { margin-top: 16px; font: 600 12px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.join-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow); }
.join-card form { display: grid; gap: 20px; }
.join-card h2 { margin: 0; font: 800 28px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.fineprint { margin: 18px 0 0; font-size: 13px; color: var(--dim); }
.gate { display: grid; gap: 20px; }
.quick { display: grid; gap: 18px; }
.quick h2 { margin: 0; font: 800 28px/1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.quick-hint { margin: -8px 0 0; }
.quick .link-btn { justify-self: center; }
.profiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 380px; overflow-y: auto; }
.profile { display: flex; align-items: center; gap: 6px; }
.profile-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); text-align: left; }
.profile-go:hover { border-color: var(--lamp); }
.profile-go:disabled { opacity: .65; cursor: progress; }
.profile-go .mini-av { width: 44px; height: 44px; font-size: 17px; }
.profile-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.profile-text b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-sub { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-arrow { display: grid; color: var(--dim); }
.profile-arrow .ic { transform: rotate(-90deg); }
.profile-x { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--dim); }
.profile-x:hover { background: var(--panel-2); color: var(--danger); }
.profile-x .ic { width: 16px; height: 16px; }
.join-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.av-pick { display: flex; align-items: center; gap: 14px; }
.av-btn { position: relative; flex: none; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%; background: none; }
.av-btn .mini-av { width: 64px; height: 64px; font-size: 24px; }
.av-cam { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--lamp); color: var(--on-lamp); border: 2px solid var(--panel); }
.av-cam .ic { width: 14px; height: 14px; }
.av-pick-text { min-width: 0; display: grid; gap: 2px; justify-items: start; }
.av-pick-text small { color: var(--dim); font-size: 13px; }
.av-pick-text .link-btn { padding-left: 0; }
.av-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.gate-head { display: flex; align-items: center; gap: 12px; }
.gate-ic { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--lamp); color: var(--on-lamp); }
.gate-text { margin: -8px 0 0; font-size: 15px; }
.link-btn { justify-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; background: transparent; color: var(--dim); font-size: 13px; }
.link-btn:hover { color: var(--fg); text-decoration: underline; }
.link-btn .ic { width: 14px; height: 14px; }
.mic-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mic-row select { flex: 1 1 200px; min-width: 0; }
@media (max-width: 860px) {
  .join { grid-template-columns: 1fr; align-items: start; }
  .lede { margin-bottom: 20px; }
  .jackfield { grid-template-columns: repeat(8, 22px); gap: 10px 12px; }
  .jack { width: 22px; height: 22px; } .jack::after { inset: 7px; }
}

/* ---------- room: server layout ----------
   Layout: channel sidebar on the left (server name, text channels, voice channels with who is in each),
   the open channel fills the rest, and your own mic and headphone controls sit bottom-left. */
.app { height: 100%; display: grid; grid-template-columns: 344px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "side main" "user main"; }
.side { grid-area: side; min-height: 0; display: grid; grid-template-columns: 72px minmax(0, 1fr); background: var(--panel); border-right: 1px solid var(--line); }
.side-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.rail { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; background: var(--field); border-right: 1px solid var(--line); overflow-y: auto; }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; justify-items: center; }
.rail-item { position: relative; }
.rail-item::before { content: ""; position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--fg); transform: translateY(-50%); transition: height .15s; }
.rail-item:hover::before { height: 18px; }
.rail-item.current::before { height: 40px; }
.rail-btn { width: 48px; height: 48px; border: 0; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--h, 30) var(--av-s) var(--av-l)); color: var(--av-fg); font: 800 17px/1 var(--font-display); letter-spacing: .04em; transition: border-radius .15s; }
.rail-btn:hover, .rail-btn[aria-current="true"] { border-radius: 16px; }
.rail-btn[aria-current="true"] { box-shadow: 0 0 0 2px var(--lamp); }
.rail-btn:disabled { cursor: progress; }
.rail-btn .ic { width: 22px; height: 22px; }
.rail-btn.rail-home { background: var(--panel-2); color: var(--lamp-ink); }
.rail-btn.rail-home[aria-current="true"] { background: var(--lamp); color: var(--on-lamp); }
.app.home .server-head, .app.home .conn-line, .app.home .channels, .app.home #copyInvite { display: none; }
.side-home { display: none; }
.app.home .side-home { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 8px 16px; overflow-y: auto; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); font-size: 16px; font-weight: 600; text-align: left; }
.nav-item:hover, .nav-item[aria-current="true"] { background: var(--panel-2); color: var(--fg); }
.nav-item .ic { width: 22px; height: 22px; }
.nav-item .count-pill { margin-left: auto; }
.dm-head { margin-top: 14px; }
.cat-label { color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.dm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.dm-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); font-size: 15px; font-weight: 500; text-align: left; --dot-ring: var(--panel); }
.dm-item:hover, .dm-item[aria-current="true"] { background: var(--panel-2); color: var(--fg); --dot-ring: var(--panel-2); }
.dm-item.unread { color: var(--fg); font-weight: 700; }
.dm-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-home-text { margin: 4px 10px 0; color: var(--dim); font-size: 13px; }
.av-wrap { position: relative; flex: none; display: inline-grid; }
.av-wrap .mini-av { width: 32px; height: 32px; font-size: 13px; }
.status-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px var(--dot-ring, var(--panel)); }
.status-dot.on { background: var(--ok); }
.rail-badge { position: absolute; right: -5px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: var(--on-danger); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 3px var(--field); pointer-events: none; }
.rail-item.joined::before { height: 8px; }
.view-home { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.friends-page, .dm-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px clamp(16px, 2.5vw, 28px); border-bottom: 1px solid var(--line); }
.tab { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); font-size: 14px; font-weight: 600; }
.tab:hover, .tab[aria-selected="true"] { background: var(--panel-2); color: var(--fg); }
.tab-add { background: var(--ok); color: var(--on-ok); }
.tab-add:hover { background: var(--ok); color: var(--on-ok); filter: brightness(1.06); }
.tab-add[aria-selected="true"] { background: transparent; color: var(--ok); }
.tab-dev { margin-left: auto; }
.tab-dev .ic { width: 16px; height: 16px; }
.fr-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px clamp(16px, 2.5vw, 28px) 32px; }
.fr-scroll > * { max-width: 760px; }
.fr-section-title { margin: 16px 0 6px; color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.fr-list { list-style: none; margin: 0; padding: 0; display: grid; }
.fr-row { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 0 8px; border-top: 1px solid var(--line); border-radius: 8px; --dot-ring: var(--bg); }
.fr-row:hover { background: var(--panel); --dot-ring: var(--panel); }
.fr-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.fr-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-text span { font-size: 13px; color: var(--dim); }
.fr-actions { display: flex; gap: 8px; }
.fr-act { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.fr-act:hover { border-color: var(--dim); }
.fr-act.ok:hover { color: var(--ok); border-color: var(--ok); }
.fr-act.no:hover { color: var(--danger); border-color: var(--danger); }
.fr-act .ic { width: 18px; height: 18px; }
.fr-empty { margin: 0; padding: 10px 8px; color: var(--dim); }
.fr-add { padding-top: 16px; }
.fr-add h2 { margin: 0 0 6px; font: 800 26px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: .02em; }
.fr-add-text { margin: 0 0 14px; color: var(--dim); max-width: 62ch; }
.fr-add-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fr-add-row .input { flex: 1 1 220px; min-width: 0; height: 46px; }
.fr-add-row .btn.primary { width: auto; height: 46px; padding: 0 18px; font-size: 15px; }
.fr-note { margin: 10px 0 0; color: var(--ok); font-weight: 600; }
.fr-note.bad { color: var(--danger); }
.home-servers-box { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.home-servers-box .fr-section-title { margin-bottom: 0; }
.home-empty { margin: 0; color: var(--dim); }
.home-servers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.home-server { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
.home-server:hover { border-color: var(--lamp); }
.home-server .rail-btn { width: 42px; height: 42px; flex: none; border-radius: 12px; font-size: 15px; }
.home-server-text { min-width: 0; display: grid; gap: 2px; }
.home-server-text b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-server-text span { font-size: 13px; color: var(--dim); }
.home-servers-box > .btn { justify-self: start; }
.dm-intro { --dot-ring: var(--bg); }
.dm-intro .av-wrap { margin-bottom: 12px; }
.dm-intro .av-wrap .mini-av { width: 72px; height: 72px; font-size: 28px; }
.dm-intro .status-dot { width: 18px; height: 18px; right: 1px; bottom: 1px; box-shadow: 0 0 0 4px var(--bg); }
.dm-pending { grid-column: 2; font-size: 12px; color: var(--dim); font-style: italic; }
.pop-friend { width: 100%; margin-top: 10px; }
.join-invite { margin: -8px 0 0; color: var(--lamp-ink); font-weight: 600; }
.rail-sep { width: 32px; height: 2px; flex: none; border-radius: 1px; background: var(--line); }
.rail-add { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border: 1px dashed var(--dim); border-radius: 50%; background: var(--panel); color: var(--ok); transition: border-radius .15s; }
.rail-add:hover { border-radius: 16px; border-style: solid; border-color: transparent; background: var(--ok); color: var(--on-ok); }
.switching { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding-inline: 16px; background: var(--scrim); }
.switch-card { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; }
.spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--lamp); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#addServer { width: min(440px, calc(100% - 32px)); }
.main { grid-area: main; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.user-area { grid-area: user; display: grid; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--field); border-right: 1px solid var(--line); border-top: 1px solid var(--line); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.warn { background: var(--lamp); }
.dot.bad { background: var(--danger); }
.dot.off { background: var(--dim); }

/* server header + menu */
.server-head { position: relative; border-bottom: 1px solid var(--line); }
.server-btn { width: 100%; height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 0 16px; border: 0; background: transparent; font: 800 23px/1 var(--font-display); text-transform: uppercase; letter-spacing: .03em; text-align: left; }
.server-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-btn:hover { background: var(--panel-2); }
.server-btn .ic { transition: transform .15s; }
.server-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.menu { position: absolute; z-index: 35; top: 58px; left: 8px; right: 8px; padding: 6px; display: grid; gap: 2px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); box-shadow: var(--shadow); }
.menu button { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; font-weight: 600; text-align: left; }
.menu button:hover { background: var(--panel-2); }
.menu .danger { color: var(--danger); }
.conn-line { display: flex; align-items: center; gap: 7px; margin: 0; padding: 10px 16px 0; font-size: 12px; color: var(--dim); white-space: nowrap; }

/* channel list */
.channels { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 16px; }
.cat { margin-top: 16px; }
.cat-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px 4px; }
.cat-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; border: 0; background: transparent; color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.cat-toggle .ic { width: 12px; height: 12px; transition: transform .15s; }
.cat-toggle[aria-expanded="false"] .ic { transform: rotate(-90deg); }
.cat-toggle:hover, .cat-add:hover { color: var(--fg); }
.cat-add { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--dim); }
.cat-add .ic { width: 16px; height: 16px; }
.cat-new { padding: 2px 2px 6px; }
.cat-new input { width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--lamp); background: var(--field); }
.chan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chan { width: 100%; min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); font-size: 16px; font-weight: 500; text-align: left; }
.chan:hover { background: var(--panel-2); color: var(--fg); }
.chan[aria-current="true"] { background: var(--panel-2); color: var(--fg); font-weight: 600; }
.chan.unread { color: var(--fg); font-weight: 700; }
.glyph { width: 20px; flex: none; text-align: center; font: 600 21px/1 var(--font-mono); color: var(--dim); }
.chan .ic { width: 20px; height: 20px; color: var(--dim); }
.chan.in-voice .ic { color: var(--ok); }
.chan-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--on-danger); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.chan-live { font: 700 10px/1 var(--font-mono); letter-spacing: .08em; padding: 3px 5px; border-radius: 4px; background: var(--danger); color: var(--on-danger); }
.members { list-style: none; margin: 0 0 4px; padding: 0 0 0 28px; display: grid; gap: 1px; }
.member { width: 100%; min-height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); font-size: 14px; text-align: left; }
button.member:hover { background: var(--panel-2); color: var(--fg); }
.member.is-me { color: var(--fg); }
.member-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .ic { width: 15px; height: 15px; color: var(--danger); }
.mini-av { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: hsl(var(--h, 30) var(--av-s) var(--av-l)); color: var(--av-fg); font: 800 11px/1 var(--font-display); letter-spacing: .02em; transition: box-shadow .12s; }
.speaking > .mini-av { box-shadow: 0 0 0 2px var(--lamp), 0 0 12px 2px var(--lamp-glow); }

/* bottom-left: voice connection + your controls */
.voice-status { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 2px 2px 8px 6px; border-bottom: 1px solid var(--line); }
.vs-text { min-width: 0; display: grid; }
.vs-state { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ok); }
.vs-state .ic { width: 16px; height: 16px; }
.vs-chan { min-width: 0; padding: 0; border: 0; background: transparent; color: var(--dim); font-size: 13px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-chan:hover { color: var(--fg); text-decoration: underline; }
.vs-btns { display: flex; gap: 2px; }
.user-bar { display: flex; align-items: center; gap: 2px; }
.ub { position: relative; width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--fg); touch-action: manipulation; }
.ub:hover { background: var(--panel-2); }
.ub.off { color: var(--danger); }
.ub.on { background: var(--lamp); color: var(--on-lamp); }
.ub.active { color: var(--lamp-ink); }
.ub.danger { color: var(--danger); }
.ub.danger:hover { background: var(--danger-soft); }
.ub:disabled { opacity: .4; cursor: not-allowed; }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.me:hover { background: var(--panel-2); }
.me .mini-av { width: 34px; height: 34px; font-size: 14px; }
.me-text { min-width: 0; display: grid; line-height: 1.25; }
.me-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-status { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-status.bad { color: var(--danger); font-weight: 600; }
.ptt-hold { height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-weight: 700; user-select: none; -webkit-user-select: none; touch-action: none; }
.ptt-hold.held { background: var(--lamp); color: var(--on-lamp); border-color: transparent; }

/* main header */
.main-head { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.drawer-btn { display: none; }
.dot-badge { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.view-icon { flex: none; display: grid; place-items: center; color: var(--dim); font: 600 24px/1 var(--font-mono); }
.view-icon .ic { width: 22px; height: 22px; }
.view-title { margin: 0; min-width: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-sub { flex: 1; min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { margin-left: auto; display: flex; gap: 8px; }
.notice-row { display: flex; justify-content: center; padding: 10px 16px 0; }

/* mic check section */
.micpanel { width: calc(100% - 32px); max-width: 780px; margin: 12px auto 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); }
.micpanel.bad { border-color: var(--danger); background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--panel); }
.mp-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--fg); }
.micpanel.bad .mp-icon { background: var(--danger); color: var(--on-danger); }
.micpanel.ok .mp-icon { background: var(--ok); color: var(--on-ok); }
.mp-main { min-width: 0; }
.mp-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.mp-text { margin: 3px 0 0; }
.mp-steps { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 4px; }
.mp-steps li::marker { font: 600 13px var(--font-mono); color: var(--dim); }
.mp-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.mp-controls select { flex: 1 1 220px; min-width: 0; height: 38px; }
.mp-controls .btn { height: 38px; }
.mp-meter-label { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--dim); }
.mp-meter-label + .meter { margin-top: 6px; }
.mp-note { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--danger); }
.mp-note.good { color: var(--ok); }

/* text channel view: big chat */
.view-text { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.messages { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 8px clamp(16px, 2.5vw, 28px) 12px; display: flex; flex-direction: column; }
.messages > :first-child { margin-top: auto; }  /* short chats sit just above the message box, like a real chat */
.chan-intro { padding: 28px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.chan-intro .glyph-big { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); font: 600 34px/1 var(--font-mono); color: var(--fg); margin-bottom: 12px; }
.chan-intro h2 { margin: 0; font: 800 clamp(30px, 4vw, 42px)/1.05 var(--font-display); letter-spacing: .01em; text-wrap: balance; }
.chan-intro p { margin: 8px 0 0; max-width: 62ch; color: var(--dim); }
.msg { display: grid; grid-template-columns: 42px minmax(0, 1fr); column-gap: 14px; padding-top: 16px; min-width: 0; }
.msg > .mini-av { grid-row: 1 / span 3; width: 42px; height: 42px; font-size: 16px; }
.msg.cont { padding-top: 3px; }
.msg.cont > .mini-av, .msg.cont .msg-head { display: none; }
.msg-head, .msg-body, .msg-media { grid-column: 2; min-width: 0; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-name { font-weight: 700; color: hsl(var(--h, 30) var(--name-s) var(--name-l)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { flex: none; font: 11px var(--font-mono); color: var(--dim); font-variant-numeric: tabular-nums; }
.msg-body { font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-media { margin-top: 6px; }
.media-btn { display: block; max-width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.media-img { display: block; max-width: min(100%, 460px); max-height: 360px; width: auto; height: auto; border-radius: 10px; background: var(--panel-2); }
.media-video { display: block; width: min(100%, 520px); max-height: 380px; border-radius: 10px; background: var(--stage-bg); }
.media-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; font-size: 12px; color: var(--dim); }
.media-meta.bad { color: var(--danger); }
.media-meta a { font-weight: 600; }
.media-pending { width: min(100%, 340px); display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; }
.media-pending.bad { border-color: var(--danger); color: var(--danger); }
.bar { height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--lamp); transition: width .15s linear; }
.sys { padding: 12px 0 0 56px; font-size: 13px; color: var(--dim); }
.composer { padding: 0 clamp(16px, 2.5vw, 28px) 16px; }
.composer-box { display: grid; gap: 6px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.composer-box:focus-within { border-color: var(--dim); }
.composer-row { display: flex; align-items: flex-end; gap: 4px; }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 220px; min-height: 38px; padding: 9px 4px; border: 0; background: transparent; font-size: 15.5px; line-height: 1.4; }
.composer textarea:focus-visible { outline: none; }
.tray { display: flex; gap: 8px; overflow-x: auto; padding: 4px; }
.att { position: relative; flex: none; width: 116px; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.att img, .att video { display: block; width: 116px; height: 86px; object-fit: cover; background: var(--stage-bg); }
.att-name { display: block; padding: 4px 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--danger); color: var(--on-danger); }
.att-x .ic { width: 14px; height: 14px; }
.dropzone { position: absolute; inset: 10px; z-index: 5; display: grid; place-items: center; border: 2px dashed var(--lamp); border-radius: 16px; background: var(--panel); color: var(--lamp-ink); font: 800 30px/1 var(--font-display); text-transform: uppercase; letter-spacing: .03em; pointer-events: none; }

/* voice channel view */
.view-voice { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px; overflow: auto; }
.view-voice.has-stage { overflow: hidden; }
.tiles { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 300px)); justify-content: center; align-content: center; gap: 14px; }
.tile { position: relative; aspect-ratio: 16 / 10; min-width: 0; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; transition: border-color .15s, box-shadow .15s; }
.tile.dim { opacity: .6; }
.avatar { width: clamp(52px, 30%, 84px); aspect-ratio: 1; border-radius: 50%; background: hsl(var(--h, 30) var(--av-s) var(--av-l)); color: var(--av-fg); display: grid; place-items: center; font: 800 clamp(20px, 2.4vw, 30px)/1 var(--font-display); letter-spacing: .03em; transition: box-shadow .15s; }
.tile.speaking { border-color: var(--lamp); }
.tile.speaking .avatar { box-shadow: 0 0 0 3px var(--lamp), 0 0 26px 6px var(--lamp-glow); }
.lamp { position: absolute; top: 10px; left: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--jack); box-shadow: inset 0 0 0 2px var(--line); transition: background .12s, box-shadow .12s; }
.tile.speaking .lamp { background: var(--lamp); box-shadow: 0 0 10px 2px var(--lamp-glow); }
.tile-meta { position: absolute; left: 12px; bottom: 9px; right: 76px; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.tile-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-badges { position: absolute; right: 9px; bottom: 9px; display: flex; gap: 5px; align-items: center; }
.tb { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); }
.tb .ic { width: 14px; height: 14px; }
.live { font: 700 11px/1 var(--font-mono); letter-spacing: .1em; padding: 6px 7px; border-radius: 6px; background: var(--danger); color: var(--on-danger); border: 0; }
.tile-vol { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.tile-vol:hover { background: var(--panel-2); color: var(--fg); }
.tile:hover .tile-vol, .tile-vol:focus-visible { opacity: 1; }
@media (hover: none) { .tile-vol { opacity: 1; } }
.crowd-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--lamp); background: var(--panel); }
.crowd-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--lamp); color: var(--on-lamp); }
.crowd-ic .ic { width: 18px; height: 18px; }
.crowd-text { flex: 1 1 260px; min-width: 0; font-size: 14px; }
.alone, .voice-empty { margin: 0 auto; max-width: 46ch; text-align: center; color: var(--dim); font-size: 14px; display: grid; justify-items: center; gap: 10px; }
.voice-empty { margin: auto; }
.voice-empty p { margin: 0; font-size: 16px; }
.row-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stage { flex: 1; min-height: 240px; display: flex; flex-direction: column; background: var(--stage-bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; flex-wrap: wrap; background: var(--panel); border-bottom: 1px solid var(--line); }
.stage-title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-title small { font-weight: 500; color: var(--dim); margin-left: 8px; }
.stage-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-view { flex: 1; min-height: 0; position: relative; display: grid; }
.stage video { width: 100%; height: 100%; min-height: 0; object-fit: contain; background: var(--stage-bg); }
.stage-wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 14px; }
.has-stage .tiles { flex: none; display: flex; overflow-x: auto; justify-content: flex-start; align-content: start; gap: 10px; padding-bottom: 4px; }
.has-stage .tile { width: 150px; flex: none; }
.has-stage .avatar { width: 40px; font-size: 17px; }
.has-stage .tile-sub, .has-stage .tile-vol, .has-stage .live, .has-stage .alone { display: none; }
.has-stage .tile-meta { right: 44px; bottom: 6px; left: 8px; font-size: 13px; }
.has-stage .tile-badges { right: 6px; bottom: 6px; }

/* photo viewer */
.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px); background: var(--lb-bg); color: var(--lb-fg); }
.lb-bar { display: flex; align-items: center; gap: 10px; }
.lb-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-btn { background: transparent; color: var(--lb-fg); border-color: var(--lb-line); text-decoration: none; }
.lightbox img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; border-radius: 8px; }

/* phones: the channel list slides in from the left */
.drawer-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "user"; }
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(92vw, 380px); padding-top: env(safe-area-inset-top, 0px); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .app.drawer-open .side { transform: none; }
  .drawer-btn { display: grid; margin-left: -8px; }
  .user-area { border-right: 0; }
  .view-sub, .hide-sm { display: none; }
  .sys { padding-left: 0; }
  .msg { grid-template-columns: 36px minmax(0, 1fr); column-gap: 10px; }
  .msg > .mini-av { width: 36px; height: 36px; font-size: 14px; }
}
@media (max-width: 600px) { .micpanel { grid-template-columns: minmax(0, 1fr) auto; } .mp-icon { display: none; } }

/* ---------- dialog, popover, toasts ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--fg); padding: 0; width: min(520px, calc(100% - 32px)); max-height: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: var(--scrim); }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 22px; }
.set-head h2 { margin: 0; font: 800 26px/1 var(--font-display); text-transform: uppercase; letter-spacing: .03em; }
.set-body { display: grid; gap: 18px; padding: 8px 22px 22px; }
.set-body fieldset { display: grid; gap: 10px; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.keys dd { margin: 0; color: var(--dim); }
kbd { font: 600 12px var(--font-mono); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--field); }
.popover { position: fixed; z-index: 40; width: 240px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 12px; }
.pop-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; color: var(--dim); }
.pop-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--lamp); }
.pop-row output { font: 12px var(--font-mono); font-variant-numeric: tabular-nums; }
.levels { display: grid; gap: 16px; }
.level { display: grid; gap: 6px; }
.level-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; }
.level-head output { font: 600 13px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--lamp-ink); }
.level-head output.boost { color: var(--danger); }
.level input[type="range"] { width: 100%; accent-color: var(--lamp); margin: 0; }
.level small { color: var(--dim); font-size: 13px; }
.level .meter { margin-top: 2px; }
.mp-level { margin-top: 14px; max-width: 420px; }
.pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.popover { width: 270px; }
.mini-av.has-img, .avatar.has-img { background-size: cover; background-position: center; color: transparent; }
.avatar.has-img .initials { visibility: hidden; }
.idcode { flex: none; display: inline-block; margin-left: 5px; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--line); font: 600 10px/1.2 var(--font-mono); letter-spacing: .04em; color: var(--dim); vertical-align: 1px; }
.pop-id { margin: 0; font-size: 12px; line-height: 1.4; color: var(--dim); }
.pop-id.warn { color: var(--danger); font-weight: 600; }
.crown { display: inline-grid; place-items: center; margin-left: 5px; color: var(--lamp-ink); vertical-align: -2px; flex: none; }
.crown .ic { width: 14px; height: 14px; }
.pop-admin { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop-admin .flabel { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--lamp-ink); }
.pop-admin .flabel .ic { width: 14px; height: 14px; }
.pop-admin .btn { justify-content: flex-start; }
.adm-danger { color: var(--danger); }
.adm-danger:hover { border-color: var(--danger); }
#confirmDlg { width: min(420px, calc(100% - 32px)); }
.cf { display: grid; gap: 10px; padding: 22px; }
.cf h2 { margin: 0; font-size: 19px; font-weight: 700; text-wrap: balance; }
.cf p { margin: 0; color: var(--dim); }
.cf-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.cf-ok { background: var(--danger); color: var(--on-danger); border-color: transparent; }
.msg { position: relative; }
.msg-del { position: absolute; top: 12px; right: 0; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--danger); opacity: 0; transition: opacity .12s; }
.msg.cont .msg-del { top: 0; }
.msg:hover .msg-del, .msg-del:focus-visible { opacity: 1; }
.msg-del .ic { width: 15px; height: 15px; }
@media (hover: none) { .msg-del { opacity: .75; } }
.chan-list li { position: relative; }
.chan-del { position: absolute; right: 4px; top: 5px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: var(--panel-2); color: var(--danger); opacity: 0; }
.chan-list li:hover > .chan-del, .chan-del:focus-visible { opacity: 1; }
.chan-del .ic { width: 14px; height: 14px; }
@media (hover: none) { .chan-del { opacity: .75; } }
.count-pill { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--on-danger); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
#feedback { width: min(600px, calc(100% - 32px)); }
.fb-form { display: grid; gap: 14px; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.fb-kind { position: relative; }
.fb-kind input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kind span { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; cursor: pointer; }
.fb-kind input:checked + span { background: var(--lamp); color: var(--on-lamp); border-color: transparent; }
.fb-kind input:focus-visible + span { outline: 2px solid var(--lamp); outline-offset: 2px; }
.fb-text { width: 100%; min-height: 120px; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); line-height: 1.45; }
.fb-note { margin: 0; font-size: 13px; color: var(--dim); }
.fb-note.good { color: var(--ok); font-weight: 600; }
.fb-section { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.fb-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-section-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.fb-item { display: grid; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.fb-item.new { border-color: var(--lamp); }
.fb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--dim); }
.fb-meta b { color: var(--fg); font-size: 13px; }
.fb-pill { font: 700 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 4px 6px; border-radius: 5px; background: var(--panel-2); color: var(--fg); }
.fb-pill.bug { background: var(--danger); color: var(--on-danger); }
.fb-pill.idea { background: var(--lamp); color: var(--on-lamp); }
.fb-body { font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-status { font-size: 12px; font-weight: 600; color: var(--dim); }
.fb-status.done { color: var(--ok); }
.fb-del { justify-self: start; padding-left: 0; }
.fb-empty { margin: 0; color: var(--dim); font-size: 14px; }
.fb-owner summary { cursor: pointer; color: var(--dim); font-size: 13px; }
.fb-owner summary:hover { color: var(--fg); }
.fb-owner[open] summary { margin-bottom: 12px; }
.fb-owner-on { display: grid; gap: 6px; justify-items: start; }
.fb-owner-on .link-btn { justify-self: start; padding-left: 0; }
.afk-bar { width: calc(100% - 32px); max-width: 780px; margin: 12px auto 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--lamp); background: var(--panel); }
.afk-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--lamp); color: var(--on-lamp); }
.afk-text { flex: 1 1 220px; min-width: 0; font-weight: 600; }
.afk-text b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--lamp-ink); }
.toasts { position: fixed; z-index: 50; top: calc(env(safe-area-inset-top, 0px) + 64px); right: 16px; display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; animation: toast-in .2s ease-out; }
.toast span { flex: 1; }
.toast .btn { pointer-events: auto; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- server version additions ---------- */
.auth-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.auth-tabs .tab { height: 38px; font-size: 15px; }
#authForm { display: grid; gap: 20px; }
.offline-bar { width: calc(100% - 32px); max-width: 780px; margin: 12px auto 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--danger); background: var(--panel); font-weight: 600; }
.as-form { display: grid; gap: 6px; }
.as-form + .as-form { padding-top: 16px; border-top: 1px solid var(--line); }
.pw-box summary { cursor: pointer; color: var(--dim); font-size: 14px; font-weight: 600; }
.pw-box summary:hover { color: var(--fg); }
.pw-form { display: grid; gap: 8px; margin-top: 10px; }
.pop-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pop-who .mini-av { width: 40px; height: 40px; font-size: 16px; }
.pop-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pop-btns .btn { flex: 1; }
.view-voice .join-voice { width: auto; padding: 0 22px; }
#joinVoiceRow { flex: none; }
.msg-tools { position: absolute; top: 12px; right: 0; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.msg.cont .msg-tools { top: 0; }
.msg:hover .msg-tools, .msg-tools:focus-within { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: .75; } }
.msg-tool { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--dim); }
.msg-tool:hover { color: var(--fg); }
.msg-tool.del { color: var(--danger); }
.msg-tool .ic { width: 15px; height: 15px; }
.msg-edited { font-size: 11px; color: var(--dim); margin-left: 4px; }
.msg-editbox { grid-column: 2; display: grid; gap: 6px; }
.msg-editbox textarea { width: 100%; min-height: 60px; resize: vertical; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--lamp); background: var(--field); }
.msg-editbox small { color: var(--dim); }
.msg.pending { opacity: .55; }
.load-more { align-self: center; margin: 8px 0; }
.member .mini-av.has-img, .tile .avatar.has-img { color: transparent; }
.status-ring { --dot-ring: var(--panel); }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-opt span { display: grid; place-items: center; height: 36px; border-radius: 9px; font-weight: 600; color: var(--dim); cursor: pointer; }
.theme-opt input:checked + span { background: var(--lamp); color: var(--on-lamp); }
.theme-opt input:focus-visible + span { outline: 2px solid var(--lamp); outline-offset: 2px; }
.theme-toggle { position: fixed; z-index: 5; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--fg); }
.theme-toggle:hover { border-color: var(--dim); }

/* ---------- mentions, replies, reactions, typing, search ---------- */
.mention { display: inline; padding: 0 3px; border: 0; border-radius: 4px; background: var(--lamp-glow); color: var(--lamp-ink); font-weight: 600; font: inherit; font-weight: 600; cursor: pointer; }
.mention:hover { text-decoration: underline; }
.msg.mentioned { background: linear-gradient(90deg, var(--lamp-glow), transparent 70%); box-shadow: inset 2px 0 0 var(--lamp); margin-inline: calc(-1 * clamp(16px, 2.5vw, 28px)); padding-inline: clamp(16px, 2.5vw, 28px); }
.msg.flash { animation: flash 2s ease-out; }
@keyframes flash { 0%, 40% { background: var(--lamp-glow); } 100% { background: transparent; } }
.msg-reply { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 0 2px; padding: 0 0 0 20px; border: 0; background: none; color: var(--dim); font-size: 13px; text-align: left; position: relative; }
.msg-reply::before { content: ""; position: absolute; left: 20px; top: 50%; width: 28px; height: 10px; margin-left: -14px; border-left: 2px solid var(--line); border-top: 2px solid var(--line); border-top-left-radius: 6px; }
.msg-reply > * { position: relative; }
.msg-reply .mini-av { width: 16px; height: 16px; font-size: 8px; margin-left: 22px; }
.msg-reply b { color: var(--fg); font-weight: 600; flex: none; }
.msg-reply span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reply:hover span { color: var(--fg); }
.msg.has-reply > .mini-av { grid-row: 2 / span 3; }
.msg.has-reply { padding-top: 12px; }
.reactions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction { height: 26px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.reaction:hover { border-color: var(--dim); }
.reaction.mine { border-color: var(--lamp); background: var(--lamp-glow); }
.reaction.add { color: var(--dim); opacity: 0; transition: opacity .12s; }
.reaction.add .ic { width: 15px; height: 15px; }
.msg:hover .reaction.add, .reaction.add:focus-visible { opacity: 1; }
@media (hover: none) { .reaction.add { opacity: 1; } }
.emoji-pop { position: fixed; z-index: 45; display: grid; grid-template-columns: repeat(6, 38px); gap: 2px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.emoji-pop button { width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 21px; line-height: 1; }
.emoji-pop button:hover, .emoji-pop button:focus-visible { background: var(--panel-2); }
.composer { position: relative; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 8px; font-size: 13px; color: var(--dim); }
.reply-bar .ic { width: 16px; height: 16px; }
.reply-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-x { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--panel-2); color: var(--fg); }
.reply-x .ic { width: 14px; height: 14px; }
.mention-pop { position: absolute; left: clamp(16px, 2.5vw, 28px); right: clamp(16px, 2.5vw, 28px); bottom: calc(100% - 8px); z-index: 6; list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); max-width: 420px; }
.mention-pop li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.mention-pop li[aria-selected="true"], .mention-pop li:hover { background: var(--panel-2); }
.typing-line { min-height: 20px; padding: 0 clamp(16px, 2.5vw, 28px); font-size: 12px; font-weight: 600; color: var(--dim); }
.main { position: relative; }
.search-panel { position: absolute; z-index: 30; top: 54px; right: 0; width: min(520px, 100%); max-height: calc(100% - 54px); display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--panel); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); border-bottom-left-radius: 14px; }
.search-form { display: flex; gap: 6px; }
.search-form .input { flex: 1; min-width: 0; }
.search-results { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 6px; }
.search-hit { width: 100%; display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); text-align: left; }
.search-hit:hover { border-color: var(--lamp); }
.search-head { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.search-head span { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 4.5em; overflow: hidden; }
.tile.has-cam { overflow: hidden; background: var(--stage-bg); }
.tile-cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.tile-cam.mirror { transform: scaleX(-1); }
.tile.has-cam .tile-meta { left: 8px; bottom: 6px; padding: 2px 8px; border-radius: 8px; background: rgba(6, 8, 12, .62); color: #f3eee4; right: auto; max-width: calc(100% - 90px); }
.tile.has-cam .tile-sub { color: #c7cbd3; }
.tile.has-cam .lamp { z-index: 1; }
.tile.has-cam.speaking { box-shadow: 0 0 0 3px var(--lamp), 0 0 22px 4px var(--lamp-glow); }
.tile-badges, .tile-vol { z-index: 1; }
.tb.cam { background: var(--panel-2); color: var(--fg); }
.voice-status { grid-template-columns: minmax(0, 1fr) auto; }
.vs-btns .ub { width: 34px; }

/* ---------- developer panel ---------- */
.dev-panel { width: min(1000px, calc(100% - 32px)); height: min(760px, calc(100% - 32px)); }
.dev-panel[open] { display: flex; flex-direction: column; }
.dev-tabs { padding: 4px 22px 10px; border-bottom: 1px solid var(--line); }
.dev-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 22px 22px; display: grid; gap: 12px; align-content: start; }
.dev-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.dev-card { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); }
.dev-card b { font: 700 22px/1.2 var(--font-mono); }
.dev-card small { color: var(--dim); font-size: 12px; }
.dev-card.bad { border-color: var(--danger); }
.dev-label { color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dev-h { margin: 8px 0 0; font-size: 15px; }
.dev-chan { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); }
.dev-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dev-list { margin: 0; padding-left: 18px; font-size: 14px; }
.dev-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; font-size: 14px; }
.dev-facts li { display: flex; gap: 8px; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.dev-facts span { color: var(--dim); }
.dev-facts b { text-align: right; overflow-wrap: anywhere; }
.dev-facts .bad b, .dev-table .bad { color: var(--danger); font-weight: 700; }
.dev-table { width: 100%; border-collapse: collapse; font: 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.dev-table th { text-align: left; color: var(--dim); font: 700 11px var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dev-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dev-body { overflow-x: auto; }
.dev-actions { justify-content: flex-start; }
.dev-actions .btn { flex: none; }
.dev-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; }
.dev-log li { display: grid; grid-template-columns: 120px 56px 110px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 6px; }
.dev-log.small li { grid-template-columns: 70px 56px minmax(0, 1fr); }
.dev-log li:nth-child(odd) { background: var(--field); }
.dev-log time { font: 12px var(--font-mono); color: var(--dim); }
.dev-log b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-text { overflow-wrap: anywhere; }
.dev-kind { font: 700 10px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; text-align: center; border-radius: 4px; background: var(--panel-2); }
.k-voice .dev-kind { background: var(--lamp); color: var(--on-lamp); }
.k-error .dev-kind { background: var(--danger); color: var(--on-danger); }
@media (max-width: 700px) { .dev-log li { grid-template-columns: 1fr; gap: 0; } }
.dev-search { max-width: 320px; height: 38px; }
.dev-name { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-body); font-weight: 600; }
.dev-name .mini-av { width: 26px; height: 26px; font-size: 11px; }
.dev-table td.ok { color: var(--ok); font-weight: 700; }
.dev-acts .btn + .btn { margin-left: 6px; }
