/* ───────────────────────────────────────────────
   RedsssProduction Studios — Global Styles
   Theme: Gray, Black, Red · Rounded corners
   ─────────────────────────────────────────────── */

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #151515;
  --bg-tertiary: #1c1c1c;
  --bg-card: #1a1a1a;
  --bg-hover: #222;
  --bg-input: #1a1a1a;
  --red: #c0392b;
  --red-light: #e74c3c;
  --red-dark: #8b1a1a;
  --red-glow: rgba(192, 57, 43, 0.25);
  --gray: #2a2a2a;
  --gray-light: #3a3a3a;
  --text: #eee;
  --text-secondary: #aaa;
  --text-muted: #666;
  --border: #2a2a2a;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --online: #2ecc71;
  --status-online: #43b581;
  --status-away: #faa61a;
  --status-dnd: #f04747;
  --status-offline: #747f8d;
  --r: 10px;       /* default border-radius */
  --r-sm: 6px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow: 0 4px 20px rgba(0,0,0,.5);
  --transition: .2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  overflow-x: hidden;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--gray); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-light); }

button { font-family: inherit; }

/* ─── NAVBAR ─── */

.navbar {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 32px;
  flex-shrink: 0;
}

.nav-brand img {
  width: 32px;
  height: 32px;
  /* favicon/logo stays square, no rounding */
}

.nav-brand .brand-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: var(--transition);
}

/* Allow <a> tags to look identical to button nav-links */
a.nav-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}
a.nav-link:hover { text-decoration: none; }

.nav-link:hover { color: var(--text); background: var(--bg-hover); border-color: var(--gray-light); }
.nav-link.active { color: var(--red); background: var(--bg-tertiary); border-color: var(--red); pointer-events: none; cursor: default; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Notification Bell */
.notif-wrapper {
  position: relative;
  cursor: pointer;
}

.notif-bell {
  font-size: 20px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
}

.notif-bell:hover { color: var(--text); }

.stream-manage-nav-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.stream-manage-nav-btn:hover {
  color: var(--text);
  border-color: var(--gray-light);
  background: var(--bg-hover);
}
.stream-manage-nav-btn.live {
  color: #fff;
  border-color: var(--red);
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  box-shadow: 0 0 0 2px rgba(192,57,43,.2);
}

/* Friends nav icon */
.nav-friends-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: none;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
  position: relative;
}
.nav-friends-btn:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.nav-friends-btn.active { color: var(--red); background: var(--bg-tertiary); }

/* Friend request badge on nav icon */
.friend-req-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ed4245;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg-primary);
  pointer-events: none;
}

.notif-bell.ringing {
  animation: ring .4s ease infinite alternate;
}

@keyframes ring {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(12deg); }
  50% { transform: rotate(-10deg); }
  75% { transform: rotate(6deg); }
  100% { transform: rotate(0deg); }
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notif-badge.visible { display: flex; }

.notif-dropdown {
  display: none;
  position: absolute;
  top: 36px;
  right: -60px;
  width: 300px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  z-index: 200;
}

.notif-dropdown.open { display: block; }

.notif-dropdown-header {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.notif-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-empty { padding: 20px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* User Area */
.nav-avatar-wrapper {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Status Dots */
.status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--status-offline);
}

.status-dot.online  { background: var(--status-online); }
.status-dot.away    { background: var(--status-away); }
.status-dot.dnd     { background: var(--status-dnd); }
.status-dot.offline { background: var(--status-offline); }

.nav-username {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

/* ─── LOADING SCREEN ─── */

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
  gap: 20px;
}

.loader-logo { font-size: 26px; font-weight: 700; color: var(--red); }
.loader-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AUTH SCREENS ─── */

.auth-page {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  justify-content: center;
  align-items: center;
  background: var(--bg-primary);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 36px;
  background: var(--bg-secondary);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-box h1 {
  text-align: center;
  font-size: 22px;
  color: var(--red);
  margin-bottom: 4px;
}

.auth-box .subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }

.form-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input {
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-glow);
}

.auth-error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 6px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-light); box-shadow: 0 4px 16px var(--red-glow); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-full { width: 100%; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}

.btn-google:hover { background: var(--bg-hover); }
.btn-google svg { width: 18px; height: 18px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  margin: 16px 0;
}

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

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}

.auth-switch a { color: var(--red-light); cursor: pointer; }

.avatar-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-muted);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.avatar-preview:hover { border-color: var(--red); }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.avatar-upload-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── PAGE CONTENT ─── */

.page-content {
  min-height: calc(100vh - 56px);
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; }

/* ─── HOME PAGE ─── */

/* ── Slideshow ── */
.slideshow {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--bg-secondary);
  user-select: none;
}
.slideshow-track {
  display: flex;
  transition: transform .5s ease;
}
.slide {
  min-width: 100%;
  position: relative;
  height: 420px;
  display: flex;
  align-items: stretch;
}
.slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.slide-bg-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
}
/* Caption bar at the bottom */
.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  padding: 14px 20px 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 2;
}
.slide-caption-text {}
.slide-caption-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.slide-caption-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.slide-caption-btn {
  flex-shrink: 0;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.slide-caption-btn:hover { background: var(--red-light); }

/* Dot navigation */
.slideshow-dots {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  z-index: 3;
}
.slideshow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background .2s, transform .2s;
}
.slideshow-dot.active {
  background: #fff;
  transform: scale(1.25);
}

