/* ===================================================
   MiniTalks — Premium Dark UI
   =================================================== */

:root {
  /* Base Palette */
  --bg:          #080d1a;
  --bg-2:        #0c1222;
  --surface:     #0f1829;
  --surface-2:   #131f35;
  --surface-3:   #18263f;
  --surface-4:   #1e2e4a;

  /* Borders */
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-glow:   rgba(56, 189, 248, 0.25);

  /* Text */
  --text:       #e8eeff;
  --text-muted: #8fa0c4;
  --text-dim:   #526080;

  /* Brand Colors */
  --primary:      #38bdf8;
  --primary-600:  #0ea5e9;
  --primary-700:  #0284c7;
  --primary-soft: rgba(56, 189, 248, 0.12);
  --primary-glow: rgba(56, 189, 248, 0.35);

  --accent:      #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-glow: rgba(45, 212, 191, 0.35);

  --violet:      #818cf8;
  --violet-soft: rgba(129, 140, 248, 0.12);

  /* Status */
  --danger:      #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --success:     #34d399;
  --warning:     #fbbf24;

  /* Geometry */
  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  /* Shadows */
  --shadow:    0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(56, 189, 248, 0.15);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
body { position: relative; }

/* ===== AMBIENT BACKGROUNDS ===== */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 70% 55% at 15% 10%, rgba(56, 189, 248, 0.14), transparent 65%),
    radial-gradient(ellipse 55% 50% at 88% 90%, rgba(45, 212, 191, 0.11), transparent 65%),
    radial-gradient(ellipse 50% 50% at 55% 50%, rgba(99, 102, 241, 0.06), transparent 70%);
  filter: blur(8px);
  animation: glowShift 18s ease-in-out infinite alternate;
}

.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
}

/* ===== APP LAYOUT ===== */
.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

/* ===== PANEL BASE ===== */
.panel {
  background: linear-gradient(160deg, rgba(18, 28, 50, 0.75) 0%, rgba(10, 18, 38, 0.85) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* ===== LEFT PANEL ===== */
.panel-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.panel-left::-webkit-scrollbar { width: 4px; }
.panel-left::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

/* ===== BRAND HEADER ===== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
  flex-wrap: wrap;
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(56,189,248,0.3), 0 0 0 1px rgba(255,255,255,0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.logo-mark:hover {
  transform: scale(1.06) rotate(-3deg);
  box-shadow: 0 6px 24px rgba(56,189,248,0.5), 0 0 0 1px rgba(255,255,255,0.12);
}
.logo-icon { display: block; width: 100%; height: 100%; }

.brand-text { flex: 1; min-width: 0; }
.brand h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #e8eeff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}
.tagline {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2px;
  margin-top: 1px;
}

/* HEADER & BADGES */
.header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Grotesk", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.25);
  backdrop-filter: blur(4px);
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 2s ease-in-out infinite;
}

/* PING BADGE */
.ping-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Grotesk", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}
.ping-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulseDot 2s ease-in-out infinite;
}
.ping-badge.warn .ping-dot { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.ping-badge.bad  .ping-dot { background: var(--danger);  box-shadow: 0 0 8px var(--danger); animation: none; }

/* ===== ID CARD ===== */
.id-card {
  background: linear-gradient(135deg, rgba(56,189,248,0.08) 0%, rgba(45,212,191,0.05) 100%);
  border: 1px solid rgba(56,189,248,0.18);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.id-card:hover {
  border-color: rgba(56,189,248,0.3);
  box-shadow: 0 0 30px rgba(56,189,248,0.08);
}
.id-card::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15), transparent 65%);
  pointer-events: none;
}
.id-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  transition: all 0.3s ease;
}
.status-pill.online { border-color: rgba(52, 211, 153, 0.25); background: rgba(52, 211, 153, 0.07); color: var(--success); }
.status-pill.online .status-dot { background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulseDot 2s ease-in-out infinite; }

