/**
 * Boyutix Studio Pro - World-Class Broadcast Studio CSS
 * Inspired by Linear, Figma, and OBS/Streamlabs Dark Obsidian UI
 * Ultra-responsive, hardware-accelerated 60fps glassmorphism layout
 */

:root {
  --bg-core: #07090e;
  --bg-panel: #0d121d;
  --bg-panel-elevated: #131a29;
  --bg-surface: #182235;
  --bg-hover: #1f2b42;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(239, 68, 68, 0.6);
  --primary: #ef4444;
  --primary-glow: rgba(239, 68, 68, 0.35);
  --primary-hover: #dc2626;
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.35);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background: var(--bg-core);
  color: var(--text-main);
  font-family: var(--font-family);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.studio-header {
  height: 54px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  gap: 16px;
}

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

.brand-logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));
}

.brand-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.studio-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* Stream Health Metrics Bar */
.stream-health-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 24px;
  font-size: 0.76rem;
}

.health-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.health-stat strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.pulse-indicator.live {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulseGlow 1.8s infinite;
}

.pulse-indicator.rec {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: pulseGlow 1.2s infinite;
}

@keyframes pulseGlow {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

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

.btn-studio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  outline: none;
}

.btn-studio-record {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-subtle);
  color: #fff;
}
.btn-studio-record:hover {
  background: rgba(255, 255, 255, 0.14);
}
.btn-studio-record.recording {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--primary);
  color: #fca5a5;
}

