:root {
  --bg-0: #0c0d10;
  --bg-1: #111216;
  --bg-2: #16181c;
  --bg-3: #1c1e23;
  --bg-4: #24272d;
  --line: #ffffff0f;
  --line-2: #ffffff17;
  --text: #e4e5e8;
  --text-2: #a3a6ad;
  --text-3: #6d717a;
  --accent-rgb: 255 122 26;
  --accent: rgb(var(--accent-rgb));
  --accent-ink: #140a02;
  --fs: 14.5px;
  --font: Inter, system-ui, sans-serif;
  --accent-soft: rgb(var(--accent-rgb) / 7.8%);
  --accent-line: rgb(var(--accent-rgb) / 33.3%);
  --ok: #3ecf7a;
  --away: #e8b339;
  --danger: #ef5454;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-1);
  color: var(--text);
  font: 400 var(--fs)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: #ffffff14; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #ffffff24; }
::-webkit-scrollbar-track { background: transparent; }

/* title bar */
#titlebar {
  height: 32px; display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-0); padding-left: 14px;
}
.tb-brand { font: 700 11px 'Chakra Petch', sans-serif; letter-spacing: .18em; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.tb-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.tb-buttons { display: flex; height: 100%; }
.tb-buttons button { width: 46px; height: 100%; display: grid; place-items: center; color: var(--text-3); transition: background .15s, color .15s; }
.tb-buttons button:hover { background: var(--bg-3); color: var(--text); }
.tb-buttons button.close:hover { background: #c4302b; color: #fff; }
.tb-buttons svg { width: 12px; height: 12px; }
.tb-buttons #tb-update {
  width: auto; height: 22px; margin: 5px 8px 0 0; padding: 0 10px; display: flex; gap: 6px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); font: 600 11.5px var(--font);
}
.tb-buttons #tb-update:hover { background: var(--accent); color: var(--accent-ink); }
.tb-buttons #tb-update[hidden] { display: none; }
#updating { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--bg-0); font: 600 15px var(--font); color: var(--text-2); }

#app { height: calc(100% - 32px); display: grid; grid-template-columns: 72px 248px 1fr auto; grid-template-rows: minmax(0, 1fr); }
#app > * { min-height: 0; }

/* server rail */
#rail { background: var(--bg-0); padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; overflow-y: auto; }
#rail::-webkit-scrollbar { display: none; }
.srv {
  position: relative; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; background: var(--bg-3);
  font: 700 14px 'Chakra Petch', sans-serif; color: var(--text-2);
  transition: border-radius .25s var(--ease), background .2s, color .2s, transform .15s;
}
.srv:hover { border-radius: 12px; background: var(--bg-4); color: var(--text); }
.srv:active { transform: scale(.94); }
.srv.active { border-radius: 12px; background: var(--bg-4); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.srv::before {
  content: ''; position: absolute; left: -13px; width: 4px; height: 0; border-radius: 0 4px 4px 0;
  background: var(--text); transition: height .25s var(--ease);
}
.srv.unread::before { height: 8px; }
.srv:hover::before { height: 18px; }
.srv.active::before { height: 30px; background: var(--accent); }
.srv .ping { position: absolute; right: -3px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font); border: 3px solid var(--bg-0); box-sizing: content-box; text-align: center; }
.rail-sep { width: 28px; height: 1px; background: var(--line-2); margin: 2px 0; }
.srv.add { color: var(--text-3); font-size: 22px; font-weight: 400; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

/* channel sidebar */
#sidebar { background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; }
#server-head { position: relative; flex: none; cursor: pointer; border-bottom: 1px solid var(--line); }
#banner {
  --h: var(--accent);
  position: relative; height: 92px; overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--h) 45%, transparent), transparent 55%),
    repeating-linear-gradient(135deg, #ffffff07 0 1px, transparent 1px 9px),
    linear-gradient(170deg, color-mix(in srgb, var(--h) 18%, var(--bg-2)), var(--bg-2));
  transition: filter .2s;
}
#banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, var(--bg-2)); }
#banner-mark {
  position: absolute; right: -6px; top: -14px; font: 700 84px/1 'Chakra Petch', sans-serif;
  color: #ffffff0c; letter-spacing: -.02em; transition: transform .5s var(--ease);
}
#server-head:hover #banner { filter: brightness(1.12); }
#server-head:hover #banner-mark { transform: translateX(-6px); }
.sh-row {
  position: absolute; left: 16px; right: 12px; top: 54px; display: flex; align-items: center; justify-content: space-between;
  font: 700 15px 'Chakra Petch', sans-serif; letter-spacing: .06em; text-transform: uppercase;
}
.sh-row svg { color: var(--text-2); }
.sh-stats { display: flex; align-items: center; gap: 6px; padding: 0 16px 12px; margin-top: -8px; font-size: 12px; color: var(--text-3); position: relative; }
.sdot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.sdot:not(.on) { margin-left: 8px; }
.sdot.on { background: var(--ok); box-shadow: 0 0 6px #3ecf7a80; }
#channels.swap, #messages.swap { animation: swap-in .22s var(--ease); }
@keyframes swap-in { from { opacity: 0; transform: translateY(5px); } }

/* rail tooltip */
#tip {
  position: fixed; z-index: 50; pointer-events: none; padding: 7px 11px; border-radius: 8px;
  background: var(--bg-0); color: var(--text); font-weight: 600; font-size: 13.5px; white-space: nowrap;
  box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px #000a;
  opacity: 0; transform: translate(-4px, -50%); transition: opacity .12s, transform .15s var(--ease);
}
#tip.show { opacity: 1; transform: translate(0, -50%); }
#tip::before { content: ''; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; background: var(--bg-0); transform: translateY(-50%) rotate(45deg); }

/* profile card */
#profile {
  position: fixed; z-index: 40; width: 300px; border-radius: 14px; overflow: hidden;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px #000c;
  animation: card-in .2s var(--ease); user-select: text;
}
@keyframes card-in { from { opacity: 0; transform: scale(.96) translateY(4px); } }
.pc-banner { height: 76px; }
.pc-avatar { position: absolute; left: 16px; top: 36px; padding: 5px; border-radius: 50%; background: var(--bg-2); }
.pc-avatar .avatar { width: 74px; height: 74px; font-size: 22px; }
.pc-avatar .avatar .pres { width: 14px; height: 14px; right: 1px; bottom: 1px; border: 4px solid var(--bg-2); }
.pc-body { padding: 46px 16px 16px; }
.pc-name { font: 700 19px 'Chakra Petch', sans-serif; display: flex; align-items: center; gap: 8px; }
.pc-sub { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.pc-box { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--bg-1); display: grid; gap: 10px; }
.pc-label { font: 700 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
.pc-roles { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-role { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--bg-3); font-size: 12px; font-weight: 500; }
.pc-role i { width: 8px; height: 8px; border-radius: 50%; }
.pc-act { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pc-act .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--bg-3); display: grid; place-items: center; color: var(--text-2); }
.pc-actions { display: flex; gap: 8px; margin-top: 12px; }
.pc-actions button { flex: 1; height: 34px; border-radius: 8px; background: var(--bg-3); font-weight: 600; font-size: 13px; transition: background .15s, transform .1s; }
.pc-actions button:hover { background: var(--bg-4); }
.pc-actions button:active { transform: scale(.97); }
.pc-actions button.main { background: var(--accent); color: var(--accent-ink); }
.pc-actions button.main:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
#channels { flex: 1; overflow-y: auto; padding: 12px 8px; }
.cat {
  display: flex; align-items: center; gap: 4px; padding: 14px 8px 6px; cursor: pointer;
  font: 600 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.cat:first-child { padding-top: 2px; }
.cat:hover { color: var(--text-2); }
.cat svg { width: 10px; height: 10px; transition: transform .2s var(--ease); }
.cat.closed svg { transform: rotate(-90deg); }
.ch {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  height: 34px; padding: 0 8px; margin: 1px 0; border-radius: 6px; color: var(--text-3);
  transition: background .15s, color .15s;
}
.ch:hover { background: var(--bg-3); color: var(--text-2); }
.ch.active { background: var(--bg-4); color: var(--text); }
.ch.unread { color: var(--text); font-weight: 600; }
.ch.unread::before { content: ''; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.ch .glyph { width: 18px; text-align: center; font-size: 17px; color: var(--text-3); flex: none; }
.ch .name { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font); }
.ch.voice.live .glyph { color: var(--ok); }
.vusers { padding: 2px 0 4px 34px; }
.vuser { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; }
.vuser:hover { background: var(--bg-3); }
.vuser .avatar { width: 22px; height: 22px; font-size: 9px; transition: box-shadow .15s; }
.vuser.speaking .avatar { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--ok); }
.vuser .muted { margin-left: auto; color: var(--text-3); }
.vuser .muted svg { width: 13px; height: 13px; }

