/* ==========================================================================
   NeonForge · Hub: Discord-style servers, chat, voice, DMs, friends,
   profile popups, QR invites, squads, project hubs and playground tester
   ========================================================================== */

/* ---------- Shared bits ---------- */
.hp-field {
  position: absolute !important;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.nav-link {
  position: relative;
}

.nav-dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 22px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 10px rgba(var(--red-rgb), 0.7);
}

.hub-avatar {
  --size: 40px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, hsl(var(--hue) 95% 72% / 0.95), transparent 60%),
    linear-gradient(135deg, hsl(var(--hue) 85% 50%), hsl(calc(var(--hue) + 60) 80% 38%));
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--size) * 0.38);
  letter-spacing: -0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: box-shadow 140ms var(--ease);
}

.hub-avatar.avatar-xs { --size: 22px; font-size: 9px; }
.hub-avatar.avatar-sm { --size: 32px; }
.hub-avatar.avatar-md { --size: 40px; }
.hub-avatar.avatar-lg { --size: 56px; }
.hub-avatar.avatar-xl { --size: 84px; }

/* Speaking ring: green neon glow, toggled live by the voice service. */
.hub-avatar.is-speaking {
  box-shadow:
    0 0 0 2px var(--bg-2),
    0 0 0 4px var(--lime),
    0 0 18px 2px rgba(var(--lime-rgb), 0.75);
}

.presence-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  width: clamp(10px, calc(var(--size) * 0.3), 18px);
  height: clamp(10px, calc(var(--size) * 0.3), 18px);
  border-radius: 50%;
  border: 3px solid var(--surface-solid);
  background: #4b5270;
}

.presence-online {
  background: var(--lime);
  box-shadow: 0 0 8px rgba(var(--lime-rgb), 0.7);
}

/* Idle: crescent moon. */
.presence-idle {
  background: radial-gradient(circle at 30% 30%, var(--surface-solid) 0 38%, var(--amber) 40%);
}

/* Do not disturb: red with a bar. */
.presence-dnd {
  background: linear-gradient(var(--red), var(--red)) padding-box;
  box-shadow: inset 0 0 0 30px var(--red);
}

.presence-dnd::after {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: calc(50% - 1px);
  height: 2px;
  border-radius: 2px;
  background: var(--surface-solid);
}

.presence-offline,
.presence-invisible {
  background: var(--surface-solid);
  box-shadow: inset 0 0 0 3px #6b7391;
}

/* Inline (non-avatar) presence dots */
.friend-id .presence-dot,
.user-card-status .presence-dot,
.hub-topic .presence-dot,
.menu .presence-dot,
.friends-body small .presence-dot {
  position: relative;
  right: auto;
  bottom: auto;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-width: 0;
  margin-right: 6px;
  vertical-align: -1px;
}

.menu .presence-dot.presence-offline,
.menu .presence-dot.presence-invisible,
.friends-body .presence-dot.presence-offline {
  box-shadow: inset 0 0 0 2px #6b7391;
}

.srole {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  background: rgba(var(--srole-rgb, 132, 148, 205), 0.14);
  color: rgb(var(--srole-rgb, 182, 188, 212));
  border: 1px solid rgba(var(--srole-rgb, 132, 148, 205), 0.3);
  white-space: nowrap;
}

.srole .icon {
  width: 11px;
  height: 11px;
}

.srole-cyan { --srole-rgb: var(--cyan-rgb); }
.srole-magenta { --srole-rgb: var(--magenta-rgb); }
.srole-lime { --srole-rgb: var(--lime-rgb); }
.srole-amber { --srole-rgb: var(--amber-rgb); }
.srole-violet { --srole-rgb: var(--violet-rgb); }
.srole-red { --srole-rgb: var(--red-rgb); }

.role-text-cyan { color: var(--cyan) !important; }
.role-text-magenta { color: var(--magenta) !important; }
.role-text-lime { color: var(--lime) !important; }
.role-text-amber { color: var(--amber) !important; }
.role-text-violet { color: var(--violet) !important; }
.role-text-red { color: #ff7a9b !important; }

.icon-btn.icon-xs {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.icon-btn.icon-xs .icon {
  width: 14px;
  height: 14px;
}

.icon-btn.success:hover {
  color: var(--lime);
  border-color: rgba(var(--lime-rgb), 0.5);
}

.icon-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--cyan);
  color: #031014;
  font-size: 10px;
  line-height: 16px;
}

.empty-mini {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-mini .icon {
  width: 28px;
  height: 28px;
  color: var(--cyan);
  opacity: 0.8;
}

.live-chip {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.text-red {
  color: var(--red);
}

/* ==========================================================================
   Hub shell
   ========================================================================== */
body.is-hub .layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
  padding: 0;
  gap: 0;
}

body.is-hub .sidebar {
  display: none;
}

body.is-hub .main-view {
  max-width: none;
  gap: 0;
}

body.is-hub .bg-fx {
  opacity: 0.45;
}

.hub {
  --rail-w: 76px;
  --side-w: 252px;
  --members-w: 0px;
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr) var(--members-w);
  height: calc(100vh - var(--nav-h));
  height: calc(100dvh - var(--nav-h));
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.hub.has-members.members-open {
  --members-w: 248px;
}

.hub-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  overflow-y: auto;
  scrollbar-width: none;
  background: rgba(5, 6, 11, 0.92);
  border-right: 1px solid var(--border);
}

.hub-rail::-webkit-scrollbar {
  display: none;
}

.rail-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none !important;
}

.rail-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: border-radius 200ms var(--ease), background 200ms, color 200ms, box-shadow 200ms;
}

.rail-icon .icon {
  width: 22px;
  height: 22px;
}