/* Arrow buttons */
.slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  line-height: 1;
  /* keep arrows above the caption bar */
  bottom: calc(58px + 36px);
  top: auto;
  transform: none;
}
.slideshow-arrow:hover { background: rgba(192,57,43,.7); }
.slideshow-arrow.prev { left: 12px; }
.slideshow-arrow.next { right: 12px; }

/* ── Welcome section ── */
.home-welcome {
  text-align: center;
  padding: 52px 24px 36px;
  background: linear-gradient(160deg, var(--bg-secondary) 0%, var(--red-dark) 100%);
  border-bottom: 1px solid var(--border);
}
.home-welcome h2 {
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -.5px;
}
.home-welcome h2 span { color: var(--red-light); }
.home-welcome p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 540px;
  margin: 0 auto;
}

/* ── Community stats bar ── */
.home-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}
.home-stat {
  flex: 1;
  max-width: 200px;
  text-align: center;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
}
.home-stat:last-child { border-right: none; }
.home-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--red-light);
  line-height: 1;
  margin-bottom: 4px;
}
.home-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Quick access cards ── */
.home-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 36px 40px 40px;
}
@media (max-width: 700px) {
  .home-quick { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .home-quick { grid-template-columns: 1fr; }
}
.quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 16px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}
.quick-card:hover {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--red-glow);
}
.quick-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg-tertiary);
}
.quick-card-icon.red { background: var(--red-glow); color: var(--red-light); }
.quick-card h3 { font-size: 15px; font-weight: 700; }
.quick-card p { font-size: 12px; color: var(--text-muted); }

.section { padding: 36px 40px; }
.section-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; text-align: center; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  justify-items: center;
  justify-content: center;
}

/* ─── GAME CARDS ─── */

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.game-card:hover {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(192,57,43,.15);
}

.game-card-img {
  width: 100%;
  height: 160px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--text-muted);
}

.game-card-img img { width: 100%; height: 100%; object-fit: cover; }

.game-card-body { padding: 16px; }
.game-card-body h3 { font-size: 16px; margin-bottom: 6px; }
.game-card-body p { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--r-sm);
  text-transform: uppercase;
}

.badge-released { background: var(--success); color: #fff; }
.badge-early { background: var(--warning); color: #000; }
.badge-coming { background: var(--text-muted); color: #fff; }

/* ─── GAME PLAYER OVERLAY ─── */

#game-player {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: var(--bg-primary);
  flex-direction: column;
}

#game-player.active { display: flex; }

.game-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.game-player-bar h3 { font-size: 15px; }

.game-player-close {
  padding: 6px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
}

.game-player-close:hover { background: var(--bg-hover); }

#game-iframe { flex: 1; border: none; width: 100%; }

/* ─── SUPPORT PAGE ─── */

.support-page { max-width: 700px; margin: 0 auto; padding: 40px 20px 60px; }
.support-page h2 { font-size: 24px; margin-bottom: 6px; }
.support-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

/* ── Type selector buttons ── */
.support-type-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 8px;
}
.support-type-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
  text-align: center;
}
.support-type-btn svg { color: var(--red); }
.support-type-btn span { font-size: 16px; font-weight: 700; }
.support-type-btn small { font-size: 12px; color: var(--text-muted); }
.support-type-btn:hover {
  border-color: var(--red);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--red-glow);
}

/* ── Form card ── */
.support-form-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.support-form-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.support-form-header h3 { font-size: 18px; font-weight: 700; }
.support-back-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}
.support-back-btn:hover { color: var(--text); border-color: var(--text-muted); }

.support-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

/* ── Searchable dropdown ── */
.support-search-wrap { position: relative; }
.support-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.support-dropdown.open { display: block; }
.support-dd-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .1s;
}
.support-dd-item:hover { background: var(--bg-hover); }
.support-dd-item .dd-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.support-dd-item .dd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.support-dd-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Selected tag ── */
.support-selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red-glow);
  border: 1px solid var(--red-dark);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  font-size: 13px;
  color: var(--text);
  margin-top: 8px;
}
.support-selected-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.support-selected-tag button:hover { color: var(--text); }

/* ── Textarea ── */
.support-textarea {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  transition: border-color .15s;
}
.support-textarea:focus { border-color: var(--red); }

/* ── Image attachments ── */
.support-img-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.support-img-add {
  width: 72px;
  height: 72px;
  border: 2px dashed var(--border);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.support-img-add:hover { border-color: var(--red); color: var(--red); }
.support-img-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--r);
  object-fit: cover;
  border: 1px solid var(--border);
  position: relative;
}
.support-img-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}
.support-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.support-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  border: none;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.support-submit-btn { margin-top: 20px; align-self: flex-end; padding: 10px 28px; }

/* ─── PROFILE DROPDOWN ─── */

.profile-dropdown {
  display: none;
  position: absolute;
  top: 52px;
  right: 16px;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  z-index: 200;
  padding: 16px;
}

.profile-dropdown.open { display: block; }

.profile-dd-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.profile-dd-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.profile-dd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-dd-avatar:hover::after {
  content: '✎';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.6);
  font-size: 16px;
}

.profile-dd-name { font-size: 15px; font-weight: 600; }
.profile-dd-email { font-size: 12px; color: var(--text-muted); }

.profile-dd-section { margin-bottom: 12px; }
.profile-dd-section label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: block; }

.profile-dd-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.profile-dd-input:focus { border-color: var(--red); }

.btn-sm { padding: 7px 14px; font-size: 13px; }