.btn-studio-golive {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  box-shadow: 0 0 16px var(--primary-glow);
}
.btn-studio-golive:hover {
  background: linear-gradient(135deg, #f87171, #dc2626);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.55);
}
.btn-studio-golive.broadcasting {
  background: linear-gradient(135deg, #10b981, #047857);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

.btn-studio-icon {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
  color: var(--text-muted);
  padding: 8px 10px;
}
.btn-studio-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ==========================================================================
   STUDIO BODY LAYOUT
   ========================================================================== */
.studio-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.studio-main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: radial-gradient(circle at center, #0e1422 0%, #06080d 100%);
}

/* Viewport Toolbar */
.viewport-toolbar {
  height: 38px;
  background: rgba(13, 18, 29, 0.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.75rem;
}

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

.scene-quick-name {
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.tool-chip:hover, .tool-chip.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Central Canvas Container */
.canvas-viewport-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.canvas-aspect-frame {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#studioCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Safe Area Guidelines Overlay */
.canvas-safe-areas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.canvas-safe-areas.visible {
  opacity: 1;
}

.safe-zone-title {
  position: absolute;
  inset: 10%;
  border: 1px dashed rgba(56, 189, 248, 0.4);
}
.safe-zone-action {
  position: absolute;
  inset: 5%;
  border: 1px dashed rgba(239, 68, 68, 0.4);
}
.safe-zone-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

/* Selection Bounding Box & Transform Handles */
.transform-bounding-box {
  position: absolute;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
  pointer-events: none;
  display: none;
}
.transform-bounding-box.active {
  display: block;
}

.transform-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--accent-cyan);
  border-radius: 2px;
  pointer-events: auto;
  cursor: pointer;
}
.handle-tl { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-tr { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-br { bottom: -5px; right: -5px; cursor: nwse-resize; }

.source-tag-label {
  position: absolute;
  top: -24px;
  left: 0;
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
}

/* ==========================================================================
   BOTTOM DOCK (Scenes, Sources, Mixer)
   ========================================================================== */
.studio-bottom-dock {
  height: 230px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 260px 320px 1fr;
  overflow: hidden;
  z-index: 10;
}

.dock-pod {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dock-pod:last-child {
  border-right: none;
}

.pod-header {
  height: 38px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.pod-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-dock-tool {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-dock-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.pod-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Scenes List Items */
.scene-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.scene-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.scene-list-item.active {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fff;
  font-weight: 600;
}

.scene-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Sources List Items */
.source-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.source-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.source-list-item.selected {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.source-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-source-toggle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  font-size: 0.75rem;
  transition: color var(--transition-fast);
}
.btn-source-toggle.active {
  color: var(--text-main);
}
.btn-source-toggle:hover {
  color: #fff;
}

/* ==========================================================================
   AUDIO MIXER POD (VU Meters & DSP)
   ========================================================================== */
.mixer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  height: 100%;
}

.mixer-strip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.meter-wrapper {
  display: flex;
  gap: 4px;
  height: 80px;
  align-items: center;
  justify-content: center;
}

.vu-meter-bar {
  width: 10px;
  height: 100%;
  background: #111827;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.vu-meter-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(to top, #10b981 0%, #10b981 65%, #f59e0b 80%, #ef4444 100%);
  transition: height 0.05s ease-out;
}

.vu-meter-clip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #ef4444;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.strip-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.strip-volume-slider {
  flex: 1;
  height: 4px;
  accent-color: #ef4444;
  cursor: pointer;
}

.strip-db-val {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  width: 32px;
  text-align: right;
}

.strip-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-mute-strip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}
.btn-mute-strip.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--primary);
  color: #fca5a5;
}

.btn-dsp-gear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
}
.btn-dsp-gear:hover {
  color: #fff;
}

/* Soundboard Quick Strip */
.soundboard-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.btn-sfx {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all var(--transition-fast);
}
.btn-sfx:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-sfx:active {
  transform: scale(0.95);
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   RIGHT DOCK (Sidebar Tabs: Chat, Filters, Stream Settings)
   ========================================================================== */
.studio-sidebar {
  width: 340px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

.sidebar-tab-bar {
  height: 42px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.sidebar-tab-btn:hover {
  color: #fff;
}
.sidebar-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--primary);
  background: rgba(239, 68, 68, 0.06);
}

.sidebar-tab-content {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}
.sidebar-tab-content.active {
  display: flex;
}

/* Tab 1: Live Chat Dock */
.chat-dock-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.4;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.superlike {
  border-left: 3px solid #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.chat-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-username {
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-time {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.chat-dock-input-bar {
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 8px;
}

.chat-dock-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}
.chat-dock-input:focus {
  border-color: var(--primary);
}

/* Tab 2: Visual Effects & Shaders */
.fx-section {
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.fx-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lut-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-lut-preset {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}
.btn-lut-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.btn-lut-preset.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--primary);
  color: #fff;
}

.slider-field {
  margin-bottom: 12px;
}

.slider-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.slider-label-row span {
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.studio-range-slider {
  width: 100%;
  height: 4px;
  accent-color: #ef4444;
  cursor: pointer;
}

/* Tab 3: Stream Settings & Destination */
.settings-section {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.clean-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group {
  margin-bottom: 10px;
}

.form-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-input, .form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
}

/* ==========================================================================
   MODALS (Add Source, Filters, Hotkeys)
   ========================================================================== */
.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: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 90%;
  max-width: 520px;
  background: var(--bg-panel-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalScale {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}
.btn-close-modal:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.source-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.source-pick-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition-fast);
}
.source-pick-card:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.source-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.source-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

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

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

/* Toast HUD */
.studio-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 20, 32, 0.95);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 3000;
}
.studio-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   STUDIO PRO RESPONSIVE & MOBILE POLISH (< 960px & < 640px)
   ========================================================================== */

@media (max-width: 960px) {
  .studio-header {
    height: 52px;
    padding: 0 10px;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .studio-pill {
    display: none;
  }

  .stream-health-hud {
    padding: 4px 8px;
    gap: 8px;
    font-size: 0.68rem;
  }

  .health-stat i {
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 6px;
  }

  /* Hide Windows desktop download button on mobile/tablet viewports */
  .header-actions a[href*="BoyutixStudio"] {
    display: none !important;
  }

  .btn-studio {
    padding: 6px 10px;
    font-size: 0.74rem;
  }

  .studio-body {
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .studio-main-stage {
    min-height: 480px;
    flex-shrink: 0;
  }

  .studio-sidebar {
    width: 100%;
    min-height: 380px;
    flex-shrink: 0;
    border-left: none;
    border-top: 1px solid var(--border-subtle);
  }

  .studio-bottom-dock {
    height: 180px;
    grid-template-columns: 1fr 1fr;
  }

  .dock-pod:nth-child(3) {
    grid-column: span 2;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 640px) {
  .stream-health-hud .health-stat:nth-child(4) {
    display: none; /* Hide RTT on very narrow mobile */
  }

  .canvas-viewport-wrapper {
    padding: 8px;
  }

  .studio-bottom-dock {
    height: auto;
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
  }

  .dock-pod {
    min-height: 130px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}