.rail-server {
  background:
    radial-gradient(circle at 30% 20%, hsl(var(--hue, 200) 95% 70% / 0.55), transparent 60%),
    linear-gradient(135deg, hsl(var(--hue, 200) 70% 30%), hsl(calc(var(--hue, 200) + 50) 70% 20%));
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.rail-item:hover .rail-icon,
.rail-item.is-active .rail-icon {
  border-radius: 16px;
}

.rail-home .rail-icon {
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.25), rgba(var(--magenta-rgb), 0.25));
  color: var(--cyan);
}

.rail-item.is-active .rail-icon,
.rail-home:hover .rail-icon {
  box-shadow: 0 0 0 1px rgba(var(--cyan-rgb), 0.55), 0 0 20px -4px rgba(var(--cyan-rgb), 0.8);
}

.rail-action .rail-icon {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--lime);
}

.rail-action:hover .rail-icon {
  background: rgba(var(--lime-rgb), 0.14);
  border-style: solid;
  border-color: rgba(var(--lime-rgb), 0.6);
}

.rail-pill {
  position: absolute;
  left: -12px;
  top: 50%;
  width: 6px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--text);
  transform: translateY(-50%);
  transition: height 200ms var(--ease);
}

.rail-item.has-unread .rail-pill {
  height: 8px;
}

.rail-item:hover .rail-pill {
  height: 20px;
}

.rail-item.is-active .rail-pill {
  height: 40px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.8);
}

.rail-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  border: 3px solid #05060b;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
}

.rail-dot {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.9);
}

.rail-kind {
  position: absolute;
  right: -1px;
  bottom: -1px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #05060b;
  background: var(--surface-raised);
  color: var(--amber);
}

.rail-kind .icon {
  width: 11px;
  height: 11px;
}

.rail-sep {
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--border-strong);
}

/* ---------- Channel sidebar ---------- */
.hub-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(10, 12, 21, 0.9);
  border-right: 1px solid var(--border);
}

.hub-side-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  flex-shrink: 0;
}

.side-head:hover {
  background: var(--surface-hover);
}

.side-head-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-head .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.side-search {
  margin: 10px;
  width: calc(100% - 20px);
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(var(--tint-rgb), 0.35);
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 16px;
  scrollbar-width: thin;
}

.side-desc {
  margin: 0 6px 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.side-invite {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(var(--cyan-rgb), 0.3);
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.12), rgba(var(--magenta-rgb), 0.1));
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.side-invite span {
  flex: 1;
  text-align: left;
}

.side-invite .icon {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.side-invite:hover {
  box-shadow: var(--glow);
}

.side-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}

.channel-group {
  margin-top: 12px;
}

.channel-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.channel-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none !important;
  transition: background var(--fast), color var(--fast);
}

.channel-link > .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.channel-link > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-link:hover {
  background: var(--surface-hover);
  color: var(--text-dim);
}

.channel-link.has-unread {
  color: var(--text);
  font-weight: 700;
}

.channel-link.is-active {
  background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.18), rgba(var(--cyan-rgb), 0.04));
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.channel-lock .icon {
  width: 12px;
  height: 12px;
}

.channel-unread,
.channel-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.channel-count {
  background: rgba(var(--lime-rgb), 0.18);
  color: var(--lime);
}

.voice-channel.is-connected .channel-voice {
  color: var(--lime);
}

.voice-occupants {
  margin: 2px 0 6px 30px;
  padding: 0;
  list-style: none;
}

.voice-occupant {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}

.voice-occupant:hover {
  background: var(--surface-hover);
}

.voice-occupant > span:not(.hub-avatar) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-flag .icon {
  width: 14px;
  height: 14px;
  color: var(--red);
}

.dm-friends {
  margin-bottom: 4px;
}

.dm-link-wrap {
  position: relative;
}

.dm-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none !important;
}

.dm-link:hover {
  background: var(--surface-hover);
}

.dm-link.is-active {
  background: rgba(var(--cyan-rgb), 0.14);
  color: var(--text);
}

.dm-link.has-unread strong {
  color: var(--text);
}

.dm-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.dm-text strong,
.dm-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-text strong {
  color: var(--text-dim);
  font-size: 14px;
}

.dm-text small {
  font-size: 12px;
  color: var(--muted);
}

.dm-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
}

.dm-link-wrap:hover .dm-close,
.dm-close:focus-visible {
  opacity: 1;
}

.dm-link-wrap:hover .channel-unread {
  visibility: hidden;
}

/* Voice + user panels */
.voice-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--lime-rgb), 0.08), transparent);
}

.voice-panel-info {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 1px;
  font-size: 12px;
}

.voice-panel-info a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.voice-panel-info small {
  color: var(--muted);
}

.voice-ok {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--lime);
  font-size: 13px;
  text-shadow: 0 0 10px rgba(var(--lime-rgb), 0.6);
}

.voice-ok .icon {
  width: 15px;
  height: 15px;
}

.voice-warn {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--amber) !important;
}

.voice-warn .icon {
  width: 12px;
  height: 12px;
}

.icon-btn.danger:hover,
.btn.danger:hover {
  color: var(--red);
  border-color: rgba(var(--red-rgb), 0.5);
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: rgba(var(--ink-rgb), 0.8);
}

.user-panel-me {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 8px;
  text-align: left;
}

.user-panel-me:hover {
  background: var(--surface-hover);
}

.user-panel-me > span:last-child {
  display: grid;
  min-width: 0;
}

.user-panel-me strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.user-panel-me small {
  color: var(--muted);
  font-size: 11.5px;
}

.panel-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-dim);
  transition: background var(--fast), color var(--fast);
}

.panel-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.panel-btn .icon {
  width: 18px;
  height: 18px;
}