.btn-logout {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
  margin-top: 8px;
  transition: var(--transition);
}

.btn-logout:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ─── TOAST ─── */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  max-width: 340px;
  transition: opacity .3s;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--red); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Status Select (profile dropdown) ─── */
.profile-dd-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.profile-dd-select:focus { border-color: var(--red); }

.profile-dd-bio {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}
.profile-dd-bio:focus { border-color: var(--red); }

/* ───────────────────────────────────────────────
   FRIENDS PAGE
   Two-column layout: sidebar + main content
   ─────────────────────────────────────────────── */

.friends-layout {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.friends-sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.friends-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.friends-sidebar-header h3 { font-size: 16px; }

.friends-add-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.friends-add-section input { margin-bottom: 8px; }

.friends-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
}

.friends-search-item .friend-avatar { width: 28px; height: 28px; font-size: 12px; }
.friends-search-item .friend-name { flex: 1; font-size: 13px; }
.friends-search-item .friends-add-btn { padding: 4px 12px; font-size: 12px; }
.friends-search-item .search-clickable { cursor: pointer; }
.friends-search-item .search-clickable:hover { opacity: .8; }

.friends-search-hint {
  padding: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.friends-pending {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.friends-section-title {
  padding: 10px 16px 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-pending-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.friends-filter { padding: 4px 12px 8px; flex-shrink: 0; display: flex; gap: 8px; align-items: center; }
.friends-filter .form-input { flex: 1; font-size: 13px; }

.friends-list-scroll {
  flex: 1;
  overflow-y: auto;
}

.friends-list-scroll .friend-item { margin: 2px 8px; }
.friends-list-scroll .friend-item-info { min-width: 0; }

.friends-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  background: var(--bg-tertiary);
  overflow-y: auto;
  padding: 32px;
}

.friends-empty {
  color: var(--text-muted);
  font-size: 15px;
}

/* Friend Profile Card — redesigned */
.friend-profile-card {
  width: 100%;
  max-width: 680px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}

.friend-profile-banner {
  height: 80px;
  background: linear-gradient(135deg, var(--red-dark) 0%, #8b0000 100%);
}

.friend-profile-body {
  padding: 0 24px 24px;
  position: relative;
}

.friend-profile-avatar-wrap {
  margin-top: -44px;
  margin-bottom: 12px;
}

.friend-profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  border: 4px solid var(--bg-secondary);
}

.friend-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.friend-profile-avatar .status-dot {
  width: 16px;
  height: 16px;
  bottom: 2px;
  right: 2px;
  border-width: 3px;
  border-color: var(--bg-secondary);
}

.friend-profile-initial {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.friend-profile-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.friend-profile-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.friend-profile-name {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.friend-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.friend-status-pill.online  { background: rgba(87,242,135,.15); color: var(--status-online); }
.friend-status-pill.away    { background: rgba(250,168,26,.15);  color: var(--status-away); }
.friend-status-pill.dnd     { background: rgba(237,66,69,.15);   color: var(--status-dnd); }
.friend-status-pill.offline { background: rgba(116,127,141,.15); color: var(--text-muted); }

.friend-profile-activity {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
}
.friend-profile-activity svg { flex-shrink: 0; opacity: .7; }

.friend-profile-bio-card {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.friend-profile-bio-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.friend-profile-bio-text {
  font-size: 14px;
  color: var(--text-secondary);
  word-break: break-word;
  line-height: 1.5;
}

.friend-profile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.friend-profile-meta svg { flex-shrink: 0; }

.friend-profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* Profile tabs */
.friend-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.friend-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: -1px;
  white-space: nowrap;
}
.friend-tab:hover { color: var(--text); }
.friend-tab.active { color: var(--text); border-bottom-color: var(--red); }

.friend-tab-panels { }
.friend-tab-panel {
  display: none;
  padding: 20px 24px 24px;
  flex-direction: column;
  gap: 14px;
}
.friend-tab-panel.active { display: flex; }

/* Mutual items */
.mutual-list { display: flex; flex-direction: column; }
.mutual-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.mutual-item:last-child { border-bottom: none; }
.mutual-server-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.mutual-server-icon img { width: 100%; height: 100%; object-fit: cover; }

/* Last seen */
.friend-profile-lastseen { font-size: 12px; color: var(--text-muted); }

/* Friend note */
.friend-note-card {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.friend-note-area {
  width: 100%;
  min-height: 64px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}
.friend-note-area:focus { outline: none; border-color: var(--red); }
.friend-note-save { align-self: flex-start; }

/* Online-only toggle */
.online-only-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  flex-shrink: 0;
}
.online-only-toggle svg { color: var(--text-muted); transition: var(--transition); }
.online-only-toggle.active { border-color: var(--status-online); color: var(--status-online); }
.online-only-toggle.active svg { color: var(--status-online); }

.friend-join-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.friend-join-action-btn:hover { background: var(--bg-primary); }

.friend-unfriend-btn {
  background: transparent;
  border: 1px solid rgba(237,66,69,.5);
  color: var(--red);
  margin-left: auto;
}
.friend-unfriend-btn:hover { background: rgba(237,66,69,.1); }

.status-dot-inline {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot-inline.online  { background: var(--status-online); }
.status-dot-inline.away    { background: var(--status-away); }
.status-dot-inline.dnd     { background: var(--status-dnd); }
.status-dot-inline.offline { background: var(--status-offline); }

/* Sent requests section */
.friends-sent {
  margin-bottom: 8px;
}

/* ───────────────────────────────────────────────
   MESSENGER STYLES
   Discord-like layout:
   server strip | sidebar | chat area | members
   ─────────────────────────────────────────────── */

/* Layout — standalone messenger.html page */
body.messenger-page #app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#messenger-app {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Server Strip ─── */
.server-strip {
  width: 60px;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
  overflow-y: auto;
  flex-shrink: 0;
}

#server-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.server-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  overflow: hidden;
  flex-shrink: 0;
}

.server-icon:hover,
.server-icon.active {
  border-radius: var(--r-lg);
  background: var(--red);
  color: #fff;
}

.server-icon img { width: 100%; height: 100%; object-fit: cover; }

.server-icon.add {
  font-size: 24px;
  font-weight: 300;
  color: var(--success);
  background: var(--bg-secondary);
}
.server-icon.add:hover { background: var(--success); color: #fff; }

.server-divider {
  width: 28px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin: 2px 0;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header {
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-search { padding: 10px; }
.sidebar-search input { width: 100%; font-size: 13px; padding: 7px 10px; }

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.sidebar-tab {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.sidebar-tab:hover { color: var(--text-secondary); }
.sidebar-tab.active { color: var(--red); border-bottom-color: var(--red); }

.sidebar-tab-content { display: none; flex: 1; overflow-y: auto; }
.sidebar-tab-content.active { display: block; }

.sidebar-section { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-empty { padding: 20px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Friend / DM items */
.friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--r-sm);
  margin: 2px 6px;
}

.friend-item:hover { background: var(--bg-hover); }
.friend-item.active { background: var(--bg-tertiary); }

.dm-category-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-top: 6px;
}

.friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  position: relative;
  flex-shrink: 0;
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.friend-avatar .status-dot {
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
}

.friend-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-status {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* Channel items */
.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  border-radius: var(--r-sm);
  margin: 1px 6px;
}

.channel-item:hover { background: var(--bg-hover); color: var(--text); }
.channel-item.active { background: var(--bg-tertiary); color: var(--text); }
.channel-hash { color: var(--text-muted); font-weight: 700; }

/* Channel reorder buttons (owner only) */
.ch-order-btns {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity .15s;
}
.channel-item:hover .ch-order-btns { opacity: 1; }
.ch-order-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
}
.ch-order-btn:hover { background: var(--bg-tertiary); color: var(--text); }

/* Add friend form */
.add-friend-form {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-friend-form input { font-size: 13px; }

/* Pending requests */
.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.pending-item span { font-size: 13px; }

.pending-actions { display: flex; gap: 6px; }
.pending-actions button {
  padding: 4px 10px;
  font-size: 12px;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.pending-accept { background: var(--success); color: #fff; }
.pending-deny { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ─── User Bar ─── */
.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-bar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.user-bar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-bar-info { flex: 1; min-width: 0; }
.user-bar-name { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-bar-status { display: block; font-size: 11px; color: var(--text-muted); }

.user-bar-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  transition: var(--transition);
}
.user-bar-btn:hover { color: var(--text); }

/* ─── Chat Area ─── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-tertiary);
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-leave-chat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--danger);
  border: 1px solid var(--danger);
  background: transparent;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-leave-chat:hover {
  background: var(--danger);
  color: #fff;
}
.btn-leave-chat svg { stroke: currentColor; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-empty {
  margin: auto;
  color: var(--text-muted);
  font-size: 14px;
}

.msg {
  display: flex;
  gap: 10px;
  padding: 6px 0;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  position: relative;
  flex-shrink: 0;
}
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.msg-avatar .status-dot {
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
}

.msg-body { min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-author { font-size: 14px; font-weight: 600; color: var(--text); }
.msg-time { font-size: 11px; color: var(--text-muted); }
.msg-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; word-wrap: break-word; }

/* Chat Input */
.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
  /* prevent overflow behind members sidebar */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-input {
  flex: 1;
  /* Prevent the input from pushing past its flex container when the user types
     a long line — without min-width:0, flex items default to min-width:auto
     which equals the content's intrinsic width. */
  min-width: 0;
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.chat-input:focus { border-color: var(--red); }

.chat-send {
  padding: 10px 18px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}
.chat-send:hover { background: var(--red-light); }

/* ─── Members Sidebar ─── */
.members-sidebar {
  width: 200px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
}

.members-header {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .5px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  position: relative;
  flex-shrink: 0;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.member-avatar .status-dot {
  bottom: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-width: 1.5px;
}

.member-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.member-name { font-size: 13px; color: var(--text-secondary); }
.member-activity { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-item.online .member-name { color: var(--text); }

/* ─── Messenger Modals ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, .65);
  justify-content: center;
  align-items: center;
}

.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal h3 { margin-bottom: 18px; font-size: 18px; color: var(--red); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.modal-actions .btn:hover { background: var(--bg-hover); }

/* Server image upload */
.server-img-upload {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
  color: var(--text-muted);
}
.server-img-upload:hover { border-color: var(--red); }
.server-img-upload img { width: 100%; height: 100%; object-fit: cover; }

/* Visibility toggle */
.visibility-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
}
.visibility-opt {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.visibility-opt.active {
  background: var(--red);
  color: #fff;
}

/* ─── Preview Banner ─── */
.preview-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--red) 15%, var(--bg-secondary));
  border-bottom: 1px solid color-mix(in srgb, var(--red) 40%, var(--border));
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.preview-banner svg { flex-shrink: 0; color: var(--red); }
.preview-banner span { flex: 1; }

/* ─── Discover Grid ─── */
.discover-search-wrap {
  padding: 16px 20px 0;
}
.discover-search-input {
  width: 100%;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
}
.discover-search-input:focus { border-color: var(--red); }

.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding: 20px;
}

.discover-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.discover-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
}

.discover-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-muted);
  overflow: hidden;
}
.discover-card-img img { width: 100%; height: 100%; object-fit: cover; }

.discover-card-body { padding: 12px; }
.discover-card-body h4 { font-size: 14px; margin-bottom: 4px; }
.discover-card-body p { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.discover-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Server Label Dividers */
.server-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .5px;
  text-align: center;
  padding: 4px 0 2px;
}

/* ── Crop Modal ── */
.crop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.crop-overlay.active { display: flex; }
.crop-modal {
  background: var(--card-bg, #1a1a1a);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  overflow: hidden;
}
.crop-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.crop-modal-header h3 { margin: 0; color: #fff; font-size: 1.1rem; }
.crop-modal-body {
  padding: 20px;
  max-height: 400px;
  overflow: hidden;
}
.crop-modal-body img { display: block; max-width: 100%; }
.crop-modal-actions {
  padding: 16px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

/* ── Username Edit (profile dropdown) ── */
.profile-dd-username-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.profile-dd-username-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 14px;
  width: 130px;
}
.profile-dd-username-input:focus { border-color: var(--accent); outline: none; }
.profile-dd-username-save {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.profile-dd-username-save:hover { opacity: .85; }

/* ── Reply Bar ── */
.chat-input-bar {
  flex-direction: column;
  padding: 0;
  min-width: 0;
  max-width: 100%;
}
.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 8px;
}
.reply-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-label strong { color: var(--text-primary); }
.reply-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
}
.reply-cancel:hover { color: var(--text-primary); }
.reply-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.reply-input-row .chat-input { flex: 1; min-width: 0; }

/* ── Message actions (edit/delete/reply) ── */
.msg {
  position: relative;
}
.msg-actions {
  display: none;
  position: absolute;
  top: 4px;
  right: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 4px;
  gap: 2px;
  align-items: center;
}
.msg:hover .msg-actions { display: flex; }
.msg-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1;
}
.msg-action-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.msg-action-btn.delete:hover { color: var(--red); }

/* ── Reply quote inside message ── */
.msg-reply-quote {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  font-size: 13px;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  background: none;
  border: none;
  padding: 0;
}
.reply-curve-line {
  flex-shrink: 0;
  width: 26px;
  height: 12px;
  border-top: 2px solid rgba(255,255,255,.2);
  border-left: 2px solid rgba(255,255,255,.2);
  border-top-left-radius: 6px;
  align-self: flex-end;
  margin-bottom: 1px;
}
.reply-avatar-mini {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.reply-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.reply-name { font-weight: 600; color: var(--text-secondary); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.reply-text { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reply-quote:hover .reply-name { color: var(--text); }
.msg-reply-quote:hover .reply-text { color: var(--text-secondary); }

/* Message jump highlight animation */
@keyframes msgHighlight {
  0%   { background: rgba(255, 59, 59, .22); }
  100% { background: transparent; }
}
.msg-highlight {
  animation: msgHighlight 2s ease forwards;
  border-radius: 6px;
}

/* Message jump highlight animation */
@keyframes msgHighlight {
  0%   { background: rgba(255, 59, 59, .22); }
  100% { background: transparent; }
}
.msg-highlight {
  animation: msgHighlight 2s ease forwards;
  border-radius: 6px;
}

/* ── User Mini-Profile Popup ── */
.user-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5300;
}
.user-popup-overlay.open { display: block; }

.user-popup {
  position: absolute;
  width: 300px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 901;
}
.user-popup-banner {
  height: 60px;
  background: linear-gradient(135deg, var(--red-dark) 0%, #8b0000 100%);
}
.user-popup-body {
  padding: 0 16px 16px;
  position: relative;
}
.user-popup-avatar-wrap {
  margin-top: -30px;
  margin-bottom: 8px;
}
.user-popup-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  border: 3px solid var(--bg-secondary);
}
.user-popup-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.user-popup-avatar .status-dot {
  width: 14px;
  height: 14px;
  bottom: 0;
  right: 0;
  border-width: 3px;
  border-color: var(--bg-secondary);
}
.user-popup-initial {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}
.user-popup-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
}
.user-popup-status {
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.user-popup-activity {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.user-popup-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.user-popup-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 10px;
}
.user-popup-actions {
  display: flex;
  gap: 6px;
}
.user-popup-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 0;
  text-align: center;
}
.user-popup-view-more {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  width: 100%;
  padding: 0;
}
.user-popup-view-more:hover { color: var(--text); }

/* Clickable avatars + usernames in messages */
.msg-avatar { cursor: pointer; }
.msg-author { cursor: pointer; }
.msg-author:hover { text-decoration: underline; }

/* ── Inline edit ── */
.msg-edit-wrapper {
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 4px;
  box-shadow: 0 0 0 3px rgba(255,59,59,.08);
  width: 100%;
  box-sizing: border-box;
}
.msg-edit-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.msg-edit-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  padding: 0;
  line-height: 1.5;
  box-sizing: border-box;
  min-height: 22px;
}
.msg-edit-input:focus { outline: none; }
.msg-edit-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  gap: 8px;
}
.msg-edit-char-count {
  font-size: 11px;
  color: var(--text-muted);
}
.msg-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-edit-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.msg-edit-save {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  transition: filter .15s;
}
.msg-edit-save:hover { filter: brightness(1.15); }
.msg-edit-cancel {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.msg-edit-cancel:hover { background: var(--bg-hover); color: var(--text); }
.msg-edited-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ── Clickable links in messages ── */
.msg-link {
  color: #5b9cf6;
  text-decoration: underline;
  word-break: break-all;
}
.msg-link:hover { color: #88b8ff; }

/* ── GIF messages ── */
.msg-gif-wrap { margin-top: 4px; }
.msg-gif {
  max-width: 280px;
  max-height: 240px;
  border-radius: 8px;
  display: block;
  cursor: zoom-in;
}

/* ── Uploaded image attachments in messages ── */
.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.msg-images.single .msg-image {
  max-width: 320px;
  max-height: 320px;
}
.msg-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  cursor: zoom-in;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.msg-image:hover { border-color: var(--red); }

/* ── Attachment staging area ── */
.attachment-staging {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  scrollbar-width: thin;
}
.attachment-thumb-wrap {
  position: relative;
  flex-shrink: 0;
}
.attachment-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  border: 2px solid var(--border);
}
.attachment-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.attachment-remove:hover { background: var(--red-light); }
.attachment-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 4px;
  flex-shrink: 0;
}

/* ── Custom confirm modal ── */
.confirm-modal { max-width: 400px; }
.confirm-msg-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.confirm-msg-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.confirm-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.confirm-msg-info { flex: 1; min-width: 0; }
.confirm-msg-author {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}
.confirm-msg-text {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.confirm-modal-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.confirm-modal-ok {
  background: var(--red) !important;
  color: #fff !important;
  border: none !important;
}
.confirm-modal-ok:hover { background: var(--red-light) !important; }

/* ── Leave Chat Modal ── */
.leave-modal {
  text-align: center;
  padding: 28px 24px 20px;
  max-width: 360px;
}
.leave-modal-icon {
  color: var(--danger);
  margin-bottom: 8px;
}
.leave-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
}
.leave-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 20px;
}
.leave-modal-name { color: var(--text-primary); }
.btn-danger {
  background: var(--danger) !important;
  color: #fff !important;
  border: none !important;
}
.btn-danger:hover { opacity: .85; }

/* ── Channel Type Picker ── */
.channel-type-picker {
  display: flex;
  gap: 8px;
}
.channel-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 2px solid var(--border);
  border-radius: var(--r);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}
.channel-type-btn:hover { border-color: var(--text-muted); color: var(--text); }
.channel-type-btn.active {
  border-color: var(--red);
  color: var(--text);
  background: rgba(192,57,43,.08);
}

/* ── Streaming Channel ── */
.channel-icon-stream {
  display: inline-flex;
  color: var(--text-muted);
  flex-shrink: 0;
}
.channel-icon-stream svg { width: 14px; height: 14px; }

.stream-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stream-content {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.stream-main-area {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
}
.stream-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.stream-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }

.stream-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  align-content: start;
  align-items: start;
}
.stream-card {
  background: #000;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
  align-self: start;
  width: 100%;
  max-width: 100%;
}
.stream-card .stream-video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}
.stream-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.stream-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  pointer-events: auto;
  z-index: 2;
}
.stream-fullscreen-btn {
  width: 26px;
  height: 22px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(0,0,0,.55);
  color: #fff;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.stream-fullscreen-btn:hover { background: rgba(0,0,0,.75); }
.stream-live-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  letter-spacing: .5px;
}
.stream-card-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 9px 10px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,.25));
  transform: translateZ(0);
}
.stream-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

