:root {
  --bg0: #111215;
  --bg1: #17191D;
  --bg2: #1D1F24;
  --bg3: #25282E;
  --bg-input: #111215;
  --line: #2C2F36;
  --line-strong: #4A4E57;
  --text: #E7E8EA;
  --text-2: #C3C6CB;
  --muted: #A0A5AD;
  --faint: #8A9099;
  --accent: #E3A13B;
  --accent-hover: #F0B85E;
  --accent-ink: #111215;
  --accent-soft: #2E2717;
  --accent-line: #5A4724;
  --mention-bg: #26231B;
  --green: #3FB27F;
  --red: #C9655B;
  --red-text: #E08A80;
  --red-soft: #2A1C1A;
  --red-line: #6A3A35;
  --s1: #17191D;
  --s2: #1D1F24;
  --hover: #202328;
  --msg-hover: #1A1C20;
  --bg-deep: #131518;
  --ctl-hover: #30343B;
  --warm: #221E15;
  --mention-strong: #3A2F18;
  --chat-size: 15px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { background: var(--bg2); color: var(--text); font: 15px/1.45 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2C2F36; border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shared controls ---------- */
.btn { height: 38px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg3); font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--bg3); }
.btn.danger { background: var(--red-soft); border-color: var(--red-line); color: var(--red-text); }
.btn.green { background: var(--green); border-color: var(--green); color: var(--accent-ink); font-weight: 600; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn { width: 34px; height: 34px; border-radius: 6px; border: none; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.icon-btn.on { background: var(--bg3); color: var(--text); }
.icon-btn.bad { color: var(--red-text); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .field input, .field select, .field textarea { height: 40px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text); font-size: 15px; font-weight: 400; outline: none; width: 100%; }
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-line); }
.help { font-size: 12px; color: var(--faint); font-weight: 400; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 100%; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.role { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .03em; }
.role.host { background: var(--accent-soft); color: var(--accent); }
.role.admin { background: #1B2733; color: #8EC0EC; }
.role.member { background: var(--bg3); color: var(--text-2); }

/* ---------- avatar ---------- */
.av { position: relative; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--accent-ink); font-weight: 700; flex: none; background-size: cover; background-position: center; user-select: none; }
.av .dot { --dot-cut: var(--bg1); position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 10px; min-height: 10px; border-radius: 50%; border: 2px solid var(--bg1); box-sizing: content-box; background: var(--green); }
.av.speaking { box-shadow: 0 0 0 2px var(--green); }

/* ---------- connect screen ---------- */
.connect { height: 100%; display: flex; flex-direction: column; background: var(--bg1); overflow: auto; }
.topbar { height: 56px; padding: 0 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex: none; }
.logo { width: 28px; height: 28px; border-radius: 8px; }
.connect-body { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 40px 24px; display: flex; flex-wrap: wrap; gap: 24px; align-content: flex-start; }
.connect-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.connect-side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; }
.panel { padding: 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; gap: 14px; }
.panel.warm { border-color: var(--accent-line); background: var(--warm); }
.panel h2 { margin: 0; font-size: 16px; font-weight: 600; }
.server-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.server-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--bg2); border-bottom: 1px solid var(--line); }
.server-row:last-child { border-bottom: none; }
.server-icon { flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--bg3); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; background: var(--bg2); }
h1.page { margin: 0; font-size: 22px; font-weight: 600; }