.panel-btn.is-off {
  color: var(--red);
  background: rgba(var(--red-rgb), 0.12);
}

/* ---------- Main column ---------- */
.hub-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(13, 15, 26, 0.82);
}

.hub-header {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 6px 18px -14px rgba(0, 0, 0, 0.9);
}

.hub-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 15.5px;
}

.hub-title > .icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.hub-title-user {
  padding: 4px 8px 4px 4px;
  border-radius: 8px;
}

.hub-title-user:hover {
  background: var(--surface-hover);
}

.hub-topic {
  flex: 1;
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hub-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.hub-header-actions .icon-btn {
  position: relative;
}

.hub-header-actions .icon-btn.is-active {
  color: var(--cyan);
}

.hub-nav-toggle {
  display: none;
}

.hub-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.hub-scrim {
  display: none;
}

/* ---------- Members ---------- */
.hub-members {
  min-height: 0;
  overflow: hidden;
  background: rgba(10, 12, 21, 0.9);
  border-left: 1px solid var(--border);
}

.hub:not(.members-open) .hub-members,
.hub:not(.has-members) .hub-members {
  display: none;
}

.members-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 14px 8px;
  scrollbar-width: thin;
}

.member-group h4 {
  margin: 10px 8px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: left;
}

.member-row:hover {
  background: var(--surface-hover);
}

.member-row.is-offline {
  opacity: 0.45;
}

.member-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.member-text strong {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-text small {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.member-text small .icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.member-blocked .icon {
  width: 14px;
  height: 14px;
  color: var(--red);
}

/* ==========================================================================
   Chat
   ========================================================================== */
.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0 8px;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.chat-welcome {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.chat-welcome h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.chat-welcome p {
  color: var(--muted);
}

.chat-welcome-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.24), rgba(var(--magenta-rgb), 0.24));
  box-shadow: var(--glow);
}

.chat-welcome-icon .icon {
  width: 34px;
  height: 34px;
  color: var(--cyan);
}

.chat-welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 18px 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.msg {
  position: relative;
  padding: 2px 18px;
  margin-top: 14px;
}

.msg.is-grouped {
  margin-top: 0;
}

.msg:hover {
  background: rgba(255, 255, 255, 0.025);
}

.msg.is-mention {
  background: linear-gradient(90deg, rgba(var(--amber-rgb), 0.12), rgba(var(--amber-rgb), 0.03));
  box-shadow: inset 2px 0 0 var(--amber);
}

.msg.is-highlighted {
  animation: msg-flash 1.6s var(--ease);
}

@keyframes msg-flash {
  0%,
  30% {
    background: rgba(var(--cyan-rgb), 0.2);
  }
}

.msg-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
}

.msg-gutter {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.msg-avatar {
  height: max-content;
  border-radius: 50%;
}

.msg-avatar:hover .hub-avatar {
  box-shadow: 0 0 0 2px rgba(var(--cyan-rgb), 0.6);
}

.msg-hover-time {
  padding-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  opacity: 0;
}

.msg:hover .msg-hover-time {
  opacity: 1;
}

.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 1px;
}

.msg-author {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.msg-author:hover {
  text-decoration: underline;
}

.msg-head time {
  color: var(--muted);
  font-size: 11.5px;
}

.msg-head .verified-mark .icon {
  width: 14px;
  height: 14px;
}

.msg-pin-flag .icon {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

.msg-body {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.msg-edited {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
}

.mention {
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(var(--cyan-rgb), 0.16);
  color: var(--cyan);
  font-weight: 600;
}

.mention:hover {
  background: rgba(var(--cyan-rgb), 0.32);
}

.mention.is-me {
  background: rgba(var(--amber-rgb), 0.2);
  color: var(--amber);
}

.msg-reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 30px;
  max-width: 100%;
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
  overflow: hidden;
}

.msg-reply-ref > .icon {
  width: 14px;
  height: 14px;
  transform: scaleY(-1);
  flex-shrink: 0;
}

.msg-reply-ref b {
  color: var(--text-dim);
  white-space: nowrap;
}

.msg-reply-ref span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-reply-ref:hover span:last-child {
  color: var(--text);
}

.msg-reply-ref.is-missing {
  font-style: italic;
}

.msg-system,
.msg-blocked {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 34px;
  color: var(--muted);
  font-size: 13.5px;
}

.msg-system-icon .icon {
  width: 16px;
  height: 16px;
  color: var(--lime);
}

.msg-system time {
  font-size: 11px;
}

.msg-blocked .icon {
  width: 15px;
  height: 15px;
  color: var(--red);
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.reaction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}

.reaction b {
  font-size: 12px;
}

.reaction:hover {
  border-color: var(--border-strong);
}

.reaction:active {
  transform: scale(0.94);
}

.reaction.is-mine {
  border-color: rgba(var(--cyan-rgb), 0.6);
  background: rgba(var(--cyan-rgb), 0.15);
  color: var(--cyan);
  box-shadow: 0 0 12px -4px rgba(var(--cyan-rgb), 0.8);
}

.reaction-add {
  opacity: 0;
}

.reaction-add .icon {
  width: 14px;
  height: 14px;
}

.msg:hover .reaction-add {
  opacity: 1;
}

.msg-toolbar {
  position: absolute;
  top: -16px;
  right: 18px;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms, transform 120ms;
}

.msg:hover .msg-toolbar,
.msg:focus-within .msg-toolbar {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.msg-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 15px;
}

.msg-tool:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.msg-tool .icon {
  width: 17px;
  height: 17px;
}

.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--cyan);
  color: #031014;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 0 20px rgba(var(--cyan-rgb), 0.6);
  transform: translateX(-50%);
}

.chat-jump .icon {
  width: 15px;
  height: 15px;
}