@media (max-width: 720px) {
  .stream-grid {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 10px;
  }
  .stream-inline-chat { display: none; }
}
.stream-core-host-note {
  position: absolute;
  inset: auto 10px 42px 10px;
  background: rgba(0,0,0,.55);
  color: #ddd;
  font-size: 11px;
  padding: 4px 7px;
  border-radius: 6px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.14);
}

.stream-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}
.stream-empty svg { opacity: .5; }
.stream-empty h3 { font-size: 16px; color: var(--text-secondary); margin: 0; }
.stream-empty p { font-size: 13px; margin: 0; max-width: 280px; }

.stream-inline-chat {
  width: 320px;
  max-width: 36vw;
  border-left: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}
.stream-inline-chat-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}
.stream-inline-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stream-inline-chat-picker {
  border-top: 1px solid var(--border);
  padding: 7px 10px;
  display: flex;
  gap: 6px;
}
.stream-inline-emoji {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
}
.stream-inline-chat-staging {
  border-top: 1px solid var(--border);
  padding: 7px 10px;
  font-size: 11px;
  color: var(--text-secondary);
}
.stream-inline-chat-input-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 10px;
  border-top: 1px solid var(--border);
}

/* ── Stream Manager + Chat Window ── */
.stream-manage-panel,
.stream-chat-window {
  position: fixed;
  /* default position — JS overrides after first drag */
  right: 16px;
  bottom: 80px;
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  z-index: 5200;
  /* prevent content from overflowing */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(520px, calc(100vh - 100px));
  /* Allow the user to resize the window by its bottom-right corner */
  resize: both;
  min-width: 260px;
  min-height: 240px;
  max-width: calc(100vw - 24px);
}

