:root {
  --bg-dark: #07090e;
  --bg-card: rgba(15, 21, 37, 0.75);
  --bg-card-hover: rgba(22, 30, 52, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.25);
  
  --primary: #38bdf8;
  --primary-rgb: 56, 189, 248;
  --primary-glow: rgba(56, 189, 248, 0.2);
  --secondary: #818cf8;
  --accent: #f97316;
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.07) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(129, 140, 248, 0.07) 0%, transparent 45%),
              var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 14, 24, 0.85);
  backdrop-filter: blur(14px);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2px;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-status.live {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.badge-status.live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 1.5s infinite;
}

.badge-status.connecting {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

button.btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

button.btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

button.btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: none;
  color: white;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

button.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  position: relative;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Left Panel: QR Code and Pairing */
.qr-box {
  background: #ffffff;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.25rem auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  width: 260px;
  height: 260px;
}

.qr-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.link-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.link-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
}

.link-row {
  display: flex;
  gap: 0.5rem;
}

.link-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.instructions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.instructions li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.step-num {
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Right Panel: Voice Stage */
.stage-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.meta-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 10px;
  border-radius: 6px;
}

.stage-participants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.speaker-card {
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
}

.speaker-card.speaking {
  border-color: var(--primary);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  position: relative;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.avatar svg {
  width: 40px;
  height: 40px;
  fill: var(--text-muted);
}

.avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.speaker-card.speaking .avatar-ring {
  border-color: var(--primary);
  animation: ripple 1.2s infinite ease-out;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

.speaker-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.speaker-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

/* Audio Waveform Canvas */
.waveform-container {
  width: 100%;
  height: 44px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waveform-canvas {
  width: 100%;
  height: 100%;
}

/* Call Control Bar */
.control-dock {
  background: rgba(8, 12, 22, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-circle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.btn-circle.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-circle.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-circle.danger:hover {
  background: #dc2626;
}

/* Metrics Bar */
.telemetry-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.telemetry-item span {
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
  }
  .stage-participants {
    grid-template-columns: 1fr;
  }
}