.chat-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.chat-typing b {
  color: var(--text-dim);
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  animation: typing 1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: none;
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-composer {
  margin: 0 16px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(23, 27, 44, 0.9);
  transition: border-color var(--fast), box-shadow var(--fast);
}

.chat-composer:focus-within {
  border-color: rgba(var(--cyan-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.12), 0 0 26px -10px rgba(var(--cyan-rgb), 0.8);
}

.chat-composer.shake {
  animation: shake 360ms;
}

@keyframes shake {
  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 14px;
  border-bottom: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  background: rgba(var(--cyan-rgb), 0.07);
  color: var(--muted);
  font-size: 13px;
}

.chat-reply-bar > .icon {
  width: 15px;
  height: 15px;
}

.chat-reply-bar span {
  flex: 1;
}

.chat-reply-bar b {
  color: var(--text);
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px 6px 6px 14px;
}

.chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 180px;
  padding: 9px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.chat-input::placeholder {
  color: var(--muted);
}

.chat-tool,
.chat-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.chat-tool:hover {
  background: var(--surface-hover);
  color: var(--amber);
}

.chat-send {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 0 18px -6px rgba(var(--cyan-rgb), 0.9);
}

.chat-send:disabled {
  background: var(--surface-raised);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.chat-tool .icon,
.chat-send .icon {
  width: 19px;
  height: 19px;
}

.chat-composer-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12px;
}

.chat-composer-meta:has(span:not(:empty)) {
  padding-bottom: 6px;
}

.chat-error {
  color: var(--danger-text);
}

.chat-count {
  color: var(--muted);
}

.chat-readonly {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 16px 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 14px;
}

.chat-readonly .icon {
  width: 16px;
  height: 16px;
}

/* Emoji picker */
.popover-emoji {
  min-width: 0;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(6, 38px);
  gap: 4px;
  padding: 8px;
}

.emoji-option {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 21px;
  transition: transform var(--fast), background var(--fast);
}

.emoji-option:hover,
.emoji-option:focus-visible {
  background: var(--surface-hover);
  transform: scale(1.15);
}

/* Pinned list */
.pinned-list {
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}

.pinned-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.pinned-item small {
  color: var(--muted);
}

.pinned-item .rich-text {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 14px;
}

.pinned-actions {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

/* ==========================================================================
   Profile popup
   ========================================================================== */
.popover-user {
  max-height: calc(100vh - 16px);
  max-height: calc(100dvh - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
}

.user-card {
  position: relative;
}

.user-card-banner {
  height: 76px;
  background:
    radial-gradient(circle at 20% 0%, hsl(var(--hue) 90% 60% / 0.65), transparent 60%),
    linear-gradient(135deg, hsl(var(--hue) 70% 32%), hsl(calc(var(--hue) + 60) 70% 22%));
}

.user-card-avatar {
  position: absolute;
  top: 34px;
  left: 16px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(18, 21, 35, 0.97);
}

.user-card-avatar .hub-avatar {
  --size: 80px;
}

.user-card-body {
  display: grid;
  gap: 10px;
  padding: 50px 16px 14px;
}

.user-card-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.user-card-name strong {
  font-size: 19px;
  font-weight: 800;
}

.user-card-handle {
  width: 100%;
  color: var(--muted);
  font-size: 13.5px;
}

.user-card-status {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-dim);
  font-size: 13px;
}

.user-card-status .live-chip {
  margin-left: 8px;
}

.user-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.user-card-bio {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

.user-card-section {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.user-card-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.user-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.user-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.user-card-meta .icon {
  width: 13px;
  height: 13px;
}

.user-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
}

.user-card-links a,
.user-card-links .link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.user-card-links .icon {
  width: 13px;
  height: 13px;
}

.user-card-links .danger:hover {
  color: var(--red);
}

.role-editor summary {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}

.role-editor summary .icon {
  width: 13px;
  height: 13px;
}

.role-toggle-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.role-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.role-toggle input {
  accent-color: var(--cyan);
}

/* ==========================================================================
   Voice stage
   ========================================================================== */
.voice-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 22px;
  gap: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(var(--lime-rgb), 0.07), transparent 60%),
    transparent;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  flex: 1;
  align-content: start;
  overflow-y: auto;
}

.voice-grid.is-empty {
  place-items: center;
  align-content: center;
}

.voice-tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 12px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 30%, hsl(var(--hue) 80% 50% / 0.18), transparent 65%),
    var(--surface-2);
  transition: border-color 140ms, box-shadow 140ms, transform 140ms;
}

.voice-tile:hover {
  transform: translateY(-2px);
}

.voice-tile.is-speaking {
  border-color: rgba(var(--lime-rgb), 0.85);
  box-shadow: 0 0 0 1px rgba(var(--lime-rgb), 0.5), 0 0 30px -6px rgba(var(--lime-rgb), 0.8);
}

.voice-tile-name {
  max-width: 100%;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-tile-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(var(--red-rgb), 0.18);
  color: var(--red);
}

.voice-tile-flag .icon {
  width: 15px;
  height: 15px;
}

.voice-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 300px;
  color: var(--muted);
  text-align: center;
}

.voice-empty .icon {
  width: 42px;
  height: 42px;
  color: var(--lime);
}

.voice-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.vc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 23px;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 700;
}

.vc-btn:hover {
  border-color: rgba(var(--cyan-rgb), 0.5);
}

.vc-btn .icon {
  width: 19px;
  height: 19px;
}

.vc-btn.is-off {
  border-color: rgba(var(--red-rgb), 0.5);
  background: rgba(var(--red-rgb), 0.14);
  color: var(--danger-text);
}

.vc-btn.danger {
  border-color: transparent;
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 22px -6px rgba(var(--red-rgb), 0.9);
}