.stream-manage-panel { top: 62px; }

.stream-manage-header,
.stream-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}
.stream-chat-header:active,
.stream-manage-header:active { cursor: grabbing; }

.stream-manage-close,
.stream-chat-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.stream-manage-close:hover,
.stream-chat-close:hover { color: var(--text); }

.stream-manage-body { padding: 10px 12px; }
.stream-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.stream-manage-row strong {
  color: var(--text);
  font-weight: 700;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-manage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.stream-quality-select {
  background: var(--bg-panel, #202327);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  max-width: 62%;
  cursor: pointer;
}
.stream-quality-select:focus { outline: none; border-color: var(--accent, #5865f2); }
.stream-manage-hint {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 6px 0 2px;
  line-height: 1.35;
  opacity: 0.8;
}

/* second .stream-chat-window block — keep in sync with first */
.stream-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stream-chat-msg {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.stream-chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--red-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.stream-chat-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stream-chat-msg-avatar .status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}
.stream-chat-msg-main {
  min-width: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 8px;
}
.stream-chat-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.stream-chat-msg-author {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.stream-chat-msg-author:hover {
  text-decoration: underline;
}
.stream-chat-msg-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.stream-chat-popup-page {
  min-height: 100vh;
  background: var(--bg-primary);
}
.stream-chat-popup-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
}
.stream-chat-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stream-chat-popup-header h1 {
  font-size: 16px;
  margin: 0;
}
.stream-chat-popup-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stream-chat-popup-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}
.stream-chat-popup-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.stream-chat-picker {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.stream-chat-emoji {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
}
.stream-chat-staging {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.stream-chat-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .stream-manage-panel,
  .stream-chat-window {
    right: 10px;
    left: 10px;
    width: auto;
  }
  .stream-inline-chat {
    display: none;
  }
}

/* ── Lightbox ── */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.92);
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }
.lightbox-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 6px 16px;
}
.lightbox-ctrl-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
}
.lightbox-ctrl-btn:hover { background: rgba(255,255,255,.15); }
.lightbox-zoom-level {
  font-size: 13px;
  color: #fff;
  min-width: 44px;
  text-align: center;
  font-weight: 500;
}
.lightbox-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 60px 20px 70px;
  box-sizing: border-box;
}
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  transition: transform .15s;
  transform-origin: center center;
}