.id-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin-top: 16px;
  font-weight: 600;
}
.id-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}
.id-value {
  font-family: "Space Grotesk", monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
.id-note {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.55;
}

/* ICON BUTTONS */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(56,189,248,0.3);
  transform: scale(1.06);
}
#refreshIdBtn:hover svg { transform: rotate(180deg); transition: transform 0.45s ease; }
#refreshIdBtn svg { transition: transform 0.45s ease; }

/* ===== CONNECT CARD ===== */
.connect-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.2s ease;
}
.connect-card:focus-within { border-color: var(--border-glow); }
.connect-card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--text);
}

.muted { color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.small { font-size: 11px; }

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* INPUTS */
input[type="text"] {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-family: "Space Grotesk", monospace;
  font-size: 13.5px;
  letter-spacing: 0.5px;
  outline: none;
  transition: all 0.2s ease;
  min-width: 0;
}
input[type="text"]::placeholder { color: var(--text-dim); font-family: "Inter", sans-serif; letter-spacing: 0; font-size: 13px; }
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), 0 0 20px rgba(56,189,248,0.08);
  background: rgba(0, 0, 0, 0.4);
}

.form-msg {
  font-size: 12px;
  margin-top: 10px;
  min-height: 16px;
  color: var(--text-dim);
  transition: color 0.2s ease;
}
.form-msg.error { color: var(--danger); }
.form-msg.ok    { color: var(--success); }

/* CARD DIVIDER */
.card-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0 12px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}
.card-divider::before,
.card-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed var(--border-strong);
}
.card-divider span {
  padding: 0 10px;
  text-transform: uppercase;
}

/* RANDOM CONNECT BUTTON */
.btn-random {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.18) 0%, rgba(56, 189, 248, 0.18) 100%);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.btn-random:hover {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.32) 0%, rgba(56, 189, 248, 0.32) 100%);
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 0 20px rgba(129, 140, 248, 0.25);
  transform: translateY(-1px);
}
.btn-random:active {
  transform: translateY(0);
}
.btn-random svg {
  transition: transform 0.3s ease;
  color: var(--violet);
}
.btn-random:hover svg {
  transform: rotate(15deg) scale(1.15);
  color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.08), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn:hover::after { opacity: 1; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 50%, var(--primary-700) 100%);
  color: #001827;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.28), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.42), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--text-muted);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); border-color: var(--border-glow); }

.btn-danger-ghost {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.22);
  color: var(--danger);
  padding: 9px 14px;
  font-size: 13px;
}
.btn-danger-ghost:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: var(--danger);
  box-shadow: 0 0 16px rgba(248,113,113,0.18);
}

.btn-sm { padding: 8px 12px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }

.btn-accept {
  background: linear-gradient(135deg, var(--success), #10b981);
  color: #04231a;
  font-weight: 700;
}
.btn-decline {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-decline:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); }