.vc-join {
  box-shadow: 0 0 28px -6px rgba(var(--lime-rgb), 0.7);
}

.voice-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.voice-hint .icon {
  width: 14px;
  height: 14px;
  color: var(--lime);
  flex-shrink: 0;
}

/* ==========================================================================
   Friends
   ========================================================================== */
.friends-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.friends-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.friends-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.friends-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.friends-tab.is-active {
  background: rgba(var(--cyan-rgb), 0.16);
  color: var(--text);
}

.friends-tab b {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.friends-tab.add {
  background: var(--lime);
  color: #0b1203;
}

.friends-tab.add.is-active {
  background: transparent;
  color: var(--lime);
  box-shadow: inset 0 0 0 1px rgba(var(--lime-rgb), 0.6);
}

.friends-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px 24px;
}

.friends-count {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  border-radius: 10px;
}

.friend-row:hover {
  background: var(--surface-hover);
  border-top-color: transparent;
}

.friend-id {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.friend-id > span:last-child {
  display: grid;
  min-width: 0;
}

.friend-id strong {
  font-size: 15px;
}

.friend-id small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-actions {
  display: flex;
  gap: 6px;
}

.friend-actions .icon-btn {
  border-radius: 50%;
}

.add-friend h3 {
  margin-top: 12px;
  font-size: 17px;
}

.add-friend-form {
  margin: 12px 0 18px;
}

.add-friend-row {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(var(--tint-rgb), 0.3);
}

.add-friend-row .input {
  flex: 1;
  border: 0;
  background: transparent;
}

.friend-qr-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--magenta-rgb), 0.3);
  background: linear-gradient(135deg, rgba(var(--magenta-rgb), 0.1), rgba(var(--cyan-rgb), 0.06));
}

.friend-qr-card > div {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
}

.friend-qr-card > div .icon {
  grid-row: span 2;
  width: 30px;
  height: 30px;
  color: var(--magenta);
}

.friend-qr-card p {
  color: var(--muted);
  font-size: 13px;
}

.dm-pick-list {
  display: grid;
  gap: 4px;
  max-height: 340px;
  margin-top: 10px;
  overflow-y: auto;
}

.dm-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.dm-pick:hover,
.dm-pick:has(input:checked) {
  background: var(--surface-hover);
}

.dm-pick input {
  accent-color: var(--cyan);
}

.dm-pick span:last-child {
  display: grid;
}

.dm-pick small {
  color: var(--muted);
}

.stack-form {
  display: grid;
  gap: 14px;
}

.explore {
  display: grid;
  gap: 10px;
}

.explore-title {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.explore-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.explore-row .rail-icon {
  border-radius: 14px;
}

.explore-text {
  display: grid;
  flex: 1;
  gap: 2px;
}

.explore-text small {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.explore-text .icon {
  width: 12px;
  height: 12px;
}

.presence-menu .menu-item {
  flex-wrap: wrap;
}

.presence-menu .menu-item small {
  width: 100%;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11.5px;
}

.presence-menu .menu-item.is-active {
  background: rgba(var(--cyan-rgb), 0.12);
  color: var(--text);
}

.hub-join {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin: 40px auto;
  max-width: 420px;
  padding: 32px;
  text-align: center;
}

/* ==========================================================================
   QR share
   ========================================================================== */
.qr-share {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.qr-frame {
  position: relative;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(var(--cyan-rgb), 0.5), 0 0 40px -8px rgba(var(--cyan-rgb), 0.75);
}

.qr-share.accent-magenta .qr-frame { box-shadow: 0 0 0 1px rgba(var(--magenta-rgb), 0.5), 0 0 40px -8px rgba(var(--magenta-rgb), 0.75); }
.qr-share.accent-lime .qr-frame { box-shadow: 0 0 0 1px rgba(var(--lime-rgb), 0.5), 0 0 40px -8px rgba(var(--lime-rgb), 0.7); }
.qr-share.accent-violet .qr-frame { box-shadow: 0 0 0 1px rgba(var(--violet-rgb), 0.5), 0 0 40px -8px rgba(var(--violet-rgb), 0.75); }

.qr-frame svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-meta {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.qr-meta > strong {
  font-size: 18px;
}

.qr-meta > p {
  color: var(--muted);
  font-size: 14px;
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qr-note,
.qr-alt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.qr-note .icon {
  width: 14px;
  height: 14px;
  color: var(--lime);
  flex-shrink: 0;
}

/* ==========================================================================
   Squads & project hubs
   ========================================================================== */
.dir-hero {
  flex-wrap: wrap;
}

.dir-hero > div {
  flex: 1;
  min-width: 220px;
}

.dir-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.dir-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dir-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 340px;
  min-width: 200px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(var(--tint-rgb), 0.3);
}

.dir-search .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.dir-search input {
  flex: 1;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.engine-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.engine-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13.5px;
  transition: border-color var(--fast), box-shadow var(--fast), color var(--fast);
}

.engine-tab .icon {
  width: 16px;
  height: 16px;
}

.engine-tab:hover {
  color: var(--text);
}

.engine-tab.is-active {
  border-color: rgba(var(--engine-rgb, var(--cyan-rgb)), 0.75);
  background: rgba(var(--engine-rgb, var(--cyan-rgb)), 0.14);
  color: rgb(var(--engine-rgb, var(--cyan-rgb)));
  box-shadow: 0 0 18px -6px rgba(var(--engine-rgb, var(--cyan-rgb)), 0.9);
}

.engine-unreal { --engine-rgb: var(--violet-rgb); }
.engine-unity { --engine-rgb: var(--cyan-rgb); }
.engine-godot { --engine-rgb: var(--lime-rgb); }
.engine-general { --engine-rgb: var(--amber-rgb); }
.engine-fivem { --engine-rgb: var(--amber-rgb); }
.engine-tint-fivem { --engine-rgb: var(--amber-rgb); }

.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 6px;
  border-radius: 999px;
  border: 1px solid rgba(var(--engine-rgb), 0.45);
  background: rgba(var(--engine-rgb), 0.14);
  color: rgb(var(--engine-rgb));
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.engine-badge .icon,
.engine-logo {
  width: 16px;
  height: 16px;
}

.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.dir-card {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform 180ms var(--ease), border-color 180ms, box-shadow 180ms;
}

.dir-card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--engine-rgb, var(--cyan-rgb)), 0.5);
  box-shadow: 0 18px 40px -22px rgba(var(--engine-rgb, var(--cyan-rgb)), 0.9);
}

.engine-tint-unreal { --engine-rgb: var(--violet-rgb); }
.engine-tint-unity { --engine-rgb: var(--cyan-rgb); }
.engine-tint-godot { --engine-rgb: var(--lime-rgb); }
.engine-tint-general { --engine-rgb: var(--amber-rgb); }

.dir-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.dir-card button,
.dir-card [data-user-card],
.dir-card a:not(.dir-card-link) {
  position: relative;
  z-index: 2;
}

.dir-card h3 {
  font-size: 17px;
  font-weight: 800;
}

.dir-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dir-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.dir-card-meta .icon {
  width: 12px;
  height: 12px;
}

.dir-card-text {
  color: var(--text-dim);
  font-size: 14px;
}

.dir-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.dir-card-foot > :last-child {
  margin-left: auto;
}

.squad-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(var(--engine-rgb, var(--cyan-rgb)), 0.5), rgba(var(--magenta-rgb), 0.35));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 0 18px -6px rgba(var(--engine-rgb, var(--cyan-rgb)), 0.9);
}

