/* ============================================================
   relay — chat.donaldrowe.com
   Midnight-signal theme: deep ink base, luminous teal signal,
   IRC-style hashed nick colors.
   ============================================================ */

:root {
  --ink-900: #07090d;
  --ink-850: #0a0c12;
  --ink-800: #0d1017;
  --ink-750: #11151e;
  --ink-700: #161b26;
  --ink-650: #1c2230;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  --txt: #e7ecf3;
  --txt-soft: #aeb7c6;
  --txt-faint: #6c7689;
  --txt-ghost: #49515f;

  --signal: #34e2c4;
  --signal-deep: #16b89c;
  --signal-glow: rgba(52, 226, 196, 0.16);
  --coral: #ff7a6b;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-pop: 0 18px 50px -18px rgba(0, 0, 0, 0.7), 0 2px 8px -2px rgba(0, 0, 0, 0.5);

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The `hidden` attribute must always win. Several elements below set an explicit
   `display` (flex/grid), which would otherwise override the UA [hidden] rule and
   leave toggled-off elements (jump button, overlays, app shell) visible. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--ink-850);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  position: relative;
}

/* Atmospheric background ----------------------------------- */
.bg-aura {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -8%, rgba(52, 226, 196, 0.10), transparent 60%),
    radial-gradient(820px 560px at 96% 8%, rgba(120, 110, 255, 0.08), transparent 62%),
    radial-gradient(700px 700px at 70% 120%, rgba(255, 122, 107, 0.06), transparent 60%),
    linear-gradient(180deg, var(--ink-900), var(--ink-850));
}
.bg-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
   Nickname gate
   ============================================================ */
.gate {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 24px;
}
.gate.hide { animation: gate-out 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes gate-out { to { opacity: 0; transform: scale(1.03); visibility: hidden; } }

.gate-card {
  position: relative; width: min(380px, 100%);
  background: linear-gradient(180deg, rgba(28, 34, 48, 0.72), rgba(13, 16, 23, 0.82));
  border: 1px solid var(--line-strong);
  border-radius: 22px; padding: 40px 34px 26px;
  text-align: center;
  box-shadow: var(--shadow-pop), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  animation: gate-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes gate-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }

.gate-mark {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: grid; place-items: center; color: var(--signal);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 30%, var(--signal-glow), rgba(52, 226, 196, 0.02));
  border: 1px solid rgba(52, 226, 196, 0.3);
  box-shadow: 0 0 30px -6px var(--signal-glow);
}
.gate-title {
  font-family: var(--font-display); font-weight: 800; font-size: 38px;
  letter-spacing: -0.03em; line-height: 1;
  background: linear-gradient(180deg, #fff, #b9c4d2);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-sub { color: var(--txt-faint); font-size: 14.5px; margin: 8px 0 24px; }

.field {
  display: flex; align-items: center; gap: 2px;
  background: var(--ink-850); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus-within { border-color: var(--signal-deep); box-shadow: 0 0 0 3px var(--signal-glow); }
.field-prefix { font-family: var(--font-mono); color: var(--signal); font-size: 16px; user-select: none; }
.field input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--txt); font-family: var(--font-mono); font-size: 16px;
  padding: 14px 6px; letter-spacing: 0.01em; min-width: 0;
}
.field input::placeholder { color: var(--txt-ghost); }

.nick-error { color: var(--coral); font-size: 13px; min-height: 18px; margin: 8px 2px 0; text-align: left; }

#nick-form button, .btn-primary {
  width: 100%; margin-top: 14px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(180deg, var(--signal), var(--signal-deep));
  color: #04221c; font-family: var(--font-body); font-weight: 700; font-size: 15px;
  border: none; border-radius: var(--radius-sm); padding: 14px;
  cursor: pointer; transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 10px 26px -10px var(--signal-glow);
}
#nick-form button:hover, .btn-primary:hover { filter: brightness(1.07); box-shadow: 0 14px 30px -8px var(--signal-glow); }
#nick-form button:active, .btn-primary:active { transform: translateY(1px); }

.gate-foot {
  margin-top: 22px; font-size: 12px; color: var(--txt-faint);
  font-family: var(--font-mono); display: flex; align-items: center; justify-content: center; gap: 7px;
}

.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--txt-ghost);
  box-shadow: 0 0 0 0 transparent; transition: background 0.3s;
}
.dot.online { background: var(--signal); box-shadow: 0 0 10px 1px var(--signal-glow); }
.dot.off { background: var(--coral); }