/* ── YouTube iframe embed ── */
.msg-yt-embed { margin-top: 6px; max-width: 480px; }
.msg-yt-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
}

/* ── Emoji / GIF Picker panel ── */
.picker-toggle-btn,
.img-upload-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-toggle-btn { font-size: 20px; }
.picker-toggle-btn:hover,
.img-upload-btn:hover { background: var(--bg-tertiary); color: var(--text); }

.picker-panel {
  flex-direction: column;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 300px;
  overflow: hidden;
}

.picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.picker-tab-btn {
  flex: 1;
  padding: 8px 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.picker-tab-btn:hover { background: var(--bg-tertiary); color: var(--text); }
.picker-tab-btn.active { color: var(--red); border-bottom: 2px solid var(--red); }

/* ═══════════════════ Stream Channel Hub (Discord-style join) ═══════════════════ */
.stream-channel-nav-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--red);
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 0 0 2px rgba(192,57,43,.15);
}
.stream-channel-nav-btn:hover { filter: brightness(1.1); }
.stream-channel-live-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #43b581;
  box-shadow: 0 0 0 2px var(--bg);
}

.stream-channel-hub {
  position: fixed;
  z-index: 2500;
  width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  overflow: hidden;
  display: none;
}
.stream-channel-hub-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stream-channel-hub-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
}
.stream-hub-btn {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  font-size: 13px;
}

