/* ═══════════════════════════════════════════════════════════════
   style.css — PhoneEitor Voice Chat — Premium Dark Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Font ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ───────────────────────────────────── */
:root {
  /* Surface colors */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);

  /* Accent palette */
  --accent-violet: #8b5cf6;
  --accent-violet-dim: rgba(139, 92, 246, 0.15);
  --accent-cyan: #06b6d4;
  --accent-cyan-dim: rgba(6, 182, 212, 0.15);
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme='light'] {
  --bg-primary: #f5f7fb;
  --bg-secondary: #eef2ff;
  --bg-card: rgba(15, 23, 42, 0.05);
  --bg-card-hover: rgba(15, 23, 42, 0.08);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-glass: rgba(15, 23, 42, 0.12);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
}

:root[data-theme='sunset'] {
  --bg-primary: #1a1026;
  --bg-secondary: #2c153d;
  --accent-violet: #c084fc;
  --accent-cyan: #f97316;
  --text-primary: #fef3c7;
  --text-secondary: #fdba74;
  --text-muted: #f59e0b;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body.chat-resizing,
body.chat-resizing * {
  user-select: none !important;
  cursor: ns-resize !important;
}

/* ── Animated Background Mesh ────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 20%, rgba(139, 92, 246, 0.12), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(6, 182, 212, 0.08), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(16, 185, 129, 0.05), transparent);
  animation: meshFloat 20s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes meshFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(-30px, 20px) scale(1.05);
  }

  100% {
    transform: translate(20px, -10px) scale(0.98);
  }
}

/* ── Layout Container ────────────────────────────────────────── */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ── View Transitions ────────────────────────────────────────── */
.view {
  display: none;
  width: 100%;
  max-width: 520px;
  animation: viewEnter var(--transition-spring) both;
}

.view.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes viewEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Brand / Logo Area ───────────────────────────────────────── */
.brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  box-shadow:
    0 0 40px rgba(139, 92, 246, 0.25),
    0 0 80px rgba(6, 182, 212, 0.1);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {

  0%,
  100% {
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.25), 0 0 80px rgba(6, 182, 212, 0.1);
  }

  50% {
    box-shadow: 0 0 60px rgba(139, 92, 246, 0.35), 0 0 100px rgba(6, 182, 212, 0.15);
  }
}

.brand h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 6px;
}

/* ── Glass Card ──────────────────────────────────────────────── */
.glass-card {
  width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.btn-icon-small {
  background: none;
  border: none;
  font-size: 1.2rem;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-small:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ── Form Elements ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.input-field {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px var(--accent-violet-dim);
}

.logged-user-chip {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ── Premium Toggle ──────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.toggle-label .badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-amber), #e67e22);
  color: #000;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--transition-smooth);
}

.toggle-switch input:checked+.toggle-slider {
  background: linear-gradient(135deg, var(--accent-amber), #e67e22);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(22px);
}

/* ── Action Buttons ──────────────────────────────────────────── */
.btn-group {
  display: flex;
  gap: 12px;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-violet), #7c3aed);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-rose), #dc2626);
  color: white;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(244, 63, 94, 0.4);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

/* ═══════════════════════════════════════════════════════════════
   ROOM VIEW
   ═══════════════════════════════════════════════════════════════ */

#room-view {
  width: 100%;
  max-width: none;
}

#room-view.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-main-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  position: relative;
}

.screen-share-stage {
  width: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.screen-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.screen-share-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.screen-share-video {
  width: 100%;
  max-height: min(34vh, 360px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.28);
  object-fit: contain;
}

/* ── Room Header ─────────────────────────────────────────────── */
.room-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  gap: 16px;
  flex-wrap: wrap;
}

.room-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.room-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.room-code-value {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 0.15em;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.btn-copy {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-copy:hover {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.btn-copy.copied {
  color: var(--accent-emerald);
}

/* ── Mode Badge ──────────────────────────────────────────────── */
.mode-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all var(--transition-smooth);
  align-self: flex-start;
}

.mode-badge.mesh {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.mode-badge.sfu {
  background: var(--accent-violet-dim);
  color: var(--accent-violet);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: dotPulse 2s ease-in-out infinite;
}

.mesh .mode-dot {
  background: var(--accent-cyan);
}

.sfu .mode-dot {
  background: var(--accent-violet);
}

@keyframes dotPulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ── Participants Grid ───────────────────────────────────────── */
.participants-section {
  width: 100%;
  margin-bottom: 0;
}

.participants-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: min(66vh, 640px);
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
}

.participants-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
}

.participants-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 80px;
  overflow-y: auto;
  padding-right: 2px;
}