#voice-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line);
  background: var(--bg-2); animation: rise .25s var(--ease);
}
.vb-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.vb-state { color: var(--ok); font-weight: 600; font-size: 13px; }
.vb-where { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vb-leave, #vb-share { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2); transition: background .15s, color .15s; }
#vb-leave:hover { background: #ef54541f; color: var(--danger); }
#vb-share:hover { background: var(--bg-3); color: var(--text); }
#vb-share.on { color: var(--accent); background: var(--accent-soft); }

.live-pill { flex: none; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font: 700 10px/16px 'Chakra Petch', sans-serif; letter-spacing: .08em; }
.vuser .live-pill { margin-left: auto; cursor: pointer; }
.vuser .live-pill + .muted { margin-left: 6px; }
.vuser.live { cursor: pointer; }
.vuser.watching .live-pill { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3px var(--accent); }

#chat { position: relative; }
#stage {
  position: absolute; inset: 48px 0 0; z-index: 20; display: flex; flex-direction: column;
  background: #07080a; animation: fade .15s;
}
.stage-head { height: 44px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
#stage-who { font-weight: 600; color: var(--text); }
.stage-tools { margin-left: auto; display: flex; gap: 4px; }
#stage-video { flex: 1; min-height: 0; display: grid; place-items: center; }
#stage-video video { width: 100%; height: 100%; object-fit: contain; background: #000; }
#stage-video .stage-wait { color: var(--text-3); font-size: 13px; }
#stage:fullscreen .stage-head { position: absolute; inset: 0 0 auto; opacity: 0; transition: opacity .2s; z-index: 1; }
#stage:fullscreen:hover .stage-head { opacity: .92; }

#me { height: 56px; padding: 0 8px; display: flex; align-items: center; gap: 8px; background: var(--bg-1); }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.me-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; min-width: 0; white-space: nowrap; }
.me-status { font-size: 12px; color: var(--text-3); }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn .slash { display: none; }
.icon-btn.off { color: var(--danger); }
.icon-btn.off .slash { display: inline; }
.icon-btn.on { color: var(--text); }

.avatar {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font: 700 12px 'Chakra Petch', sans-serif; color: #ffffffd9;
}
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; background: var(--bg-3); }
.avatar .pres { z-index: 1; }
.avatar .pres { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--bg-1); box-sizing: content-box; background: var(--text-3); }
.avatar .pres.online { background: var(--ok); }
.avatar .pres.away, .avatar .pres.idle { background: var(--away); }
.avatar .pres.dnd { background: var(--danger); }
.avatar .pres.dnd::after { content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 2px; margin-top: -1px; border-radius: 1px; background: var(--bg-1); }
.avatar .pres.invisible { background: var(--bg-1); box-shadow: inset 0 0 0 3px var(--text-3); }
.me-text { cursor: pointer; border-radius: 6px; padding: 3px 6px; margin-left: -6px; transition: background .15s; }
.me-text:hover { background: var(--bg-3); }
#menu button[class*="st-"] { justify-content: flex-start; gap: 10px; }
#menu button[class*="st-"]::before { content: ''; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
#menu button.st-idle::before { background: var(--away); }
#menu button.st-dnd::before { background: var(--danger); }
#menu button.st-invisible::before { background: transparent; box-shadow: inset 0 0 0 2.5px var(--text-3); }
#menu button.on { color: var(--text); background: var(--bg-3); }
/* mute */
#btn-mute.muted { color: var(--danger); }
#btn-mute.muted .slash { display: inline; }
#btn-mute[hidden] { display: none; }
.ch.muted { opacity: .5; }
.ch.muted:hover, .ch.muted.active { opacity: 1; }
#btn-pins.on { background: var(--accent-soft); color: var(--accent); }
.msg .tools .pin-tool svg { fill: currentColor; stroke: none; }
#btn-pins svg { fill: currentColor; stroke: none; width: 15px; height: 15px; }
.msg.pinned { box-shadow: inset 2px 0 0 var(--accent-line); }

