/* ==========================================================================
   KEPOW — Live Peer-to-Peer Video Streaming for OBS Studio
   Master Design System & Stylesheet (style.css)
   ========================================================================== */

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f141f;
  --bg-tertiary: #171f30;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 37, 58, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #8b5cf6;

  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.35);
  --accent-amber: #f59e0b;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.7), 0 0 20px -5px var(--accent-purple-glow);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* OBS Transparent View Mode */
body.obs-mode {
  background: transparent !important;
  background-color: transparent !important;
  overflow: hidden !important;
}

body.obs-mode #header,
body.obs-mode .main-nav,
body.obs-mode .footer,
body.obs-mode .ambient-glow,
body.obs-mode .control-dock {
  display: none !important;
}

body.obs-mode #app {
  padding: 0 !important;
  max-width: 100% !important;
  height: 100vh !important;
  margin: 0 !important;
}

/* Background Ambient Lighting */
.ambient-glow {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-purple-glow) 0%, rgba(6, 182, 212, 0.1) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   HEADER NAVIGATION BAR
   ========================================================================== */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(11, 16, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: #fff;
  font-weight: 900;
  font-size: 1.25rem;
  box-shadow: 0 0 15px var(--accent-purple-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 7px;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  border-radius: var(--radius-full);
}

/* Header Quick Room Jump */
.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-join-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 4px 6px 4px 14px;
  transition: var(--transition);
}

.quick-join-box:focus-within {
  border-color: var(--accent-purple);
  box-shadow: 0 0 12px var(--accent-purple-glow);
}

.quick-join-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  width: 210px;
}

.quick-join-input::placeholder {
  color: var(--text-muted);
}

.quick-join-btn {
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.quick-join-btn:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

/* Header Action Tools */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-tool-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  transition: var(--transition);
}

.header-tool-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
  background: var(--bg-tertiary);
}

/* OBS Copy Helper Banner */
.obs-helper-banner {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: #e2e8f0;
}

.obs-helper-link {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  border: 1px dashed rgba(6, 182, 212, 0.4);
  cursor: pointer;
}

/* ==========================================================================
   APP CONTAINER & MAIN VIEW GRID
   ========================================================================== */
#app {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 24px 80px 24px;
  min-height: calc(100vh - 120px);
}

/* View Sections */
.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Home Welcome Hero */
.home-hero {
  text-align: center;
  margin-bottom: 36px;
}

.home-title {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.home-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 680px;
  margin: 0 auto;
}

/* ==========================================================================
   FEATURE CARDS GRID (IDENTICAL TO VDO.NINJA)
   ========================================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.feature-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-purple), transparent);
  opacity: 0;
  transition: var(--transition);
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card:hover::before {
  opacity: 1;
}

.card-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--accent-purple);
  margin-bottom: 18px;
  transition: var(--transition);
}

.feature-card:hover .card-icon-wrap {
  color: #fff;
  background: var(--accent-purple);
  box-shadow: 0 0 16px var(--accent-purple-glow);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.card-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
  font-weight: 600;
  font-size: 0.88rem;
}

/* Secondary Tools Row */
.tools-row-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tools-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.tool-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.tool-chip:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.tool-chip-icon {
  font-size: 1.4rem;
  color: var(--accent-cyan);
}

.tool-chip-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* ==========================================================================
   INTERACTIVE SETUP PANELS (CREATE ROOM / ADD CAMERA / SCREENSHARE)
   ========================================================================== */
.setup-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 780px;
  margin: 0 auto;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-back-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-back-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px var(--accent-purple-glow);
}

.form-input-with-action {
  display: flex;
  gap: 8px;
}

.input-action-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 0 16px;
  cursor: pointer;
  transition: var(--transition);
}

.input-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-purple);
}

/* Checkbox Toggle Row */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  cursor: pointer;
}

.custom-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.custom-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

input[type="checkbox"]:checked + .custom-switch {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

input[type="checkbox"]:checked + .custom-switch::after {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.92rem;
  color: var(--text-primary);
}

/* Live Video Preview Box */
.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Audio VU Meter */
.vu-meter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.vu-meter-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.vu-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981 60%, #f59e0b 80%, #ef4444 100%);
  border-radius: var(--radius-full);
  transition: width 0.05s linear;
}

.vu-clipping {
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

/* Primary Action Buttons */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px var(--accent-purple-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.5);
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   DIRECTOR CONTROL CENTER (DIRECTOR VIEW)
   ========================================================================== */
#view-director {
  max-width: 1500px;
  padding: 10px 0;
}

.director-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.director-room-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.room-badge {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

/* Director Link Badges */
.director-link-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-link-badge {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.stream-link-badge:hover {
  border-color: var(--accent-green);
  color: var(--text-primary);
}

.badge-scene {
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

/* Director Master Action Bar */
.director-actions-dock {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.dock-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.dock-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.15);
}

.dock-btn.active-danger {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.dock-btn.active-success {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green);
}

/* Studio Guest Tiles Grid */
.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.guest-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.guest-tile.active-speaker {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px var(--accent-green-glow);
}

.guest-tile-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.guest-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tally Lights */
.tally-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tally-live {
  background: var(--accent-red);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-red-glow);
}

.tally-preview {
  background: var(--accent-green);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-green-glow);
}

.tally-standby {
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-muted);
}

