:root {
  --bg: #08090d;
  --bg-1: #0c0e14;
  --bg-2: #0f1117;
  --bg-3: #161923;
  --bg-4: #1d212c;
  --bg-hover: #232733;
  --bg-active: #2a2f3d;
  --line: #22262f;
  --text: #f3f5f9;
  --text-2: #a8b0c0;
  --muted: #6f7889;
  --gold: #f5c518;
  --gold-d: #d9a900;
  --gold-soft: rgba(245, 197, 24, .12);
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #c084fc;
  --orange: #fb923c;
  --idle: #f5c518;
  --dnd: #f87171;
  --radius: 10px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: Archivo, Inter, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
::selection { background: rgba(245, 197, 24, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262a35; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }

/* ---------- boot ---------- */
.boot { height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-logo { width: 64px; height: 64px; animation: bob 1.6s ease-in-out infinite; }
.boot-text { font: 800 20px var(--font-display); letter-spacing: .02em; color: var(--text-2); }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ---------- auth ---------- */
.auth-wrap { width: 100%; max-width: 960px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.auth-hero h1 { font: 800 clamp(34px, 5vw, 52px)/1.02 var(--font-display); margin: 18px 0 14px; letter-spacing: -.02em; }
.auth-hero h1 span { color: var(--gold); }
.auth-hero p { color: var(--text-2); font-size: 17px; max-width: 440px; margin: 0 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 20px var(--font-display); }
.brand img { width: 36px; height: 36px; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 460px; }
.feature { display: flex; gap: 10px; align-items: center; color: var(--text-2); font-size: 14px; }
.feature svg { color: var(--gold); }
.card {
  background: rgba(15, 17, 23, .92); border: 1px solid var(--line); border-radius: 16px; padding: 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45); backdrop-filter: blur(8px);
}
.card h2 { margin: 0 0 4px; font: 700 24px var(--font-display); }
.card .sub { color: var(--text-2); margin: 0 0 20px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.input, .textarea, .select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 80px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 8px;
  font-weight: 600; background: var(--bg-4); transition: background .15s, transform .05s, filter .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #111; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #b93838; color: #fff; }
.btn.danger:hover { background: #cc4444; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.green { background: #1f9d6c; color: #fff; }
.btn.block { width: 100%; padding: 12px; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.auth-switch { margin-top: 14px; color: var(--muted); font-size: 14px; }
.auth-switch button { color: var(--gold); font-weight: 600; }
.form-error { color: var(--red); font-size: 14px; min-height: 20px; margin: -4px 0 8px; }

/* ---------- app shell ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.rail {
  width: 72px; flex: none; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 12px 0; overflow-y: auto; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 2px; margin: 2px 0; flex: none; }
.rail-item { position: relative; flex: none; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; overflow: hidden;
  transition: border-radius .18s, background .18s, color .18s; color: var(--text); font: 700 15px var(--font-display);
}
.rail-btn img { width: 100%; height: 100%; object-fit: cover; }
.rail-btn:hover, .rail-item.active .rail-btn { border-radius: 16px; background: var(--gold); color: #111; }
.rail-btn.has-img:hover, .rail-item.active .rail-btn.has-img { background: var(--bg-3); }
.rail-btn.home img { width: 28px; height: 28px; object-fit: contain; }
.rail-btn.action { color: var(--green); }
.rail-btn.action:hover { background: var(--green); color: #0b1a14; }
.rail-pill {
  position: absolute; left: -12px; top: 50%; width: 8px; height: 0; background: var(--text); border-radius: 0 4px 4px 0;
  transform: translateY(-50%); transition: height .18s;
}
.rail-item.unread .rail-pill { height: 8px; }
.rail-item:hover .rail-pill { height: 20px; }
.rail-item.active .rail-pill { height: 40px; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff;
  font: 700 11px/18px var(--font); text-align: center; display: inline-block;
}
.rail-item .badge { position: absolute; right: -4px; bottom: -2px; border: 3px solid var(--bg); height: 24px; line-height: 18px; border-radius: 12px; }

.sidebar { width: 248px; flex: none; background: var(--bg-2); display: flex; flex-direction: column; min-width: 0; }
.side-head {
  height: 52px; flex: none; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--line);
  font: 700 15px var(--font-display); gap: 8px;
}
.side-head.clickable { cursor: pointer; }
.side-head.clickable:hover { background: var(--bg-3); }
.side-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll { flex: 1; overflow-y: auto; padding: 10px 8px; }
.cat {
  display: flex; align-items: center; gap: 4px; padding: 16px 6px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); user-select: none;
}
.cat span { flex: 1; }
.cat button { color: var(--muted); opacity: 0; }
.cat:hover button { opacity: 1; }
.cat button:hover { color: var(--text); }
.chan {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--muted); cursor: pointer;
  margin: 1px 0; position: relative; user-select: none;
}
.chan:hover { background: var(--bg-3); color: var(--text-2); }
.chan.active { background: var(--bg-active); color: var(--text); }
.chan.unread { color: var(--text); font-weight: 600; }
.chan.unread::before { content: ""; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.chan .cname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan .cact { opacity: 0; color: var(--muted); display: flex; }
.chan:hover .cact, .chan.active .cact { opacity: 1; }
.chan .cact:hover { color: var(--text); }
.vusers { padding: 2px 0 6px 30px; display: grid; gap: 2px; }
.vuser { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; color: var(--text-2); font-size: 13.5px; cursor: pointer; }
.vuser:hover { background: var(--bg-3); }
.vuser .av { width: 24px; height: 24px; }
.vuser .vicons { margin-left: auto; display: flex; gap: 4px; color: var(--muted); }
.vuser .vicons .live { background: var(--red); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; }

.dm-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--text-2); cursor: pointer; margin: 1px 0; }
.dm-item:hover { background: var(--bg-3); color: var(--text); }
.dm-item.active { background: var(--bg-active); color: var(--text); }
.dm-item .dname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.dm-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* avatars */
.av { position: relative; width: 32px; height: 32px; flex: none; }
.av .av-img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  font: 700 13px var(--font-display); color: #111;
}
.av.lg { width: 80px; height: 80px; }
.av.lg .av-img { font-size: 30px; }
.av.md { width: 40px; height: 40px; }
.av .dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--bg-2); background: var(--muted); box-sizing: content-box;
}
.av.lg .dot { width: 18px; height: 18px; border-width: 5px; right: 0; bottom: 0; }
.dot.online { background: var(--green); }
.dot.idle { background: var(--idle); }
.dot.dnd { background: var(--dnd); }
.dot.offline { background: #4b5263; }
.speaking .av-img, .av-img.speaking { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--green); }

/* user panel */
.voice-panel { border-top: 1px solid var(--line); padding: 10px 10px 8px; background: var(--bg-1); }
.voice-panel .vp-top { display: flex; align-items: center; gap: 8px; }
.voice-panel .vp-status { flex: 1; min-width: 0; }
.voice-panel .vp-status b { color: var(--green); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.voice-panel .vp-status div { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-panel .vp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.on { color: var(--red); }
.icon-btn.active { color: var(--gold); }
.user-panel { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-1); flex: none; }
.user-panel .me { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px; border-radius: 6px; cursor: pointer; }
.user-panel .me:hover { background: var(--bg-3); }
.user-panel .me .av .dot { border-color: var(--bg-1); }
.user-panel .who { min-width: 0; line-height: 1.2; }
.user-panel .who b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel .who span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-3); }
.topbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg-3); min-width: 0;
}
.topbar .t-name { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar .t-name svg { color: var(--muted); }
.topbar .t-topic {
  flex: 1; min-width: 0; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: 12px; border-left: 1px solid var(--line);
}
.topbar .t-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topbar .search { width: 180px; }
.topbar .search input { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; width: 100%; outline: none; }
.topbar .search input:focus { border-color: var(--gold); }
.menu-btn { display: none; }
.body-row { flex: 1; display: flex; min-height: 0; }
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* messages */
.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 0 12px; display: flex; flex-direction: column; }
.messages .spacer { flex: 1; }
.chan-intro { padding: 32px 16px 16px; }
.chan-intro .ci-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--bg-hover); display: grid; place-items: center; margin-bottom: 12px;
}
.chan-intro .ci-icon svg { width: 34px; height: 34px; }
.chan-intro h2 { margin: 0 0 6px; font: 800 28px var(--font-display); }
.chan-intro p { margin: 0; color: var(--text-2); }
.load-more { text-align: center; padding: 12px; color: var(--muted); font-size: 13px; }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 18px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.unread-sep { display: flex; align-items: center; margin: 8px 16px; color: var(--red); font-size: 11px; font-weight: 700; }
.unread-sep::before { content: ""; height: 1px; flex: 1; background: var(--red); margin-right: 6px; }

.msg { position: relative; padding: 2px 64px 2px 72px; margin-top: 0; }
.msg.head { margin-top: 14px; }
.msg:hover { background: rgba(0, 0, 0, .14); }
.msg.mentioned { background: rgba(245, 197, 24, .07); box-shadow: inset 2px 0 0 var(--gold); }
.msg.mentioned:hover { background: rgba(245, 197, 24, .1); }
.msg.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(245, 197, 24, .22); } }
.msg .m-av { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; cursor: pointer; }
.msg .m-av .av-img { font-size: 15px; }
.msg .m-time-side {
  position: absolute; left: 0; width: 72px; text-align: center; top: 5px; font-size: 11px; color: var(--muted); opacity: 0;
}
.msg:hover .m-time-side { opacity: 1; }
.m-meta { display: flex; align-items: baseline; gap: 8px; }
.m-author { font-weight: 600; cursor: pointer; }
.m-author:hover { text-decoration: underline; }
.role-tag { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em; align-self: center; }
.role-owner { background: var(--gold-soft); color: var(--gold); }
.role-admin { background: rgba(248, 113, 113, .14); color: var(--red); }
.role-mod { background: rgba(96, 165, 250, .14); color: var(--blue); }
.m-time { font-size: 12px; color: var(--muted); }
.m-content { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; color: #dde1ea; }
.m-content .edited { font-size: 11px; color: var(--muted); margin-left: 4px; }
.m-content code { font: 13px var(--mono); background: var(--bg-1); padding: 2px 5px; border-radius: 4px; }
.m-content pre { font: 13px/1.5 var(--mono); background: var(--bg-1); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 6px 0; white-space: pre; max-width: 100%; }
.m-content pre code { background: none; padding: 0; }
.m-content blockquote { margin: 2px 0; padding-left: 12px; border-left: 4px solid var(--bg-active); }
.m-content .mention { background: rgba(245, 197, 24, .16); color: var(--gold); padding: 0 3px; border-radius: 4px; font-weight: 600; cursor: pointer; }
.m-content .spoiler { background: #000; color: transparent; border-radius: 4px; cursor: pointer; padding: 0 2px; }
.m-content .spoiler.open { background: var(--bg-hover); color: inherit; }
.m-content .big-emoji { font-size: 44px; line-height: 1.2; }
.m-content h3 { margin: 6px 0 2px; font-size: 18px; }
.m-reply { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 2px; cursor: pointer; position: relative; }
.m-reply::before {
  content: ""; position: absolute; left: -38px; top: 9px; width: 30px; height: 10px; border-left: 2px solid var(--bg-active);
  border-top: 2px solid var(--bg-active); border-top-left-radius: 6px;
}
.m-reply .av { width: 16px; height: 16px; }
.m-reply .av-img { font-size: 8px; }
.m-reply b { color: var(--text-2); font-weight: 600; }
.m-reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.m-reply:hover span { color: var(--text); }
.m-system { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 6px 16px 6px 36px; margin-top: 8px; }
.m-system svg { color: var(--green); }
.m-system b { color: var(--text); cursor: pointer; }
.m-attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.m-attach img, .m-attach video { max-width: min(420px, 100%); max-height: 320px; border-radius: 8px; cursor: zoom-in; background: var(--bg-1); }
.m-attach video { cursor: auto; }
.m-attach audio { max-width: 100%; }
.m-file {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; max-width: 420px;
}
.m-file svg { color: var(--gold); width: 28px; height: 28px; }
.m-file .fn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-file .fs { font-size: 12px; color: var(--muted); }
.m-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px; background: var(--bg-2);
  border: 1px solid var(--line); font-size: 14px;
}
.react b { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.react:hover { border-color: var(--muted); }
.react.me { background: var(--gold-soft); border-color: rgba(245, 197, 24, .55); }
.react.me b { color: var(--gold); }
.m-tools {
  position: absolute; right: 14px; top: -16px; display: none; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); z-index: 2;
}
.msg:hover .m-tools { display: flex; }
.m-tools button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--text-2); }
.m-tools button:hover { color: var(--text); background: var(--bg-hover); }
.m-tools button.del:hover { color: var(--red); }
.pin-flag { color: var(--gold); font-size: 11px; font-weight: 700; display: inline-flex; gap: 3px; align-items: center; }
.edit-box textarea { width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: none; outline: none; }
.edit-box .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.edit-box .hint button { color: var(--blue); }