/* side panel: pins + search results */
#side {
  position: absolute; top: 56px; right: 12px; z-index: 30; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 140px);
  display: flex; flex-direction: column; border-radius: 12px; background: var(--bg-0);
  box-shadow: 0 0 0 1px var(--line-2), 0 20px 50px #000c; animation: card-in .18s var(--ease);
}
#side[hidden] { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.side-head b { font: 700 14px 'Chakra Petch', sans-serif; letter-spacing: .04em; text-transform: uppercase; }
#side-list { overflow-y: auto; padding: 8px; display: grid; gap: 6px; }
.side-msg { position: relative; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); cursor: pointer; transition: background .15s, box-shadow .15s; }
.side-msg:hover { background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.side-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; min-width: 0; }
.side-meta .avatar { width: 22px; height: 22px; font-size: 8.5px; }
.side-meta .time { color: var(--text-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.side-ch { color: var(--text-3); font-size: 12px; }
.side-msg .body { font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; max-height: 7.5em; overflow: hidden; }
.side-files { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.side-unpin { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 6px; display: none; place-items: center; color: var(--text-3); background: var(--bg-0); }
.side-msg:hover .side-unpin { display: grid; }
.side-unpin svg { width: 12px; height: 12px; }
.side-msg:hover .side-meta .time { visibility: hidden; }
.side-unpin:hover { color: var(--danger); }
.side-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.side-empty svg { width: 34px; height: 34px; fill: var(--accent); opacity: .7; }
.side-empty b { color: var(--text); font-size: 14px; }
.mact.playing b { color: var(--text-2); font-weight: 600; }
.pc-custom { margin-top: 8px; font-size: 13.5px; color: var(--text-2); }
.pc-game { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); display: grid; gap: 1px; }
.pc-game b { font-weight: 600; font-size: 14px; }
#members .avatar .pres { border-color: var(--bg-2); }

/* chat */
#chat { display: flex; flex-direction: column; min-width: 0; background: var(--bg-1); }
#chat-head { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); }
#chat-head .hash { color: var(--text-3); font-size: 20px; }
#chat-title { font-weight: 700; }
#chat-head .divider { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; }
#chat-topic { color: var(--text-3); font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-tools { display: flex; align-items: center; gap: 6px; }
.search { position: relative; display: flex; align-items: center; }
.search input {
  width: 150px; height: 28px; padding: 0 28px 0 10px; border-radius: 6px; border: 0; outline: 0;
  background: var(--bg-0); color: var(--text); font: 13px var(--font); transition: width .25s var(--ease), box-shadow .15s;
}
.search input:focus { width: 230px; box-shadow: 0 0 0 1px var(--accent-line); }
.search svg { position: absolute; right: 8px; color: var(--text-3); width: 14px; height: 14px; pointer-events: none; }

#messages-wrap { flex: 1; position: relative; min-height: 0; }
#messages { height: 100%; overflow-y: auto; padding: 16px 0 8px; user-select: text; }
.intro { padding: 24px 16px 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.intro .big { width: 60px; height: 60px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; font-size: 30px; color: var(--text-2); margin-bottom: 12px; }
.intro h1 { font: 700 26px 'Chakra Petch', sans-serif; }
.intro p { color: var(--text-3); margin-top: 4px; }

.day { display: flex; align-items: center; gap: 10px; margin: 16px 16px 6px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.day::before, .day::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.unread-line { display: flex; align-items: center; margin: 10px 16px 4px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.unread-line::before { content: ''; flex: 1; height: 1px; background: var(--accent-line); margin-right: 8px; }

.msg { position: relative; display: grid; grid-template-columns: 40px 1fr; column-gap: 14px; padding: 2px 16px 2px 16px; transition: background .1s; }
.msg.head { margin-top: 14px; padding-top: 4px; }
.msg:hover { background: #ffffff05; }
.msg.mention { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.msg .avatar { width: 40px; height: 40px; margin-top: 2px; cursor: pointer; }
.msg .time-gutter { font-size: 10.5px; color: transparent; text-align: right; padding-top: 4px; user-select: none; }
.msg:hover .time-gutter { color: var(--text-3); }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 600; cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .tag { font: 700 9.5px var(--font); letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: var(--bg-4); color: var(--text-2); align-self: center; }
.msg .time { font-size: 11.5px; color: var(--text-3); }
.msg .body { color: #d6d8dc; word-wrap: break-word; white-space: pre-wrap; }
.msg .body:empty { display: none; }
.msg .body .edited { font-size: 10.5px; color: var(--text-3); margin-left: 4px; }
.msg .body code { font: 500 13px 'JetBrains Mono', monospace; background: var(--bg-0); padding: 1px 5px; border-radius: 4px; }
.msg .body .codeblock {
  margin: 4px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line);
  font: 500 12.5px/1.55 'JetBrains Mono', monospace; color: #cfd2d8; white-space: pre; overflow-x: auto; user-select: text; max-width: 100%;
}
.msg .body b { font-weight: 700; color: var(--text); }
.msg .body s { color: var(--text-3); }
.msg .body .quote { display: block; padding-left: 10px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.msg .body .spoiler { background: var(--bg-4); color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer; transition: color .15s, background .15s; }
.msg .body .spoiler * { visibility: hidden; }
.msg .body .spoiler.shown { background: var(--bg-3); color: inherit; cursor: auto; }
.msg .body .spoiler.shown * { visibility: visible; }
.msg .body .at { color: var(--accent); background: var(--accent-soft); padding: 0 3px; border-radius: 4px; font-weight: 500; }
.msg.enter { animation: msg-in .28s var(--ease); }
.msg.leaving { animation: msg-out .2s ease forwards; }
.msg.pending .body { color: var(--text-3); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes msg-out { to { opacity: 0; transform: translateX(-8px); height: 0; } }

.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react {
  display: flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px;
  background: var(--bg-3); box-shadow: inset 0 0 0 1px transparent; font-size: 13px;
  transition: background .15s, box-shadow .15s, transform .12s;
}
.react:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.react:active { transform: scale(.92); }
.react .n { font-size: 12px; font-weight: 600; color: var(--text-2); }
.react.mine { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.react.mine .n { color: var(--accent); }
.react.pop { animation: pop .3s var(--ease); }
@keyframes pop { 40% { transform: scale(1.18); } }

.tools {
  position: absolute; right: 16px; top: -14px; display: flex; padding: 2px; border-radius: 8px;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 6px 16px #0006;
  opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .12s, transform .12s var(--ease);
}
.msg:hover .tools { opacity: 1; transform: none; pointer-events: auto; }
.tools button { width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2); font-size: 15px; }
.tools button:hover { background: var(--bg-4); color: var(--text); }
.tools button.del:hover { color: var(--danger); }

.edit-box { margin-top: 4px; }
.edit-box textarea { width: 100%; min-height: 38px; resize: none; border: 0; outline: 0; border-radius: 8px; background: var(--bg-3); color: var(--text); font: inherit; padding: 9px 12px; box-shadow: 0 0 0 1px var(--accent-line); }
.edit-box small { color: var(--text-3); font-size: 11.5px; }
.edit-box small b { color: var(--accent); font-weight: 600; }

#jump {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border-radius: 15px;
  background: var(--bg-4); color: var(--text); font-size: 12.5px; font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent-line), 0 6px 18px #0008; animation: rise .25s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
#voice-bar { animation-name: rise-plain; }
@keyframes rise-plain { from { opacity: 0; transform: translateY(8px); } }

#composer-wrap { position: relative; padding: 0 16px; flex: none; }
#composer {
  display: flex; align-items: flex-end; gap: 4px; padding: 6px; border-radius: 10px; background: var(--bg-3);
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .2s;
}
#composer:focus-within { box-shadow: inset 0 0 0 1px var(--line-2); }
#composer .icon-btn { width: 34px; height: 34px; }
#composer .add { border-radius: 50%; }
#input {
  flex: 1; resize: none; border: 0; outline: 0; background: none; color: var(--text);
  font: inherit; line-height: 20px; padding: 7px 4px; max-height: 200px; user-select: text;
}
#input::placeholder { color: var(--text-3); }
#send {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-3); transition: background .2s, color .2s, transform .12s;
}
#send.ready { background: var(--accent); color: var(--accent-ink); }
#send.ready:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
#send:active { transform: scale(.9); }
#typing { height: 26px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding-left: 4px; }
#typing b { font-weight: 600; color: var(--text); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

#emoji-pop {
  position: absolute; right: 16px; bottom: 76px; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; padding: 8px;
  border-radius: 10px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 12px 32px #000a;
  animation: pop-in .18s var(--ease); transform-origin: bottom right; z-index: 5;
}
#emoji-pop button, #react-pop button { height: 36px; border-radius: 6px; font-size: 20px; transition: background .1s, transform .1s; }
#emoji-pop button:hover, #react-pop button:hover { background: var(--bg-4); transform: scale(1.12); }
#react-pop {
  position: fixed; z-index: 45; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; padding: 8px;
  border-radius: 10px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 12px 32px #000a; animation: pop-in .15s var(--ease);
}

.mention-pop {
  position: absolute; left: 16px; right: 16px; bottom: calc(100% - 4px); z-index: 6; padding: 6px; display: grid; gap: 1px;
  border-radius: 10px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 12px 32px #000a; animation: rise-plain .12s var(--ease);
}
.mention-pop::before { content: 'Members'; padding: 2px 8px 6px; font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.mrow { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 7px; color: var(--text-2); text-align: left; }
.mrow .avatar { width: 24px; height: 24px; font-size: 9.5px; }
.mrow.on { background: var(--bg-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } }

/* members */
#members { width: 240px; background: var(--bg-2); overflow-y: auto; padding: 16px 8px; transition: width .25s var(--ease), padding .25s; }
#members.hide { width: 0; padding: 16px 0; overflow: hidden; }
.mgroup { font: 600 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); padding: 12px 8px 6px; white-space: nowrap; }
.mgroup:first-child { padding-top: 0; }
.member { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: background .12s; }
.member:hover { background: var(--bg-3); }
.member.off { opacity: .45; }
.member .mname { font-weight: 500; font-size: 14px; }
.member .mact { display: block; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.member > div:last-child { min-width: 0; line-height: 1.25; }

/* login */
#auth {
  position: fixed; inset: 32px 0 0; z-index: 60; display: grid; place-items: center;
  background:
    radial-gradient(700px 500px at 15% 110%, rgb(var(--accent-rgb) / 14.9%), transparent 60%),
    radial-gradient(600px 400px at 90% -10%, #4a5a8a22, transparent 60%),
    #08090b;
  transition: opacity .3s, visibility .3s;
}
#auth.gone { opacity: 0; visibility: hidden; }
.auth-card {
  width: 380px; padding: 32px; border-radius: 18px; background: var(--bg-2);
  box-shadow: 0 0 0 1px #ffffff0d, 0 30px 70px #000a; animation: card-in .35s var(--ease);
}
.tb-logo { width: 18px; height: 18px; margin-left: -2px; }
.auth-logo { display: block; width: 150px; height: 150px; margin: -18px auto -6px; filter: drop-shadow(0 6px 24px rgb(var(--accent-rgb) / 20%)); animation: logo-in .6s var(--ease); }
@keyframes logo-in { from { opacity: 0; transform: scale(.92); } }
.auth-brand { display: flex; align-items: center; gap: 8px; font: 700 11px 'Chakra Petch'; letter-spacing: .2em; color: var(--text-3); }
.auth-card h1 { font: 700 26px 'Chakra Petch'; margin-top: 18px; }
.auth-sub { color: var(--text-3); margin-top: 2px; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin: 20px 0 16px; border-radius: 10px; background: var(--bg-1); }
.auth-tabs button { flex: 1; height: 32px; border-radius: 7px; color: var(--text-3); font-weight: 600; font-size: 13px; transition: background .15s, color .15s; }
.auth-tabs button.on { background: var(--bg-4); color: var(--text); }
#auth-form { display: grid; gap: 12px; }
#auth-form label, .field { display: grid; gap: 6px; font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
#auth-form input, .field input, .auth-server input {
  height: 40px; padding: 0 12px; border: 0; outline: 0; border-radius: 8px; background: var(--bg-0); color: var(--text);
  font: 14px var(--font); letter-spacing: 0; text-transform: none; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s;
  user-select: text;
}
#auth-form input:focus, .field input:focus, .auth-server input:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
#auth:not(.register) .reg-only { display: none; }
.auth-error { min-height: 18px; color: var(--danger); font-size: 13px; }
.auth-go, .btn-main {
  height: 42px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px;
  transition: background .15s, transform .1s, opacity .15s;
}
.auth-go:hover, .btn-main:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.auth-go:active, .btn-main:active { transform: scale(.98); }
.auth-go:disabled { opacity: .6; pointer-events: none; }
.auth-server { margin-top: 16px; color: var(--text-3); font-size: 12px; }
.auth-server summary { cursor: pointer; }
.auth-server input { width: 100%; margin-top: 8px; height: 34px; font-size: 13px; }

/* menu, modal, toast, connection bar */
#menu {
  position: fixed; z-index: 45; min-width: 210px; padding: 6px; border-radius: 10px; background: var(--bg-0);
  box-shadow: 0 0 0 1px var(--line-2), 0 16px 40px #000c; animation: card-in .15s var(--ease);
}
#menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 34px; padding: 0 10px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); }
#menu button:hover { background: var(--accent); color: var(--accent-ink); }
#menu button.danger:hover { background: var(--danger); color: #fff; }
#menu hr { border: 0; height: 1px; background: var(--line-2); margin: 4px 6px; }
#modal { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; background: #000a; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 420px; padding: 24px; border-radius: 16px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 30px 70px #000c; animation: card-in .2s var(--ease); display: grid; gap: 14px; }
.modal-card h2 { font: 700 20px 'Chakra Petch'; }
.modal-card p { color: var(--text-3); font-size: 13.5px; }
.modal-row { display: flex; gap: 8px; justify-content: flex-end; }
.modal-row button { height: 38px; padding: 0 16px; border-radius: 8px; font-weight: 600; }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.invite-code { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 8px 0 16px; border-radius: 10px; background: var(--bg-0); font: 500 18px 'JetBrains Mono'; letter-spacing: .15em; user-select: text; }
.invite-code button { height: 34px; padding: 0 14px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font: 700 13px var(--font); letter-spacing: 0; }
.modal-split { display: grid; gap: 14px; }
.modal-split .or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; }
.modal-split .or::before, .modal-split .or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row .field { flex: 1; }
.field-row button { height: 40px; padding: 0 16px; }

.modal-card.wide { width: 560px; max-height: calc(100vh - 80px); overflow-y: auto; gap: 18px; }
.set-group { display: grid; gap: 2px; }
.set-group h3 { font: 600 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 6px 12px; border-radius: 10px; background: var(--bg-1); }
.set-row + .set-row { margin-top: 4px; }
.set-row > span { display: grid; gap: 2px; min-width: 0; }
.set-row b { font-weight: 600; font-size: 14px; }
.set-row small { color: var(--text-3); font-size: 12.5px; }
.set-row select {
  width: 260px; height: 34px; padding: 0 10px; border: 0; outline: 0; border-radius: 7px; background: var(--bg-0); color: var(--text);
  font: 13px var(--font); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
}
.set-row select:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
.set-pic { display: flex !important; grid-auto-flow: column; align-items: center; gap: 12px; }
.set-pic > span:last-child { display: grid; gap: 2px; }
#set-pic-av .avatar { width: 44px; height: 44px; font-size: 15px; }
.set-pic-tools { display: flex; gap: 6px; flex: none; }
.set-pic-tools button { height: 34px; padding: 0 14px; border-radius: 7px; font-size: 13px; }
.set-pic-tools button[hidden] { display: none; }
.swatches { display: flex; gap: 6px; flex: none; }
.swatch { width: 22px; height: 22px; border-radius: 50%; transition: transform .12s, box-shadow .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--accent); }
.toggle {
  appearance: none; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--bg-3); position: relative; cursor: pointer;
  transition: background .18s;
}
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform .18s var(--ease), background .18s; }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(16px); background: var(--accent-ink); }
.set-pass { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.set-pass input {
  height: 40px; padding: 0 12px; border: 0; outline: 0; border-radius: 8px; background: var(--bg-0); color: var(--text);
  font: 14px var(--font); box-shadow: inset 0 0 0 1px var(--line); user-select: text; min-width: 0;
}
.set-pass input:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
.set-pass .btn-main { height: 40px; padding: 0 16px; }
.btn-main.danger { background: var(--danger); color: #fff; }
.btn-main.danger:hover { background: #ff6b6b; }
#ss-bans .set-row .btn-ghost { height: 32px; padding: 0 14px; }
#ss-bans .empty-note { padding: 8px 12px; }
.set-note { margin-top: 6px; }
.seg { display: flex; flex: none; padding: 3px; border-radius: 8px; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { height: 28px; padding: 0 12px; border-radius: 6px; color: var(--text-3); font: 600 12.5px var(--font); transition: background .15s, color .15s; }
.seg button.on { background: var(--bg-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.set-row[hidden] { display: none; }
.keybind {
  min-width: 120px; height: 32px; padding: 0 14px; border-radius: 7px; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line-2);
  font: 600 13px 'JetBrains Mono', monospace; color: var(--text);
}
.keybind.listening { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
#me.ptt-on .avatar { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 4px var(--ok); }

#volpop {
  position: fixed; z-index: 46; width: 220px; padding: 12px; display: grid; gap: 8px; border-radius: 10px; background: var(--bg-2);
  box-shadow: 0 0 0 1px var(--line-2), 0 12px 32px #000a; animation: pop-in .14s var(--ease);
}
.vp-head { font-weight: 700; font-size: 14px; }
.vp-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.vp-row b { color: var(--text); font: 600 12px 'JetBrains Mono', monospace; }
#vp-range {
  appearance: none; width: 100%; height: 6px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--bg-4) var(--fill, 50%));
}
#vp-range::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--bg-2); }
.vp-tools { display: flex; gap: 6px; }
.vp-tools button { flex: 1; height: 30px; border-radius: 6px; background: var(--bg-3); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.vp-tools button:hover { background: var(--bg-4); color: var(--text); }
.vuser.local-muted > span:not(.live-pill):not(.muted) { text-decoration: line-through; color: var(--text-3); }
.set-note b { color: var(--text-2); }
.btn-ghost.danger { margin-right: auto; color: var(--danger); }
.btn-ghost.danger:hover { background: #ef54541f; color: var(--danger); }
#toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 70; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px; background: var(--bg-0); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 0 0 1px var(--line-2), 0 12px 30px #000c; transition: opacity .2s, transform .25s var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { box-shadow: 0 0 0 1px #ef545466, 0 12px 30px #000c; }
#conn { flex: none; height: 28px; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); background: var(--away); }
.msg.failed .body { color: var(--danger); }
.ch.voice .soon { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); padding: 2px 6px; border-radius: 5px; background: var(--bg-3); }
.loading-older { text-align: center; color: var(--text-3); font-size: 12px; padding: 8px; }
.empty-note { color: var(--text-3); padding: 0 16px; font-size: 13px; }

/* direct messages */
.ch.dm { height: 42px; }
.ch.dm .avatar { width: 30px; height: 30px; font-size: 10.5px; }
.ch.dm .avatar .pres { width: 8px; height: 8px; border-width: 3px; border-color: var(--bg-2); }
.ch.dm.active .avatar .pres, .ch.dm:hover .avatar .pres { border-color: var(--bg-3); }
.intro .intro-avatar { width: 64px; height: 64px; font-size: 22px; margin-bottom: 12px; }

/* attachments */
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.att { position: relative; border-radius: 10px; overflow: hidden; background: var(--bg-3); box-shadow: 0 0 0 1px var(--line); max-width: min(440px, 100%); }
.att img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; cursor: zoom-in; transition: filter .15s; }
.att img:hover { filter: brightness(1.08); }
.att video { display: block; max-width: 100%; max-height: 340px; background: #000; }
.msg.pending .att { opacity: .55; }
.atts.many .att img { width: 200px; height: 160px; object-fit: cover; }

/* link previews */
.embeds { display: grid; gap: 6px; justify-items: start; }
.embeds:not(:empty) { margin-top: 6px; }
.embed {
  --ec: var(--line-2);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; max-width: min(460px, 100%);
  padding: 10px 14px 12px 12px; border-radius: 8px; background: var(--bg-1);
  border-left: 4px solid var(--ec); box-shadow: 0 0 0 1px var(--line); animation: rise-plain .2s var(--ease);
}
.embed.big { grid-template-columns: minmax(0, 1fr); }
.e-text { display: grid; gap: 4px; min-width: 0; align-content: start; }
.e-site { font-size: 12px; color: var(--text-3); }
.e-author { font-size: 13px; font-weight: 600; color: var(--text); }
.e-title { font-weight: 600; font-size: 14.5px; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.e-title:hover { text-decoration: underline; }
.e-desc { font-size: 13px; color: var(--text-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.e-media { position: relative; display: block; border-radius: 8px; overflow: hidden; justify-self: start; }
.e-media img { display: block; width: 80px; height: 80px; object-fit: cover; }
.embed.big .e-media img { width: auto; height: auto; max-width: 100%; max-height: 340px; }
.e-play {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  display: grid; place-items: center; background: #000000b0; color: #fff; transition: transform .15s var(--ease), background .15s;
}
.e-play svg { width: 22px; height: 22px; fill: currentColor; margin-left: 3px; }
.e-media:hover .e-play { transform: scale(1.08); background: var(--ec, var(--accent)); }
.embed-img { display: block; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.embed-img img { display: block; max-width: min(420px, 100%); max-height: 320px; }

/* server tag */
.utag {
  display: inline-flex; align-items: center; gap: 3px; flex: none; margin-left: 6px; padding: 1px 6px 1px 5px; border-radius: 5px;
  background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--line-2);
  font: 700 11px/16px 'Chakra Petch', sans-serif; letter-spacing: .05em; color: var(--text); vertical-align: 1px; white-space: nowrap;
}
.utag svg { width: 11px; height: 11px; fill: var(--accent); flex: none; }
.utag.big { margin: 0; padding: 4px 10px 4px 8px; font-size: 14px; line-height: 18px; border-radius: 7px; }
.utag.big svg { width: 14px; height: 14px; }
.msg .meta .utag { align-self: center; margin-left: 0; }
.pc-name .utag { margin-left: 0; font-size: 12px; }
.me-nm { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* bots */
.ubot {
  display: inline-flex; align-items: center; flex: none; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); font: 700 10px/15px 'Chakra Petch', sans-serif; letter-spacing: .08em;
  vertical-align: 1px; white-space: nowrap;
}
.msg .meta .ubot { align-self: center; margin-left: 0; }
.pc-name .ubot { margin-left: 0; }
.ubot + .utag { margin-left: 4px; }
.bot-row .avatar { width: 36px; height: 36px; font-size: 13px; }
.bot-row select { height: 34px; max-width: 170px; }
.set-row.bot-row > span.set-pic-tools { display: flex; align-items: center; }
.bot-row .set-pic-tools button { padding: 0 12px; }
.bot-token { display: grid; grid-template-columns: 1fr auto; gap: 8px 10px; align-items: center; margin-bottom: 8px; padding: 12px;
  border-radius: 9px; background: var(--bg-3); box-shadow: inset 0 0 0 1px var(--accent); }
.bot-token > span { display: grid; gap: 2px; grid-column: 1 / -1; }
.bot-token code { overflow-wrap: anywhere; font: 12px/1.4 Consolas, monospace; color: var(--text); user-select: all; }
.bot-token button { height: 32px; padding: 0 14px; border-radius: 7px; }

/* backgrounds + server settings */
#profile.has-pic .pc-banner { height: 112px; }
#profile.has-pic .pc-avatar { top: 72px; }
.ban-prev { width: 96px; height: 32px; border-radius: 6px; flex: none; box-shadow: 0 0 0 1px var(--line-2); }
#server-head.pic #banner { height: 122px; background: var(--pic) center / cover no-repeat, var(--bg-2); }
#server-head.pic #banner::after { background: linear-gradient(180deg, transparent 30%, #0008 62%, var(--bg-2)); }
#server-head.pic #banner-mark { display: none; }
#server-head.pic .sh-row { top: 84px; text-shadow: 0 1px 8px #000c; }
.set-row > span.tag-tools { display: flex; align-items: center; gap: 10px; }
.ban-prev { margin-right: 4px; }
.tag-tools input {
  width: 92px; height: 34px; padding: 0 10px; border: 0; outline: 0; border-radius: 7px; background: var(--bg-0); color: var(--text);
  font: 700 14px 'Chakra Petch', sans-serif; letter-spacing: .08em; text-transform: uppercase; box-shadow: inset 0 0 0 1px var(--line);
}
.tag-tools input:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
.tag-icons { display: flex; gap: 6px; padding: 8px 12px; border-radius: 10px; background: var(--bg-1); margin-top: 4px; }
.tag-icons button { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background .15s, color .15s; }
.tag-icons button svg { width: 16px; height: 16px; fill: currentColor; }
.tag-icons button:hover { background: var(--bg-3); color: var(--text); }
.tag-icons button.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.modal-row.tight { margin-top: 8px; }
#tray { display: flex; gap: 8px; padding: 10px 10px 8px; border-radius: 10px 10px 0 0; background: var(--bg-3); overflow-x: auto; border-bottom: 1px solid var(--line); }
#replybar {
  display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 8px 0 14px;
  border-radius: 10px 10px 0 0; background: var(--bg-3); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-3); animation: rise-plain .18s var(--ease);
}
#replybar b { color: var(--text); font-weight: 600; }
#replybar button { width: 24px; height: 24px; border-radius: 6px; color: var(--text-3); }
#replybar button:hover { background: var(--bg-4); color: var(--text); }
#replybar:not([hidden]) + #tray { border-radius: 0; }
#composer.joined, [data-look] #composer.joined { border-radius: 0 0 14px 14px; }
.reply-quote {
  grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 6px; min-width: 0;
  padding-left: 54px; margin-bottom: 2px; font-size: 12.5px; color: var(--text-3); cursor: pointer;
}
.reply-quote::before {
  content: ''; position: absolute; left: 35px; top: 9px; width: 15px; height: 9px;
  border: 2px solid var(--line-2); border-right: 0; border-bottom: 0; border-top-left-radius: 6px;
}
.reply-quote .avatar { width: 16px; height: 16px; font-size: 7px; }
.reply-quote b { font-weight: 600; color: var(--text-2); flex: none; }
.reply-quote span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-quote:hover, .reply-quote:hover b { color: var(--text); }
.reply-quote i { font-style: italic; }
.msg.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); } }
.chip { position: relative; flex: none; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--bg-1); box-shadow: 0 0 0 1px var(--line-2); animation: pop-in .18s var(--ease); }
.chip img, .chip video { width: 100%; height: 100%; object-fit: cover; }
.chip .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 6px; background: #000b; color: #fff; display: grid; place-items: center; font-size: 13px; }
.chip .x:hover { background: var(--danger); }
.chip .sz { position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px; background: #000b; font-size: 10.5px; color: #ddd; }
#lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #000d; animation: fade .15s; cursor: zoom-out; }
#lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 20px 60px #000; animation: card-in .2s var(--ease); }
#dropzone { position: fixed; inset: 32px 0 0; z-index: 75; display: grid; place-items: center; background: #08090bcc; pointer-events: none; animation: fade .12s; }
#dropzone > div { padding: 40px 60px; border-radius: 18px; border: 2px dashed var(--accent-line); background: var(--bg-2); font-size: 16px; color: var(--text-2); }
#dropzone b { color: var(--accent); }
.upload-bar { height: 3px; border-radius: 2px; background: var(--bg-4); margin-top: 6px; overflow: hidden; max-width: 240px; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.role-founder { color: #ff9d57; }
.role-crew { color: #d9dbe0; }
.role-bot { color: #8fb4ff; }

/* roles + channel permissions */
.ch .lock { width: 12px; height: 12px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.4; opacity: .8; }
#composer.readonly { opacity: .55; }
#composer.readonly .icon-btn, #composer.readonly #send { pointer-events: none; }
#composer.readonly textarea { cursor: not-allowed; }
.field small { color: var(--text-3); font-weight: 400; font-size: 12px; text-transform: none; letter-spacing: 0; }
.role-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.role-pick button { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 7px; background: var(--bg-1);
  color: var(--text-3); font: 500 12.5px var(--font); box-shadow: inset 0 0 0 1px var(--line); transition: background .15s, color .15s; }
.role-pick button i { width: 8px; height: 8px; border-radius: 50%; }
.role-pick button:hover { color: var(--text); }
.role-pick button.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
#nc-kind { align-self: flex-start; margin-bottom: 4px; }
.set-row.role-row > span.role-main { display: flex; align-items: center; gap: 10px; flex: 1; }
.role-row input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; flex: none; }
.role-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.role-row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.role-row .role-name { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: 600 14px var(--font); outline: 0; }
.role-row .role-name:focus { background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--accent-line); }
.set-row.role-row > span.set-pic-tools { display: flex; align-items: center; gap: 4px; }
.role-row .role-admin { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; margin-right: 6px; cursor: pointer; }
.role-row .role-admin input { accent-color: var(--accent); }
.role-row .btn-ghost { height: 30px; padding: 0 10px; }
.role-row .btn-ghost.danger { margin-right: 0; }
.role-row button[disabled] { opacity: .3; pointer-events: none; }

/* full-screen settings: menu on the left, one page at a time */
select[hidden] { display: none !important; }
.modal-card.full { width: min(1180px, calc(100vw - 48px)); height: calc(100vh - 64px); padding: 0; gap: 0; display: block; overflow: hidden; }
.set-full { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
.set-nav { display: flex; flex-direction: column; gap: 2px; padding: 28px 12px; background: var(--bg-1); overflow-y: auto; }
.set-nav-head { padding: 0 12px 10px; font: 600 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.set-nav button { position: relative; height: 38px; padding: 0 14px; border-radius: 8px; text-align: left; color: var(--text-2); font: 500 14px var(--font);
  transition: background .15s, color .15s, transform .18s var(--ease); }
.set-nav button:hover { background: var(--bg-3); color: var(--text); transform: translateX(3px); }
.set-nav button.on { background: var(--bg-4); color: var(--text); }
.set-nav button.on::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.set-nav button.danger { color: var(--danger); }
.set-nav button.danger:hover { background: #ef54541f; }
.set-nav hr { border: 0; height: 1px; background: var(--line-2); margin: 10px 8px; }
.set-pane { position: relative; overflow-y: auto; padding: 36px 56px 56px; }
.set-x { position: sticky; top: 0; float: right; z-index: 2; display: grid; justify-items: center; gap: 4px; margin: -12px -32px 0 0; color: var(--text-3); }
.set-x svg { width: 36px; height: 36px; padding: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); fill: none; stroke: currentColor; stroke-width: 1.6;
  transition: background .15s, transform .2s var(--ease), box-shadow .15s; }
.set-x small { font: 600 10px var(--font); letter-spacing: .06em; }
.set-x:hover { color: var(--text); }
.set-x:hover svg { background: var(--bg-3); transform: rotate(90deg); box-shadow: inset 0 0 0 1.5px var(--text-3); }
.set-body { max-width: 740px; display: grid; }
.set-body.tab-in > :not([hidden]) { animation: swap-in .22s var(--ease); }
.full .set-group { gap: 10px; }
.full .set-group[hidden] { display: none; }
.full .set-group h2 { font: 700 24px 'Chakra Petch'; margin-bottom: 14px; }
.full .set-group h3 { margin: 12px 0 0; }
.full .set-row { min-height: 66px; padding: 14px 18px; gap: 24px; border-radius: 12px; transition: background .15s, box-shadow .15s; }
.full .set-row + .set-row { margin-top: 0; }
.full .set-row:hover { background: #1b1d22; box-shadow: inset 0 0 0 1px var(--line); }
.full .set-row b { font-size: 14.5px; }
.full .set-row small { font-size: 13px; line-height: 1.4; }
.full .set-note { margin: 2px 4px 0; line-height: 1.5; }
.full .set-pass { margin-top: 4px; }
.full .field-row { margin-top: 6px; }
/* profile card preview */
.set-preview { width: 320px; border-radius: 14px; overflow: hidden; background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); padding-bottom: 16px; margin-bottom: 8px;
  transition: transform .25s var(--ease), box-shadow .25s; }
.set-preview:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-2), 0 14px 34px #0008; }
.sp-banner { height: 96px; }
.sp-av { width: max-content; margin: -34px 0 0 16px; padding: 5px; border-radius: 50%; background: var(--bg-1); }
.sp-av .avatar { width: 66px; height: 66px; font-size: 20px; }
.sp-av .avatar .pres { width: 14px; height: 14px; border-width: 4px; }
.sp-name { padding: 6px 18px 0; font: 700 19px 'Chakra Petch'; }
.sp-sub { padding: 2px 18px 0; color: var(--text-3); font-size: 12.5px; }

/* our own dropdown */
.fsel { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 36px; min-width: 200px; max-width: 320px; padding: 0 12px;
  border-radius: 8px; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 500 13px var(--font); text-align: left;
  transition: box-shadow .15s, background .15s; }
.fsel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsel svg { width: 12px; height: 12px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 1.6; transition: transform .2s var(--ease); }
.fsel:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
.fsel.open { box-shadow: inset 0 0 0 1px var(--accent); }
.fsel.open svg { transform: rotate(180deg); }
.bot-row .fsel { min-width: 150px; height: 34px; }
.fsel-pop { position: fixed; z-index: 80; display: grid; gap: 2px; max-width: 420px; max-height: 300px; overflow-y: auto; padding: 5px; border-radius: 10px;
  background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 16px 40px #000b; }
.fsel-pop[hidden] { display: none; }
.fsel-pop.pop-in { animation: pop-in .14s var(--ease); transform-origin: top center; }
.fsel-opt { height: 32px; padding: 0 10px; border-radius: 6px; text-align: left; color: var(--text-2); font: 500 13px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .1s, color .1s; }
.fsel-opt.on { background: var(--bg-4); color: var(--text); }
.fsel-opt:hover { background: var(--accent); color: var(--accent-ink); }

/* name panel: give the name the room */
#me { gap: 6px; }
#me .icon-btn { width: 30px; height: 30px; flex: none; }

/* small hover life */
@media (prefers-reduced-motion: no-preference) {
  .srv { transition: border-radius .2s var(--ease), background .15s, color .15s, transform .2s var(--ease); }
  .srv:hover { transform: translateY(-1px); }
  .srv:active { transform: scale(.94); }
  .ch .name { transition: transform .16s var(--ease); }
  .ch:hover .name { transform: translateX(2px); }
  .member { transition: background .12s, transform .16s var(--ease); }
  .member:hover { transform: translateX(2px); }
  .avatar { transition: transform .2s var(--ease), box-shadow .2s; }
  .member:hover .avatar, #me .avatar:hover, .msg .avatar:hover, .vuser:hover .avatar { transform: scale(1.08); }
  .icon-btn svg { transition: transform .2s var(--ease); }
  .icon-btn:hover svg { transform: scale(1.1); }
  #btn-settings:hover svg { transform: rotate(60deg); }
  .icon-btn:active { transform: scale(.92); }
  .me-text { transition: background .15s, transform .16s var(--ease); }
  .me-text:hover { transform: translateX(1px); }
  .btn-main { transition: background .15s, transform .15s var(--ease), box-shadow .15s; }
  .btn-main:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgb(var(--accent-rgb) / 20%); }
  .btn-main:active { transform: scale(.98); }
  .pc-role, .role-pick button, .tag-icons button { transition: background .15s, color .15s, transform .15s var(--ease); }
  .pc-role:hover, .role-pick button:hover { transform: translateY(-1px); }
  .swatch { transition: transform .15s var(--ease); }
  .swatch:hover { transform: scale(1.15); }
}

/* my card (click your name bottom-left) */
#mecard { position: fixed; z-index: 60; width: 300px; border-radius: 14px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px #000c; }
#mecard[hidden] { display: none; }
#mecard.card-up { animation: card-up .2s var(--ease); transform-origin: bottom left; }
@keyframes card-up { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.mc-banner { height: 96px; border-radius: 14px 14px 0 0; }
.mc-top { display: flex; align-items: flex-start; gap: 10px; margin: -38px 12px 0; }
.mc-av { flex: none; padding: 5px; border-radius: 50%; background: var(--bg-2); }
.mc-av .avatar { width: 72px; height: 72px; font-size: 22px; }
.mc-av .avatar .pres { width: 14px; height: 14px; border-width: 4px; border-color: var(--bg-2); right: 0; bottom: 0; }
.mc-bubble { position: relative; margin-top: 46px; max-width: 190px; padding: 7px 11px; border-radius: 12px; background: var(--bg-1); color: var(--text-2);
  font: 500 12.5px var(--font); text-align: left; box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .15s, box-shadow .15s, transform .15s var(--ease); }
.mc-bubble b { color: var(--accent); }
.mc-bubble:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); transform: translateY(-1px); }
.mc-body { padding: 8px 14px 14px; display: grid; gap: 8px; }
.mc-name { font: 700 20px 'Chakra Petch'; line-height: 1.1; }
.mc-sub { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; margin-top: -4px; }
.mc-bio { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.mc-menu { position: relative; display: grid; padding: 5px; border-radius: 10px; background: var(--bg-1); }
.mc-menu > button { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 7px; color: var(--text-2); font: 500 13.5px var(--font); text-align: left;
  transition: background .12s, color .12s, padding .15s var(--ease); }
.mc-menu > button:hover, .mc-menu > button.open { background: var(--bg-3); color: var(--text); padding-left: 13px; }
.mc-menu > button.danger { color: var(--danger); }
.mc-menu > button.danger:hover { background: #ef54541f; }
.mc-menu svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.mc-menu .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s var(--ease); }
.mc-status.open .chev { transform: translateX(2px); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 3px; background: var(--ok); }
.dot.st-idle { background: var(--away); }
.dot.st-dnd { background: var(--danger); }
.dot.st-invisible { background: transparent; box-shadow: inset 0 0 0 2.5px var(--text-3); }
.mc-flyout { position: absolute; left: calc(100% + 18px); top: 0; width: 230px; display: grid; gap: 2px; padding: 5px; border-radius: 10px; background: var(--bg-2);
  box-shadow: 0 0 0 1px var(--line-2), 0 16px 40px #000b; animation: pop-in .14s var(--ease); transform-origin: left top; }
.mc-flyout[hidden] { display: none; }
.mc-flyout button { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 7px; color: var(--text-2); font: 500 13.5px var(--font); text-align: left; transition: background .12s, color .12s; }
.mc-flyout button .dot { margin-top: 4px; }
.mc-flyout button span { display: grid; gap: 2px; }
.mc-flyout button small { color: var(--text-3); font-size: 11.5px; font-weight: 400; }
.mc-flyout button:hover { background: var(--accent); color: var(--accent-ink); }
.mc-flyout button:hover small { color: var(--accent-ink)b3; }
.mc-flyout button.on:not(:hover) { background: var(--bg-4); color: var(--text); }
#me.card-open .me-text { background: var(--bg-3); }
.set-row.danger-row { box-shadow: inset 0 0 0 1px #ef545433; }
.set-row.danger-row .btn-main { flex: none; height: 36px; padding: 0 16px; }
.btn-main[disabled] { opacity: .4; pointer-events: none; }

/* long text: wrap instead of cutting off */
.pc-bio { display: block; width: 100%; resize: none; overflow: hidden; background: none; border: 0; outline: 0; padding: 0; color: var(--text); font: inherit; line-height: 1.45; user-select: text; }
.pc-box > div { overflow-wrap: anywhere; line-height: 1.45; }
.pc-custom { overflow-wrap: anywhere; line-height: 1.4; }
.mc-bubble { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.35; }
.mc-bio { overflow-wrap: anywhere; }
.me-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* server pictures */
.srv .srv-img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; transition: border-radius .25s var(--ease); }
.srv.pic { background: var(--bg-1); }
.srv.pic.active { box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 3.5px var(--accent); }
.srv-prev { width: 52px; height: 52px; flex: none; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--bg-3);
  font: 700 15px 'Chakra Petch', sans-serif; color: var(--text-2); }
.srv-prev img { width: 100%; height: 100%; object-fit: cover; }

/* clickable server tags + the card they open */
.utag[data-tag-srv] { cursor: pointer; transition: background .15s, box-shadow .15s, color .15s; }
.utag[data-tag-srv]:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--text); }
.sc-face { border-radius: 20px; }
.sc-face .srv-img, .sc-face .srv-txt { width: 74px; height: 74px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-3); font: 700 22px 'Chakra Petch', sans-serif; color: var(--text-2); }
.sc-face .srv-img { display: block; object-fit: cover; }
.sc-kind { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.sc-kind svg { width: 12px; height: 12px; fill: currentColor; }
.sc-stats { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.sc-stats span { display: flex; align-items: center; gap: 6px; }
.sc-stats i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sc-stats i.on { background: #3ddc84; }
.sc-note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg-1); font-size: 13px; color: var(--text-2); line-height: 1.45; }
.pc-actions button[disabled] { opacity: .6; pointer-events: none; }

/* categories: a full-width row you can't miss, with room before the first channel */
.cat {
  width: 100%; text-align: left; height: 36px; margin: 10px 0 4px; padding: 0 8px 0 12px; border-radius: 9px; gap: 8px; cursor: pointer;
  font: 600 13px var(--font); letter-spacing: .05em; color: var(--text-2);
  display: flex; align-items: center; transition: background .15s, color .15s;
}
.cat:first-child { padding-top: 0; margin-top: 0; }
.cat .cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .cat-n { min-width: 20px; padding: 0 6px; border-radius: 9px; background: #ffffff0a; color: var(--text-3); font: 600 11px/18px var(--font); text-align: center; letter-spacing: 0; }
.cat svg { width: 22px; height: 22px; padding: 5px; border-radius: 6px; flex: none; transition: transform .2s var(--ease), background .15s; }
.cat:hover { background: var(--bg-3); color: var(--text); }
.cat:hover svg { background: #ffffff0d; }
.cat:active { transform: scale(.985); }
.ch { min-height: 36px; }

.cat.label { cursor: default; padding-left: 8px; }
.cat.label:hover { background: none; color: var(--text-2); }
.cat.label:active { transform: none; }

/* one style for everything that pops up: same surface, same corner, thin orange edge */
#menu, #profile, #mecard, .modal-card, .fsel-pop, #toast, #tip {
  background: #191b20; box-shadow: 0 0 0 1px #ffffff14, inset 0 1px 0 #ffffff0d, 0 22px 54px #000b;
}
#menu, .fsel-pop { border-radius: 12px; padding: 6px; }
#profile, #mecard { border-radius: 16px; }
.modal-card::before { content: ''; position: absolute; left: 24px; right: 24px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .65; }
.modal-card { position: relative; }
#menu button, .fsel-opt { border-radius: 8px; }
#menu button:hover, .fsel-opt:hover { background: #ffffff0f; color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
#menu button.danger { color: #f07a7a; }
#menu button.danger:hover { background: #ef54541f; color: #ff8d8d; box-shadow: inset 2px 0 0 var(--danger); }
#toast { border-radius: 12px; box-shadow: inset 3px 0 0 var(--accent), 0 0 0 1px #ffffff14, 0 16px 40px #000c; }
#toast.err { box-shadow: inset 3px 0 0 var(--danger), 0 0 0 1px #ffffff14, 0 16px 40px #000c; }

/* voice: people in a channel sit in their own soft block, speaking = calm green ring */
.vusers { margin: 2px 0 6px 30px; padding: 4px; border-radius: 10px; background: #ffffff06; }
.vuser { height: 32px; border-radius: 8px; padding: 0 8px; }
.vuser.speaking { color: var(--text); }
.vuser.speaking .avatar { box-shadow: 0 0 0 2px #191b20, 0 0 0 3.5px var(--ok), 0 0 12px #3ecf7a66; }

/* clickable roles + who has them */
.mgroup[data-role] { cursor: pointer; border-radius: 8px; transition: color .15s; }
.mgroup[data-role]:hover { color: var(--text); }
.pc-role[data-role] { cursor: pointer; transition: background .15s, box-shadow .15s; }
.pc-role[data-role]:hover { background: var(--bg-4); box-shadow: inset 0 0 0 1px var(--accent-line); }
.rc-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.rc-head i { width: 4px; height: 34px; border-radius: 2px; flex: none; }
.rc-head b { display: block; font: 700 17px 'Chakra Petch', sans-serif; }
.rc-head span { font-size: 12.5px; color: var(--text-3); }
.rc-list { max-height: min(380px, 60vh); overflow-y: auto; padding: 8px; display: grid; gap: 2px; }
.rc-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 8px; border-radius: 9px; text-align: left; transition: background .12s; }
.rc-row:hover { background: #ffffff0d; }
.rc-row.off { opacity: .5; }
.rc-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.rc-name em { font: 600 10.5px var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
#tip::before { background: #191b20; }

/* server list: drag to arrange, groups */
#rail > *, .rail-group > * { flex: none; }
.rail-group { display: flex; flex-direction: column; align-items: center; gap: 8px; border-radius: 17px; }
.rail-group.open { padding: 4px; margin: 0; background: color-mix(in srgb, var(--gc) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc) 30%, transparent); }
.srv.folder { background: color-mix(in srgb, var(--gc) 22%, var(--bg-2)); }
.srv.folder:hover { background: color-mix(in srgb, var(--gc) 32%, var(--bg-2)); }
.srv.folder > svg { width: 20px; height: 20px; fill: var(--gc); }
.rail-group.open .srv.folder { background: none; box-shadow: none; height: 38px; }
.rail-group.open .srv::before { left: -17px; }
.rail-group.open .srv.folder::before { display: none; }
.folder-grid { display: grid; grid-template-columns: 16px 16px; gap: 3px; align-content: center; justify-content: center; width: 100%; height: 100%; }
.mini { width: 16px; height: 16px; border-radius: 5px; overflow: hidden; display: grid; place-items: center; background: var(--bg-0); font: 700 7px 'Chakra Petch', sans-serif; color: var(--text-2); }
.mini .srv-img { width: 16px; height: 16px; border-radius: 0; }
.srv.dragging { opacity: .3; }
.srv.drop-into { box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent) !important; transform: scale(.94); }
#rail-line { position: fixed; z-index: 70; height: 4px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px rgb(var(--accent-rgb) / 53.3%); pointer-events: none; }
.rail-ghost { position: fixed !important; z-index: 80; width: 46px !important; height: 46px !important; pointer-events: none; opacity: .92; transform: rotate(-3deg) scale(1.06); box-shadow: 0 12px 30px #000c !important; transition: none !important; }
.rail-ghost::before { display: none; }
.rail-dragging, .rail-dragging * { cursor: grabbing !important; }
.gr-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gr-colors button { width: 30px; height: 30px; border-radius: 9px; transition: transform .12s; }
.gr-colors button:hover { transform: scale(1.08); }
.gr-colors button.on { box-shadow: 0 0 0 2px #191b20, 0 0 0 4px var(--text); }
body.rail-dragging #tip { opacity: 0; }

/* ---------- 0.1.2: settings bits ---------- */
.range { appearance: none; width: 190px; height: 6px; border-radius: 3px; cursor: pointer; background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--bg-4) var(--fill, 50%)); }
.range::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--bg-2); }
.set-row > .range-wrap { display: flex; align-items: center; gap: 14px; }
.range-wrap b { min-width: 58px; text-align: right; font: 500 12.5px 'JetBrains Mono', monospace !important; }
.set-row > .snd-tools { display: flex; align-items: center; gap: 8px; }
.snd-tools .btn-ghost, #set-others { font-size: 13.5px; }
.snd-tools .btn-ghost { height: 34px; padding: 0 14px; border-radius: 8px; }
.set-text { width: 260px; height: 36px; padding: 0 12px; border: 0; outline: 0; border-radius: 9px; background: var(--bg-0); color: var(--text); font: 14px var(--font); box-shadow: inset 0 0 0 1px var(--line); user-select: text; }
.set-text:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
#set-accent .swatch { width: 28px; height: 28px; }
#set-accent .own { position: relative; overflow: hidden; cursor: pointer; background: conic-gradient(#ef5454, #e8b339, #3ecf7a, #2bb5c9, #4a8cff, #d65db1, #ef5454); }
#set-accent .own input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.look-demo { padding: 10px 0 14px; border-radius: 14px; background: #131418; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.look-demo .msg:hover { background: none; }
#set-others { height: 36px; padding: 0 16px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 600; flex: none; }
.field textarea { width: 100%; min-height: 76px; resize: vertical; padding: 10px 12px; border: 0; outline: 0; border-radius: 9px; background: var(--bg-0); color: var(--text); font: 14px/1.45 var(--font); box-shadow: inset 0 0 0 1px var(--line); user-select: text; text-transform: none; letter-spacing: 0; }
.field textarea:focus { box-shadow: inset 0 0 0 1px var(--accent-line); }
.time-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.time-pick button { height: 42px; border-radius: 10px; background: var(--bg-1); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.time-pick button:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }

/* compact messages */
.mbox { grid-column: 2; min-width: 0; }
.compact .msg { grid-template-columns: 44px 1fr; column-gap: 10px; padding-top: 1px; padding-bottom: 1px; }
.compact .msg.head { margin-top: 5px; padding-top: 1px; }
.compact .msg > .avatar { width: 20px; height: 20px; font-size: 8px; margin: 1px 0 0; justify-self: end; }
.compact .msg.head .meta { float: left; margin-right: 8px; }
.compact .msg.head .meta .time { display: none; }
.compact .msg.head .body:has(.codeblock), .compact .msg.head .body:empty + * { clear: both; }
.compact .msg .reacts, .compact .msg .atts, .compact .msg .embeds, .compact .msg .edit-box { clear: both; }
.compact .day { margin: 10px 16px 4px; }

/* message links, mentions, blocked */
.msg .body .at.who { cursor: pointer; }
.msg .body .at.who:hover, .msg .body .at.mlink:hover { text-decoration: underline; }
.msg .body .at.mlink { cursor: pointer; }
.mcard { max-width: 520px; margin-top: 6px; padding: 10px 14px; border-radius: 10px; background: var(--bg-2); box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px var(--line); cursor: pointer; transition: background .15s; }
.mcard:hover { background: var(--bg-3); }
.mc2-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 3px; min-width: 0; }
.mc2-head .avatar, .msg .mc2-head .avatar { width: 20px; height: 20px; font-size: 8px; margin: 0; }
.mc2-head span { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .body { max-height: 8.7em; overflow: hidden; overflow-wrap: anywhere; }
.mcard img { display: block; max-width: 220px; max-height: 130px; margin-top: 6px; border-radius: 8px; }
.msg.blocked { opacity: .6; }
.blocked-note { grid-column: 2; justify-self: start; padding: 3px 10px; border-radius: 7px; background: var(--bg-3); color: var(--text-3); font-size: 12.5px; }
.blocked-note b { margin-left: 8px; color: var(--text-2); font-weight: 600; }
.mrow small { color: var(--text-3); margin-left: 6px; }
.t-out { display: inline-grid; margin-left: 6px; color: var(--away); vertical-align: -2px; }
.t-out svg { width: 13px; height: 13px; }

/* code */
.msg .body .codeblock, .side-msg .codeblock { margin: 6px 0 4px; padding: 0; border-radius: 10px; background: var(--bg-0); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; white-space: normal; max-width: min(760px, 100%); }
.cb-head { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 6px 0 12px; background: #ffffff06; color: var(--text-3); font: 600 11.5px var(--font); }
.cb-copy { height: 22px; padding: 0 10px; border-radius: 6px; color: var(--text-3); font: 600 11.5px var(--font); }
.cb-copy:hover { background: #ffffff12; color: var(--text); }
.codeblock pre { padding: 10px 12px; font: 500 12.5px/1.55 'JetBrains Mono', monospace; color: #cfd2d8; white-space: pre; overflow-x: auto; max-height: 420px; user-select: text; }
.codeblock i { font-style: normal; }
.codeblock pre { font-variant-ligatures: none; }
.c-c { color: #747a85; } .c-s { color: #9fd08a; } .c-n { color: #e0a36a; } .c-k { color: #6cb2ff; } .c-f { color: #e3cf86; } .c-d { color: #f08a8a; }

/* voice: time + who's watching */
.vtime { font: 500 12px 'JetBrains Mono', monospace; color: var(--ok); flex: none; }
.ch.voice .vtime { margin-left: auto; }
.vuser .vtime { margin-left: auto; color: var(--text-3); font-size: 11px; }
.vuser .vtime ~ .live-pill, .vuser .vtime ~ .muted { margin-left: 6px; }
.vuser .vname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vb-state, .vb-where { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vuser.live .vtime { display: none; }
.vuser.live .live-pill { margin-left: auto !important; }
.vuser.local-muted > .vtime { text-decoration: none !important; }
.eyes { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: 8px; background: #ffffff0a; color: var(--text-2); font-size: 12.5px; transition: background .15s, color .15s; }
.eyes:hover { background: #ffffff14; color: var(--text); }
.eyes .eye { display: grid; }
.eyes svg { width: 15px; height: 15px; }
.pile { display: flex; }
.pile .avatar { width: 18px; height: 18px; font-size: 7px; margin-left: -5px; box-shadow: 0 0 0 2px var(--bg-1); }
.pile .avatar:first-child { margin-left: 2px; }
#vb-eyes .pile { display: none; }
#vb-eyes .eyes { padding: 0 7px; gap: 4px; }
#stage-eyes { margin-left: 4px; }
.draft { width: 12px; height: 12px; color: var(--text-3); flex: none; }
#btn-readall svg { width: 18px; height: 18px; }

/* profile card extras */
.pc-avatar.zoom, .pc-banner.zoom { cursor: zoom-in; }
.pc-note { width: 100%; resize: none; border: 0; outline: 0; border-radius: 6px; padding: 3px 6px; margin: -2px -6px; background: none; color: var(--text-2); font: 13px/1.4 var(--font); user-select: text; overflow: hidden; }
.pc-note:hover, .pc-note:focus { background: var(--bg-0); }
.pc-actions button.more { flex: 0 0 40px; font-size: 16px; }

/* picture viewer */
#lightbox { cursor: default; overflow: hidden; touch-action: none; }
#lightbox img { cursor: zoom-in; transition: transform .12s ease-out; will-change: transform; animation: none; }
#lightbox.zoomed img { cursor: grab; }
#lightbox.zoomed img:active { cursor: grabbing; transition: none; }
.lb-bar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 12px; background: #191b20ee; box-shadow: 0 0 0 1px #ffffff14, 0 16px 40px #000c; }
.lb-name { max-width: 340px; padding: 0 12px; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name:empty { display: none; }
.lb-bar button { height: 32px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13px; display: grid; place-items: center; }
.lb-bar button:hover { background: #ffffff14; }
.lb-nav { position: absolute; top: 50%; width: 46px; height: 46px; margin-top: -23px; border-radius: 50%; background: #191b20cc; display: grid; place-items: center; }
.lb-nav:hover { background: #2a2d34; }
.lb-nav.prev { left: 22px; } .lb-nav.next { right: 22px; }
.lb-nav svg { width: 20px; height: 20px; }

/* Ctrl+K */
#quick { position: fixed; inset: 0; z-index: 78; display: grid; justify-items: center; align-items: start; padding-top: 12vh; background: #000a; animation: fade .12s; }
.qk-card { width: min(580px, calc(100vw - 40px)); border-radius: 16px; overflow: hidden; background: #191b20; box-shadow: 0 0 0 1px #ffffff14, inset 0 1px 0 var(--accent-line), 0 30px 70px #000c; animation: card-in .16s var(--ease); }
#qk-in { width: 100%; height: 58px; padding: 0 20px; border: 0; outline: 0; background: none; color: var(--text); font: 500 17px var(--font); border-bottom: 1px solid var(--line); user-select: text; }
#qk-list { max-height: min(400px, 52vh); overflow-y: auto; padding: 8px; display: grid; gap: 1px; }
.qk-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--text-2); text-align: left; }
.qk-row.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.qk-row.hot { color: var(--text); font-weight: 600; }
.qk-face { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; flex: none; color: var(--text-3); font-size: 16px; }
.qk-face img { width: 100%; height: 100%; object-fit: cover; }
.qk-face .srv-txt { font: 700 10px var(--font); width: 100%; height: 100%; display: grid; place-items: center; background: var(--bg-4); }
.qk-row > .avatar { width: 26px; height: 26px; font-size: 9px; }
.qk-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qk-name em { font-style: normal; color: var(--text-3); font-weight: 400; margin-left: 6px; }
.qk-sub { margin-left: auto; color: var(--text-3); font-size: 12.5px; font-weight: 400; flex: none; }
.qk-row .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font); text-align: center; }
.qk-tip { display: flex; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; }
.qk-tip b { color: var(--text-2); font-weight: 600; }
.qk-tip span { margin-left: auto; }

/* settings: updates + what's new */
.set-row.up-row img { width: 46px; height: 46px; flex: none; }
.set-row.up-row > span { flex: 1; }
#up-go { height: 38px; padding: 0 18px; border-radius: 9px; font-weight: 600; flex: none; }
#up-go:disabled { opacity: .6; }
.wn { border-radius: 14px; background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.wn summary { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 18px; cursor: pointer; list-style: none; }
.wn summary::-webkit-details-marker { display: none; }
.wn summary b { font: 700 16px 'Chakra Petch', sans-serif; }
.wn summary span { color: var(--text-3); font-size: 12.5px; }
.wn summary em { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); }
.wn summary svg { width: 14px; height: 14px; margin-left: auto; color: var(--text-3); transition: transform .18s var(--ease); }
.wn[open] summary svg { transform: rotate(180deg); }
.wn summary:hover { background: #ffffff05; }
.wn ul { margin: 0; padding: 2px 18px 16px 36px; display: grid; gap: 7px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.wn li::marker { color: var(--accent); }
.inv-c { font: 500 14px 'JetBrains Mono', monospace !important; letter-spacing: .12em; user-select: text; }
.rc-head .rc-id { margin-left: auto; height: 28px; padding: 0 10px; border-radius: 8px; background: #ffffff0a; color: var(--text-2); font-size: 12px; font-weight: 600; }
.rc-head .rc-id:hover { background: #ffffff14; color: var(--text); }