.squad-mark-lg {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  font-size: 30px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack > span {
  margin-left: -8px;
}

.avatar-stack > span:first-child {
  margin-left: 0;
}

.avatar-stack .hub-avatar {
  box-shadow: 0 0 0 2px var(--surface-solid);
}

.avatar-more {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--surface-solid);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
}

.pill .icon {
  width: 13px;
  height: 13px;
}

.pill-ok {
  border-color: rgba(var(--lime-rgb), 0.45);
  color: var(--lime);
}

.project-banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 96px;
  margin: -16px -16px 0;
  padding: 12px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(var(--engine-rgb), 0.6), transparent 55%),
    radial-gradient(circle at 10% 100%, rgba(var(--magenta-rgb), 0.35), transparent 50%),
    linear-gradient(135deg, #0d1022, #151a33);
}

.project-banner.is-hero {
  position: absolute;
  inset: 0 0 auto;
  height: 120px;
  margin: 0;
}

.project-banner-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--engine-rgb), 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--engine-rgb), 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, #000 80%);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 80%);
}

.project-banner > :not(.project-banner-grid) {
  position: relative;
}

.stage-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
}

.open-roles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.open-roles-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--lime);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.open-roles-label.is-full {
  color: var(--muted);
}

.open-roles-label .icon {
  width: 13px;
  height: 13px;
}

.role-chip {
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid rgba(var(--engine-rgb, var(--cyan-rgb)), 0.35);
  background: rgba(var(--engine-rgb, var(--cyan-rgb)), 0.08);
  color: var(--text-dim);
  font-size: 12px;
}

.progress-mini {
  flex: 1;
  min-width: 60px;
  max-width: 120px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.progress-mini span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgb(var(--engine-rgb, var(--cyan-rgb))), var(--magenta));
  box-shadow: 0 0 10px rgba(var(--engine-rgb, var(--cyan-rgb)), 0.8);
}

/* Entity pages */
.entity-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  overflow: hidden;
}

.project-hero {
  padding-top: 140px;
}

.entity-hero-glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--engine-rgb, var(--cyan-rgb)), 0.28), transparent 70%);
  pointer-events: none;
}

.entity-hero-text {
  position: relative;
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}

.entity-hero-text h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.entity-hero-text p {
  color: var(--text-dim);
}

.entity-kicker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entity-kicker .icon {
  width: 13px;
  height: 13px;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.entity-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.entity-meta .icon {
  width: 14px;
  height: 14px;
}

.entity-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.entity-section {
  display: grid;
  gap: 4px;
  padding: 18px;
}

.entity-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.count-chip {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(var(--cyan-rgb), 0.18);
  color: var(--cyan);
  font-size: 12px;
  text-align: center;
}

.sub-title {
  margin: 12px 0 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.person-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
}

.person-row:hover {
  background: var(--surface-hover);
}

.person-row.is-muted {
  color: var(--muted);
  font-size: 13px;
}

.person-id {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 180px;
  text-align: left;
}

.person-id > span:last-child {
  display: grid;
}

.person-id small {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.person-id small .icon {
  width: 12px;
  height: 12px;
  color: var(--amber);
}

.person-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.person-actions .input-sm {
  max-width: 220px;
}

.application-note {
  width: 100%;
  margin: 0 0 0 52px;
  padding: 8px 12px;
  border-left: 2px solid var(--cyan);
  border-radius: 0 8px 8px 0;
  background: rgba(var(--cyan-rgb), 0.06);
  color: var(--text-dim);
  font-size: 13.5px;
}

.squad-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.squad-role .icon {
  width: 12px;
  height: 12px;
}

.squad-role.role-owner {
  background: rgba(var(--amber-rgb), 0.16);
  color: var(--amber);
}

.squad-role.role-officer {
  background: rgba(var(--magenta-rgb), 0.16);
  color: var(--magenta);
}

.open-role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}

.task-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.task-add .input:first-child {
  flex: 1;
  min-width: 200px;
}

.task-add select.input {
  max-width: 180px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.kanban-col {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 120px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(var(--tint-rgb), 0.22);
}

.kanban-col h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kanban-col h3 .icon {
  width: 14px;
  height: 14px;
}

.kanban-col h3 b {
  margin-left: auto;
  color: var(--muted);
}

.col-todo h3 { color: var(--text-dim); }
.col-doing h3 { color: var(--amber); }
.col-done h3 { color: var(--lime); }

.task {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color var(--fast), box-shadow var(--fast);
}

.task:hover {
  border-color: rgba(var(--cyan-rgb), 0.4);
  box-shadow: 0 0 16px -8px rgba(var(--cyan-rgb), 0.8);
}

.col-done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.task-title {
  font-size: 14px;
}

.task-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.input-xs {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  max-width: 150px;
}

.task-assignee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  font-size: 12px;
}

.task-moves {
  display: flex;
  gap: 2px;
}

.icon-btn.flip .icon {
  transform: scaleX(-1);
}

.kanban-empty {
  color: #4b5270;
  font-size: 12.5px;
  text-align: center;
}

.engine-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.engine-option {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast), color var(--fast);
}