/* ---------- app layout ---------- */
.app { height: 100%; display: flex; }
.rail { flex: 0 0 72px; background: var(--bg0); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.rail-item { position: relative; display: flex; align-items: center; }
.rail-btn { width: 48px; height: 48px; border-radius: 24px; border: none; background: var(--bg2); color: var(--text); font-weight: 600; display: flex; align-items: center; justify-content: center; transition: border-radius .15s, background .15s; }
.rail-btn:hover, .rail-btn.active { border-radius: 14px; }
.rail-btn.active { background: var(--accent); color: var(--accent-ink); }
.rail-btn.dashed { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.rail-pill { position: absolute; left: -12px; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text); transition: height .18s ease; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.dot .rail-pill { height: 8px; }
.rail-item.active .rail-pill { height: 32px; }
.rail-sep { width: 32px; height: 2px; background: var(--line); margin: 4px 0; }
.rail .badge { position: absolute; right: -4px; bottom: -4px; border: 2px solid var(--bg0); min-width: 20px; height: 20px; }

.side { flex: 0 0 248px; background: var(--bg1); display: flex; flex-direction: column; min-height: 0; }
.side-head { height: 56px; padding: 0 16px; border: none; border-bottom: 1px solid var(--line); background: transparent; display: flex; align-items: center; gap: 8px; text-align: left; flex: none; width: 100%; }
.side-head .name { font-weight: 600; display: block; }
.side-scroll { flex: 1; overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.cat { display: flex; justify-content: space-between; align-items: center; padding: 12px 8px 6px; }
.cat:first-child { padding-top: 4px; }
.cat .icon-btn { width: 22px; height: 22px; }
.cat svg.i { width: 14px; height: 14px; }
.ch { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px; border-radius: 6px; border: none; background: transparent; color: var(--muted); text-align: left; width: 100%; }
.ch:hover { background: var(--hover); color: var(--text); }
.ch.active { background: var(--bg3); color: var(--text); font-weight: 600; }
.ch.unread { color: var(--text); font-weight: 600; }
.ch .ico { color: var(--faint); }
.ch .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vlist { display: flex; flex-direction: column; gap: 2px; padding: 0 0 4px 34px; }
.vuser { display: flex; align-items: center; gap: 8px; height: 28px; font-size: 13px; color: var(--muted); }
.vuser span.n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; border: none; background: transparent; color: var(--text); width: 100%; text-align: left; }
.dm-row:hover { background: var(--hover); }
.dm-row.active { background: var(--bg3); }
.dm-row .meta { flex: 1; min-width: 0; }
.dm-row .meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voicebar { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.userbar { padding: 8px 10px; background: var(--bg-deep); display: flex; align-items: center; gap: 6px; }
.userbar .who { flex: 1; min-width: 0; border: none; background: transparent; text-align: left; padding: 2px 4px; border-radius: 6px; display: flex; align-items: center; gap: 8px; }
.userbar .who:hover { background: var(--bg3); }
.userbar .icon-btn { width: 32px; height: 32px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg2); position: relative; }
.head { min-height: 56px; padding: 8px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex: none; }
.head h1 { margin: 0; font-size: 16px; font-weight: 600; white-space: nowrap; }
.head .topic { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head .vsep { width: 1px; height: 20px; background: var(--line); }
.search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px; background: var(--bg0); color: var(--faint); font-size: 13px; }
.search input { width: 140px; border: none; background: transparent; outline: none; color: var(--text); }

.messages { flex: 1; overflow-y: auto; padding: 8px 0 16px; display: flex; flex-direction: column; }
.messages .spacer { flex: 1; }
.chan-start { padding: 24px 16px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.chan-start h2 { margin: 8px 0 4px; font-size: 22px; }
.day { display: flex; align-items: center; gap: 12px; padding: 12px 16px 4px; font-size: 12px; color: var(--faint); }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: flex; gap: 14px; padding: 2px 16px; }
.msg.first { margin-top: 12px; padding-top: 4px; }
.msg:hover { background: var(--msg-hover); }
.msg.mentioned { background: var(--mention-bg); box-shadow: inset 2px 0 0 var(--accent); }
.msg .gutter { flex: 0 0 40px; display: flex; justify-content: center; }
.msg .gutter time { visibility: hidden; font-family: var(--mono); font-size: 10px; color: var(--faint); padding-top: 4px; }
.msg:hover .gutter time { visibility: visible; }
.msg .body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 600; border: none; background: none; padding: 0; cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .ts { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.msg .text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: var(--chat-size, 15px); }
.msg .edited { font-size: 11px; color: var(--faint); }
.msg .reply-ref { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mention { color: var(--accent); background: var(--mention-strong); padding: 0 3px; border-radius: 3px; }
.msg .tools { position: absolute; right: 16px; top: -14px; display: none; background: var(--bg1); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.msg:hover .tools { display: flex; }
.msg .tools .icon-btn { width: 30px; height: 30px; }
.msg.pending { opacity: .55; }
.att-img { display: block; max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: var(--bg1); }
.att-video { display: block; max-width: min(480px, 100%); max-height: 320px; border-radius: 8px; border: 1px solid var(--line); background: #000; }
.att-file { display: flex; align-items: center; gap: 12px; width: 380px; max-width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg1); }
.att-file .fname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.reacts { display: flex; flex-wrap: wrap; gap: 6px; }
.react { height: 26px; padding: 0 8px; border-radius: 13px; border: 1px solid var(--line); background: var(--bg3); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.react.mine { border-color: var(--accent-line); background: var(--accent-soft); }
.load-more { align-self: center; margin: 8px; }

.typing { height: 20px; padding: 0 16px; font-size: 12px; color: var(--faint); flex: none; }
.composer-wrap { padding: 0 16px 16px; flex: none; }
.composer-extra { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 10px; background: var(--bg1); border-radius: 8px 8px 0 0; border: 1px solid var(--line); border-bottom: none; font-size: 13px; color: var(--muted); align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 6px; background: var(--bg3); color: var(--text); max-width: 260px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .icon-btn { width: 24px; height: 24px; }
.composer { display: flex; align-items: flex-end; gap: 8px; min-height: 48px; padding: 6px 8px; border-radius: 8px; background: var(--bg3); }
.composer-extra + .composer { border-radius: 0 0 8px 8px; }
.composer textarea { flex: 1; min-width: 0; min-height: 36px; max-height: 200px; padding: 7px 4px; border: none; background: transparent; outline: none; resize: none; font-size: 15px; line-height: 1.45; }
.composer .send { background: var(--accent); color: var(--accent-ink); }
.composer .send:hover { background: var(--accent-hover); color: var(--accent-ink); }
.progress { height: 6px; border-radius: 3px; background: var(--bg0); overflow: hidden; flex: 1; min-width: 80px; }
.progress div { height: 100%; background: var(--accent); }
.drop-hint { position: absolute; inset: 0; background: rgba(17,18,21,.85); border: 2px dashed var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; z-index: 20; pointer-events: none; }

.members { flex: 0 0 240px; background: var(--bg1); padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 8px; border-radius: 6px; border: none; background: transparent; width: 100%; text-align: left; }
.member:hover { background: var(--hover); }
.member.off { color: var(--faint); }
.member .meta { min-width: 0; }
.member .meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- voice view ---------- */
.voice { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg0); }
.stage { flex: 1; min-height: 0; padding: 20px; display: flex; gap: 16px; }
.stage-main { flex: 1; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: #000; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.stage-main video { width: 100%; height: 100%; object-fit: contain; }
.stage-label { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; }
.stage-label span { font-size: 13px; padding: 4px 8px; border-radius: 4px; background: var(--bg0); }
.stage-label .live { background: var(--red); color: var(--accent-ink); font-weight: 600; font-size: 12px; }
.stage-tools { position: absolute; right: 12px; top: 12px; display: flex; gap: 6px; }
.tiles { display: grid; gap: 12px; align-content: center; }
.tiles.side-strip { flex: 0 0 240px; grid-template-columns: 1fr; overflow-y: auto; align-content: start; }
.tiles.grid { flex: 1; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tile { min-height: 150px; border-radius: 12px; background: var(--bg2); border: 2px solid var(--line); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: default; }
.tile.speaking { border-color: var(--green); animation: speakPulse 1.4s ease-out infinite; }
.tile.clickable { cursor: pointer; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .nm { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; background: var(--bg0); font-size: 13px; }
.controls { padding: 14px 20px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; flex: none; }
.ctl { width: 52px; height: 52px; border-radius: 26px; border: none; background: var(--bg3); color: var(--text); display: flex; align-items: center; justify-content: center; }
.ctl:hover { background: var(--ctl-hover); }
.ctl.off { background: var(--red-soft); color: var(--red-text); }
.ctl svg.i { width: 22px; height: 22px; }
.ctl.wide { width: auto; padding: 0 18px; gap: 8px; font-weight: 600; }
.ctl.accent { background: var(--accent); color: var(--accent-ink); }
.ctl.leave { width: auto; padding: 0 20px; background: var(--red); color: var(--accent-ink); font-weight: 600; }

/* ---------- modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,9,11,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px; }
.dialog { width: 440px; max-width: 100%; max-height: 100%; overflow: auto; border-radius: 12px; background: var(--s2); border: 1px solid var(--line); display: flex; flex-direction: column; }
.dialog-head { padding: 20px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.dialog-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg1); }
.option:has(input:checked) { border-color: var(--accent-line); background: var(--warm); }
.option input { accent-color: var(--accent); }

.fullpage { position: fixed; inset: 0; background: var(--s2); display: flex; z-index: 40; }
.fp-nav { flex: 0 0 260px; background: var(--s1); padding: 32px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.fp-nav button { height: 36px; padding: 0 10px; border-radius: 6px; border: none; background: transparent; color: var(--muted); text-align: left; }
.fp-nav button:hover { background: var(--hover); color: var(--text); }
.fp-nav button.active { background: var(--bg3); color: var(--text); font-weight: 600; }
.fp-nav button.bad { color: var(--red-text); }
.fp-nav .section-label { padding: 0 10px 8px; }
.fp-nav .section-label:not(:first-child) { padding-top: 18px; }
.fp-nav hr { border: none; height: 1px; background: var(--line); margin: 14px 10px; }
.fp-main { flex: 1; min-width: 0; overflow-y: auto; padding: 32px 40px 80px; position: relative; }
.fp-close { position: absolute; right: 24px; top: 24px; width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.fp-close:hover { color: var(--text); }
.fp-content { max-width: 720px; display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > * { flex: 1 1 240px; }
.savebar { position: sticky; bottom: 0; margin-top: 8px; padding: 12px 16px; border-radius: 8px; background: var(--bg0); display: flex; align-items: center; gap: 12px; }
.meter { height: 10px; border-radius: 5px; background: var(--bg0); overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--green); transition: width .05s; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 8px; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
th { background: var(--bg1); color: var(--faint); font-size: 12px; text-align: left; font-weight: 600; padding: 10px 14px; }
td { padding: 10px 14px; border-top: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin: 0; }
.stats dt { font-size: 12px; color: var(--faint); }
.stats dd { margin: 4px 0 0; font-family: var(--mono); font-size: 15px; overflow-wrap: anywhere; }
.kbd { font-family: var(--mono); font-size: 13px; padding: 0 12px; height: 32px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg0); }

.card { width: 300px; border-radius: 12px; background: var(--s1); border: 1px solid var(--line); overflow: hidden; box-shadow: 0 12px 32px rgba(0,0,0,.4); }
.card .banner { height: 72px; background-size: cover; background-position: center; }
.card .inner { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.card .inner > .av { margin-top: -32px; border: 4px solid var(--bg1); }
.card hr { border: none; height: 1px; background: var(--line); margin: 0; width: 100%; }
.popover { position: fixed; z-index: 60; }

.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.screen-opt { border: 2px solid var(--line); border-radius: 8px; background: var(--bg1); padding: 6px; text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.screen-opt img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; background: #000; }
.screen-opt.on { border-color: var(--accent); }
.screen-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(8,9,11,.9); display: flex; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

#toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--s1); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 380px; font-size: 14px; }
.toast.bad { background: var(--red-soft); border-color: var(--red-line); }
.status-dot { width: 8px; height: 8px; border-radius: 4px; flex: none; }
.banner-bar { padding: 8px 16px; background: var(--red-soft); border-bottom: 1px solid var(--red-line); color: var(--text); font-size: 14px; display: flex; align-items: center; gap: 12px; }

@media (max-width: 900px) {
  .members { display: none; }
  .side { flex-basis: 220px; }
}
@media (max-width: 760px) {
  .fullpage { flex-direction: column; }
  .fp-nav { flex: none; padding: max(16px, env(safe-area-inset-top)) 12px 12px; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .fp-nav .section-label, .fp-nav hr, .fp-nav > span { display: none; }
  .fp-nav button { height: 34px; padding: 0 12px; border-radius: 17px; background: var(--bg3); }
  .fp-main { padding: 20px 16px calc(80px + env(safe-area-inset-bottom)); }
  .fp-close { top: max(14px, env(safe-area-inset-top)); right: 14px; }
  .stage { flex-direction: column; padding: 12px; }
  .tiles.side-strip { flex: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .tile { min-height: 110px; }
  .row > * { flex-basis: 100%; }
}

/* ---------- motion ---------- */
.btn, .icon-btn, .ctl, .ch, .member, .dm-row, .react, .swatch, .screen-opt, .fp-nav button, .side-head, .userbar .who {
  transition: background-color .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .08s ease;
}
.btn:active:not(:disabled), .icon-btn:active, .ctl:active, .react:active, .rail-btn:active { transform: scale(.96); }
.av { transition: box-shadow .15s ease; }
.tile { transition: border-color .15s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes tileIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes speakPulse { 0% { box-shadow: 0 0 0 0 rgba(63,178,127,.45); } 70% { box-shadow: 0 0 0 8px rgba(63,178,127,0); } 100% { box-shadow: 0 0 0 0 rgba(63,178,127,0); } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.msg.enter { animation: msgIn .18s ease-out; }
.messages.switch-in { animation: fadeIn .16s ease-out; }
.overlay { animation: fadeIn .14s ease-out; }
.dialog { animation: popIn .16s cubic-bezier(.2,.8,.3,1); }
.fullpage { animation: fadeIn .14s ease-out; }
.fullpage .fp-content { animation: popIn .2s cubic-bezier(.2,.8,.3,1); }
.popover > * { animation: popIn .14s cubic-bezier(.2,.8,.3,1); transform-origin: top left; }
.toast { animation: toastIn .2s cubic-bezier(.2,.8,.3,1); }
.toast.leaving { animation: toastOut .18s ease-in forwards; }
.lightbox { animation: fadeIn .15s ease-out; }
.lightbox img { animation: popIn .18s cubic-bezier(.2,.8,.3,1); }
.drop-hint { animation: fadeIn .12s ease-out; }
.tile.enter { animation: tileIn .22s cubic-bezier(.2,.8,.3,1); }
.banner-bar { animation: fadeIn .2s ease-out; }

.typing { display: flex; align-items: center; gap: 6px; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 4px; height: 4px; border-radius: 2px; background: var(--muted); animation: dot 1.2s infinite ease-in-out; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }

/* update bar */
#update-root { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 90; }
.update-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--s1); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0,0,0,.45); font-size: 14px; min-width: 380px; max-width: calc(100vw - 32px); animation: slideDown .22s cubic-bezier(.2,.8,.3,1); }
.update-bar.ready { border-color: var(--accent-line); background: var(--warm); }
.update-bar .progress div { transition: width .3s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .tile.speaking { animation: none; box-shadow: 0 0 0 2px var(--green); }
}

/* ---------- voice messages ---------- */
.vm { display: flex; align-items: center; gap: 12px; width: 340px; max-width: 100%; padding: 7px 14px 7px 7px; border-radius: 24px; background: var(--bg1); border: 1px solid var(--line); }
.vm-play { width: 36px; height: 36px; flex: none; border-radius: 18px; border: none; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; transition: transform .08s ease, background-color .12s ease; }
.vm-play:hover { background: var(--accent-hover); }
.vm-play:active { transform: scale(.94); }
.vm-wave { flex: 1; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.vm-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--line-strong); transition: background-color .1s ease; }
.vm-wave i.on { background: var(--accent); }
.vm-time { font-size: 12px; color: var(--muted); min-width: 34px; text-align: right; }
.composer.recording { align-items: center; gap: 10px; padding: 6px 8px; }
.rec-dot { width: 10px; height: 10px; flex: none; border-radius: 5px; background: var(--red); animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 50% { opacity: .35; } }
.rec-bars { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.rec-bars i { flex: 1; min-width: 2px; height: 8%; border-radius: 2px; background: var(--accent); transition: height .09s ease; }

/* ---------- news ---------- */
.news-card { width: 500px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column; background: var(--s2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,.5); animation: popIn .2s cubic-bezier(.2,.8,.3,1); }
.news-card.preview { max-height: 640px; box-shadow: none; animation: none; }
.news-head { padding: 18px 16px 12px 20px; display: flex; align-items: flex-start; gap: 12px; }
.news-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; }
.news-date { font-size: 12px; color: var(--faint); margin-top: 2px; }
.news-scroll { flex: 1; overflow-y: auto; padding: 0 20px 22px; }
.news-banner { display: block; width: 100%; aspect-ratio: 1200 / 525; object-fit: cover; border-radius: 6px; background: var(--bg1); margin-bottom: 6px; }
.news-h { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--accent); font-size: 14px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.news-h::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .45; }
.news-ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); line-height: 1.5; }
.news-ul li::marker { color: var(--faint); }
.news-p { margin: 12px 0 0; color: var(--text-2); line-height: 1.55; }
.news-card strong { color: var(--text); font-weight: 700; }
.news-foot { padding: 10px 12px 10px 20px; background: var(--bg1); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--bg0); color: var(--text-2); }

/* ---------- themes ---------- */
#bg-layer { position: fixed; inset: -40px; background-size: cover; background-position: center; z-index: 0; pointer-events: none; }
#root { position: relative; z-index: 1; }
body.has-bg { background: #000; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--line); border-radius: 10px; padding: 6px; background: var(--s1); text-align: left; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text); }
.theme-card.on { border-color: var(--accent); }
.theme-mini { height: 70px; border-radius: 6px; display: flex; overflow: hidden; }
.theme-mini i { display: block; }
.bg-thumb { width: 160px; height: 90px; border-radius: 8px; border: 1px solid var(--line); background-size: cover; background-position: center; background-color: var(--bg0); flex: none; }
/* ---------- bot cards, GIF picker, activity, encryption ---------- */
.bot-card { max-width: 520px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); overflow: hidden; }
.bot-card .bc-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bot-card .bc-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.bot-card .bc-body { padding: 4px 14px 14px; font-size: 14px; }
.bot-card .news-h { margin: 14px 0 8px; font-size: 12px; }
.bot-card .news-ul { gap: 6px; }
.role.bot { background: var(--accent-soft); color: var(--accent); }
.gif-picker { width: 420px; height: 460px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; background: var(--s1); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.5); overflow: hidden; }
.gif-grid { flex: 1; overflow-y: auto; padding: 8px; columns: 2; column-gap: 8px; }
.gif-grid button { display: block; width: 100%; margin: 0 0 8px; padding: 0; border: none; border-radius: 6px; overflow: hidden; background: var(--bg3); break-inside: avoid; cursor: pointer; }
.gif-grid img { display: block; width: 100%; height: auto; min-height: 60px; }
.gif-grid button:hover { outline: 2px solid var(--accent); }
.gif-foot { padding: 6px 12px; border-top: 1px solid var(--line); font-size: 11px; color: var(--faint); text-align: right; letter-spacing: .04em; }
.playing { color: var(--green); }
.enc-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); border: none; background: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.enc-badge:hover { background: var(--bg3); color: var(--text); }
.enc-badge.off { color: var(--red-text); }

