/* ==========================================================================
   StreamMirror - Modern Dark Theme & OBS Studio Design System
   ========================================================================== */

:root {
  --bg-app: #080b11;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(25, 34, 53, 0.85);
  --bg-input: #0e1320;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --border-glow: rgba(99, 102, 241, 0.35);

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.4);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --obs-bg: #05070a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Background Atmosphere */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 10%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  right: 5%;
  width: 50vw;
  height: 50vh;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* Base App Layout */
.insecure-context-banner {
  background: rgba(245, 158, 11, 0.15);
  border-bottom: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  padding: 10px 20px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.4;
  z-index: 100;
  position: relative;
}

.insecure-context-banner svg {
  flex-shrink: 0;
  color: var(--warning);
}

.insecure-context-banner code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(13, 17, 26, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  transition: all var(--transition-normal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #818cf8;
}

/* Peer Status Bar in Header */
.peer-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.65);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.pulse-dot.online {
  background: var(--success);
  box-shadow: 0 0 12px var(--success-glow);
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.my-id-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.my-id-card:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.id-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #a5b4fc;
  letter-spacing: 0.05em;
}

.id-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 4px;
  transition: color var(--transition-fast);
}

.btn-icon:hover {
  color: #fff;
}

.btn-subtle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-obs-highlight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
  transition: all var(--transition-fast);
}

.btn-obs-highlight:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

/* Main Content Workspace */
.main-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  padding: 20px 24px;
  flex: 1;
  max-width: 1700px;
  width: 100%;
  margin: 0 auto;
}

/* Stage Section (Left / Center) */
.stage-section {
  display: flex;
  flex-direction: column;
  min-height: 580px;
}

.video-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 540px;
  background: var(--obs-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-normal);
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  display: block;
}

#remoteVideo.fit-cover {
  object-fit: cover;
}

/* Standby Viewport Display */
.viewport-standby {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(17, 24, 39, 0.8) 0%, #05070a 90%);
  z-index: 10;
  transition: opacity var(--transition-normal);
}

.standby-card {
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.standby-radar {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-circle {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(99, 102, 241, 0.3);
}

.circle-1 { animation: ripple 3s infinite linear; }
.circle-2 { animation: ripple 3s infinite linear 1s; }
.circle-3 { animation: ripple 3s infinite linear 2s; }

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

.radar-icon {
  position: relative;
  z-index: 2;
  color: #818cf8;
}

.standby-card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.standby-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.standby-id-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.standby-id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.standby-id-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.04em;
}

.btn-copy-standby {
  background: var(--accent-primary);
  border: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-copy-standby:hover {
  background: var(--accent-primary-hover);
}

.obs-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: left;
  font-size: 0.78rem;
  color: #a7f3d0;
}

.obs-tip svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--success);
}

/* Badges on Viewport */
.viewport-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.live-badge {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  letter-spacing: 0.06em;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pulse-ring 1.5s infinite;
}

.sender-badge {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.res-badge {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
}

/* Audio VU Meter */
.audio-vu-container {
  position: absolute;
  bottom: 68px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  z-index: 20;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.audio-vu-container.active {
  opacity: 1;
}

.vu-icon {
  color: var(--success);
  display: flex;
}

.vu-meter {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.vu-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981 60%, #eab308 85%, #ef4444 100%);
  border-radius: 3px;
  transition: width 0.08s ease;
}

/* Floating In-Video Controls */
.viewport-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  z-index: 25;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.v-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-danger-pill {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  gap: 6px;
}

.btn-danger-pill:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

.volume-slider {
  width: 70px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Exit Hint in OBS Mode */
.obs-exit-hint {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-subtle);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
  z-index: 50;
  display: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

.obs-exit-hint kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.75rem;
  color: #fff;
  font-weight: 700;
}

/* Control Panel (Right) */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.panel-title svg {
  color: var(--accent-primary);
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 3px 8px;
}

.status-pill.streaming {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.panel-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-with-button {
  display: flex;
  align-items: center;
  position: relative;
}

input[type="text"], input[type="number"], .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition-fast);
}

input[type="text"]:focus, input[type="number"]:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--border-glow);
}

.btn-input-action {
  position: absolute;
  right: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.btn-input-action:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

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

/* Source Selector Cards */
.source-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.source-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.source-card:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(99, 102, 241, 0.4);
}

.source-card.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.source-card .source-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
}

.source-card.active .source-icon {
  background: var(--accent-primary);
  color: #fff;
}

.source-info strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.source-info span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Device Selects */
.device-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Toggle Switches */
.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

.toggle-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Action Buttons */
.stream-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-danger {
  width: 100%;
  background: var(--danger);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
}

/* Local Stream Preview */
.local-preview-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-live {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.preview-viewport {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#localVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* OBS Tips Card */
.tips-card {
  font-size: 0.82rem;
  line-height: 1.5;
}

.tips-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #a5b4fc;
  font-size: 0.88rem;
}

.obs-instructions {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-secondary);
}

.obs-instructions strong {
  color: #fff;
}

/* ==========================================================================
   OBS Clean Mode (Theater / Pure Stream for Window Capture)
   ========================================================================== */
body.obs-clean-mode {
  background: var(--obs-bg);
  overflow: hidden;
}

body.obs-clean-mode .app-header,
body.obs-clean-mode .control-panel,
body.obs-clean-mode .viewport-badges,
body.obs-clean-mode .viewport-standby,
body.obs-clean-mode .audio-vu-container {
  display: none !important;
}

body.obs-clean-mode .main-content {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  grid-template-columns: 1fr !important;
  width: 100vw !important;
  height: 100vh !important;
}

body.obs-clean-mode .stage-section {
  min-height: 100vh !important;
  height: 100vh !important;
}

body.obs-clean-mode .video-viewport {
  border: none !important;
  border-radius: 0 !important;
  min-height: 100vh !important;
  height: 100vh !important;
  width: 100vw !important;
  background: var(--obs-bg) !important;
  box-shadow: none !important;
}

body.obs-clean-mode .viewport-controls {
  opacity: 0;
  transform: translateY(20px);
}

body.obs-clean-mode .video-viewport:hover .viewport-controls {
  opacity: 1;
  transform: translateY(0);
}

body.obs-clean-mode .obs-exit-hint {
  display: block;
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 500px;
  background: #0f1626;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.color-options {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.color-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.color-radio input {
  display: none;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform var(--transition-fast);
}

.color-radio input:checked + .color-swatch {
  transform: scale(1.15);
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 120;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: slideToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition-fast);
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--accent-primary);
}

@keyframes slideToast {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
  
  .stage-section {
    min-height: 480px;
  }
  
  .peer-status-bar {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 16px;
  }
  
  .main-content {
    padding: 12px 16px;
  }
  
  .source-selector {
    grid-template-columns: 1fr;
  }
}