/* ===== PARTICIPANTS ===== */
.participants {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.participants h3,
.requests h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 7px;
  animation: slideIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.participant-item:last-child { margin-bottom: 0; }
.participant-item:hover { background: var(--surface-4); border-color: var(--border-strong); }

.participant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #001827;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(56,189,248,0.3);
}
.participant-info { flex: 1; min-width: 0; }
.participant-id {
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.participant-tag {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.participant-mic { color: var(--accent); flex-shrink: 0; }
.participant-mic.muted { color: var(--text-dim); }

/* ===== REQUESTS ===== */
.requests {
  background: var(--surface-2);
  border: 1px solid rgba(248,113,113,0.18);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  animation: slideIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.request-item:last-child { margin-bottom: 0; }
.request-id {
  font-family: "Space Grotesk", monospace;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request-actions { display: flex; gap: 6px; flex-shrink: 0; }
.request-actions .btn { padding: 7px 12px; font-size: 12px; }

.panel-foot {
  margin-top: auto;
  padding-top: 4px;
  text-align: center;
}
.panel-foot .muted { color: var(--text-dim); }

/* ===== CHAT PANEL ===== */
.panel-chat {
  position: relative;
  overflow: hidden;
}

.chat-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 40px;
  animation: fadeIn 0.4s ease;
}
.chat-state h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* STATE ART */
.state-art {
  position: relative;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.state-core {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 36px rgba(56, 189, 248, 0.55), 0 0 60px rgba(56, 189, 248, 0.2);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ended-core {
  background: linear-gradient(135deg, var(--text-dim), var(--surface-4));
  box-shadow: none;
}
.ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.2);
  animation: ripple 3s infinite ease-out;
}
.ring-1 { width: 80px;  height: 80px;  animation-delay: 0s; }
.ring-2 { width: 108px; height: 108px; animation-delay: 0.75s; }
.ring-3 { width: 130px; height: 130px; animation-delay: 1.5s; }

.pulse {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  animation: pulse 1.4s infinite ease-out;
  box-shadow: 0 0 24px var(--primary-glow);
}

/* ===== ACTIVE CHAT ===== */
.chat-active {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.35s ease;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 12px;
  flex-shrink: 0;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* VOICE BAR */
.voice-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.07), rgba(56, 189, 248, 0.07));
  flex-shrink: 0;
}
.voice-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.voice-toggle:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--border-glow); }
.voice-toggle.active {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #04231a;
  border-color: transparent;
  box-shadow: 0 0 18px rgba(45, 212, 191, 0.45);
}
.voice-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.voice-label { font-size: 12px; font-weight: 600; color: var(--text); }
.voice-participants { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-indicator { display: flex; gap: 3px; align-items: flex-end; height: 18px; flex-shrink: 0; }
.voice-indicator span {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: voiceWave 0.8s infinite ease-in-out;
}
.voice-indicator span:nth-child(1) { height: 60%; animation-delay: 0s; }
.voice-indicator span:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.voice-indicator span:nth-child(3) { height: 70%; animation-delay: 0.3s; }
.voice-indicator span:nth-child(4) { height: 90%; animation-delay: 0.45s; }

/* INVITE PANEL */
.invite-panel {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(30, 46, 74, 0.5);
  animation: slideIn 0.25s ease;
  flex-shrink: 0;
}
.invite-form { display: flex; gap: 8px; align-items: center; }
.invite-form input { flex: 1; min-width: 0; }
.invite-msg { margin-top: 8px; font-size: 12px; color: var(--text-muted); min-height: 16px; }
.invite-msg.error { color: var(--danger); }
.invite-msg.ok    { color: var(--success); }

/* CHAT PEER */
.chat-peer { display: flex; align-items: center; gap: 12px; min-width: 0; }
.peer-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
  flex-shrink: 0;
  animation: pulseDot 2s ease-in-out infinite;
}
.peer-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}
.chat-header h2 {
  font-family: "Space Grotesk", monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== MESSAGES ===== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.msg {
  max-width: 68%;
  padding: 10px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: msgIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg.them {
  align-self: flex-start;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg .msg-author {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
  font-family: "Space Grotesk", monospace;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  color: #001827;
  border-bottom-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(14,165,233,0.25);
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-dim);
  font-size: 11.5px;
  font-style: italic;
  padding: 5px 14px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 999px;
  max-width: 90%;
  text-align: center;
}

/* TYPING ROW */
.typing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 10px;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  height: 30px;
}
.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingBounce 1.2s infinite;
  opacity: 0.6;
}
.typing-dots span:nth-child(2) { animation-delay: 0.18s; }
.typing-dots span:nth-child(3) { animation-delay: 0.36s; }