/* ── Participant Card ────────────────────────────────────────── */
.participant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  transition: all var(--transition-smooth);
  animation: cardEnter var(--transition-spring) both;
  position: relative;
  overflow: hidden;
}

.participant-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-cyan));
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.participant-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.participant-card:hover::before {
  opacity: 1;
}

.participant-card.speaking::before {
  opacity: 1;
}

.participant-card.speaking {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.participant-card.is-me {
  border-color: rgba(6, 182, 212, 0.2);
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.participant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  position: relative;
  flex: 0 0 auto;
}

.participant-info {
  min-width: 0;
  flex: 1;
}

.participant-avatar .ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.participant-avatar .speaking-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}

.speaking .participant-avatar .ring {
  border-color: var(--accent-violet);
  animation: speakRing 1.5s ease-in-out infinite;
}

.speaking .participant-avatar .speaking-ring {
  border-color: var(--accent-violet);
  animation: speakRing 1.5s ease-in-out infinite;
}

@keyframes speakRing {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.6;
  }
}

.participant-role {
  font-size: 0.62rem;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 0;
}

.participant-presence {
  margin-left: 2px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.participant-presence.online { color: #22c55e; }
.participant-presence.idle { color: #f59e0b; }
.participant-presence.dnd { color: #ef4444; }

.participant-client {
  margin-left: 2px;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  padding: 1px 6px;
}

.participant-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
}

.participant-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

.badge-premium {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-amber), #e67e22);
  color: #000;
  font-weight: 700;
}

.badge-you {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  font-weight: 600;
}

.participant-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-icon {
  font-size: 0.85rem;
}

.status-icon.muted {
  color: var(--accent-rose);
}

.status-icon.active {
  color: var(--accent-emerald);
}

.participant-latency {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Streamer Mode ───────────────────────────────────────────── */
.room-code-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.room-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.room-code-group:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.hidden-code {
  filter: blur(8px);
  user-select: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  /* Essential for filter to work reliably */
  opacity: 0.7;
}

.hidden-code:hover {
  filter: blur(5px);
  opacity: 1;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* ── Controls Bar ────────────────────────────────────────────── */
.controls-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 10px 24px rgba(2, 6, 23, 0.2);
}

.btn-control {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.btn-control::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.btn-mute {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-mute:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.08);
}

.btn-mute.muted {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-leave {
  background: linear-gradient(135deg, var(--accent-rose), #dc2626);
  color: white;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-screen-share {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-screen-share:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: scale(1.08);
}

.btn-screen-share.active {
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.35);
}

.btn-leave:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(244, 63, 94, 0.4);
}

/* ── Status Bar ──────────────────────────────────────────────── */
.status-bar {
  width: 100%;
  text-align: left;
  margin-top: 0;
  padding: 4px 8px 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  animation: dotPulse 2s ease-in-out infinite;
}

.status-dot.connecting {
  background: var(--accent-amber);
}

.status-dot.error {
  background: var(--accent-rose);
  animation: none;
}

/* ── Toast Notification ──────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(16px);
  animation: toastIn var(--transition-spring) both;
  border: 1px solid;
  max-width: 320px;
}

.toast.info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.2);
}

.toast.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.2);
}

.toast.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.2);
}

.toast.error {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.2);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ── Chat Section ────────────────────────────────────────────── */
.chat-section {
  width: 100%;
  margin-bottom: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 460px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 24px rgba(2, 6, 23, 0.2);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-chat-notifications {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-chat-notifications:hover {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.chat-resize-handle {
  height: 10px;
  cursor: ns-resize;
  position: relative;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.chat-resize-handle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  width: 48px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.chat-resize-handle:hover::before {
  background: rgba(6, 182, 212, 0.9);
}


.chat-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
}

.btn-chat-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-chat-toggle:hover {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.chat-messages {
  min-height: 260px;
  max-height: min(55vh, 520px);
  height: 100%;
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.chat-messages.collapsed {
  display: none;
}

.chat-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 0;
  opacity: 0.6;
}

/* Chat message bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: msgIn 0.2s ease-out both;
}

.chat-msg.mine {
  align-self: flex-end;
}

.chat-msg.theirs {
  align-self: flex-start;
}

.chat-msg-author {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 3px;
  padding: 0 4px;
}

.chat-msg.mine .chat-msg-author {
  color: var(--accent-violet);
  text-align: right;
}

.chat-msg-bubble {
  padding: 8px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}


.chat-msg-text {
  white-space: pre-wrap;
}

.chat-msg-meta {
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chat-link {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.chat-link:hover {
  opacity: 0.9;
}

.twitter-embed-wrapper {
  margin-top: 10px;
  border-radius: 10px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.twitter-embed-frame {
  width: 100%;
  min-height: 220px;
  border: 0;
  border-radius: 10px;
}

.tweet-fallback-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
}

.tweet-fallback-link.is-hidden {
  display: none;
}

.tweet-interaction-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chat-msg.theirs .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg.mine .chat-msg-bubble {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.15));
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  padding: 0 4px;
}

.chat-msg.mine .chat-msg-time {
  text-align: right;
}

.chat-img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Typing indicator */
.typing-indicator {
  display: none;
  /* Hidden by default */
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  /* Make it look like a "theirs" bubble */
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  width: fit-content;
  margin-left: 0;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
}

.typing-indicator.active {
  display: inline-flex;
  opacity: 1;
  transform: translateY(0);
}

/* ── Audio Settings Modal ────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.2s ease-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 90%;
  max-width: 400px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}


.image-preview-content {
  max-width: 900px;
}

.image-preview-body {
  display: flex;
  justify-content: center;
  align-items: center;
}

#image-preview-target {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.setting-select {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.setting-select:focus {
  border-color: var(--accent-cyan);
}

.setting-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.setting-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-inline-secondary {
  width: fit-content;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-inline-secondary:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.07);
}

.btn-inline-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.notifications-content {
  max-width: 520px;
}

.notifications-list {
  max-height: 56vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.notifications-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.notification-room {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.notification-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.notification-room-code {
  color: var(--accent-cyan);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.notification-room-counts {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.notification-room-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notification-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notification-item {
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.notification-item.unread {
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
}

.notification-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.7rem;
}

.notification-type {
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notification-time {
  color: var(--text-muted);
}

.notification-text {
  font-size: 0.8rem;
  color: var(--text-primary);
  word-break: break-word;
}

.notification-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* App shell / routing layouts */
.hidden {
  display: none !important;
}

.auth-loading {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1300;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}

.auth-loading.active {
  display: flex;
}

.auth-loading-card {
  width: min(360px, 92vw);
  text-align: center;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
}

.auth-card {
  width: min(420px, 100%);
}

.auth-switch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-switch-btn.is-active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.auth-form.hidden {
  display: none;
}

.auth-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.app-layout {
  min-height: 100vh;
  max-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 12px;
  position: relative;
  z-index: 1;
}

.app-layout > .glass-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.035));
  box-shadow:
    0 12px 26px rgba(2, 6, 23, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.app-sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - 20px);
  max-height: calc(100vh - 20px);
  overflow: hidden;
}

.app-brand-mini {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: 2px 2px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.app-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.app-nav-btn.is-active {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.16);
}

.app-nav-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.28);
}

.friends-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

.friends-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.friends-requests {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.friend-requests-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-requests-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.friend-requests-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-request-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.friend-request-empty {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.friend-request-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.friend-request-user {
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 600;
}

.friend-request-time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

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

.friends-input {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.8rem;
}

.friends-counter {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.friends-help {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.friends-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.friends-list::-webkit-scrollbar {
  width: 6px;
}

.friends-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.friends-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 8px 4px;
}

.friend-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 9px;
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.friend-row:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.friend-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.friend-meta {
  min-width: 0;
}

.friend-name {
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-status {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.friend-status.online {
  color: #22c55e;
}

.friend-status.idle {
  color: #f59e0b;
}

.friend-status.offline {
  color: var(--text-muted);
}

.friend-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.friend-invite,
.friend-remove,
.friend-dm,
.friend-block {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  height: 24px;
  border-radius: 6px;
  padding: 0 7px;
  transition: all var(--transition-fast);
}

.friend-invite:hover,
.friend-remove:hover,
.friend-dm:hover,
.friend-block:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.friend-invite:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.friend-invite:disabled:hover {
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
}

.friend-remove:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.35);
}

.friend-block:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.35);
}

.app-main {
  min-height: calc(100vh - 20px);
  max-height: calc(100vh - 20px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.app-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-main-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-main-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.app-main-header p {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-logout-header {
  border-color: rgba(244, 63, 94, 0.28);
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.08);
}

.btn-logout-header:hover {
  border-color: rgba(244, 63, 94, 0.5);
  color: #ffe4e6;
  background: rgba(244, 63, 94, 0.16);
}

.app-section.hidden {
  display: none;
}

.app-section.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.app-section.active::-webkit-scrollbar {
  width: 7px;
}

.app-section.active::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.34);
  border-radius: 999px;
}

#app-layout .view {
  max-width: none;
  width: 100%;
}

#app-layout .view.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.lobby-card {
  width: min(620px, 100%);
  margin: 0 auto;
}

.panel-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 18px rgba(2, 6, 23, 0.22);
}

.panel-card + .panel-card {
  margin-top: 10px;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-card-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

.session-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.room-context-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room-context-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.room-context-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.room-context-item:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.room-context-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.room-context-value {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

code.room-context-value {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 0.08em;
}

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

.room-permission-toggle {
  margin-top: 10px;
}

.room-permission-toggle input {
  margin-right: 6px;
}

.dm-message {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dm-message.mine {
  border-color: rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.1);
}

.dm-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
}

.dm-message-author {
  color: var(--text-primary);
  font-weight: 600;
}

.dm-message-time {
  color: var(--text-muted);
}

.dm-message-content {
  color: var(--text-secondary);
  font-size: 0.82rem;
  word-break: break-word;
}

.invite-list {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invite-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.invite-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invite-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.invite-from {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

.invite-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.invite-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

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

.app-sidebar-right {
  min-height: calc(100vh - 20px);
  max-height: calc(100vh - 20px);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 1320px) {
  .room-main-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

@media (max-width: 1200px) {
  .app-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .app-sidebar-right {
    display: none;
  }

  .room-main-grid {
    grid-template-columns: 1fr;
  }

  .participants-panel {
    max-height: none;
  }

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

  .chat-section {
    min-height: 420px;
  }
}

@media (max-width: 760px) {
  .app-layout {
    grid-template-columns: 1fr;
    max-height: none;
    min-height: auto;
  }

  .app-sidebar-left {
    min-height: auto;
    max-height: none;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .app-nav {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
  }

  .app-brand-mini {
    display: none;
  }

  .friends-panel {
    display: none;
  }

  .app-nav-btn {
    text-align: center;
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .app-main {
    max-height: none;
    min-height: auto;
  }

  .app-main-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .app-main-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .room-main-grid {
    grid-template-columns: 1fr;
  }

  .participants-grid {
    grid-template-columns: 1fr;
  }

  .participant-card {
    padding: 10px;
  }

  .chat-section {
    min-height: 360px;
  }
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.volume-control input[type="range"] {
  flex: 1;
  accent-color: var(--accent-cyan);
}

/* Individual user volume slider */
.user-volume-slider {
  width: 100%;
  height: 4px;
  margin-top: 8px;
  accent-color: var(--accent-violet);
  cursor: pointer;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

/* System messages (join / leave) */
.chat-msg-system {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 0;
  font-style: italic;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat input row */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 2px var(--accent-violet-dim);
}

.btn-emoji,
.btn-send,
.btn-attach {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.btn-emoji:hover,
.btn-attach:hover {
  background: var(--accent-amber);
  color: #000;
  transform: scale(1.1);
}

.btn-send {
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  color: white;
}

.btn-send:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.4);
}

/* Emoji picker */
.emoji-picker {
  position: absolute;
  bottom: 60px;
  left: 12px;
  right: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 10;
  animation: pickerIn 0.15s ease-out both;
}

@keyframes pickerIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.emoji-grid button {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.emoji-grid button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.2);
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state .icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .app-container {
    padding: 16px;
  }

  .glass-card {
    padding: 24px 20px;
  }

  .brand h1 {
    font-size: 1.4rem;
  }

  .room-header {
    flex-direction: column;
    align-items: stretch;
  }

  .participants-grid {
    grid-template-columns: 1fr;
  }

  .chat-messages {
    min-height: 220px;
    max-height: 44vh;
    height: auto;
  }

  .chat-resize-handle {
    display: none !important;
  }

  .twitter-embed-frame {
    min-height: 460px;
  }

  .controls-bar {
    padding: 16px;
  }

  .btn-control {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }
}


.setting-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.setting-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.setting-checkbox input[type="checkbox"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