/* Stream list modal (medium-sized popup with previews) */
.stream-list-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}
.stream-list-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
}
.stream-list-window {
  position: relative;
  width: min(720px, 92vw);
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stream-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
}
.stream-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.stream-list-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  display: flex;
  flex-direction: column;
}
.stream-list-card:hover { transform: translateY(-2px); border-color: var(--red); }
.stream-list-card-video-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
}
.stream-list-card-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stream-list-live-dot {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 4px;
}
.stream-list-live-dot::before { content: 'LIVE'; }
.stream-list-card-bar {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.stream-list-card-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Floating stream viewer (small, resizable, draggable) */
.floating-stream-viewer {
  position: fixed;
  z-index: 2600;
  min-width: 280px;
  min-height: 200px;
  width: 360px;
  height: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  resize: both;
}
.floating-stream-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
}
.floating-stream-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.floating-stream-actions {
  display: flex;
  gap: 4px;
}
.floating-stream-icon {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.floating-stream-icon:hover { color: var(--text); background: var(--bg-hover); }
.floating-stream-video-wrap {
  flex: 1;
  background: #000;
  min-height: 0;
}
.floating-stream-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.floating-stream-footer {
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}
.floating-stream-volume-slider {
  flex: 1;
  accent-color: var(--red);
  cursor: pointer;
}

/* Fullscreen pop-out overlay for the floating viewer */
.floating-stream-popout-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,.97);
  display: none;
  align-items: center;
  justify-content: center;
}
.floating-stream-popout-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.floating-stream-popout-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.6);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.floating-stream-popout-close:hover { background: rgba(255,255,255,.15); }