/* COMPOSER */
.composer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(8, 13, 26, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
  align-items: center;
}
.composer input {
  flex: 1;
  font-family: "Inter", sans-serif;
  letter-spacing: 0;
  font-size: 14.5px;
  padding: 12px 16px;
  border-radius: 12px;
}
.send-btn {
  padding: 12px 16px;
  border-radius: 12px;
  flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn    { from { opacity: 0; }                            to { opacity: 1; } }
@keyframes slideIn   { from { opacity: 0; transform: translateY(-8px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes msgIn     { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes ripple    { 0% { opacity: 0.65; transform: scale(0.65); } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes pulse     { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.18); opacity: 1; } }
@keyframes pulseDot  { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes voiceWave { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
@keyframes glowShift { 0% { opacity: 0.8; } 100% { opacity: 1; } }

/* ===== MOBILE NAVIGATION ===== */
.mobile-nav { display: none; }

/* ===== RESPONSIVE: 900px ===== */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 320px 1fr;
    padding: 12px;
    gap: 12px;
  }
  .panel-left { padding: 16px; }
}

/* ===== RESPONSIVE: 768px (Full Mobile) ===== */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
    height: 100dvh;
  }

  .app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    padding: 10px 10px 70px 10px;
    gap: 0;
    border-radius: 0;
  }

  .bg-glow { filter: blur(24px); opacity: 0.5; }

  .panel {
    will-change: transform;
    transform: translateZ(0);
    border-radius: 20px;
  }

  /* MOBILE NAV BAR */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 16, 32, 0.96);
    border-top: 1px solid var(--border-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    padding: 6px 16px;
    gap: 8px;
  }

  .mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: "Inter", sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    position: relative;
    transition: all 0.2s ease;
    padding: 8px;
  }
  .mobile-nav-btn.active {
    color: var(--primary);
    background: var(--primary-soft);
  }
  .mobile-nav-btn.active svg { stroke: var(--primary); }
  .mobile-nav-btn svg { transition: stroke 0.2s ease; }

  .nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: var(--danger);
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    line-height: 1.4;
  }
  .nav-badge.dot-badge {
    width: 8px;
    height: 8px;
    padding: 0;
    right: calc(50% - 15px);
    top: 8px;
    border-radius: 50%;
  }

  /* Tab panels */
  .panel-left, .panel-chat {
    flex: 1;
    width: 100%;
    height: 100%;
    border-radius: 20px;
  }
  .app.tab-room .panel-left  { display: flex !important; }
  .app.tab-room .panel-chat  { display: none !important; }
  .app.tab-chat .panel-left  { display: none !important; }
  .app.tab-chat .panel-chat  { display: flex !important; }

  /* Mobile tweaks */
  .brand { padding: 2px 0 4px; }
  .brand h1 { font-size: 19px; }
  .id-value { font-size: 22px; }
  .id-card { padding: 15px 16px; }
  .connect-card { padding: 15px 16px; }
  .participants, .requests { padding: 14px 16px; }

  .chat-header { padding: 11px 14px; }
  .chat-header h2 { font-size: 15px; }
  .chat-header-actions { gap: 5px; }
  .btn-sm { padding: 7px 10px; font-size: 11.5px; }
  .btn-sm span { display: inline-block; }

  .messages { padding: 14px 12px; gap: 8px; }
  .msg { max-width: 88%; font-size: 14px; }
  .composer { padding: 10px 12px; gap: 8px; }
  .composer input { font-size: 14px; padding: 10px 13px; }
  .send-btn { padding: 10px 14px; }
  .btn-primary { padding: 10px 14px; font-size: 13px; }
  .voice-bar { padding: 8px 14px; gap: 10px; }
  .ping-badge { font-size: 10px; padding: 4px 8px; }

  .chat-state { padding: 24px 18px; gap: 12px; }
  .chat-state h2 { font-size: 22px; }
  .state-art { width: 110px; height: 110px; }
  .ring-1 { width: 66px;  height: 66px; }
  .ring-2 { width: 88px;  height: 88px; }
  .ring-3 { width: 110px; height: 110px; }
  .state-core { width: 46px; height: 46px; }

  .toast { bottom: 76px; font-size: 12px; padding: 9px 18px; }
}

/* ===== RESPONSIVE: 380px (Small Phones) ===== */
@media (max-width: 380px) {
  .brand h1 { font-size: 17px; }
  .id-value { font-size: 20px; }
  .logo-mark { width: 40px; height: 40px; }
  .btn-sm span { display: none; }
  .msg { max-width: 94%; }
}