.poll { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-width: 460px; margin-top: 6px; }
.poll h4 { margin: 0 0 10px; font-size: 16px; }
.poll-opt {
  position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line);
  margin-bottom: 6px; overflow: hidden; width: 100%; text-align: left;
}
.poll-opt:hover { border-color: var(--muted); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: var(--gold-soft); transition: width .3s; }
.poll-opt.mine { border-color: var(--gold); }
.poll-opt span { position: relative; }
.poll-opt .pct { color: var(--text-2); font-size: 13px; }
.poll .poll-foot { font-size: 12px; color: var(--muted); }

.typing { height: 24px; padding: 0 16px; font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex: none; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: blink 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .2s; }
.typing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* composer */
.composer { padding: 0 16px; flex: none; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; background: var(--bg-2); border-radius: 10px 10px 0 0; padding: 8px 12px;
  font-size: 13px; color: var(--text-2);
}
.reply-bar b { color: var(--text); }
.reply-bar button { margin-left: auto; color: var(--muted); }
.reply-bar button:hover { color: var(--text); }
.pending-files { display: flex; gap: 10px; background: var(--bg-2); padding: 12px; border-radius: 10px 10px 0 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.pending-file { width: 130px; flex: none; background: var(--bg-1); border-radius: 8px; padding: 8px; position: relative; font-size: 12px; }
.pending-file img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.pending-file .pf-icon { height: 80px; display: grid; place-items: center; color: var(--gold); }
.pending-file .pf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-file button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; }
.compose-box { display: flex; align-items: flex-end; gap: 4px; background: var(--bg-hover); border-radius: 10px; padding: 4px 6px; }
.reply-bar + .compose-box, .pending-files + .compose-box, .reply-bar + .pending-files { border-top-left-radius: 0; border-top-right-radius: 0; }
.compose-box textarea {
  flex: 1; background: transparent; border: 0; outline: none; resize: none; padding: 9px 4px; max-height: 40vh; min-height: 40px; line-height: 1.4;
}
.compose-box .icon-btn { width: 36px; height: 38px; }
.compose-note { font-size: 12px; color: var(--muted); padding: 6px 2px 10px; min-height: 26px; display: flex; gap: 10px; }
.compose-note .err { color: var(--red); }
.readonly-note { background: var(--bg-2); border-radius: 10px; padding: 14px; color: var(--muted); text-align: center; margin-bottom: 18px; }
.drop-overlay {
  position: fixed; inset: 0; background: rgba(8, 9, 13, .8); z-index: 60; display: grid; place-items: center; pointer-events: none;
}
.drop-overlay div { border: 2px dashed var(--gold); border-radius: 20px; padding: 60px 80px; font: 700 22px var(--font-display); color: var(--gold); }
.autocomplete {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; padding: 6px; max-height: 260px; overflow-y: auto;
}
.autocomplete .ac-title { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted); padding: 4px 8px; letter-spacing: .05em; }
.ac-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ac-item.sel, .ac-item:hover { background: var(--bg-hover); }
.ac-item .av { width: 24px; height: 24px; }
.ac-item small { color: var(--muted); }

/* members */
.members { width: 240px; flex: none; background: var(--bg-2); overflow-y: auto; padding: 8px; }
.members h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 8px 6px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.member:hover { background: var(--bg-3); }
.member.offline { opacity: .45; }
.member .mn { min-width: 0; line-height: 1.2; }
.member .mn b { display: block; font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .mn span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .crown { color: var(--gold); margin-left: 4px; display: inline-flex; vertical-align: -2px; }
.member .crown svg { width: 14px; height: 14px; }

/* home / friends / discover */
.page { flex: 1; overflow-y: auto; padding: 20px 24px; }
.tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tab { padding: 4px 12px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--bg-active); color: var(--text); }
.tab.add { background: #1f9d6c; color: #fff; }
.tab.add.active { background: transparent; color: var(--green); }
.list-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 10px; }
.friend-row {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-top: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.friend-row:hover { background: var(--bg-hover); border-top-color: transparent; }
.friend-row .fr-name { flex: 1; min-width: 0; }
.friend-row .fr-name b { display: block; }
.friend-row .fr-name span { font-size: 13px; color: var(--muted); }
.friend-row .fr-actions { display: flex; gap: 8px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; color: var(--text-2); }
.round-btn:hover { color: var(--text); background: var(--bg); }
.round-btn.ok:hover { color: var(--green); }
.round-btn.no:hover { color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty img { width: 90px; margin: 0 auto 16px; opacity: .8; }
.empty h3 { color: var(--text-2); margin: 0 0 6px; }
.add-friend { max-width: 640px; }
.add-friend p { color: var(--text-2); margin-top: 0; }
.add-friend .row { display: flex; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.add-friend .row:focus-within { border-color: var(--gold); }
.add-friend .row input { flex: 1; background: none; border: 0; outline: none; min-width: 0; }
.add-friend .res { margin-top: 8px; font-size: 14px; }
.discover-hero {
  border-radius: 16px; padding: 36px 28px; margin-bottom: 22px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(245, 197, 24, .22), rgba(96, 165, 250, .08) 60%), var(--bg-2); border: 1px solid var(--line);
}
.discover-hero h2 { font: 800 30px var(--font-display); margin: 0 0 6px; }
.discover-hero p { color: var(--text-2); margin: 0 0 16px; }
.discover-hero .input { max-width: 420px; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.server-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.server-card .sc-banner { height: 72px; background: linear-gradient(135deg, var(--gold-d), #7a5d00); }
.server-card .sc-body { padding: 0 16px 16px; flex: 1; display: flex; flex-direction: column; }
.server-card .sc-icon {
  width: 56px; height: 56px; border-radius: 16px; margin-top: -28px; border: 4px solid var(--bg-2); background: var(--bg-3); overflow: hidden;
  display: grid; place-items: center; font: 800 20px var(--font-display);
}
.server-card .sc-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-card h3 { margin: 10px 0 4px; font-size: 16px; }
.server-card p { color: var(--text-2); font-size: 13.5px; margin: 0 0 12px; flex: 1; }
.server-card .sc-foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.home-welcome { max-width: 760px; }
.home-welcome h2 { font: 800 28px var(--font-display); margin: 0 0 4px; }
.home-welcome > p { color: var(--text-2); margin: 0 0 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 26px; }
.quick { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: left; transition: border-color .15s, transform .15s; }
.quick:hover { border-color: var(--gold); transform: translateY(-2px); }
.quick svg { color: var(--gold); width: 26px; height: 26px; margin-bottom: 10px; }
.quick b { display: block; margin-bottom: 2px; }
.quick span { font-size: 13px; color: var(--text-2); }

/* voice stage */
.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #050608; }
.stage-grid {
  flex: 1; display: grid; gap: 10px; padding: 16px; align-content: center; justify-content: center; overflow-y: auto;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}
.stage-grid.focus { grid-template-columns: 1fr; grid-template-rows: 1fr auto; align-content: stretch; }
.tile {
  position: relative; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--bg-3); overflow: hidden; display: grid; place-items: center;
  max-height: 70vh; border: 2px solid transparent; transition: border-color .12s;
}
.tile.speaking { border-color: var(--green); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.screen video { object-fit: contain; }
.tile .av { width: 88px; height: 88px; }
.tile .av .av-img { font-size: 34px; }
.tile .t-label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); padding: 3px 8px; border-radius: 6px; font-size: 13px;
  display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px);
}
.tile .t-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .t-label svg { color: var(--red); }
.tile .t-expand { position: absolute; right: 8px; top: 8px; background: rgba(0, 0, 0, .6); border-radius: 6px; width: 30px; height: 30px; display: none; place-items: center; }
.tile:hover .t-expand { display: grid; }
.stage-empty { flex: 1; display: grid; place-content: center; text-align: center; gap: 12px; padding: 20px; }
.stage-empty h2 { font: 800 28px var(--font-display); margin: 0; }
.stage-empty p { margin: 0; color: var(--text-2); }
.stage-empty .who { display: flex; justify-content: center; gap: -6px; }
.stage-empty .who .av { margin-left: -8px; }
.stage-empty .who .av .av-img { border: 3px solid #050608; }
.stage-bar { display: flex; justify-content: center; gap: 12px; padding: 14px; flex: none; flex-wrap: wrap; }
.ctl {
  width: 52px; height: 52px; border-radius: 50%; background: var(--bg-4); display: grid; place-items: center; color: var(--text);
  transition: background .15s;
}
.ctl:hover { background: var(--bg-active); }
.ctl.off { background: #fff; color: #111; }
.ctl.on { background: var(--gold); color: #111; }
.ctl.leave { background: #d23f3f; }
.ctl.leave:hover { background: #e24c4c; }
.incoming-call {
  position: fixed; right: 20px; bottom: 20px; z-index: 70; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; width: 260px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); animation: pop .2s ease-out;
}
.incoming-call .av { margin: 0 auto 10px; }
.incoming-call .av-img { animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 100% { box-shadow: 0 0 0 16px rgba(52, 211, 153, 0); } }
.incoming-call .ic-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.call-banner { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #0b2a1f; color: var(--green); font-weight: 600; flex: none; }
.call-banner .btn { margin-left: auto; }

/* modals */
.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .7); z-index: 50; display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px);
  overflow: hidden; display: flex; flex-direction: column; animation: pop .16s ease-out; box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
.modal.wide { max-width: 860px; height: min(680px, calc(100vh - 32px)); }
.modal-head { padding: 20px 20px 8px; position: relative; }
.modal-head h3 { margin: 0; font: 700 21px var(--font-display); }
.modal-head p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.modal-head .x { position: absolute; right: 12px; top: 12px; }
.modal-body { padding: 12px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; background: var(--bg-1); display: flex; justify-content: flex-end; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 10px; background: var(--bg-3);
}
.choice:hover { border-color: var(--gold); }
.choice svg { color: var(--gold); width: 28px; height: 28px; }
.choice b { display: block; }
.choice span { color: var(--text-2); font-size: 13px; }
.radio-row { display: flex; gap: 8px; }
.radio-card { flex: 1; display: flex; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--bg-3); }
.radio-card.sel { border-color: var(--gold); background: var(--gold-soft); }
.radio-card small { display: block; color: var(--text-2); }
.invite-code { display: flex; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; align-items: center; }
.invite-code input { flex: 1; background: none; border: 0; outline: none; min-width: 0; font-family: var(--mono); font-size: 14px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle div b { display: block; }
.toggle div span { font-size: 13px; color: var(--text-2); }
.switch { width: 42px; height: 24px; border-radius: 12px; background: var(--bg-active); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

.settings { display: flex; height: 100%; min-height: 0; }
.settings-nav { width: 200px; flex: none; background: var(--bg-1); padding: 16px 8px; overflow-y: auto; }
.settings-nav .sn-title { font-size: 11.5px; text-transform: uppercase; font-weight: 700; color: var(--muted); letter-spacing: .06em; padding: 8px 10px 4px; }
.settings-nav button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text-2); margin: 1px 0; }
.settings-nav button:hover { background: var(--bg-3); color: var(--text); }
.settings-nav button.active { background: var(--bg-active); color: var(--text); }
.settings-nav button.danger { color: var(--red); }
.settings-nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 6px; }
.settings-main { flex: 1; overflow-y: auto; padding: 22px 26px; position: relative; min-width: 0; }
.settings-main h2 { margin: 0 0 18px; font: 700 21px var(--font-display); }
.settings-main .x { position: absolute; right: 14px; top: 14px; }
.profile-preview { border-radius: 12px; overflow: hidden; background: var(--bg-1); border: 1px solid var(--line); margin-bottom: 18px; }
.profile-preview .pp-banner { height: 80px; }
.profile-preview .pp-body { padding: 0 16px 16px; display: flex; align-items: flex-end; gap: 14px; margin-top: -30px; flex-wrap: wrap; }
.profile-preview .pp-body .av .dot { border-color: var(--bg-1); }
.profile-preview .pp-body .av .av-img { border: 5px solid var(--bg-1); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-sw { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; }
.color-sw.sel { border-color: #fff; }
.mem-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.mem-row:hover { background: var(--bg-3); }
.mem-row .mr-name { flex: 1; min-width: 0; }
.mem-row .mr-name b { display: block; }
.mem-row .mr-name span { font-size: 12px; color: var(--muted); }
.mem-row .select { width: auto; padding: 6px 8px; }
.meter { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s; }

/* popovers */
.popover {
  position: fixed; z-index: 80; background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5); animation: pop .12s ease-out; overflow: hidden;
}
.menu { padding: 6px; min-width: 200px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--text-2); font-size: 14px; text-align: left; }
.menu button:hover { background: var(--gold); color: #111; }
.menu button.danger { color: var(--red); }
.menu button.danger:hover { background: var(--red); color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px; }
.menu .dot { width: 10px; height: 10px; border-radius: 50%; border: 0; position: static; }
.profile-card { width: 320px; }
.profile-card .pc-banner { height: 70px; }
.profile-card .pc-body { padding: 0 16px 16px; }
.profile-card .pc-av { margin-top: -40px; margin-bottom: 8px; }
.profile-card .pc-av .av-img { border: 6px solid var(--bg-1); }
.profile-card .pc-av .dot { border-color: var(--bg-1); }
.profile-card h3 { margin: 0; font-size: 20px; }
.profile-card .uname { color: var(--text-2); font-size: 14px; }
.profile-card .pc-sec { background: var(--bg-2); border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
.profile-card .pc-sec h5 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; color: var(--text-2); letter-spacing: .06em; }
.profile-card .pc-sec p { margin: 0; white-space: pre-wrap; }
.profile-card .mutual { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-card .mutual span { background: var(--bg-3); padding: 2px 8px; border-radius: 6px; font-size: 12.5px; }
.profile-card .pc-actions { display: flex; gap: 8px; margin-top: 12px; }
.profile-card .pc-actions .btn { flex: 1; }
.emoji-picker { width: 332px; }
.emoji-picker .ep-search { padding: 10px; border-bottom: 1px solid var(--line); }
.emoji-picker .ep-search input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; outline: none; }
.emoji-picker .ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); padding: 8px; max-height: 280px; overflow-y: auto; }
.emoji-picker .ep-cat { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted); padding: 8px 4px 4px; }
.emoji-picker .ep-grid button { font-size: 22px; padding: 4px; border-radius: 6px; line-height: 1.2; }
.emoji-picker .ep-grid button:hover { background: var(--bg-hover); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 90; display: grid; place-items: center; padding: 30px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.lightbox a { position: absolute; bottom: 16px; color: var(--text-2); }

.side-list { display: grid; gap: 6px; }
.pins-list .msg { padding-right: 16px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; padding-top: 8px; padding-bottom: 8px; cursor: pointer; }
.pins-list .msg .m-av { top: 10px; }

/* toast */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg-1); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  animation: pop .15s ease-out; font-size: 14px; max-width: 90vw;
}
.toast.error { border-color: rgba(248, 113, 113, .5); }
.toast.ok { border-color: rgba(52, 211, 153, .5); }
.conn-bar { background: var(--orange); color: #111; font-weight: 600; font-size: 13px; text-align: center; padding: 4px; }

.backdrop { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .members { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -10px 0 30px rgba(0, 0, 0, .5); }
  .topbar .search { display: none; }
}
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; gap: 24px; }
  .auth-hero .feature-list { display: none; }
  .auth-hero p { font-size: 15px; }
  .nav { position: fixed; inset: 0 auto 0 0; z-index: 45; display: flex; transform: translateX(-100%); transition: transform .2s ease-out; }
  .app.nav-open .nav { transform: none; }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 44; }
  .sidebar { width: min(260px, calc(100vw - 72px - 40px)); }
  .menu-btn { display: grid; margin-left: -6px; }
  .topbar { padding: 0 8px 0 12px; }
  .topbar .t-topic { display: none; }
  .msg { padding-left: 64px; padding-right: 12px; }
  .msg .m-av { left: 12px; }
  .msg .m-time-side { width: 64px; }
  .m-tools { top: -30px; right: 6px; }
  .msg:hover .m-tools { display: none; }
  .msg.tools-open .m-tools { display: flex; }
  .composer { padding: 0 8px; }
  .page { padding: 16px; }
  .modal.wide { height: calc(100vh - 32px); }
  .settings { flex-direction: column; }
  .settings-nav { width: 100%; display: flex; overflow-x: auto; padding: 8px; gap: 4px; flex: none; }
  .settings-nav .sn-title, .settings-nav hr { display: none; }
  .settings-nav button { width: auto; white-space: nowrap; }
  .settings-main { padding: 18px 16px; }
  .incoming-call { right: 16px; left: 16px; width: auto; }
  .profile-card { width: min(320px, calc(100vw - 32px)); }
  .emoji-picker { width: min(332px, calc(100vw - 32px)); }
}
@media (min-width: 761px) {
  .nav { display: flex; }
}