.engine-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.engine-option .icon {
  width: 30px;
  height: 30px;
}

.engine-option:has(input:checked) {
  border-color: rgba(var(--engine-rgb), 0.85);
  background: rgba(var(--engine-rgb), 0.12);
  color: rgb(var(--engine-rgb));
  box-shadow: 0 0 22px -6px rgba(var(--engine-rgb), 0.9);
}

.engine-option:has(input:focus-visible) {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.role-pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  font-size: 13px;
  cursor: pointer;
}

.role-pick:has(input:checked) {
  border-color: rgba(var(--cyan-rgb), 0.7);
  background: rgba(var(--cyan-rgb), 0.12);
  color: var(--text);
}

.role-pick input {
  accent-color: var(--cyan);
}

.invite-banner {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-color: rgba(var(--magenta-rgb), 0.35);
  background: linear-gradient(135deg, rgba(var(--magenta-rgb), 0.1), var(--surface));
}

.invite-banner-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.invite-banner-row > span:nth-child(2) {
  flex: 1;
  min-width: 200px;
}

.invite-banner-icon .icon {
  width: 20px;
  height: 20px;
  color: var(--magenta);
}

.portfolio {
  display: grid;
  gap: var(--gap);
}

.engine-tags,
.squad-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.squad-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-weight: 600;
}

.squad-chip .squad-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 11px;
}

/* Invite landing */
.invite-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 460px;
  margin: 24px auto;
  padding: 36px 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--cyan-rgb), 0.16), transparent 60%),
    var(--surface);
}

.invite-card h1 {
  font-size: 28px;
  font-weight: 800;
}

.invite-card p {
  color: var(--text-dim);
}

.invite-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.invite-kicker .icon {
  width: 14px;
  height: 14px;
}

.invite-server {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  font-size: 28px;
}

.invite-meta,
.invite-safe {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted) !important;
  font-size: 13px;
}

.invite-meta .icon,
.invite-safe .icon {
  width: 14px;
  height: 14px;
}

.invite-icon.is-bad .icon {
  width: 46px;
  height: 46px;
  color: var(--red);
}

/* Blocked content in comments */
.comment-blocked {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 13px;
}

.comment-blocked .icon {
  width: 14px;
  height: 14px;
  color: var(--red);
}

button.comment-avatar {
  border-radius: 50%;
  height: max-content;
}

/* ==========================================================================
   Playground tester
   ========================================================================== */
.pg-test {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(var(--lime-rgb), 0.45);
  color: var(--lime);
  font-size: 12.5px;
  font-weight: 700;
  transition: background var(--fast), box-shadow var(--fast);
}

.pg-test .icon {
  width: 15px;
  height: 15px;
}

.pg-test:hover {
  background: rgba(var(--lime-rgb), 0.12);
  box-shadow: 0 0 16px -6px rgba(var(--lime-rgb), 0.9);
}

.pg-run-status {
  margin-left: auto;
  margin-right: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.pg-run-status.is-running {
  background: rgba(var(--amber-rgb), 0.16);
  color: var(--amber);
}

.pg-run-status.is-ok {
  background: rgba(var(--lime-rgb), 0.16);
  color: var(--lime);
  box-shadow: 0 0 12px -4px rgba(var(--lime-rgb), 0.8);
}

.pg-run-status.is-error {
  background: rgba(var(--red-rgb), 0.18);
  color: var(--danger-text);
  box-shadow: 0 0 12px -4px rgba(var(--red-rgb), 0.8);
}

.pg-log-line.log-success {
  color: var(--lime);
}

.pg-log-line.log-success::before {
  content: '✓';
  color: var(--lime);
}

.pg-log-line.log-test {
  color: var(--cyan);
  font-weight: 700;
}

.pg-log-line.log-test::before {
  content: '';
  margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .hub.has-members.members-open {
    --members-w: 0px;
  }

  .hub.members-open .hub-members {
    background: #0a0c15;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: block;
    width: min(280px, 85vw);
    box-shadow: var(--shadow-pop);
  }

  .hub.members-open .hub-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.45);
  }
}