/* ============================================================
   App shell — three columns
   ============================================================ */
.app {
  position: relative; z-index: 1;
  height: 100dvh;
  display: grid;
  /* user-resized widths live in --rail-*-w (inline); --rail-* is the effective
     width so the collapse classes can force it to 0 without fighting inline styles */
  --rail-left: var(--rail-left-w, 256px);
  --rail-right: var(--rail-right-w, 230px);
  grid-template-columns: var(--rail-left) minmax(0, 1fr) var(--rail-right);
}
.app:not([hidden]) { animation: app-in 0.6s ease both; }
@keyframes app-in { from { opacity: 0; } }

/* ---- Resizers + collapse (desktop) ---- */
.resizer {
  position: absolute; top: 0; bottom: 0; width: 12px; z-index: 6;
  cursor: col-resize; display: flex; align-items: center; justify-content: center;
}
#resizer-left  { left: var(--rail-left); transform: translateX(-50%); }
#resizer-right { right: var(--rail-right); transform: translateX(50%); }
.resizer .grip {
  width: 3px; height: 38px; border-radius: 3px; background: transparent; transition: background 0.15s;
}
.resizer:hover .grip, .resizer.dragging .grip { background: var(--signal); box-shadow: 0 0 10px var(--signal-glow); }
.resizer.dragging { background: linear-gradient(90deg, transparent, var(--signal-glow), transparent); }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none !important; }

.rail-collapse svg, .rail-expand svg { display: block; }

/* Members panel mini-header (holds the label + collapse button) */
.rail-mhead {
  display: flex; align-items: center; justify-content: space-between; padding-right: 8px;
}
.rail-mhead .rail-label { padding-right: 6px; }

@media (min-width: 881px) {
  .app.left-collapsed  { --rail-left: 0px; }
  .app.left-collapsed  .rail-channels,
  .app.left-collapsed  #resizer-left { display: none; }
  .app.right-collapsed { --rail-right: 0px; }
  .app.right-collapsed .rail-members,
  .app.right-collapsed #resizer-right { display: none; }
}
@media (max-width: 880px) {
  .desktop-only { display: none !important; }
}

.rail {
  background: linear-gradient(180deg, rgba(13, 16, 23, 0.6), rgba(10, 12, 18, 0.6));
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column; min-height: 0;
}
.rail-channels { border-right: 1px solid var(--line); }
.rail-members { border-left: 1px solid var(--line); padding-top: 14px; }

.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 17px 16px 14px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center; color: var(--signal);
  border-radius: 9px; background: var(--signal-glow); border: 1px solid rgba(52, 226, 196, 0.25);
}
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  letter-spacing: -0.02em; color: var(--txt);
}

.rail-label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--txt-ghost);
  padding: 16px 18px 8px;
}

.channel-list { flex: 1; overflow-y: auto; padding: 0 10px; min-height: 0; }

.channel {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 11px; margin-bottom: 2px;
  border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--txt-soft);
  font-family: var(--font-body); font-size: 14.5px; font-weight: 500;
  text-align: left; position: relative; transition: background 0.15s, color 0.15s;
}
.channel:hover { background: rgba(255, 255, 255, 0.04); color: var(--txt); }
.channel .c-hash { font-family: var(--font-mono); color: var(--txt-ghost); font-size: 15px; transition: color 0.15s; }
.channel .c-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel.active {
  background: linear-gradient(90deg, var(--signal-glow), rgba(52, 226, 196, 0.03));
  color: #fff;
}
.channel.active .c-hash { color: var(--signal); }
.channel.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--signal);
  box-shadow: 0 0 10px var(--signal-glow);
}
.unread {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--coral); color: #2a0a06; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; font-family: var(--font-mono);
}
.channel.has-unread:not(.active) .c-name { color: var(--txt); font-weight: 600; }

.me-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}
.me-avatar, .m-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700;
  font-size: 14px; color: #06120f; text-transform: uppercase;
}
.me-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.me-nick { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-status { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--txt-faint); font-family: var(--font-mono); }

/* Conversation column -------------------------------------- */
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgba(10, 12, 18, 0.35); }