.gif-label { font-size: 10px; font-weight: 800; letter-spacing: .04em; border: 1.5px solid currentColor; border-radius: 4px; padding: 1px 3px; line-height: 1.2; }
.code-block { margin: 0; padding: 12px; border-radius: 8px; background: var(--bg0); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-2); white-space: pre; overflow-x: auto; }

/* ---------- status icons ---------- */
:root { --status-idle: #F0B232; --status-dnd: #E5484D; --status-off: #80848E; }
.av .dot { box-sizing: border-box; }
.av .dot.online { background: var(--green); }
.av .dot.idle { background: radial-gradient(circle at 26% 26%, var(--dot-cut) 0 36%, var(--status-idle) 38%); }
.av .dot.dnd { background: var(--status-dnd); }
.av .dot.dnd::after { content: ""; position: absolute; left: 20%; right: 20%; top: 50%; height: 26%; transform: translateY(-50%); border-radius: 2px; background: var(--dot-cut); }
.av .dot.offline { background: var(--status-off); }
.av .dot.offline::after { content: ""; position: absolute; inset: 24%; border-radius: 50%; background: var(--dot-cut); }
.av .dot.mobile { width: 22%; height: 34%; min-width: 9px; min-height: 13px; border-radius: 3px; background: var(--green); }
.av .dot.mobile::after { content: ""; position: absolute; left: 18%; right: 18%; top: 14%; bottom: 26%; border-radius: 1px; background: var(--dot-cut); }
.status-opt { display: flex; align-items: center; gap: 10px; padding: 8px; border: none; border-radius: 6px; background: transparent; color: var(--text); font-size: 14px; width: 100%; }
.status-opt:hover, .status-opt.on { background: var(--bg3); }

/* ---------- phones: one pane at a time, like a mobile chat app ---------- */
.scrim { display: none; }
body.is-mobile { overflow: hidden; overflow: clip; }
body.is-mobile input, body.is-mobile textarea, body.is-mobile select { font-size: 16px; } /* stops iOS zooming in on focus */
body.is-mobile .app { position: relative; display: block; height: 100dvh; overflow: hidden; overflow: clip; } /* clip: nothing can scroll the off-screen panels into view */
body.is-mobile .rail { position: absolute; left: 0; top: 0; bottom: 0; width: 72px; padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
body.is-mobile .side { position: absolute; left: 72px; right: 0; top: 0; bottom: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); border-radius: 0; }
body.is-mobile .main { position: absolute; inset: 0; z-index: 5; transform: translateX(100%); transition: transform .24s cubic-bezier(.2,.8,.3,1); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); box-shadow: -8px 0 24px rgba(0,0,0,.35); }
body.is-mobile .app[data-pane="chat"] .main, body.is-mobile .app[data-pane="members"] .main { transform: none; }
body.is-mobile .members { display: flex !important; position: absolute; top: 0; bottom: 0; right: 0; width: min(300px, 86vw); z-index: 7; transform: translateX(100%); transition: transform .24s cubic-bezier(.2,.8,.3,1); padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
body.is-mobile .members.hidden { display: none !important; }
body.is-mobile .app[data-pane="members"] .members { transform: none; box-shadow: -10px 0 30px rgba(0,0,0,.45); }
body.is-mobile .app[data-pane="members"] .scrim { display: block; position: absolute; inset: 0; z-index: 6; background: rgba(0,0,0,.5); }
body.is-mobile .head { gap: 8px; padding: 6px 8px; }
body.is-mobile .head .search, body.is-mobile .head .vsep, body.is-mobile .head .topic:empty { display: none; }
body.is-mobile .head .topic { font-size: 12px; }
body.is-mobile .msg { padding-left: 10px; padding-right: 10px; gap: 10px; }
body.is-mobile .msg:hover { background: transparent; }
body.is-mobile .msg:hover .tools { display: none; }
body.is-mobile .msg.show-tools { background: var(--msg-hover); }
body.is-mobile .msg.show-tools .tools { display: flex; right: 8px; }
body.is-mobile .msg .tools .icon-btn { width: 38px; height: 38px; }
body.is-mobile .composer-wrap { padding: 0 8px 8px; }
body.is-mobile .composer .help { display: none; }
body.is-mobile .att-img, body.is-mobile .att-video { max-width: 100%; }
body.is-mobile .vm { width: 100%; }
body.is-mobile .gif-picker { width: calc(100vw - 16px); height: min(460px, 70dvh); }
body.is-mobile .card { max-width: calc(100vw - 16px); }
body.is-mobile .controls { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
body.is-mobile .ctl { width: 48px; height: 48px; }
body.is-mobile #toast-root { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); }
body.is-mobile .toast { max-width: none; }
body.is-mobile .connect-body { padding: max(20px, env(safe-area-inset-top)) 16px 24px; }
body.is-mobile .topbar { padding-top: env(safe-area-inset-top); height: auto; min-height: 56px; }

/* ---------- rich presence ---------- */
.rp { display: flex; gap: 12px; align-items: center; margin-top: -4px; }
.rp-art { position: relative; width: 64px; height: 64px; flex: none; }
.rp-art > img:first-child { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: var(--bg3); display: block; }
.rp-art.noimg { display: none; }
.rp-small { position: absolute; right: -5px; bottom: -5px; width: 24px; height: 24px; border-radius: 12px; border: 3px solid var(--s1); object-fit: cover; background: var(--bg3); }
.rp-text { min-width: 0; font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 1px; }
.rp-text > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-name { font-weight: 700; color: var(--text); font-size: 14px; }
.rp-time { font-size: 12px; color: var(--muted); }
.rp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-actions .btn { flex: 1 1 0; justify-content: center; }

/* ---------- message formatting ---------- */
.md .md-p { white-space: pre-wrap; }
.md .md-code { font-family: var(--mono); font-size: .88em; background: var(--bg0); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px; }
.md .md-codeblock { position: relative; margin: 4px 0; max-width: 100%; }
.md .md-pre { margin: 0; padding: 10px 12px; background: var(--bg0); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; font: 13px/1.5 var(--mono); white-space: pre; tab-size: 4; }
.md .md-pre code { font: inherit; }
.md .md-lang { position: absolute; top: 6px; right: 62px; font: 11px var(--mono); color: var(--faint); pointer-events: none; }
.md .md-copy { position: absolute; top: 5px; right: 6px; border: 1px solid var(--line); background: var(--bg2); color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.md .md-codeblock:hover .md-copy, .md .md-copy:focus-visible { opacity: 1; }
.md .md-copy:hover { color: var(--text); }
.hl-c { color: #7C8591; font-style: italic; }
.hl-s { color: #A9CF8E; }
.hl-n { color: #E5A86E; }
.hl-k { color: #C99BE0; }
.hl-f { color: #7FB8E8; }
.hl-t { color: #E8C77A; }
.md .md-spoiler { background: var(--line-strong); color: transparent; border-radius: 4px; cursor: pointer; transition: background .15s, color .15s; padding: 0 2px; }
.md .md-spoiler * { visibility: hidden; }
.md .md-spoiler:hover { background: #5A5F69; }
.md .md-spoiler.shown { background: rgba(255,255,255,.08); color: inherit; cursor: auto; }
.md .md-spoiler.shown * { visibility: visible; }
.md .md-quote { margin: 2px 0; padding: 0 0 0 12px; border-left: 4px solid var(--line-strong); }
.md .md-h1 { font-size: 1.5em; font-weight: 700; line-height: 1.3; margin: 4px 0 2px; }
.md .md-h2 { font-size: 1.25em; font-weight: 700; line-height: 1.3; margin: 4px 0 2px; }
.md .md-h3 { font-size: 1.08em; font-weight: 700; margin: 2px 0; }
.md .md-sub { font-size: .8em; color: var(--muted); }
.md .md-list { margin: 2px 0; padding-left: 22px; white-space: normal; }
.md .md-list li { margin: 1px 0; }
.md .md-list li.md-nested { margin-left: 18px; list-style: circle; }
.md a { color: #7FB8E8; }
.att-spoiler { position: relative; display: inline-block; cursor: pointer; border-radius: 8px; overflow: hidden; }
.att-spoiler > img, .att-spoiler > video { filter: blur(40px) brightness(.7); }
.att-spoiler::after { content: 'SPOILER'; position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; padding: 6px 12px; border-radius: 16px; background: rgba(0,0,0,.65); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.att-spoiler.shown { cursor: auto; }
.att-spoiler.shown > img, .att-spoiler.shown > video { filter: none; }
.att-spoiler.shown::after { display: none; }
.chip-toggle { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; padding: 1px 7px; border-radius: 10px; cursor: pointer; }
.chip-toggle.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* ---------- pins and notices ---------- */
.msg.system { margin-top: 8px; padding-top: 2px; padding-bottom: 2px; }
.msg.system .text { color: var(--muted); font-size: 14px; }
.msg.system .author { font-size: 14px; }
.sys-ico { display: flex; align-items: center; justify-content: center; width: 40px; height: 22px; color: var(--muted); }
.linkish { border: none; background: none; padding: 0; color: var(--text); font: inherit; cursor: pointer; font-weight: 600; }
.linkish:hover { text-decoration: underline; }
.pins-card { width: 420px; max-width: calc(100vw - 16px); }
.pins-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-deep); }
.pins-head h2 { margin: 0; font-size: 15px; }
.pins-list { max-height: min(60vh, 520px); overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.pin-item { border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.pin-item .ts { font: 11px var(--mono); color: var(--faint); }
.pin-item .pin-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; max-height: 180px; overflow: hidden; }
.pin-item .av { margin-top: 0 !important; border: 0 !important; }
.pin-item .att-img { max-height: 140px; }
.msg.flash { animation: msgFlash 1.6s ease-out; }
@keyframes msgFlash { 0%, 35% { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); } 100% { background: transparent; box-shadow: none; } }

/* ---------- custom status ---------- */
.cstatus { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.cstatus .cs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-emoji { font-size: 14px; line-height: 1; flex: none; }
.cstatus-bubble { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; overflow-wrap: anywhere; }
.cs-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: none; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.cs-emoji-btn { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--bg-input); border-radius: 8px; cursor: pointer; color: var(--muted); }
.cs-emoji-btn:hover { border-color: var(--line-strong); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.member .meta .cstatus, .dm-row .meta .cstatus { display: flex; }
.member .meta .cstatus .cs-emoji, .dm-row .meta .cstatus .cs-emoji { display: inline; overflow: visible; }
.member .meta .cstatus .cs-text, .dm-row .meta .cstatus .cs-text { display: inline; min-width: 0; }
.pin-item .pin-text { -webkit-mask-image: linear-gradient(#000 140px, transparent 180px); mask-image: linear-gradient(#000 140px, transparent 180px); }

/* ---------- health ---------- */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.hcard { background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hcard .help { font-size: 12px; overflow-wrap: anywhere; }
.hlabel { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.hval { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.hbar { display: block; height: 6px; border-radius: 3px; background: var(--bg3); overflow: hidden; margin: 2px 0; }
.hbar > span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.hbar.hot > span { background: var(--status-idle); }
.hsect { margin: 12px 0 0; font-size: 16px; }
.q-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; }
.q-tag.good { background: rgba(63,178,127,.15); color: var(--green); }
.q-tag.ok { background: rgba(240,178,50,.15); color: var(--status-idle); }
.q-tag.poor { background: rgba(229,72,77,.15); color: #F07A7E; }

/* ---------- hosted games ---------- */
.game-row { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: none; color: inherit; text-align: left; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.game-row:hover { background: var(--hover); }
.game-ico { width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.game-ico.big { width: 40px; height: 40px; border-radius: 10px; }
.game-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.game-row .gname { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-row .gsub { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-row .gcount { font-size: 11px; color: var(--green); }
.gstats { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
.gstats dt { color: var(--faint); }
.gstats dd { margin: 0; overflow-wrap: anywhere; }
.side { min-width: 0; }
.side-scroll { min-width: 0; }
.game-row { min-width: 0; }

/* ---------- custom emoji ---------- */
.cemoji { display: inline-block; vertical-align: -5px; object-fit: contain; }
.md .cemoji { margin: 0 1px; }
.react .cemoji { vertical-align: -4px; }
.emoji-pick { width: 340px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.emoji-pick-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 300px; overflow-y: auto; }
.emoji-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.emoji-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); }

/* ---------- crash reports ---------- */
.crash-card { border: 1px solid var(--line); border-left: 4px solid #E5484D; background: var(--bg1); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
.crash-card.fixed { border-left-color: var(--green); }
.crash-card.ignored { border-left-color: var(--line-strong); opacity: .8; }
.crash-card.regressed { border-left-color: var(--status-idle); }
.cc-head { display: flex; align-items: flex-start; gap: 10px; }
.cc-icon { color: #F07A7E; display: flex; padding-top: 2px; }
.crash-card.fixed .cc-icon { color: var(--green); }
.cc-title { font-weight: 700; overflow-wrap: anywhere; }
.cc-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 9px; background: rgba(229,72,77,.15); color: #F07A7E; white-space: nowrap; }
.cc-status.fixed { background: rgba(63,178,127,.15); color: var(--green); }
.cc-status.ignored { background: var(--bg3); color: var(--muted); }
.cc-status.regressed { background: rgba(240,178,50,.15); color: var(--status-idle); }
.cc-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.cc-stats b { color: var(--text); }
.cc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.crash-msg, .crash-log { margin: 0; padding: 10px 12px; background: var(--bg0); border: 1px solid var(--line); border-radius: 6px; font: 12px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.crash-log { max-height: 320px; overflow: auto; white-space: pre; }
.crash-occ { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2); }
.bc-fixed { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--green); padding: 0 12px 10px; }

/* ---------- bug tracker ---------- */
.board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; padding: 16px; overflow: auto; }
.bcol { background: var(--bg1); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 0; }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); }
.bcol-head .mono { margin-left: auto; font-size: 12px; }
.bdot { width: 9px; height: 9px; border-radius: 50%; background: #E5484D; }
.bdot { flex: none; }
.bdot.s-progress { background: var(--status-idle); } .bdot.s-fixed { background: var(--green); } .bdot.s-wontfix { background: var(--line-strong); }
.bcol-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.bcard { text-align: left; border: 1px solid var(--line); background: var(--bg2); border-radius: 8px; padding: 8px 10px; color: inherit; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.bcard:hover { border-color: var(--line-strong); }
.bcard-title { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.bcard-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bcard-meta .av { flex: none; }
.chip-proj { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.bug-meta { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.bug-meta .field { min-width: 0; }
.bug-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg1); }
.bug-body .text { white-space: normal; }
.bug-comments { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.bc { display: flex; gap: 10px; }
.bc .av { flex: none; }
.bc .text { font-size: 14px; }
.bc-sys { font-size: 13px; color: var(--muted); padding-left: 38px; }
body.is-mobile .board { grid-template-columns: 1fr; padding: 10px; }

/* ---------- jukebox ---------- */
.jb { display: flex; flex-direction: column; gap: 12px; }
.jb-now { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, var(--accent-soft), var(--bg1) 70%); }
.jb-art { width: 56px; height: 56px; flex: none; border-radius: 10px; background: var(--bg0); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.jb-title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-bar { height: 4px; border-radius: 2px; background: var(--bg3); overflow: hidden; margin: 8px 0 3px; }
.jb-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.jb-ctl { display: flex; align-items: center; gap: 4px; }
.jb-me { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jb-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.jb-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.jb-row:last-child { border-bottom: none; }
.jb-t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-strip { display: flex; align-items: center; gap: 8px; margin: 0 8px 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep); color: var(--text-2); font-size: 12px; cursor: pointer; text-align: left; }
.jb-strip:hover { border-color: var(--line-strong); }
.jb-eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; width: 12px; flex: none; }
.jb-eq i { display: block; width: 3px; height: 4px; background: var(--muted); border-radius: 1px; }
.jb-eq.on i { background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.jb-eq.on i:nth-child(2) { animation-delay: .2s; } .jb-eq.on i:nth-child(3) { animation-delay: .45s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
@media (prefers-reduced-motion: reduce) { .jb-eq.on i { animation: none; height: 8px; } }
.board-filters { display: flex; gap: 8px; padding: 8px 10px 0; }
.board-filters .search { flex: 1; min-width: 0; display: flex !important; }
.board-filters .search input { width: 100%; }
body.is-mobile .board { grid-auto-rows: max-content; align-content: start; }
body.is-mobile .bcol-list:has(> p.help) { padding: 2px 8px; }

/* ---------- 0.7 profiles ---------- */
.av.has-anim:hover, .msg:hover .gutter .av.has-anim, .member:hover .av.has-anim, .dm-row:hover .av.has-anim { background-image: var(--av-anim) !important; }
.av-deco { position: absolute; inset: -20%; width: 140%; height: 140%; pointer-events: none; z-index: 1; display: block; }
img.av-deco { object-fit: contain; }
.av .dot { z-index: 2; }
.deco-spin { transform-origin: 70px 70px; animation: decoSpin 12s linear infinite; }
.deco-pulse { animation: decoPulse 2.4s ease-in-out infinite; }
.deco-flicker { transform-origin: 70px 120px; animation: decoFlicker 1.2s ease-in-out infinite alternate; }
.deco-bob { animation: decoBob 3s ease-in-out infinite; }
@keyframes decoSpin { to { transform: rotate(360deg); } }
@keyframes decoPulse { 50% { opacity: .45; } }
@keyframes decoFlicker { from { transform: scaleY(.94); } to { transform: scaleY(1.04); } }
@keyframes decoBob { 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .deco-spin, .deco-pulse, .deco-flicker, .deco-bob { animation: none; } }

.pcard { position: relative; width: 340px; max-width: calc(100vw - 16px); }
.pcard .banner { position: relative; height: 104px; overflow: hidden; }
.pcard .banner-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pcard .inner { position: relative; z-index: 3; gap: 8px; }
.pcard .inner > .av { margin-top: -44px; border: 5px solid var(--s1); }
.pcard.themed { --pc-cut: var(--pc1); background: linear-gradient(180deg, var(--pc1), var(--pc2)); border-color: color-mix(in srgb, var(--pacc) 55%, transparent); }
.pcard.themed .inner > .av { border-color: var(--pc1); }
.pcard.themed .pc-panel, .pcard.themed .pc-actions, .pcard.themed .cstatus-bubble { background: rgba(0,0,0,.32); border-color: rgba(255,255,255,.08); }
.pcard.themed .btn.primary { background: var(--pacc); border-color: var(--pacc); color: #111; }
.pcard.themed .pc-tabs button.on { border-bottom-color: var(--pacc); }
.pfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; border-radius: inherit; object-fit: cover; }
.pcard.fx-glow { box-shadow: 0 0 0 1px var(--fx), 0 0 24px color-mix(in srgb, var(--fx) 60%, transparent), 0 12px 32px rgba(0,0,0,.4); animation: fxGlow 3s ease-in-out infinite; }
@keyframes fxGlow { 50% { box-shadow: 0 0 0 1px var(--fx), 0 0 40px color-mix(in srgb, var(--fx) 80%, transparent), 0 12px 32px rgba(0,0,0,.4); } }
@media (prefers-reduced-motion: reduce) { .pcard.fx-glow { animation: none; } }
.badge-float { position: absolute; top: 8px; right: 12px; }
.badge-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 200px; padding: 4px 6px; border-radius: 8px; background: rgba(0,0,0,.35); }
.badge-pill { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; cursor: default; }
.badge-pill:hover, .badge-pill:focus-visible { background: rgba(255,255,255,.08); }
.badge-pill.big { width: 40px; height: 40px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); flex: none; }
.badge-ico { display: block; }
.pname-block { min-width: 0; }
.pname { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; line-height: 1.25; display: inline-block; }
.psub { font-size: 13px; color: var(--muted); }
.pc-tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--line); }
.pc-tabs button { border: none; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 0 8px; border-bottom: 2px solid transparent; cursor: pointer; }
.pc-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.pc-panel { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg-deep); max-height: 52vh; overflow-y: auto; }
.pc-panel:empty { display: none; }
.pc-sect { display: flex; flex-direction: column; gap: 6px; }
.pc-sect + .pc-sect { border-top: 1px solid var(--line); padding-top: 10px; }
.pc-sect .section-label { margin: 0; }
.pc-bio { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-facts { gap: 4px; }
.pc-fact { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pc-fact .help { font-size: 12px; }
.pc-actions { display: flex; flex-direction: column; gap: 8px; }
.pcard.themed .pc-actions { padding: 8px; border: 1px solid transparent; border-radius: 10px; }
.pm-row { display: flex; align-items: center; gap: 10px; }
.pm-btn { width: 36px; height: 36px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); flex: none; }
.pcard.themed .pm-btn { background: var(--pacc); }
.pm-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-item { border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); overflow: hidden; min-width: 0; }
.sc-game { display: flex; align-items: center; gap: 8px; padding: 8px; grid-column: span 1; }
.sc-t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.sc-media { position: relative; padding: 0; cursor: pointer; aspect-ratio: 16 / 10; }
.sc-media img, .sc-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.75)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-stats { grid-column: 1 / -1; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.gb { display: flex; flex-direction: column; gap: 10px; }
.gb textarea { flex: 1; resize: none; }
.gb-entry { display: flex; gap: 8px; align-items: flex-start; }
.gb-entry .av { flex: none; }
.gb-text { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; white-space: pre-wrap; }

.pe-layout { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.pe-left { flex: 999 1 380px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.pe-right { flex: 1 1 340px; max-width: 360px; position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.pe-preview-card .pcard { box-shadow: none; width: 100%; }
.pe-sect { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.pe-head { display: flex; flex-direction: column; gap: 2px; }
.pe-head h2 { margin: 0; font-size: 15px; }
.pe-head .help { font-size: 13px; }
.ns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.ns-grid input[type=color] { width: 100%; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-input); }
.ns-sample { padding: 10px 14px; border-radius: 8px; background: var(--bg1); border: 1px solid var(--line); font-size: 18px; font-weight: 700; }
.swatch.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.theme-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-swatch { width: 52px; height: 36px; border-radius: 8px; border: 2px solid transparent; position: relative; cursor: pointer; }
.theme-swatch span { position: absolute; right: 4px; bottom: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--a); }
.theme-swatch.on { border-color: var(--text); }
.deco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.deco-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer; }
.deco-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-opt { border: 1px solid var(--line); background: var(--bg1); color: var(--text-2); border-radius: 16px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.sc-edit { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.sc-edit-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.sc-edit-row:last-child { border-bottom: none; }
.sc-edit-row .icon-btn:first-of-type svg { transform: rotate(90deg); }
.badge-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.badge-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); }
.badge-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.badge-members .chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 2px; font-size: 12px; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.icon-pick .icon-btn.on { background: var(--accent-soft); outline: 1px solid var(--accent); }
body.is-mobile .pe-right { position: static; max-width: none; }
body.is-mobile .pcard { width: calc(100vw - 16px); }
.fullpage .fp-content.still, .popover.still > * { animation: none; }
.field .check input[type=checkbox] { width: 18px; height: 18px; }
.link-code { font-size: 40px; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 14px; border-radius: 12px; background: var(--bg0); border: 1px solid var(--line); color: var(--accent); user-select: all; }
.link-input { font-size: 28px; letter-spacing: .2em; text-align: center; font-family: var(--mono); height: 56px; }

/* ---------- message boards ---------- */
.fb-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.fb-search { width: 220px; flex: none; }
.fb-search input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; color: var(--text); font: inherit; }
.fb-mobile-search { padding: 10px 12px 0; }
.fb-mobile-search .fb-search { width: 100%; height: 38px; }
.fb-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; font-size: 14px; }
.fb-crumbs .linkish { font-weight: 500; color: var(--muted); white-space: nowrap; }
.fb-crumbs .linkish:hover { color: var(--text); }
.fb-crumbs h1 { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fb-tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--bg3); color: var(--muted); margin-left: 8px; vertical-align: 1px; white-space: nowrap; }
.fb-flag { display: inline-flex; color: var(--faint); flex: none; }
.fb-sub { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-new { margin-left: 8px; color: var(--accent); font-weight: 600; }

/* board list */
.fb-boards { display: flex; flex-direction: column; gap: 8px; padding: 16px; max-width: 980px; }
.fb-board { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg1); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .12s ease, background-color .12s ease; }
.fb-board:hover { border-color: var(--line-strong); background: var(--hover); }
.fb-board-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--bg3); color: var(--faint); display: flex; align-items: center; justify-content: center; flex: none; }
.fb-board.unread .fb-board-ico { background: var(--accent-soft); color: var(--accent); }
.fb-board-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fb-board-name { font-size: 15px; font-weight: 600; }
.fb-board-desc { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-board-stats { font-size: 12px; color: var(--faint); }
.fb-board-latest { flex: 0 0 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.fb-latest-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.fb-latest-by { display: flex; align-items: center; gap: 6px; font-size: 12px; min-width: 0; white-space: nowrap; }
.fb-latest-by > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }

/* thread list */
.fb-list { display: flex; flex-direction: column; padding: 8px 16px 24px; max-width: 1100px; }
.fb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px 190px; align-items: center; gap: 12px; padding: 0 8px; border-bottom: 1px solid var(--line); min-height: 58px; }
.fb-row:not(.fb-row-head):hover { background: var(--msg-hover); }
.fb-row-head { min-height: 32px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.fb-row.pinned { background: var(--warm); }
.fb-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 9px 0; border: none; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fb-title { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; color: var(--text-2); }
.fb-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-row-main:hover .fb-title-text { text-decoration: underline; }
.fb-row.unread .fb-title { color: var(--text); font-weight: 600; }
.fb-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); flex: none; }
.fb-pages { font-size: 12px; }
.fb-pages .linkish { font-weight: 500; color: var(--muted); }
.fb-num { text-align: right; font-size: 13px; color: var(--muted); }
.fb-row-head .fb-num { font-size: 11px; color: var(--faint); }
.fb-last { display: flex; align-items: center; gap: 8px; min-width: 0; border: none; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 4px; border-radius: 6px; }
.fb-last:hover { background: var(--bg3); }
.fb-last-text { display: flex; flex-direction: column; min-width: 0; font-size: 12px; line-height: 1.3; }
.fb-last-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* search */
.fb-search-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px; font-weight: 600; }
.fb-search-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fb-hits { display: flex; flex-direction: column; padding: 0 16px 24px; max-width: 980px; }
.fb-hit { display: flex; flex-direction: column; gap: 3px; padding: 10px 8px; border: none; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fb-hit:hover { background: var(--msg-hover); }
.fb-hit-title { font-weight: 600; }
.fb-hit-snip { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }

/* a thread */
.fb-thread-inner { display: flex; flex-direction: column; gap: 12px; padding: 16px; max-width: 1000px; }
.fb-thread-title h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.fb-pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fb-pg { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg1); color: var(--text-2); font: inherit; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fb-pg:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.fb-pg.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }
.fb-pg:disabled { opacity: .4; cursor: default; }
.fpost { display: flex; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); overflow: hidden; }
.fpost.op { border-color: var(--line-strong); }
.fpost.flash { animation: msgFlash 1.6s ease-out; }
.fpost-author { flex: 0 0 150px; padding: 14px 12px; border-right: 1px solid var(--line); background: var(--bg-deep); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fpost-av { border: none; background: none; padding: 0; cursor: pointer; }
.fpost-who { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.fpost-who .author { font-weight: 600; border: none; background: none; padding: 0; cursor: pointer; font: inherit; font-weight: 600; overflow-wrap: anywhere; }
.fpost-who .author:hover { text-decoration: underline; }
.fpost-main { flex: 1; min-width: 0; padding: 10px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.fpost-head { display: flex; align-items: center; gap: 8px; min-height: 22px; }
.fpost-head .ts { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.fpost-head .edited { font-size: 11px; color: var(--faint); }
.fpost-head .fb-tag { margin-left: 0; }
.fpost-n { font-size: 12px; }
.fpost .text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: var(--chat-size, 15px); }
.fpost-tools { display: flex; align-items: center; gap: 2px; margin-top: 2px; opacity: .55; transition: opacity .12s ease; }
.fpost:hover .fpost-tools, .fpost:focus-within .fpost-tools { opacity: 1; }
.fpost-tools .icon-btn { width: 30px; height: 30px; }
.fpost-tools .btn.sm { height: 30px; padding: 0 10px; }

/* reply box */
.fb-reply { flex: none; margin: 0 16px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg3); display: flex; flex-direction: column; max-width: 1000px; }
.fb-reply textarea { border: none; background: transparent; color: var(--text); font: inherit; font-size: var(--chat-size, 15px); line-height: 1.5; padding: 12px 14px 4px; resize: none; outline: none; min-height: 72px; }
.fb-reply-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px 8px; }
.fb-reply-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 10px 0; }
.fb-reply-files[hidden] { display: none; }
.fb-reply.locked { flex-direction: row; align-items: center; gap: 10px; padding: 14px 16px; color: var(--muted); font-size: 14px; background: var(--bg1); }

@media (max-width: 1100px) {
  .fb-row { grid-template-columns: minmax(0, 1fr) auto 56px 160px; }
  .fb-board-latest { flex-basis: 190px; }
}
body.is-mobile .fb-boards { padding: 12px; }
body.is-mobile .fb-board { flex-wrap: wrap; padding: 12px; gap: 12px; }
body.is-mobile .fb-board-latest { flex: 1 1 100%; padding-left: 52px; }
body.is-mobile .fb-list { padding: 4px 0 16px; }
body.is-mobile .fb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 0 12px; }
body.is-mobile .fb-pages { display: none; }
body.is-mobile .fb-last { grid-column: 2; }
body.is-mobile .fb-last-text { display: none; }
body.is-mobile .fb-thread-inner { padding: 12px 10px; gap: 10px; }
body.is-mobile .fb-thread-title h2 { font-size: 19px; }
body.is-mobile .fpost { flex-direction: column; }
body.is-mobile .fpost-author { flex: none; flex-direction: row; justify-content: flex-start; text-align: left; padding: 10px 12px 0; border-right: none; background: none; }
body.is-mobile .fpost-who { flex-direction: row; align-items: center; gap: 6px; }
body.is-mobile .fpost-main { padding: 6px 12px 8px; }
body.is-mobile .fpost-tools { opacity: 1; }
body.is-mobile .fb-reply { margin: 0 8px 8px; }
body.is-mobile .fb-crumbs { font-size: 13px; }
body.is-mobile .fb-reply textarea { min-height: 44px; padding: 10px 12px 2px; }
.ch-lock { display: flex; color: var(--faint); flex: none; }
.ch-private { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; background: var(--bg3); color: var(--muted); flex: none; }
.gaddr-list { display: flex; flex-direction: column; gap: 8px; }
.gaddr-row { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg1); }
.gaddr-row .field { flex: 1 1 160px; min-width: 0; }
.gaddr-row .gaddr-port { flex: 0 0 96px; }
.gaddr-row .gaddr-addr { flex: 2 1 220px; }
.gaddr-row .icon-btn { margin-bottom: 4px; }
body.is-mobile .gaddr-row { flex-wrap: wrap; }