@media (max-width: 960px) {
  .hub {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - var(--nav-h) - var(--bottom-h));
    height: calc(100dvh - var(--nav-h) - var(--bottom-h) - env(safe-area-inset-bottom));
  }

  .hub-rail,
  .hub-side {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 30;
    transition: transform 240ms var(--ease);
  }

  .hub-rail {
    left: 0;
    width: var(--rail-w);
    background: var(--shade-05);
    transform: translateX(-110%);
  }

  .hub-side {
    left: var(--rail-w);
    width: min(280px, calc(100vw - var(--rail-w) - 24px));
    background: #0a0c15;
    transform: translateX(calc(-100% - var(--rail-w) - 10px));
  }

  .hub.nav-open .hub-rail,
  .hub.nav-open .hub-side {
    transform: none;
    box-shadow: var(--shadow-pop);
  }

  .hub.nav-open .hub-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 25;
    background: rgba(0, 0, 0, 0.5);
  }

  .hub-nav-toggle {
    display: inline-grid;
  }

  .hub-topic {
    display: none;
  }

  .msg {
    padding: 2px 10px;
  }

  .msg-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
  }

  .msg-toolbar {
    right: 8px;
  }

  .chat-composer {
    margin: 0 8px 8px;
  }

  .voice-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .qr-share {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .qr-frame {
    width: min(240px, 100%);
  }

  .kanban {
    grid-template-columns: minmax(0, 1fr);
  }

  .engine-picker {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .dir-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .entity-hero {
    padding: 18px;
  }

  .entity-hero-text h1 {
    font-size: 24px;
  }

  .friends-tabs,
  .friends-body {
    padding-left: 10px;
    padding-right: 10px;
  }

  .add-friend-row {
    flex-direction: column;
  }

  .hub-header-actions .btn span {
    display: none;
  }
}

@media (hover: none) {
  /* Touch: keep message actions reachable without hover. */
  .msg:focus-within .msg-toolbar,
  .msg.is-touched .msg-toolbar {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .reaction-add,
  .dm-close {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-dots i,
  .msg.is-highlighted,
  .chat-composer.shake {
    animation: none;
  }

  .hub-rail,
  .hub-side,
  .dir-card {
    transition: none;
  }
}

/* ==========================================================================
   Firebase: real profile photos, passwordless sign-in, people search, setup
   ========================================================================== */
.avatar-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-solid);
}

.avatar .status-dot,
.hub-avatar .presence-dot {
  z-index: 3;
}

.auth-fineprint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-fineprint .icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--lime);
}

.pl-sent {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 6px 0 16px;
  text-align: center;
}

.pl-sent h3 {
  font-size: 20px;
  font-weight: 800;
}

.pl-sent p {
  color: var(--text-dim);
}

.pl-sent-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.22), rgba(var(--magenta-rgb), 0.22));
  box-shadow: var(--glow);
  animation: pl-float 2.4s ease-in-out infinite;
}

.pl-sent-icon .icon {
  width: 30px;
  height: 30px;
  color: var(--cyan);
}

@keyframes pl-float {
  50% {
    transform: translateY(-4px);
  }
}

.pl-tips {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.pl-tips li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pl-tips .icon {
  width: 14px;
  height: 14px;
}

.pl-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pl-paste {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.passwordless-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
}

.passwordless-note .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--lime);
}

.people-search {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.people-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(var(--tint-rgb), 0.32);
  transition: border-color var(--fast), box-shadow var(--fast);
}

.people-search-box:focus-within {
  border-color: rgba(var(--cyan-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.12), 0 0 24px -10px rgba(var(--cyan-rgb), 0.9);
}

.people-search-box > .icon {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.people-search-box input {
  flex: 1;
  min-width: 0;
  height: 50px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.people-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.people-results {
  display: grid;
  gap: 12px;
}

.person-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px;
  transition: border-color 160ms, transform 160ms var(--ease);
}

.person-card:hover {
  border-color: rgba(var(--cyan-rgb), 0.4);
  transform: translateY(-1px);
}

.person-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 240px;
  color: inherit;
  text-decoration: none !important;
}

.person-card-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.person-card-text strong {
  display: block;
  font-size: 16px;
}

.person-card-text strong .verified-mark {
  margin-left: 4px;
  vertical-align: -2px;
}

.person-card-text small {
  color: var(--muted);
}

.person-card-text mark {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(var(--cyan-rgb), 0.22);
  color: var(--cyan);
}

.person-card-bio {
  color: var(--text-dim);
  font-size: 13.5px;
}

.person-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.person-card-meta > span:not([class]) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.person-card-meta .icon {
  width: 13px;
  height: 13px;
}

.person-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-people-link .search-item-icon {
  color: var(--lime);
}

.setup-card {
  display: grid;
  gap: 14px;
  padding: 28px;
}

.setup-card h1 {
  font-size: 24px;
  font-weight: 800;
}

.setup-card ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--text-dim);
}

.setup-card code {
  color: var(--cyan);
}

@media (max-width: 640px) {
  .person-card-actions {
    width: 100%;
  }

  .person-card-actions .btn {
    flex: 1;
  }
}

/* Setup banner shown while Firebase is not connected (the rest of the UI keeps working). */
.setup-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(760px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--amber-rgb), 0.5);
  background: rgba(30, 24, 8, 0.95);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 0 30px -8px rgba(var(--amber-rgb), 0.7);
  transform: translateX(-50%);
}

.setup-banner code {
  color: var(--amber);
}

.setup-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
  color: var(--text-dim);
}

@media (max-width: 960px) {
  .setup-banner {
    bottom: calc(var(--bottom-h) + 12px);
  }
}

/* Watch modal: real stream embeds (Twitch / YouTube / Kick) */
.watch-player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: #000; /* video letterbox stays black in both themes */
}

.watch-offline {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 280px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.watch-offline > .icon {
  width: 32px;
  height: 32px;
  color: var(--green, var(--lime));
}

.watch-offline strong {
  color: var(--text);
  font-size: 17px;
}

.watch-latest {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none !important;
}

.watch-latest:hover {
  border-color: var(--border-hover, var(--border-strong));
}