/* --- polish pass 2 --- */
.quick { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; }
@media (max-width: 760px) {
  .topbar .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: 4px !important; min-width: 0; }
  .topbar .tabs::-webkit-scrollbar { display: none; }
  .topbar .t-name { flex: none; }
}
.rail-item.muted .rail-btn { opacity: .55; }
.rail-item.muted:hover .rail-btn, .rail-item.muted.active .rail-btn { opacity: 1; }
.jumpbar {
  margin: 0 16px 4px; padding: 7px 14px; border-radius: 8px; background: var(--blue); color: #0b1220; font-size: 13px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; flex: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.jumpbar span { display: inline-flex; align-items: center; gap: 4px; }
.update-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 12px; background: var(--gold-soft); color: var(--gold); font-weight: 600; font-size: 13.5px; border-bottom: 1px solid rgba(245, 197, 24, .3); flex: none; flex-wrap: wrap; }
.update-bar small { color: var(--text-2); font-weight: 400; }
.member .mn b .crown { display: inline-flex; font-size: inherit; color: var(--gold); }
.group-av { color: #111; }
.group-av svg { width: 55%; height: 55%; }
.role-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.role-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.role-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--text-2); }
.role-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.role-chip button { color: var(--muted); font-size: 14px; line-height: 1; margin-left: 2px; }
.role-chip button:hover { color: var(--red); }
.select.role-add { width: auto; padding: 1px 6px; font-size: 12px; border-radius: 6px; }
.role-row .icon-btn[data-dir="-1"] svg { transform: rotate(180deg); }
.role-row .icon-btn:disabled { opacity: .25; cursor: default; }
.chan[draggable="true"] { cursor: pointer; }
.chan.drop-above { box-shadow: inset 0 2px 0 var(--gold); }
.chan.drop-below { box-shadow: inset 0 -2px 0 var(--gold); }
.cat.drop-cat { color: var(--gold); }
input[type=color].color-sw { width: 30px; height: 30px; cursor: pointer; }
.perm-list { border-top: 1px solid var(--line); }
.perm-group { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 16px 0 2px; }
.toggle.perm.locked { opacity: .55; }
.toggle.perm span i { color: var(--orange); font-style: normal; }
.switch:disabled { cursor: not-allowed; }
.color-sw.no-color { background: repeating-linear-gradient(45deg, #3a3f4b 0 4px, #262a33 4px 8px) !important; }
.m-meta .crown { color: var(--gold); display: inline-flex; align-self: center; }

/* ======================= batch: profiles, perks, store, admin, server tools ======================= */
/* themes */
:root[data-theme="midnight"] { --bg: #000; --bg-1: #050507; --bg-2: #08090c; --bg-3: #0c0d11; --bg-4: #15171d; --bg-hover: #191b22; --bg-active: #20232b; --line: #1a1c22; }
:root[data-theme="ash"] { --bg: #1e2026; --bg-1: #23252c; --bg-2: #2a2d34; --bg-3: #31343c; --bg-4: #3a3d46; --bg-hover: #3f434d; --bg-active: #474b56; --line: #3a3e48; }
:root[data-theme="light"] {
  --bg: #e3e5ea; --bg-1: #eceef2; --bg-2: #f6f7f9; --bg-3: #ffffff; --bg-4: #e6e8ec; --bg-hover: #eceef2; --bg-active: #e1e4ea; --line: #d9dde4;
  --text: #15171c; --text-2: #4a5160; --muted: #737c8c; --gold-d: #b58a00; color-scheme: light;
}
:root[data-theme="light"] .m-content { color: #23262d; }
:root[data-theme="light"] .rail-btn { background: #fff; }
:root[data-theme="light"] .m-content code, :root[data-theme="light"] .m-content pre { background: #eef0f3; }
:root[data-theme="light"] .btn.primary { color: #111; }
:root[data-theme="light"] .toast, :root[data-theme="light"] .popover { box-shadow: 0 12px 30px rgba(0,0,0,.15); }
/* accessibility */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: .001s !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
.underline-links .m-content a, .underline-links .pc-sec a { text-decoration: underline; }
.no-role-colors .m-author, .no-role-colors .member .mn b { color: inherit !important; }
/* compact density */
:root[data-density="compact"] .msg { padding-left: 56px; }
:root[data-density="compact"] .msg.head { margin-top: 6px; }
:root[data-density="compact"] .msg .m-av { width: 28px; height: 28px; top: 3px; }
:root[data-density="compact"] .msg .m-av .av-img { font-size: 11px; }
:root[data-density="compact"] .msg .m-time-side { width: 56px; }

/* names: fonts + server tags */
.pfont-archivo { font-family: Archivo, sans-serif !important; font-weight: 800; }
.pfont-mono { font-family: "JetBrains Mono", monospace !important; }
.pfont-pixel { font-family: Silkscreen, monospace !important; font-size: .95em; letter-spacing: .02em; }
.pfont-orbitron { font-family: Orbitron, sans-serif !important; font-weight: 700; font-size: .92em; }
.pfont-pacifico { font-family: Pacifico, cursive !important; font-weight: 400; }
.pfont-caveat { font-family: Caveat, cursive !important; font-size: 1.2em; }
.stag {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 0 5px; height: 17px; border-radius: 5px; font: 800 10.5px/17px var(--font);
  letter-spacing: .04em; color: var(--tag); background: color-mix(in srgb, var(--tag) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 40%, transparent);
  vertical-align: 1px; font-family: var(--font) !important;
}
.m-meta .crown svg { width: 14px; height: 14px; }
.cemoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; display: inline-block; }
.big-emoji .cemoji { width: 48px; height: 48px; }
.react .cemoji { width: 18px; height: 18px; vertical-align: -4px; }
.emoji-picker .ep-grid button .cemoji { width: 26px; height: 26px; }
.ac-item .cemoji { width: 22px; height: 22px; }
.m-sticker img { width: 160px; height: 160px; object-fit: contain; margin-top: 4px; }
.automod-note { color: var(--text-2); }

/* profile card extras */
.pc-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.badge-row { display: inline-flex; gap: 3px; background: var(--bg-2); border-radius: 8px; padding: 3px 5px; margin-bottom: 6px; flex-wrap: wrap; max-width: 60%; }
.pbadge { font-size: 15px; line-height: 1; cursor: default; }
.profile-card.themed { background: linear-gradient(180deg, color-mix(in srgb, var(--pc-a) 30%, var(--bg-1)), color-mix(in srgb, var(--pc-b) 55%, var(--bg-1))); border-color: color-mix(in srgb, var(--pc-a) 50%, var(--line)); }
.profile-card.themed .pc-sec { background: rgba(0, 0, 0, .28); }
.profile-card.themed .pc-av .av-img { border-color: color-mix(in srgb, var(--pc-a) 30%, var(--bg-1)); }
.pc-sec a { color: var(--blue); }
.boost-count { font-size: 12px; font-weight: 700; color: #f0abfc; }

/* home sidebar */
.store-item svg { color: var(--gold); }
.new-pill { margin-left: auto; font-size: 10px; font-weight: 800; background: var(--gold); color: #111; padding: 1px 6px; border-radius: 6px; }

/* Minecraft card */
.mc-card { margin: 2px 2px 10px; padding: 10px 12px; border-radius: 10px; background: linear-gradient(135deg, rgba(52, 211, 153, .12), rgba(245, 197, 24, .08)); border: 1px solid var(--line); cursor: pointer; position: relative; }
.mc-card:hover { border-color: var(--green); }
.mc-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.mc-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.mc-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, .25); }
.mc-dot.off { background: var(--red); }
.mc-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.mc-copy { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--green); display: inline-flex; gap: 4px; align-items: center; }
.mc-copy:hover { text-decoration: underline; }
.mc-pop { padding: 14px; width: 280px; }
.mc-motd { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; margin: 8px 0 4px; }

/* store */
.store { max-width: 980px; margin: 0 auto; }
.store-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 44px 32px; margin-bottom: 20px; border: 1px solid var(--line);
  background: radial-gradient(600px 300px at 80% 0%, rgba(192, 132, 252, .3), transparent 60%), radial-gradient(500px 300px at 0% 100%, rgba(245, 197, 24, .25), transparent 60%), var(--bg-2); }
.store-hero h1 { font: 800 clamp(28px, 4vw, 42px)/1.05 var(--font-display); margin: 0 0 10px; }
.store-hero h1 span { background: linear-gradient(90deg, var(--gold), #f472b6, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.store-hero p { color: var(--text-2); max-width: 560px; margin: 0; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tier { border-radius: 16px; padding: 22px; border: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; gap: 14px; }
.tier-pulsed { border-color: rgba(245, 197, 24, .45); background: linear-gradient(180deg, rgba(245, 197, 24, .10), var(--bg-2) 45%); }
.tier-pulsedx { border-color: rgba(192, 132, 252, .55); background: linear-gradient(180deg, rgba(192, 132, 252, .16), rgba(244, 114, 182, .06) 40%, var(--bg-2) 70%); box-shadow: 0 0 0 1px rgba(192, 132, 252, .15), 0 20px 60px rgba(192, 132, 252, .12); }
.tier.active { outline: 2px solid var(--green); }
.tier-top { display: flex; gap: 12px; align-items: center; }
.tier-icon { font-size: 34px; }
.tier h3 { margin: 0; font: 800 22px var(--font-display); }
.tier-top p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.tier ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; flex: 1; }
.tier-soon { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--muted); align-items: center; }
.tier-soon b { width: 100%; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.tier-soon span { background: var(--bg-3); padding: 2px 8px; border-radius: 6px; }
.store-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.store-row .quick { cursor: pointer; }

/* settings bits */
.sub-h { font-size: 15px; margin: 22px 0 8px; display: flex; gap: 8px; align-items: center; }
.perk-banner { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-3); margin-bottom: 8px; }
.perk-banner > span { font-size: 28px; }
.perk-banner div { flex: 1; }
.perk-banner b { display: block; }
.perk-banner small { color: var(--text-2); }
.perk-pulsed { border-color: rgba(245, 197, 24, .5); }
.perk-pulsedx { border-color: rgba(192, 132, 252, .6); }
.theme-edit { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.theme-edit label { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }
.theme-edit input[type=color] { width: 40px; height: 32px; border: 0; background: none; cursor: pointer; }
.theme-prev { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; min-width: 220px; }
.locked { opacity: .5; pointer-events: none; }
.font-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.font-opt { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); text-align: left; font-size: 17px; display: flex; flex-direction: column; gap: 2px; }
.font-opt small { font: 12px var(--font) !important; color: var(--muted); }
.font-opt.sel { border-color: var(--gold); background: var(--gold-soft); }
.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-sw { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; padding: 8px; border-radius: 10px; border: 2px solid transparent; }
.theme-sw i { width: 64px; height: 44px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.theme-sw.sel { border-color: var(--gold); }
.lang-list { display: grid; gap: 6px; max-width: 460px; }
.lang { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); }
.lang.soon { opacity: .55; }
.lang small { color: var(--muted); }
.conn { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-3); max-width: 520px; }
.conn-ic { font-size: 24px; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-opt { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); min-width: 120px; }
.tag-opt .stag { margin-left: 0; }
.tag-opt small { color: var(--muted); }
.tag-opt.sel { border-color: var(--gold); }
.icon-pick { width: 36px; height: 36px; border-radius: 8px; font-size: 18px; border: 2px solid transparent; background: var(--bg-3); }
.icon-pick.sel { border-color: var(--gold); }
.acct-row { cursor: pointer; }
.acct-row.current { cursor: default; background: var(--bg-3); }
.inline-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 14px; color: var(--text-2); margin: 6px 0 4px; }
.sm-in { width: 76px; display: inline-block; padding: 5px 8px; margin: 0 4px; }
.admin-flag { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.admin-flag.danger { color: var(--red); }

/* audit log */
.audit-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit-row > div { flex: 1; min-width: 0; }
.audit-ic { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; color: var(--gold); flex: none; }
.audit-x { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }

/* expressions */
.expr-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.expr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.expr-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); position: relative; font-size: 13px; }
.expr-item img { width: 56px; height: 56px; object-fit: contain; }
.expr-item .icon-btn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; }
.snd-play { font-size: 28px; width: 56px; height: 56px; border-radius: 50%; background: var(--bg-hover); }
.snd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; }
.snd-grid button { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--bg-3); font-size: 13px; text-align: left; }
.snd-grid button:hover { background: var(--gold); color: #111; }

/* onboarding */
.ob-head { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ob-q { margin-bottom: 16px; }
.ob-q h4, .ob-rules h4 { margin: 0 0 8px; }
.ob-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-opt { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); display: flex; gap: 6px; align-items: center; }
.ob-opt.sel { border-color: var(--gold); background: var(--gold-soft); }
.ob-rules ol { margin: 0 0 10px; padding-left: 20px; color: var(--text-2); display: grid; gap: 4px; }
.ob-agree { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.ob-edit-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.ob-edit-row.opt { padding-left: 18px; }
.ob-edit-q { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }

/* admin */
.admin-tabs { gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat b { display: block; font: 800 28px var(--font-display); }
.stat span { color: var(--text-2); font-size: 13px; }
.admin-row { display: flex; gap: 12px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-row .mr-name { flex: 1; min-width: 220px; }
.admin-row .mr-name > span { font-size: 12.5px; color: var(--muted); display: block; }
.admin-row .role-chip { cursor: pointer; }
.role-chip.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.admin-row .badge-row { vertical-align: middle; margin: 0 0 0 4px; }

/* context menu */
.ctx-quick { display: flex; justify-content: space-between; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ctx-quick button { width: 32px; height: 32px; justify-content: center; padding: 0 !important; font-size: 18px; border-radius: 50% !important; background: var(--bg-3); }
.ctx-quick button:hover { background: var(--bg-hover) !important; transform: scale(1.1); }
@media (max-width: 760px) { .admin-row .select { width: 100% !important; } }
.member .mn b .stag { display: inline-flex; }
.member .mn b { display: flex; align-items: center; gap: 0; }

/* ======================= Pulsed Bots ======================= */
.app-tag { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; margin-left: 6px; border-radius: 4px; background: #5865f2; color: #fff; font: 700 10px/16px var(--font); letter-spacing: .03em; vertical-align: 2px; }
.m-iact .slash-name { color: var(--blue); font-weight: 600; }
.m-thinking { color: var(--text-2); font-style: italic; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.m-thinking .dots { display: inline-flex; gap: 3px; }
.m-thinking .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: blink 1.2s infinite; }
.m-thinking .dots i:nth-child(2) { animation-delay: .2s; } .m-thinking .dots i:nth-child(3) { animation-delay: .4s; }
.msg.ephemeral { background: rgba(96, 165, 250, .05); }
.m-eph { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 4px; align-items: center; }
.m-eph button { color: var(--blue); font-size: 12px; }
.m-eph button:hover { text-decoration: underline; }
.m-content .ts { background: var(--bg-hover); border-radius: 4px; padding: 0 3px; }
.m-content .subtext { color: var(--muted); font-size: 12.5px; }
/* embeds */
.embed { max-width: 520px; margin-top: 6px; background: var(--bg-2); border-radius: 4px 8px 8px 4px; border-left: 4px solid var(--ec); padding: 10px 14px 12px 12px; }
.em-main { display: flex; gap: 14px; }
.em-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.em-author { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; }
.em-author img, .em-footer img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.em-author a, .em-title a { color: inherit; }
.em-title { font-weight: 700; font-size: 15.5px; }
.em-title a { color: var(--blue); }
.em-desc { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: #d4d8e1; }
.em-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin-top: 2px; }
.em-field { grid-column: 1 / -1; font-size: 14px; min-width: 0; }
.em-field.inline { grid-column: auto; }
.em-field b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.em-field div { white-space: pre-wrap; overflow-wrap: anywhere; color: #d4d8e1; }
.em-image { max-width: 100%; max-height: 300px; border-radius: 6px; margin-top: 6px; cursor: zoom-in; }
.em-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; }
.em-footer { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); margin-top: 8px; }
:root[data-theme="light"] .em-desc, :root[data-theme="light"] .em-field div { color: #2b2f37; }
/* components */
.c-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.c-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; border-radius: 6px; font-size: 14px; font-weight: 600; color: #fff; text-decoration: none; transition: filter .15s; }
.c-btn:hover { filter: brightness(1.12); text-decoration: none; }
.c-btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.c-btn.busy { opacity: .6; pointer-events: none; }
.c-btn.s1 { background: #5865f2; } .c-btn.s2 { background: #4e5058; } .c-btn.s3 { background: #248046; } .c-btn.s4 { background: #da373c; }
.c-btn.s5 { background: #4e5058; }
.c-btn svg { width: 14px; height: 14px; }
.c-select { min-width: 260px; max-width: 100%; background: var(--bg-1); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.c-select.busy { opacity: .6; }
/* slash command composer */
.opt-chip { background: var(--bg-3); border-radius: 4px; padding: 0 5px; margin-left: 4px; color: var(--text-2); font-size: 11.5px; }
.opt-chip.req { color: var(--gold); }
.slash-hint .slash-opts { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 8px 6px; }
.slash-hint .opt { background: var(--bg-3); border-radius: 8px; padding: 6px 10px; font-size: 13px; display: flex; flex-direction: column; }
.slash-hint .opt.req b { color: var(--gold); }
.slash-hint .opt small { color: var(--muted); }
.slash-hint .opt i { color: var(--muted); font-style: normal; font-size: 11.5px; }
.slash-tip { font-size: 12px; color: var(--muted); padding: 0 8px 4px; }
/* developer portal */
.dev { max-width: 980px; margin: 0 auto; }
.dev-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 26px; border-radius: 16px; margin-bottom: 18px;
  background: radial-gradient(500px 200px at 90% 0%, rgba(88, 101, 242, .28), transparent 70%), radial-gradient(400px 200px at 0% 100%, rgba(245, 197, 24, .15), transparent 70%), var(--bg-2); border: 1px solid var(--line); }
.dev-hero h1, .dev-head h1 { margin: 0 0 6px; font: 800 28px var(--font-display); }
.dev-hero p { margin: 0; color: var(--text-2); max-width: 560px; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 26px; }
.dev-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); text-align: left; }
.dev-card:hover { border-color: #5865f2; }
.dev-card span { font-size: 12.5px; color: var(--muted); }
.dev-icon { width: 56px; height: 56px; border-radius: 16px; background: #5865f2; color: #fff; display: grid; place-items: center; font: 800 18px var(--font-display); overflow: hidden; flex: none; }
.dev-icon img { width: 100%; height: 100%; object-fit: cover; }
.dev-icon.lg { width: 72px; height: 72px; border-radius: 20px; font-size: 24px; }
.dev-head { display: flex; gap: 16px; align-items: center; margin: 14px 0; }
.dev-tabs { margin-bottom: 16px; }
.dev-sec { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.dev-danger { margin-top: 26px; padding: 14px; border: 1px solid rgba(248, 113, 113, .4); border-radius: 10px; }
.dev-danger p { margin: 4px 0 10px; color: var(--text-2); font-size: 14px; }
.perm-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; }
.cmd-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 3px; }
.cmd-row span { color: var(--text-2); font-size: 14px; }
.dev-qs h2 { margin: 0 0 10px; font: 700 20px var(--font-display); }
.dev-steps { padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }
.code-wrap { position: relative; }
.code-copy { position: absolute; top: 8px; right: 8px; }
.dev-code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; font: 13px/1.55 var(--mono); margin: 0; }
.dev-warn { background: rgba(251, 146, 60, .1); border: 1px solid rgba(251, 146, 60, .35); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.dev-table { border-collapse: collapse; font-size: 14px; }
.dev-table td { padding: 6px 14px 6px 0; vertical-align: top; }
.dev-table code, .dev-sec code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: 13px; overflow-wrap: anywhere; }
.dev-support { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.dev-support > div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.dev-support ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; display: grid; gap: 4px; }
/* add app to server */
.authz { display: grid; place-items: center; padding: 20px 0; }
.authz-card { width: 100%; max-width: 480px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; overflow: hidden; }
.authz-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.authz-top h2 { margin: 2px 0; font: 800 22px var(--font-display); }
.authz-top small { color: var(--muted); }
.authz-desc { color: var(--text-2); font-size: 14px; }
.authz-perms { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.authz-perms li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.authz-perms svg { color: var(--green); }

/* ======================= profile badges (SVG) ======================= */
.badge-row { display: inline-flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px 5px; margin-bottom: 6px; flex-wrap: wrap; max-width: 62%; }
.pbadge { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; cursor: default; }
.pbadge:hover { background: var(--bg-hover); }
.pbadge-svg { width: 18px; height: 18px; stroke-width: 2.2; filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 35%, transparent)); }
.pbadge-img { width: 18px; height: 18px; object-fit: contain; border-radius: 3px; }
.badge-chip { display: inline-flex; align-items: center; gap: 5px; }
.badge-chip .pbadge-svg, .badge-chip .pbadge-img { width: 14px; height: 14px; filter: none; }
.badge-big { width: 40px; height: 40px; border-radius: 10px; background: var(--bg-3); display: grid; place-items: center; flex: none; }
.badge-big .pbadge-svg, .badge-big svg, .badge-big .pbadge-img { width: 24px; height: 24px; }
.perk-banner > span svg, .perk-banner > span .pbadge-svg { width: 28px; height: 28px; }
.perk-ic { width: 34px; height: 34px; }
.tier-icon .perk-ic { width: 38px; height: 38px; }
.boost-count { display: inline-flex; align-items: center; gap: 2px; }
.boost-count svg { width: 13px; height: 13px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.icon-opt { height: 40px; border-radius: 8px; background: var(--bg-3); display: grid; place-items: center; color: var(--text-2); border: 2px solid transparent; }
.icon-opt:hover { color: var(--text); }
.icon-opt.sel { border-color: var(--gold); background: var(--gold-soft); }
.badge-preview { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-card.mini { width: 200px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg-1); flex: none; }
.profile-card.mini .pc-banner { height: 40px; }
.profile-card.mini .pc-body { padding: 0 12px 12px; }
.profile-card.mini .pc-av { margin-top: -22px; margin-bottom: 4px; }
.profile-card.mini .pc-av .av-img { border: 4px solid var(--bg-1); }
.bd-tip { display: grid; gap: 2px; background: #000; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 13px; max-width: 220px; }
.bd-tip span { color: #b5bac1; }
.badges-admin .perk-banner { margin-bottom: 4px; }
.pbadge { position: relative; }
.pbadge-tip { display: none; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 5; background: #000; color: #fff;
  padding: 7px 10px; border-radius: 7px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.4); pointer-events: none; text-align: center; }
.pbadge-tip span { display: block; color: #b5bac1; font-size: 12px; max-width: 220px; white-space: normal; }
.pbadge-tip::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #000; }
.pbadge:hover .pbadge-tip, .pbadge:focus .pbadge-tip { display: block; }
.profile-card .pc-top { overflow: visible; }
.profile-card { overflow: visible; }
.profile-card .pc-banner { border-radius: 12px 12px 0 0; }
.stag .tag-ic { width: 11px; height: 11px; stroke-width: 2.6; margin-right: 1px; }
.icon-pick { display: grid; place-items: center; color: var(--text-2); }
.icon-pick.sel { color: var(--gold); }
.icon-pick .tag-ic { width: 18px; height: 18px; }
.popover:has(.profile-card) { overflow: visible; }
.pbadge-tip { width: max-content; max-width: 240px; white-space: normal; }
.badge-row .pbadge:last-child .pbadge-tip, .badge-row .pbadge:nth-last-child(2) .pbadge-tip { left: auto; right: -6px; transform: none; }
.badge-row .pbadge:last-child .pbadge-tip::after, .badge-row .pbadge:nth-last-child(2) .pbadge-tip::after { left: auto; right: 12px; }

/* ======================= loading curtain ======================= */
.curtain {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: #06070b; overflow: hidden;
  clip-path: inset(0 0 0 0); transition: clip-path .95s cubic-bezier(.86, 0, .07, 1) .2s;
}
.curtain.lift { clip-path: inset(0 0 100% 0); pointer-events: none; }
.cur-bg { position: absolute; inset: 0; overflow: hidden; }
.cur-grid {
  position: absolute; left: -50%; right: -50%; top: 45%; height: 120%;
  background-image: linear-gradient(rgba(245, 197, 24, .10) 1px, transparent 1px), linear-gradient(90deg, rgba(245, 197, 24, .10) 1px, transparent 1px);
  background-size: 56px 56px; transform: perspective(520px) rotateX(62deg); transform-origin: top;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 55%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 55%, transparent);
  animation: cur-grid 2.4s linear infinite;
}
@keyframes cur-grid { to { background-position: 0 56px, 0 0; } }
.cur-glow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 118%, rgba(245, 197, 24, .30), transparent 55%), radial-gradient(circle at 50% 40%, rgba(245, 197, 24, .09), transparent 32%); animation: cur-breathe 3s ease-in-out infinite alternate; }
@keyframes cur-breathe { to { opacity: .65; } }
.cur-ring { position: absolute; left: 50%; top: 40%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; border: 1.5px solid rgba(245, 197, 24, .45); opacity: 0; animation: cur-ring 2.2s cubic-bezier(.2, .7, .3, 1) .9s infinite; }
@keyframes cur-ring { 0% { transform: scale(.45); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
.cur-center { position: relative; display: grid; justify-items: center; gap: 18px; margin-top: -4vh; transition: transform .55s cubic-bezier(.7, 0, .84, 0), opacity .45s ease; }
.curtain.lift .cur-center { transform: translateY(-36px) scale(.96); opacity: 0; }
.cur-cube { width: 112px; height: 112px; overflow: visible; filter: drop-shadow(0 14px 34px rgba(245, 197, 24, .38)); animation: cur-float 3.2s ease-in-out 1.3s infinite; }
@keyframes cur-float { 50% { transform: translateY(-7px); } }
.cur-cube path { transform-box: fill-box; }
.f-top { fill: #ffe066; animation: cur-top .75s cubic-bezier(.2, .9, .25, 1.15) both; }
.f-left { fill: #f5c518; animation: cur-left .75s cubic-bezier(.2, .9, .25, 1.15) .1s both; }
.f-right { fill: #d9a900; animation: cur-right .75s cubic-bezier(.2, .9, .25, 1.15) .2s both; }
@keyframes cur-top { from { transform: translateY(-70px); opacity: 0; } }
@keyframes cur-left { from { transform: translate(-70px, 40px); opacity: 0; } }
@keyframes cur-right { from { transform: translate(70px, 40px); opacity: 0; } }
.f-px rect { fill: #0b0e15; transform-box: fill-box; transform-origin: center; animation: cur-px .3s cubic-bezier(.3, 1.7, .5, 1) calc(.6s + var(--i) * 32ms) both; }
@keyframes cur-px { from { transform: scale(0); } }
.cur-word { display: flex; overflow: hidden; padding: 2px 4px; font: 900 clamp(26px, 4.6vw, 46px)/1.05 Archivo, Inter, system-ui, sans-serif; letter-spacing: .01em; }
.cur-word span { display: inline-block; color: #f3f5f9; animation: cur-letter .65s cubic-bezier(.2, .8, .2, 1) calc(.45s + var(--i) * 40ms) both; }
.cur-word span.g { color: #f5c518; text-shadow: 0 0 22px rgba(245, 197, 24, .35); }
.cur-word span:nth-child(7) { margin-left: .2em; }
@keyframes cur-letter { from { transform: translateY(115%); opacity: 0; filter: blur(5px); } }
.cur-bar { width: 210px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; animation: cur-up .5s ease 1s both; }
.cur-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d9a900, #ffe066); box-shadow: 0 0 12px #f5c518; transform-origin: left; transform: scaleX(.04); transition: transform .55s cubic-bezier(.2, .8, .2, 1); }
.cur-status { font: 500 12.5px Inter, system-ui, sans-serif; color: #6f7889; letter-spacing: .05em; min-height: 16px; animation: cur-up .5s ease 1.05s both; }
@keyframes cur-up { from { opacity: 0; transform: translateY(6px); } }
.cur-edge {
  position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 3001; pointer-events: none;
  background: linear-gradient(90deg, transparent, #f5c518 25%, #fff4b8 50%, #f5c518 75%, transparent); box-shadow: 0 0 26px 5px rgba(245, 197, 24, .65);
  transition: transform .95s cubic-bezier(.86, 0, .07, 1) .2s, opacity .35s ease 1.05s;
}
.cur-edge.go { transform: translateY(-100vh); opacity: 0; }
.curtain.cover { clip-path: inset(100% 0 0 0); transition: clip-path .5s cubic-bezier(.86, 0, .07, 1); }
.curtain.cover.in { clip-path: inset(0 0 0 0); }
@media (prefers-reduced-motion: reduce) {
  .curtain, .cur-edge { transition: opacity .35s ease; }
  .curtain.lift { clip-path: none; opacity: 0; }
  .cur-grid, .cur-ring, .cur-cube, .cur-cube path, .f-px rect, .cur-word span, .cur-glow { animation: none !important; }
  .cur-edge { display: none; }
}

/* ======================= PulsedX themes ======================= */
#theme-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: none; }
:root[data-theme="crypto"] #theme-fx, :root[data-theme="space"] #theme-fx { display: block; }
:root[data-theme="crypto"] .app, :root[data-theme="space"] .app { position: relative; z-index: 1; }

/* Crypto: sci-fi terminal. Black-green, lime, monospace, glow, scanlines, falling code behind the panels */
:root[data-theme="crypto"] {
  --bg: #010603; --bg-1: #020b06; --bg-2: #03110a; --bg-3: #04160c; --bg-4: #072211; --bg-hover: #0a2c16; --bg-active: #0e381c; --line: #0f3f1f;
  --text: #cbffd9; --text-2: #74e393; --muted: #3f9157; --gold: #a3ff12; --gold-d: #7bd000; --gold-soft: rgba(163, 255, 18, .12);
  --green: #39ff6a; --blue: #4dffcf; --red: #ff4d6d; --orange: #e8ff4d; --purple: #7dffb0;
  --font: "JetBrains Mono", ui-monospace, monospace; --font-display: "JetBrains Mono", ui-monospace, monospace; --radius: 4px;
}
:root[data-theme="crypto"] body { font-size: 14px; background: #010603; }
:root[data-theme="crypto"] .rail { background: rgba(1, 6, 3, .9); }
:root[data-theme="crypto"] .sidebar, :root[data-theme="crypto"] .members { background: rgba(3, 17, 10, .86); }
:root[data-theme="crypto"] .main, :root[data-theme="crypto"] .topbar { background: rgba(4, 22, 12, .80); }
:root[data-theme="crypto"] .m-content, :root[data-theme="crypto"] .em-desc { color: var(--text); }
:root[data-theme="crypto"] .m-author, :root[data-theme="crypto"] .t-name, :root[data-theme="crypto"] .side-head, :root[data-theme="crypto"] h2, :root[data-theme="crypto"] h3 { text-shadow: 0 0 8px rgba(163, 255, 18, .45); }
:root[data-theme="crypto"] .rail-btn, :root[data-theme="crypto"] .btn, :root[data-theme="crypto"] .input, :root[data-theme="crypto"] .compose-box { border-radius: 4px; }
:root[data-theme="crypto"] .rail-btn { clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
:root[data-theme="crypto"] .modal, :root[data-theme="crypto"] .popover, :root[data-theme="crypto"] .embed, :root[data-theme="crypto"] .compose-box {
  box-shadow: 0 0 0 1px rgba(163, 255, 18, .28), 0 0 26px rgba(57, 255, 106, .14);
}
:root[data-theme="crypto"] .btn.primary { color: #021204; box-shadow: 0 0 14px rgba(163, 255, 18, .45); }
:root[data-theme="crypto"] .chan.active, :root[data-theme="crypto"] .dm-item.active { box-shadow: inset 2px 0 0 var(--gold); }
:root[data-theme="crypto"] .compose-box textarea::placeholder { color: var(--muted); }
:root[data-theme="crypto"] .compose-box textarea { caret-color: var(--gold); }
:root[data-theme="crypto"] body::after {
  content: ""; position: fixed; inset: 0; z-index: 2500; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .45));
  animation: crt-flicker 5s steps(1) infinite;
}
@keyframes crt-flicker { 0%, 100% { opacity: 1; } 47% { opacity: .92; } 48% { opacity: 1; } 83% { opacity: .95; } }

/* Space: animated starfield behind glassy panels */
:root[data-theme="space"] {
  --bg: #04030d; --bg-1: #0a0920; --bg-2: #0e0c2a; --bg-3: #131136; --bg-4: #1c1946; --bg-hover: #231f55; --bg-active: #2c2766; --line: #29265e;
  --text: #eef0ff; --text-2: #b6bbe8; --muted: #7d82bb; --gold: #a99bff; --gold-d: #7f6bff; --gold-soft: rgba(169, 155, 255, .16);
  --blue: #7cc4ff; --green: #5ef0c0; --purple: #d49bff;
}
:root[data-theme="space"] body { background: #04030d; }
:root[data-theme="space"] .rail { background: rgba(4, 3, 13, .45); backdrop-filter: blur(6px); }
:root[data-theme="space"] .sidebar, :root[data-theme="space"] .members { background: rgba(14, 12, 42, .52); backdrop-filter: blur(16px) saturate(1.2); }
:root[data-theme="space"] .main { background: rgba(19, 17, 54, .38); backdrop-filter: blur(3px); }
:root[data-theme="space"] .topbar { background: rgba(19, 17, 54, .35); backdrop-filter: blur(12px); }
:root[data-theme="space"] .user-panel, :root[data-theme="space"] .voice-panel { background: rgba(10, 9, 32, .6); }
:root[data-theme="space"] .compose-box { background: rgba(35, 31, 85, .7); backdrop-filter: blur(10px); }
:root[data-theme="space"] .modal, :root[data-theme="space"] .popover { background: rgba(14, 12, 42, .92); backdrop-filter: blur(18px); box-shadow: 0 0 0 1px rgba(169, 155, 255, .22), 0 30px 90px rgba(0, 0, 0, .6); }
:root[data-theme="space"] .btn.primary { color: #0b0820; }
:root[data-theme="space"] .m-author, :root[data-theme="space"] .side-head { text-shadow: 0 0 12px rgba(169, 155, 255, .35); }

/* theme picker: PulsedX-only tiles */
.theme-sw.px { position: relative; }
.theme-sw.px .px-lock { position: absolute; top: 4px; right: 6px; font: 800 9px var(--font); background: #c084fc; color: #1a0b2e; padding: 1px 5px; border-radius: 4px; }
.theme-sw.px.locked { opacity: .75; }
.theme-sw i.th-crypto { background: repeating-linear-gradient(0deg, #021006 0 2px, #03180a 2px 4px); box-shadow: inset 0 0 0 1px #a3ff12, inset 0 0 12px rgba(163, 255, 18, .5); }
.theme-sw i.th-space { background: radial-gradient(circle at 30% 30%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 50% 80%, #cbd 0 .8px, transparent 1.3px), radial-gradient(circle at 70% 20%, rgba(169, 155, 255, .8), transparent 45%), #05040f; }
.theme-sw.px.locked { pointer-events: auto; opacity: .8; cursor: pointer; }
.theme-sw.px.locked:hover { opacity: 1; }
.field label.radio-card { text-transform: none; letter-spacing: normal; font-size: 14px; font-weight: 400; color: var(--text); }
.field label.radio-card b { font-weight: 600; }
.field label.radio-card small { color: var(--text-2); font-size: 12.5px; }
/* Space: keep the stars crisp behind the chat, frost only the side panels */
:root[data-theme="space"] .main { background: rgba(14, 12, 44, .16); backdrop-filter: none; }
:root[data-theme="space"] .topbar { background: rgba(10, 9, 32, .42); }
:root[data-theme="space"] .sidebar, :root[data-theme="space"] .members { background: rgba(12, 10, 38, .46); }
:root[data-theme="space"] .msg:hover { background: rgba(255, 255, 255, .04); }
:root[data-theme="space"] .m-content { text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.boost-form { display: flex; gap: 8px; max-width: 560px; } .boost-form .select { flex: 1; } .boost-form .input { width: 90px; }

/* ======================= Server Boost levels ======================= */
.side-head.has-banner { height: 138px; position: relative; align-items: flex-end; padding-bottom: 12px; border-bottom: 0; overflow: hidden; }
.side-banner { position: absolute; inset: 0; background: center/cover no-repeat; }
.side-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0, 0, 0, .05) 30%, rgba(8, 9, 13, .85)); }
.side-head.has-banner .name, .side-head.has-banner svg, .side-head.has-banner .boost-count { position: relative; z-index: 1; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
.side-head.has-banner:hover .side-banner { filter: brightness(1.08); }
.boost-bar { display: grid; gap: 5px; width: calc(100% - 4px); margin: 2px 2px 10px; padding: 8px 10px; border-radius: 8px; background: var(--bg-3); text-align: left; }
.boost-bar:hover { background: var(--bg-hover); }
.bb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.bb-lvl { display: inline-flex; gap: 5px; align-items: center; font-weight: 700; color: #f5c518; }
.bb-lvl svg { width: 13px; height: 13px; }
.bb-next { color: var(--muted); }
.bb-track, .bh-track { position: relative; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; display: block; }
.bb-track i, .bh-track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #f5c518, #fb923c); box-shadow: 0 0 10px rgba(245, 197, 24, .5); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.boost-bar.lvl3 .bb-track i, .boost-hero.lvl3 .bh-track i { background: linear-gradient(90deg, #fde68a, #f5c518, #fb923c); }
.boost-hero { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 14px; border: 1px solid rgba(245, 197, 24, .35);
  background: radial-gradient(400px 160px at 0% 0%, rgba(245, 197, 24, .22), transparent 70%), var(--bg-2); }
.bh-gem { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(245, 197, 24, .15); flex: none; }
.bh-gem svg { width: 36px; height: 36px; filter: drop-shadow(0 0 10px rgba(245, 197, 24, .7)); }
.bh-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.bh-main > b { font: 800 22px var(--font-display); }
.bh-main > span { color: var(--text-2); font-size: 14px; }
.bh-track { height: 10px; }
.bh-steps { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.bh-steps .hit { color: #f5c518; font-weight: 700; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.level-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg-3); opacity: .75; }
.level-card.unlocked { opacity: 1; border-color: rgba(245, 197, 24, .5); background: linear-gradient(180deg, rgba(245, 197, 24, .10), var(--bg-3) 60%); }
.lc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.lc-head span { font-size: 12px; color: var(--muted); }
.level-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
.level-card li { display: flex; gap: 6px; align-items: center; }
.level-card li.on { color: var(--text); }
.level-card li.on svg { color: var(--green); }
.level-card li svg { width: 13px; height: 13px; flex: none; }
.slot-meter { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; color: var(--text-2); margin: -4px 0 14px; max-width: 560px; }
.slot-meter .bh-track { grid-column: 1 / -1; height: 6px; }
.banner-edit { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: center; }
.banner-prev { height: 120px; border-radius: 10px; background: var(--bg-3) center/cover no-repeat; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.banner-prev span { display: inline-flex; gap: 6px; align-items: center; padding: 0 10px; text-align: center; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.banner-actions small { flex-basis: 100%; color: var(--muted); }
.banner-edit.is-locked .banner-prev { background: repeating-linear-gradient(45deg, var(--bg-3) 0 10px, var(--bg-2) 10px 20px); }
@media (max-width: 760px) { .banner-edit { grid-template-columns: 1fr; } }
.compose-box { position: relative; }
.char-count { position: absolute; right: 12px; bottom: -18px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--red); font-weight: 700; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.staff-pill { display: inline-flex; align-items: center; gap: 4px; font: 700 11px var(--font); padding: 2px 7px; border-radius: 6px; vertical-align: 2px; }
.staff-pill svg { width: 12px; height: 12px; }
.staff-owner { background: var(--gold-soft); color: var(--gold); }
.staff-admin { background: rgba(248, 113, 113, .14); color: var(--red); }
.staff-moderator { background: rgba(96, 165, 250, .14); color: var(--blue); }
.admin-row.is-disabled { background: rgba(248, 113, 113, .05); }
.disabled-note { display: flex !important; gap: 5px; align-items: center; color: var(--red) !important; font-size: 12.5px; margin-top: 2px; }
.muted-note { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12.5px; }
.role-chip.on { border-color: var(--green); color: var(--green); }
/* someone is in voice in this server */
.rail-voice { position: absolute; right: -4px; top: -4px; display: inline-flex; align-items: center; gap: 1px; height: 16px; min-width: 16px; padding: 0 3px; border-radius: 9px; background: var(--green); color: #06210f; border: 2.5px solid var(--bg); font: 800 10px var(--font); pointer-events: none; box-sizing: content-box; justify-content: center; }
.rail-voice svg { width: 10px; height: 10px; stroke-width: 2.6; }
.rail-voice i { font-style: normal; }
.rail-voice.me { animation: railVoice 2.2s ease-in-out infinite; }
@keyframes railVoice { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70%, 100% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } }
:root.reduce-motion .rail-voice.me { animation: none; }

/* ---------- YouTube players ---------- */
.yt { max-width: 440px; margin-top: 6px; background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid #f00; border-radius: 8px; padding: 10px 12px 12px; }
.yt-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; min-width: 0; }
.yt-brand { font-size: 12px; color: var(--muted); }
.yt-author { font-size: 12.5px; color: var(--text-2); }
.yt-author:empty { display: none; }
.yt-title { font-weight: 600; color: var(--blue); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.yt-frame, .yt-live { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.yt.short .yt-frame, .yt.short .yt-live { aspect-ratio: 9 / 16; max-width: 260px; }
.yt-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .15s; }
.yt-frame:hover img { filter: brightness(.85); }
.yt-btn { position: absolute; inset: 0; display: grid; place-items: center; }
.yt-btn svg { width: 68px; height: 48px; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .5)); transition: transform .15s; }
.yt-frame:hover .yt-btn svg { transform: scale(1.08); }
.yt-live iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; opacity: 0; transition: opacity .15s; }
.yt-live:hover .yt-close, .touch .yt-close { opacity: 1; }

/* ---------- GIFs ---------- */
.gif-btn b, .gif-glyph { font: 800 10px/1 var(--font); border: 1.8px solid currentColor; border-radius: 4px; padding: 2px 3px; letter-spacing: .02em; }
.gif-glyph { display: inline-block; font-size: 9px; }
.gif-picker { width: min(420px, calc(100vw - 32px)); display: flex; flex-direction: column; height: 440px; max-height: 70vh; }
.gp-search { padding: 10px; border-bottom: 1px solid var(--line); }
.gp-search input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; outline: none; color: var(--text); }
.gp-grid { flex: 1; overflow-y: auto; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); grid-auto-rows: 112px; gap: 6px; align-content: start; }
.gp-empty { grid-column: 1 / -1; grid-row: span 3; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 40px 16px; }
.gp-empty b { color: var(--text); }
.gp-foot { font-size: 11px; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--line); text-align: right; }
.gp-foot:empty { display: none; }
.m-attach img[src*="img-proxy"] { max-width: min(320px, 100%); }

/* ---------- Rich Presence ---------- */
.rpc .rpc-body { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.rpc-art { width: 64px; height: 64px; flex: none; border-radius: 10px; background: var(--bg-3); display: grid; place-items: center; overflow: hidden; color: var(--text-2); }
.rpc-art img { width: 100%; height: 100%; object-fit: cover; }
.rpc-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.35; }
.rpc-text b { font-size: 14px; }
.rpc-text span, .rpc-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpc-text span { color: var(--text-2); }
.rpc-time { color: var(--green) !important; font-variant-numeric: tabular-nums; }
.rpc-btns { display: grid; gap: 6px; margin-top: 10px; }
.rpc-btns .btn { justify-content: center; }
.rpc-line { display: inline-flex !important; align-items: center; gap: 4px; }
.rpc-line svg { width: 13px; height: 13px; flex: none; }
.rpc-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.rpc-form .field { margin-bottom: 12px; }
.rpc-btn-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; margin-bottom: 6px; }
.rpc-img-row { display: flex; gap: 8px; align-items: center; }
.rpc-img-name { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpc-check { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; font-size: 14px; }
.rpc-actions { display: flex; gap: 8px; }
.rpc-preview { position: sticky; top: 0; }
.rpc-prev-card { width: 100%; }
.rpc-prev-card .pc-sec { margin-top: 0; }
.px-upsell { display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 12px; background: linear-gradient(135deg, rgba(168, 85, 247, .16), rgba(245, 197, 24, .1)); border: 1px solid var(--line); }
.px-upsell p { margin: 4px 0 0; color: var(--text-2); }
.px-upsell .btn { flex: none; }
@media (max-width: 760px) { .rpc-edit { grid-template-columns: 1fr; } .rpc-preview { position: static; order: -1; } .px-upsell { flex-direction: column; align-items: flex-start; } }

/* ---------- phones ---------- */
.compose-more { display: none; }
.members-back { display: none; }
@media (max-width: 900px) {
  .members-back { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 39; }
  .members { width: min(280px, 86vw); padding-bottom: env(safe-area-inset-bottom); animation: slideInR .2s ease-out; }
  @keyframes slideInR { from { transform: translateX(100%); } }
}
@media (max-width: 760px) {
  .app { padding-top: env(safe-area-inset-top); }
  .nav { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .compose-box [data-act=attach], .compose-box [data-act=pollModal], .compose-box [data-act=stickerPicker], .compose-box [data-act=gifPicker] { display: none; }
  .compose-more { display: grid; }
  .compose-box .icon-btn { width: 38px; height: 38px; }
  .topbar { min-height: 52px; }
  .icon-btn { min-width: 36px; min-height: 36px; }
  .chan, .dm-item, .member { min-height: 40px; }
  .yt { max-width: 100%; }
  /* pickers and menus become bottom sheets */
  .popover:has(.sheet), .popover.sheet, .popover:has(.emoji-picker), .popover:has(.sticker-picker), .popover:has(.sound-picker), .popover:has(.ctx-menu) {
    left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto !important; max-width: none;
    border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheetUp .22s cubic-bezier(.2, .8, .2, 1); max-height: 75vh; overflow: auto;
  }
  .popover.sheet .gif-picker, .popover .emoji-picker, .popover .sticker-picker, .popover .sound-picker, .popover .ctx-menu { width: 100% !important; }
  .popover.sheet::before, .popover:has(.emoji-picker)::before, .popover:has(.ctx-menu)::before, .popover:has(.sticker-picker)::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 2px; }
  .ctx-menu button { padding: 12px 14px !important; font-size: 15px; }
  .ctx-quick button { font-size: 26px !important; }
  .compose-sheet button { padding: 14px 16px; font-size: 15px; display: flex; gap: 10px; align-items: center; width: 100%; }
  .emoji-picker .ep-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); max-height: 46vh; }
  @keyframes sheetUp { from { transform: translateY(100%); } }
  .modal-back { align-items: end; padding: 0; }
  .modal-back .modal:not(.wide) { max-width: none; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); max-height: 92vh; animation: sheetUp .22s cubic-bezier(.2, .8, .2, 1); }
  .modal.wide { height: 100dvh; max-height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
}
/* iOS zooms into any input under 16px; keep them at 16px on touch screens */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]), textarea, select, .input, .textarea, .select, #input { font-size: 16px !important; }
  .touch .messages .msg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .m-tools { display: none !important; }
}
:root.reduce-motion .popover, :root.reduce-motion .modal, :root.reduce-motion .members { animation: none !important; }

/* ---------- sticker picker + favourites ---------- */
.sound-picker { width: min(340px, calc(100vw - 32px)); max-height: 380px; overflow: auto; }
.sticker-picker { width: min(420px, calc(100vw - 32px)); height: 440px; max-height: 70vh; display: flex; flex-direction: column; }
.sp-top { padding: 10px; border-bottom: 1px solid var(--line); }
.sp-top input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; outline: none; color: var(--text); }
.sp-wrap { flex: 1; display: flex; min-height: 0; }
.sp-rail { width: 48px; flex: none; border-right: 1px solid var(--line); padding: 8px 6px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; background: var(--bg); }
.sp-rail:empty { display: none; }
.sp-rail button { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-3); color: var(--text-2); font: 700 11px var(--font); overflow: hidden; flex: none; }
.sp-rail button:hover { background: var(--bg-hover); color: var(--text); }
.sp-rail button[data-jump=fav] { color: var(--gold); }
.sp-rail button img { width: 100%; height: 100%; object-fit: cover; }
.sp-body { flex: 1; overflow-y: auto; padding: 4px 8px 10px; position: relative; }
.sp-head { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--muted); padding: 10px 4px 6px; letter-spacing: .02em; }
.sp-sec[data-sec=fav] .sp-head { color: var(--gold); }
.sp-sicon { width: 16px; height: 16px; border-radius: 5px; overflow: hidden; display: inline-grid; place-items: center; background: var(--bg-3); font-size: 7px; }
.sp-sicon img { width: 100%; height: 100%; object-fit: cover; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.sp-tile { position: relative; border-radius: 10px; }
.sp-send { display: block; width: 100%; border-radius: 10px; padding: 6px; transition: background .12s, transform .12s; }
.sp-send:hover { background: var(--bg-hover); }
.sp-send:active { transform: scale(.95); }
.sp-send img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.sp-name { position: absolute; left: 4px; right: 4px; bottom: 3px; font-size: 10.5px; text-align: center; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .12s; pointer-events: none; }
.sp-tile:hover .sp-name { opacity: 1; }
.sp-fav { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; transform: scale(.8); transition: opacity .12s, transform .12s, color .12s; }
.sp-fav svg { width: 14px; height: 14px; }
.sp-tile:hover .sp-fav, .sp-fav.on, .touch .sp-fav { opacity: 1; transform: none; }
.sp-fav:hover { color: var(--gold); }
.sp-fav.on { color: var(--gold); background: rgba(0, 0, 0, .65); }
.sp-fav.on svg { fill: currentColor; }
.touch .sp-fav:not(.on) { opacity: .7; }
.sp-hint { display: flex; align-items: center; gap: 6px; margin: 8px 2px 0; padding: 8px 10px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); font-size: 12.5px; }
.sp-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 50px 16px; }
.sp-empty b { color: var(--text); }
.m-sticker img[data-act] { cursor: pointer; }
.sticker-info { width: 260px; padding: 14px; display: grid; gap: 10px; }
.sticker-info > img { width: 120px; height: 120px; object-fit: contain; justify-self: center; }
.sticker-info b { display: block; font-size: 15px; }
.sticker-info span { color: var(--text-2); font-size: 13px; }
.sticker-info span b { display: inline; font-size: inherit; color: var(--text); }
.si-actions { display: flex; gap: 6px; }
.si-actions .btn { flex: 1; justify-content: center; }
.si-actions .btn.primary svg { fill: currentColor; }
@media (max-width: 760px) { .sticker-picker { height: 70vh; } .sp-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } }

/* ---------- login / register (Discord-style card over the block-world scene) ---------- */
.auth { position: relative; min-height: 100vh; min-height: 100dvh; height: 100dvh; overflow: hidden auto; background: #05060f; color: #f2f3f5; isolation: isolate; }
.auth-scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.as-svg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); }
.as-stars circle.tw { animation: asTwinkle 3.2s ease-in-out infinite; }
@keyframes asTwinkle { 50% { opacity: .15; } }
.as-float { animation: asBob 7s ease-in-out infinite; }
.as-float.f2 { animation-duration: 8.5s; animation-delay: -3s; }
.as-float.f3 { animation-duration: 6s; animation-delay: -1.5s; }
@keyframes asBob { 50% { transform: translateY(-14px); } }
.as-cloud { animation: asDrift 90s linear infinite; }
.as-cloud.c1 { transform: translate(-300px, 140px); }
.as-cloud.c2 { animation-duration: 130s; animation-delay: -60s; transform: translate(-300px, 300px); }
@keyframes asDrift { from { transform: translate(-340px, var(--cy, 140px)); } to { transform: translate(1700px, var(--cy, 140px)); } }
.as-cloud.c2 { --cy: 300px; }
.as-cubes { position: absolute; inset: 0; pointer-events: none; }
.as-cube { position: absolute; width: 14px; height: 14px; background: linear-gradient(135deg, #ffe58a, #e0a91a 55%, #9c6f06); box-shadow: 0 0 18px rgba(245, 197, 24, .55); opacity: .75; animation: asRise 16s linear infinite; bottom: -30px; }
.as-cube.k0 { left: 12%; animation-delay: -2s; }
.as-cube.k1 { left: 31%; width: 9px; height: 9px; animation-duration: 21s; animation-delay: -11s; }
.as-cube.k2 { left: 64%; width: 11px; height: 11px; animation-duration: 18s; animation-delay: -6s; }
.as-cube.k3 { left: 82%; animation-duration: 24s; animation-delay: -15s; }
.as-cube.k4 { left: 48%; width: 7px; height: 7px; animation-duration: 14s; animation-delay: -4s; background: linear-gradient(135deg, #b8f7c5, #4ade80); box-shadow: 0 0 14px rgba(74, 222, 128, .5); }
@keyframes asRise { 0% { transform: translateY(0) rotate(0); opacity: 0; } 10% { opacity: .8; } 85% { opacity: .6; } 100% { transform: translateY(-110vh) rotate(260deg); opacity: 0; } }
.as-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(2, 3, 10, .6) 100%); }
:root.reduce-motion .auth-scene *, .auth-scene.still * { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .auth-scene * { animation: none !important; } }

.auth-brand { position: absolute; top: 28px; left: 32px; display: flex; align-items: center; gap: 10px; color: #fff; font: 800 20px var(--font-display); letter-spacing: -.01em; z-index: 2; text-decoration: none; }
.auth-brand img { width: 34px; height: 34px; filter: drop-shadow(0 4px 14px rgba(245, 197, 24, .45)); }
.auth-brand b { color: var(--gold); }
.auth-stage { min-height: 100%; display: grid; place-items: center; padding: 96px 16px 40px; }
.auth-card {
  position: relative; width: 100%; max-width: 480px; display: flex; gap: 32px; align-items: center; padding: 32px;
  background: rgba(17, 19, 27, .88); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 18px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25), 0 40px 100px rgba(0, 0, 0, .55);
  animation: authIn .5s cubic-bezier(.2, .9, .25, 1.05);
}
.auth-card::before { content: ''; position: absolute; inset: -1px -1px auto; height: 2px; border-radius: 18px 18px 0 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .8; }
.auth-card.with-qr { max-width: 784px; }
@keyframes authIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.auth-form { flex: 1; min-width: 0; }
.auth-form h2 { text-align: center; margin: 0 0 6px; font: 700 26px var(--font-display); letter-spacing: -.01em; }
.auth-form .sub { text-align: center; color: #b5bac1; margin: 0 0 22px; font-size: 15.5px; }
.auth-form .field { margin-bottom: 18px; gap: 8px; }
.auth-form .field label { color: #b5bac1; font-size: 12px; letter-spacing: .04em; }
.auth-form .field label i { color: #f23f42; font-style: normal; margin-left: 2px; }
.auth-form .input { background: #0b0c11; border: 1px solid rgba(255, 255, 255, .06); border-radius: 8px; height: 44px; padding: 0 12px; font-size: 16px; color: #f2f3f5; }
.auth-form .input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.auth-form .field.bad label { color: #fa777c; }
.auth-form .field.bad .input { border-color: #f23f42; box-shadow: 0 0 0 3px rgba(242, 63, 66, .15); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: #949ba4; }
.pw-eye:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.pw-hint { font-size: 12.5px; color: #949ba4; }
.auth-form .form-error { margin: -6px 0 10px; min-height: 0; }
.auth-form .form-error:empty { display: none; }
.auth-submit { height: 46px; font-size: 16px; margin-top: 4px; position: relative; overflow: hidden; box-shadow: 0 8px 24px rgba(245, 197, 24, .22); }
.auth-submit::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-100%); }
.auth-submit:hover::after { transform: translateX(100%); transition: transform .7s ease; }
.auth-submit.busy span { visibility: hidden; }
.auth-submit.busy::before { content: ''; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border-radius: 50%; border: 2.5px solid rgba(0, 0, 0, .25); border-top-color: #111; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-switch { margin-top: 12px; color: #949ba4; font-size: 14px; }
.auth-switch button { color: var(--gold); font-weight: 600; }
.auth-switch button:hover { text-decoration: underline; }
.auth-form.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.auth-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); font-size: 13.5px; margin-bottom: 16px; }
.auth-note svg { flex: none; margin-top: 2px; }
.auth-invite { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-bottom: 14px; }
.auth-invite .rail-btn { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; }
.auth-invite span { display: block; color: #b5bac1; font-size: 14px; }
.auth-invite b { display: block; font: 700 20px var(--font-display); }

.auth-qr { width: 240px; flex: none; display: flex; flex-direction: column; align-items: center; text-align: center; padding-left: 32px; border-left: 1px solid rgba(255, 255, 255, .08); align-self: stretch; justify-content: center; }
.auth-qr h3 { margin: 30px 0 8px; font: 700 22px var(--font-display); }
.auth-qr p { margin: 0; color: #b5bac1; font-size: 15px; line-height: 1.4; }
.auth-qr p b { color: #f2f3f5; }
.auth-qr .link { color: var(--gold); font-weight: 600; margin-top: 10px; font-size: 14px; }
.auth-qr .link:hover { text-decoration: underline; }
.qr-box { position: relative; width: 176px; height: 176px; border-radius: 12px; background: #fff; padding: 12px; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); overflow: hidden; }
.qr-code, .qr-code svg { width: 152px; height: 152px; display: block; }
.qr-logo { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 12px; background: #111318; display: grid; place-items: center; border: 4px solid #fff; }
.qr-logo img { width: 26px; height: 26px; }
.qr-box.loading { background: #e9eaee; }
.qr-shimmer { position: absolute; inset: 0; background: linear-gradient(110deg, #e6e7eb 30%, #f7f7f9 50%, #e6e7eb 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.qr-box.expired .qr-code { filter: blur(4px); opacity: .5; }
.qr-over { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 10px; color: #333; font-size: 13px; background: rgba(255, 255, 255, .7); }
.qr-box.scanned, .qr-box.done { background: transparent; box-shadow: none; }
.qr-who { display: grid; place-items: center; animation: authIn .4s ease-out; }
.qr-who .av { width: 120px; height: 120px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(245, 197, 24, .25), 0 0 40px rgba(245, 197, 24, .35); }
.qr-who .av-img { font-size: 40px; }
.qr-box.done .qr-who { width: 120px; height: 120px; border-radius: 50%; background: var(--green); color: #05230f; }
.qr-box.done .qr-who svg { width: 56px; height: 56px; stroke-width: 3; }

/* phone: QR hidden (you're on the phone), card fills the width */
@media (max-width: 830px) {
  .auth-card.with-qr { max-width: 480px; }
  .auth-qr { display: none; }
}
@media (max-width: 560px) {
  .auth-brand { top: calc(18px + env(safe-area-inset-top)); left: 20px; font-size: 18px; }
  .auth-stage { padding: calc(76px + env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom)); align-items: start; }
  .auth-card { padding: 24px 18px; border-radius: 16px; }
  .auth-form h2 { font-size: 23px; }
}

/* approving a QR login from the phone */
.qr-approve { display: grid; place-items: center; min-height: 70vh; }
.qa-card { width: 100%; max-width: 440px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; text-align: center; }
.qa-card h2 { margin: 14px 0 6px; font: 700 22px var(--font-display); }
.qa-card p { color: var(--text-2); margin: 0 0 14px; }
.qa-icon { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); }
.qa-icon.ok { background: rgba(52, 211, 153, .15); color: var(--green); }
.qa-icon.bad { background: rgba(248, 113, 113, .15); color: var(--red); }
.qa-warn { display: flex; gap: 6px; align-items: flex-start; text-align: left; padding: 9px 12px; border-radius: 10px; background: rgba(248, 113, 113, .1); color: var(--red); font-size: 13px; margin-bottom: 10px; }
.qa-warn.soft { background: var(--bg-3); color: var(--text-2); }
.qa-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }

/* ---------- GIF favourites ---------- */
.gp-item { position: relative; display: block; width: 100%; height: 100%; aspect-ratio: auto !important; border-radius: 8px; overflow: hidden; background: var(--bg-3); break-inside: avoid; }
.gp-send { display: block; width: 100%; height: 100%; }
.gp-send img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.gp-item:hover { outline: 2px solid var(--gold); outline-offset: -2px; }
.gp-item:hover .gp-send img { transform: scale(1.03); }
.gp-fav, .gif-fav { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff; opacity: 0; transform: scale(.8); transition: opacity .12s, transform .12s, color .12s; z-index: 1; }
.gp-fav svg, .gif-fav svg { width: 15px; height: 15px; }
.gp-item:hover .gp-fav, .m-gif:hover .gif-fav, .gp-fav.on, .gif-fav.on, .touch .gp-fav, .touch .gif-fav { opacity: 1; transform: none; }
.gp-fav:hover, .gif-fav:hover { color: var(--gold); }
.gp-fav.on, .gif-fav.on { color: var(--gold); }
.gp-fav.on svg, .gif-fav.on svg { fill: currentColor; }
.touch .gp-fav:not(.on), .touch .gif-fav:not(.on) { opacity: .75; }
.gp-tabs { display: flex; gap: 4px; padding: 6px 10px 0; }
.gp-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.gp-tabs button:hover { background: var(--bg-hover); color: var(--text); }
.gp-tabs button.on { background: var(--bg-3); color: var(--text); }
.gp-tabs button[data-gtab=fav].on, .gp-tabs button[data-gtab=fav] svg { color: var(--gold); }
.gp-count { font-size: 11px; background: var(--gold-soft); color: var(--gold); border-radius: 8px; padding: 0 6px; }
.gp-count:empty { display: none; }
.m-gif { position: relative; display: inline-block; max-width: min(320px, 100%); border-radius: 8px; overflow: hidden; vertical-align: top; }
.m-gif img { display: block; max-width: 100%; }
.gif-tag { position: absolute; left: 6px; bottom: 6px; font: 800 10px var(--font); padding: 2px 5px; border-radius: 4px; background: rgba(0, 0, 0, .6); color: #fff; pointer-events: none; }