.convo-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px; height: 58px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 16, 23, 0.5); backdrop-filter: blur(8px);
}
.convo-title { display: flex; align-items: baseline; gap: 1px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.convo-title .hash { font-family: var(--font-mono); color: var(--signal); font-weight: 500; }
.convo-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 9px; border: 1px solid transparent; background: none;
  color: var(--txt-faint); cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { color: var(--txt); background: rgba(255, 255, 255, 0.05); }
.icon-btn.ghost { width: auto; padding: 0 9px; gap: 6px; font-family: var(--font-mono); font-size: 12px; }

/* Message stream ------------------------------------------- */
.stream-wrap { position: relative; flex: 1; min-height: 0; }
.stream { height: 100%; overflow-y: auto; padding: 20px 22px 10px; }

.day-sep {
  display: flex; align-items: center; gap: 14px; margin: 18px 4px 16px;
  color: var(--txt-ghost); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
}
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.msg {
  position: relative;
  display: grid; grid-template-columns: 44px 1fr; gap: 12px;
  padding: 3px 6px; border-radius: 10px;
  animation: msg-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg:hover { background: rgba(255, 255, 255, 0.025); }
.msg.grouped { grid-template-rows: auto; padding-top: 1px; padding-bottom: 1px; }
.msg.grouped .m-avatar-col { visibility: hidden; height: 0; }
.msg.grouped .m-head { display: none; }

.m-avatar-col { padding-top: 4px; }
.m-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }

.m-body { min-width: 0; }
.m-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 2px; }
.m-nick { font-weight: 700; font-size: 14.5px; letter-spacing: -0.005em; }
.m-time { font-family: var(--font-mono); font-size: 11px; color: var(--txt-ghost); }
.m-text {
  font-size: 14.5px; line-height: 1.5; color: var(--txt); word-wrap: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.m-text a { color: var(--signal); text-decoration: none; border-bottom: 1px solid rgba(52, 226, 196, 0.3); }
.m-text a:hover { border-bottom-color: var(--signal); }
.msg.grouped .m-text { position: relative; }
.msg.action .m-text { font-style: italic; color: var(--txt-soft); }
.msg.action .m-text::before { content: "✦ "; color: var(--signal); font-style: normal; }

/* System notices */
.sys {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px; margin: 4px 0;
  font-family: var(--font-mono); font-size: 12px; color: var(--txt-faint);
  animation: msg-in 0.3s ease both;
}
.sys::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--txt-ghost); flex-shrink: 0; margin-left: 18px;
}
.sys .s-nick { color: var(--txt-soft); }

.empty-chan {
  text-align: center; color: var(--txt-faint); padding: 48px 20px; font-size: 14px;
}
.empty-chan .ec-mark { font-size: 40px; opacity: 0.5; margin-bottom: 12px; }

.jump-btn {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  background: var(--signal); color: #052019; border: none;
  padding: 8px 16px; border-radius: 20px; font-weight: 700; font-size: 13px;
  font-family: var(--font-body); cursor: pointer; box-shadow: var(--shadow-pop);
  animation: msg-in 0.3s ease; z-index: 3;
}

/* Composer ------------------------------------------------- */
.composer { padding: 6px 18px 16px; flex-shrink: 0; }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--ink-750); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 8px 8px 8px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer-box:focus-within { border-color: rgba(52, 226, 196, 0.4); box-shadow: 0 0 0 3px var(--signal-glow); }
#composer-input {
  flex: 1; background: none; border: none; outline: none; resize: none;
  color: var(--txt); font-family: var(--font-body); font-size: 14.5px; line-height: 1.5;
  max-height: 160px; padding: 7px 0; min-width: 0;
}
#composer-input::placeholder { color: var(--txt-ghost); }
#composer-input.cooldown { opacity: 0.55; }
.send-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; border: none; cursor: pointer;
  display: grid; place-items: center; color: #06120f;
  background: linear-gradient(180deg, var(--signal), var(--signal-deep));
  transition: transform 0.12s, filter 0.2s, opacity 0.2s;
}
.send-btn:hover { filter: brightness(1.08); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.4; cursor: default; filter: grayscale(0.4); }

.composer-hint { margin: 8px 4px 0; font-size: 11.5px; color: var(--txt-ghost); font-family: var(--font-mono); }
.composer-hint kbd {
  font-family: var(--font-mono); background: var(--ink-700); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; font-size: 10.5px; color: var(--txt-faint);
}
.composer-hint code { color: var(--signal); font-family: var(--font-mono); }