/* Guest Tile Controls Footer */
.guest-tile-footer {
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.guest-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.guest-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.tile-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tile-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.volume-slider {
  width: 80px;
  accent-color: var(--accent-cyan);
}

/* ==========================================================================
   SOLO / OBS BROWSER SOURCE VIEW
   ========================================================================== */
#view-obs-solo {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: transparent;
  display: none;
}

#view-obs-solo.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.obs-video-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==========================================================================
   REAL-TIME CHAT DRAWER
   ========================================================================== */
.chat-drawer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 340px;
  height: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  transition: var(--transition);
}

.chat-drawer.hidden {
  display: none;
}

.chat-header {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.chat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  font-size: 0.88rem;
}

.chat-msg-sender {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-bottom: 2px;
}

.chat-input-bar {
  padding: 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
}

/* ==========================================================================
   MODALS (QR CODE / WHITEBOARD / SPEED TEST)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

/* QR Code Display Container */
.qr-preview-box {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #fff;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

/* Footer Credits */
.footer {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #header { padding: 10px 14px; }
  .quick-join-box { display: none; }
  .cards-grid { grid-template-columns: 1fr; }
  .studio-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ADVANCED CAMERA / MIC / VIRTUAL BG / RECORDER STYLES
   ========================================================================== */
.advanced-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.advanced-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Audio DSP Toggle Grid */
.dsp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dsp-toggle-chip {
  display: flex;
  cursor: pointer;
}

.dsp-toggle-chip input {
  display: none;
}

.dsp-chip-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  user-select: none;
  text-align: center;
}

.dsp-toggle-chip input:checked + .dsp-chip-label {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Custom Range Slider */
.custom-range-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  transition: var(--transition);
}

.custom-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
  transition: var(--transition);
}

.custom-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #38bdf8;
}

/* Sliders Subgrid */
.sliders-subgrid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.slider-label {
  width: 90px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.slider-val {
  width: 50px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Mirror Toggle Button */
.mirror-toggle-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.mirror-toggle-btn input {
  display: none;
}

.mirror-toggle-btn span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mirror-toggle-btn input:checked + span {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent-purple);
  color: #c084fc;
}

/* Virtual Background Mode Pills */
.bg-mode-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.bg-pill {
  padding: 8px 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.bg-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.bg-pill.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

/* Preset Cards Grid */
.preset-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.preset-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-primary);
  text-align: center;
}

.preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.preset-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.preset-preview {
  height: 48px;
  width: 100%;
}

.preset-name {
  padding: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-card.active .preset-name {
  color: var(--accent-cyan);
}

/* Stream Stats & Recording Bar */
.stream-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.rec-badge-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
  animation: pulse-red 1.2s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.rec-text {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-red);
  font-family: var(--font-mono);
}

.rec-timer {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Chat Drawer Enhancements */
.chat-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.chat-action-btn:hover {
  color: var(--accent-red);
}

.chat-sub-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
  gap: 10px;
}

.chat-nick-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  width: 110px;
}

.chat-chime-label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.chat-chime-label input {
  display: none;
}

.chat-chime-label input:checked + i {
  color: var(--accent-amber);
}

.chat-emoji-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
}

.chat-emoji-btn {
  background: transparent;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.chat-emoji-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.25);
}

.chat-msg.system-msg {
  background: rgba(6, 182, 212, 0.08);
  border-left: 2px solid var(--accent-cyan);
}

/* ==========================================================================
   OBS BROWSER SOURCE TRANSPARENCY & FULLSCREEN INTEGRATION
   ========================================================================== */
body.obs-mode {
  background: transparent !important;
  background-color: transparent !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.obs-mode #header,
body.obs-mode .ambient-glow,
body.obs-mode .footer,
body.obs-mode #obs-helper-bar,
body.obs-mode #chat-drawer {
  display: none !important;
}

.obs-view-container {
  display: none !important;
}

body.obs-mode .obs-view-container.active,
.obs-view-container.active {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  z-index: 999;
}

.obs-video-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent !important;
  display: block;
}

.obs-video-canvas.fit-cover {
  object-fit: cover !important;
}

/* Status Pill in OBS */
.obs-status-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: opacity 0.5s ease;
  z-index: 100;
  pointer-events: none;
}

.obs-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: 0 0 6px var(--accent-amber);
  animation: pulse-dot 1.2s infinite;
}

.obs-status-dot.connected {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.obs-status-dot.error {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

@keyframes pulse-dot {
  0% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.5; transform: scale(0.9); }
}

/* Autoplay Audio Unblock Banner */
.obs-unblock-banner {
  position: absolute;
  bottom: 24px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pulse-alert 1.2s infinite alternate;
}

@keyframes pulse-alert {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

/* Real-time Latency & Stream Stats HUD */
.obs-stats-hud {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(10, 15, 28, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.6;
  z-index: 110;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.obs-stats-hud span {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* OBS Scene Mixer Grid */
.obs-scene-grid {
  display: grid;
  width: 100vw;
  height: 100vh;
  gap: 10px;
  padding: 10px;
  background: transparent;
  box-sizing: border-box;
}

.obs-scene-grid[data-count="1"] { grid-template-columns: 1fr; }
.obs-scene-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.obs-scene-grid[data-count="3"],
.obs-scene-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.obs-scene-grid[data-count="5"],
.obs-scene-grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }

.obs-scene-tile {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
}

.obs-scene-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}