/* Joined-channel toast — slides in from the right, auto-hides after 2s */
.joined-channel-toast {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 4000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--red);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  max-width: 320px;
  pointer-events: auto;
}
.joined-channel-toast.visible { transform: translateX(0); opacity: 1; }
.joined-channel-toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.joined-channel-toast-body { display: flex; flex-direction: column; min-width: 0; }
.joined-channel-toast-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-secondary);
  font-weight: 700;
}
.joined-channel-toast-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.joined-channel-toast-close {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.joined-channel-toast-close:hover { color: var(--text); background: var(--bg-hover); }

/* Nav stream chat staging area (mirrors .stream-chat-staging styling) */
#nav-stream-chat-staging {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.picker-tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* Emoji category nav */
.emoji-cat-nav {
  display: flex;
  overflow-x: auto;
  gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  scrollbar-width: none;
}
.emoji-cat-nav::-webkit-scrollbar { display: none; }
.emoji-cat-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: background .1s;
  opacity: .55;
}
.emoji-cat-btn:hover { background: var(--bg-tertiary); opacity: 1; }
.emoji-cat-btn.active { background: var(--bg-tertiary); opacity: 1; border-bottom: 2px solid var(--red); }

/* Scrollable emoji area */
.emoji-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}
.emoji-cat-section { margin-bottom: 10px; }
.emoji-cat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  padding: 4px 0 4px;
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

/* Emoji grid */
.emoji-grid { display: flex; flex-wrap: wrap; }
.emoji-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
  line-height: 1;
  transition: background .1s;
}
.emoji-btn:hover { background: var(--bg-tertiary); }
.gif-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}
.gif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.gif-item {
  width: 100%;
  border-radius: 6px;
  cursor: pointer;
  object-fit: cover;
  aspect-ratio: 4/3;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.gif-item:hover { border-color: var(--red); }

/* ── Video in messages ── */
.msg-video-wrap { margin-top: 6px; max-width: 480px; }
.msg-video { width: 100%; border-radius: 8px; border: 1px solid var(--border); display: block; max-height: 360px; background: #000; }

/* ── Video in picker ── */
.video-picker-item {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .15s;
  aspect-ratio: 16/9;
  background: #000;
}
.video-picker-item:hover { border-color: var(--red); }
.video-picker-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-picker-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  color: #fff;
  font-size: 20px;
}

/* ── Video in staging bar ── */
.attachment-video-wrap { position: relative; }
.attachment-video-label {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Site Footer ── */
.site-footer {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, #0a0a0a 100%);
  border-top: 2px solid var(--red-dark);
  padding: 36px 20px 20px;
  color: var(--text-muted);
  font-size: 13px;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 2px;
  background: var(--red);
  border-radius: 0 0 4px 4px;
}
.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.footer-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  justify-content: center;
}
.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all .15s;
  font-size: 13px;
}
.footer-nav a:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-hover);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  justify-content: center;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
  font-size: 12px;
}
.footer-links a:hover { color: var(--red-light); }
.footer-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.footer-version {
  background: var(--red-dark);
  color: var(--red-light);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════ */

/* ── Tablet / small desktop (≤ 1024px) ── */
@media (max-width: 1024px) {
  .members-sidebar { display: none !important; }
  .sidebar { width: 200px; }
}

/* ── Small tablet (≤ 768px) ── */
@media (max-width: 768px) {
  /* Navbar */
  .navbar { padding: 0 12px; height: 48px; }
  .nav-brand { margin-right: 12px; }
  .nav-brand .brand-text { display: none; }
  .nav-links { gap: 2px; }
  .nav-link { padding: 6px 10px; font-size: 12px; }
  .nav-right { gap: 8px; }

  /* Messenger */
  .server-strip { width: 48px; }
  .server-icon { width: 36px; height: 36px; font-size: 15px; }
  .sidebar { width: 180px; }
  .chat-messages { padding: 10px 12px; }
  .chat-header { padding: 10px 14px; font-size: 14px; }
  .chat-input-area { padding: 8px 10px; }

  /* Friends */
  .friends-sidebar { width: 240px; }

  /* Home */
  .home-welcome { padding: 32px 16px 24px; }
  .home-welcome h2 { font-size: 24px; }
  .home-quick { padding: 24px 16px; gap: 12px; }
  .home-stat-value { font-size: 20px; }

  /* Images & YouTube */
  .msg-yt-embed { max-width: 100%; }
  .msg-images.single .msg-image { max-width: 260px; max-height: 260px; }
}

/* ── Phone (≤ 600px) ── */
@media (max-width: 600px) {
  /* Messenger: hide sidebar, make it full-width overlay */
  .server-strip { display: none; }
  .sidebar { display: none; }
  #messenger-app { flex-direction: column; }
  .chat-area { flex: 1; min-height: 0; }
  .chat-messages { padding: 8px; }
  .msg-image { max-width: 160px; max-height: 160px; }
  .msg-images.single .msg-image { max-width: 220px; max-height: 220px; }

  /* Friends: stack layout */
  .friends-layout { flex-direction: column; height: auto; min-height: calc(100vh - 48px); }
  .friends-sidebar { width: 100%; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  .friends-main { min-height: 40vh; }

  /* Home */
  .home-stats { flex-wrap: wrap; }
  .home-stat { flex: 1 1 45%; min-width: 0; border-right: none; border-bottom: 1px solid var(--border); }
  .home-welcome h2 { font-size: 20px; }
  .home-welcome p { font-size: 14px; }

  /* Navbar */
  .nav-link { padding: 5px 8px; font-size: 11px; }

  /* Support page */
  .support-page { padding: 16px; }

  /* Footer */
  .site-footer { padding: 20px 12px 16px; }
}