/* Members -------------------------------------------------- */
.member-list { overflow-y: auto; padding: 0 10px; flex: 1; min-height: 0; }
.member {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px;
  transition: background 0.15s;
}
.member:hover { background: rgba(255, 255, 255, 0.03); }
.m-dot-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700;
  font-size: 13px; color: #06120f; text-transform: uppercase; position: relative;
}
.m-dot-avatar::after {
  content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--signal); border: 2px solid var(--ink-800);
}
.member-name { font-size: 13.5px; font-weight: 500; color: var(--txt-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.is-me .member-name { color: var(--txt); font-weight: 700; }
.member.is-me .member-name::after { content: " · you"; color: var(--txt-ghost); font-weight: 400; }

/* Dialog --------------------------------------------------- */
.dialog {
  border: 1px solid var(--line-strong); border-radius: 18px; padding: 0;
  background: linear-gradient(180deg, var(--ink-700), var(--ink-800));
  color: var(--txt); width: min(380px, 92vw); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: rgba(5, 7, 11, 0.6); backdrop-filter: blur(4px); }
.dialog form { padding: 26px; }
.dialog h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.dialog-sub { color: var(--txt-faint); font-size: 13px; margin: 6px 0 18px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn-ghost {
  flex: 1; background: var(--ink-700); border: 1px solid var(--line-strong); color: var(--txt-soft);
  border-radius: var(--radius-sm); padding: 12px; font-family: var(--font-body); font-weight: 600;
  font-size: 14px; cursor: pointer; transition: background 0.15s;
}
.btn-ghost:hover { background: var(--ink-650); color: var(--txt); }
.btn-primary { flex: 1; width: auto; margin-top: 0; }

/* ============================================================
   Admin controls
   ============================================================ */
.me-nick-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.me-admin {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--signal); background: var(--signal-glow);
  border: 1px solid rgba(52, 226, 196, 0.35); border-radius: 5px; padding: 1px 5px; flex-shrink: 0;
}

/* Message delete (hover, admin only) */
.msg-actions {
  position: absolute; top: -8px; right: 8px; display: none;
  background: var(--ink-700); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow-pop); padding: 2px;
}
body.is-admin .msg:hover .msg-actions { display: flex; }
.msg-del {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: none; background: none; border-radius: 6px; cursor: pointer;
  color: var(--txt-faint); transition: all 0.14s;
}
.msg-del:hover { color: var(--coral); background: rgba(255, 122, 107, 0.12); }
.msg-del.armed { color: #fff; background: var(--coral); width: auto; padding: 0 9px; }
.msg-del.armed::after { content: "delete?"; font-family: var(--font-mono); font-size: 11px; margin-left: 5px; }

/* Channel delete (hover, admin only) */
.chan-del {
  display: none; place-items: center; width: 20px; height: 20px; margin-left: 4px;
  border-radius: 6px; color: var(--txt-ghost); cursor: pointer; flex-shrink: 0; transition: all 0.14s;
}
body.is-admin .channel:hover .chan-del { display: grid; }
.chan-del:hover { color: var(--coral); background: rgba(255, 122, 107, 0.14); }

.btn-danger {
  flex: 1; background: linear-gradient(180deg, #ff8576, var(--coral)); color: #2a0a06;
  border: none; border-radius: var(--radius-sm); padding: 12px; font-family: var(--font-body);
  font-weight: 700; font-size: 14px; cursor: pointer; transition: filter 0.15s, transform 0.12s;
}
.btn-danger:hover { filter: brightness(1.06); }
.btn-danger:active { transform: translateY(1px); }

/* Toasts */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink-700); border: 1px solid var(--line-strong); color: var(--txt);
  font-size: 13.5px; font-weight: 500; padding: 11px 18px; border-radius: 11px;
  box-shadow: var(--shadow-pop); max-width: 90vw;
  animation: toast-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.toast.out { animation: toast-out 0.32s ease forwards; }
.toast.ok { border-color: rgba(52, 226, 196, 0.4); }
.toast.ok::before { content: "✦ "; color: var(--signal); }
.toast.error { border-color: rgba(255, 122, 107, 0.45); }
.toast.error::before { content: "⚠ "; color: var(--coral); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Admin-only header buttons (clear channel) */
.admin-only { display: none; }
body.is-admin .admin-only { display: grid; }
#clear-channel-btn:hover { color: var(--coral); background: rgba(255, 122, 107, 0.12); }

/* Message pin button + pinned indicator */
.msg-pin {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: none; background: none; border-radius: 6px; cursor: pointer;
  color: var(--txt-faint); transition: all 0.14s;
}
.msg-pin:hover { color: var(--signal); background: var(--signal-glow); }
.msg-pin.on { color: var(--signal); }
.m-pin-flag {
  display: inline-flex; align-items: center; gap: 3px; color: var(--signal);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
}
.pinned-msg { background: linear-gradient(90deg, rgba(52, 226, 196, 0.06), transparent 70%); }
.pinned-msg:hover { background: linear-gradient(90deg, rgba(52, 226, 196, 0.09), rgba(255,255,255,0.02) 70%); }

/* Pinned bar */
.pinbar { border-bottom: 1px solid var(--line); background: rgba(52, 226, 196, 0.04); flex-shrink: 0; }
.pinbar-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 18px; background: none; border: none; cursor: pointer;
  color: var(--txt-soft); font-family: var(--font-body); font-size: 13px; text-align: left;
}
.pinbar-toggle:hover { color: var(--txt); }
.pinbar-toggle .pin-ico { color: var(--signal); }
.pinbar-toggle b { color: var(--txt); font-weight: 700; }
.pinbar-toggle .chev { margin-left: auto; color: var(--txt-faint); transition: transform 0.2s; }
.pinbar.open .pinbar-toggle .chev { transform: rotate(180deg); }
.pinbar-panel { max-height: 230px; overflow-y: auto; padding: 4px 10px 10px; border-top: 1px solid var(--line); }
.pin-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 9px;
  position: relative; transition: background 0.14s;
}
.pin-item:hover { background: rgba(255, 255, 255, 0.03); }
.pin-avatar {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 12px; color: #06120f; text-transform: uppercase;
}
.pin-body { min-width: 0; flex: 1; }
.pin-nick { font-weight: 700; font-size: 13px; }
.pin-text { font-size: 13px; line-height: 1.45; color: var(--txt-soft); overflow-wrap: anywhere; white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pin-text a { color: var(--signal); text-decoration: none; }
.pin-unpin {
  flex-shrink: 0; display: grid; place-items: center; width: 24px; height: 24px;
  border: none; background: none; border-radius: 6px; color: var(--txt-ghost); cursor: pointer; transition: all 0.14s;
}
.pin-unpin:hover { color: var(--coral); background: rgba(255, 122, 107, 0.12); }

/* Member kick / ban */
.member { position: relative; }
.member-acts { margin-left: auto; display: none; gap: 4px; }
body.is-admin .member:hover .member-acts { display: flex; }
.m-kick, .m-ban {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em;
  border: 1px solid var(--line-strong); background: var(--ink-700); color: var(--txt-faint);
  border-radius: 6px; padding: 2px 7px; cursor: pointer; transition: all 0.14s;
}
.m-kick:hover { color: var(--txt); border-color: var(--txt-faint); }
.m-ban:hover { color: var(--coral); border-color: rgba(255, 122, 107, 0.5); }
.m-kick.armed { background: var(--txt-faint); color: #06120f; }
.m-ban.armed { background: var(--coral); color: #2a0a06; border-color: var(--coral); }
.m-kick.armed::after { content: "?"; }
.m-ban.armed::after { content: "?"; }

.blocked-mark { color: var(--coral); border-color: rgba(255, 122, 107, 0.35); background: radial-gradient(circle at 50% 30%, rgba(255,122,107,0.16), transparent); box-shadow: 0 0 30px -6px rgba(255,122,107,0.3); }
#blocked button { width: 100%; }

/* Scrollbars ----------------------------------------------- */
.channel-list::-webkit-scrollbar, .stream::-webkit-scrollbar, .member-list::-webkit-scrollbar { width: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Mobile --------------------------------------------------- */
.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgba(5, 7, 11, 0.55); z-index: 15; backdrop-filter: blur(2px); }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: grid; }
  .rail-channels, .rail-members {
    position: fixed; top: 0; bottom: 0; z-index: 20; width: 270px;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .rail-channels { left: 0; transform: translateX(-100%); }
  .rail-members { right: 0; width: 240px; transform: translateX(100%); }
  .app.show-channels .rail-channels { transform: translateX(0); }
  .app.show-members .rail-members { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.05s !important; }
}
