/* ==========================================================================
   MOVIE-MAKER ANIMATION STUDIO - MAIN DESIGN SYSTEM
   Benchmark: Modern Dark Studio Theme, Plus Jakarta Sans, Ultra-Responsive UI
   ========================================================================== */

:root {
  --studio-bg: #0f1117;
  --studio-surface: #181b24;
  --studio-surface-elevated: #222634;
  --studio-border: #2d3345;
  --studio-border-hover: #3f475f;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --accent-gold: #f59e0b;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);

  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(ellipse at 50% -18%, rgba(99, 102, 241, 0.12), transparent 42%),
    var(--studio-bg);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ================= Top Bar ================= */
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--studio-surface);
  border-bottom: 1px solid var(--studio-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  font-size: 24px;
  filter: drop-shadow(0 2px 8px var(--primary-glow));
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent-pink), var(--primary));
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

/* Mode Switch Tabs */
.mode-switch-group {
  display: flex;
  background: var(--studio-bg);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--studio-border);
}

.mode-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab-btn:hover {
  color: var(--text-main);
}

.mode-tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  background: var(--studio-surface-elevated);
  border-color: var(--studio-border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--studio-border);
}

.btn-recording {
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ================= Pane Toggles ================= */
.pane-toggle-group {
  display: flex;
  background: var(--studio-bg);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--studio-border);
  gap: 3px;
}

.pane-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.pane-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.pane-toggle-btn.active {
  background: var(--studio-surface-elevated);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.pane-toggle-btn.full-view-active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid var(--studio-border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--studio-surface-elevated);
  color: var(--text-main);
  border-color: var(--studio-border-hover);
}

/* ================= Studio Layout ================= */
.studio-layout {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  height: calc(100vh - 65px);
  overflow: hidden;
  transition: grid-template-columns 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.studio-layout.hide-left {
  grid-template-columns: 0px 1fr 340px;
}

.studio-layout.hide-right {
  grid-template-columns: 340px 1fr 0px;
}

.studio-layout.hide-left.hide-right,
.studio-layout.full-view {
  grid-template-columns: 0px 1fr 0px;
}

/* ================= Sidebars ================= */
.studio-sidebar {
  background: var(--studio-surface);
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  width: 340px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  z-index: 10;
}

.sidebar-right {
  border-right: none;
  border-left: 1px solid var(--studio-border);
}

.studio-layout.hide-left .sidebar-left {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.studio-layout.hide-right .sidebar-right {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Floating Edge Expand Handles */
.edge-expand-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--studio-surface-elevated);
  border: 1px solid var(--studio-border);
  color: var(--text-main);
  padding: 12px 7px;
  cursor: pointer;
  z-index: 50;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.edge-expand-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 22px var(--primary-glow);
}

.edge-expand-btn.edge-left {
  left: 0;
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.edge-expand-btn.edge-right {
  right: 0;
  border-right: none;
  border-radius: 8px 0 0 8px;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--studio-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--studio-border);
  border-radius: 3px;
}

/* Control Cards inside sidebars */
.control-card {
  background: var(--studio-surface-elevated);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.card-title {
  font-family: var(--font-heading);
  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;
}

/* Character Selector Grid */
.character-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.character-card-btn {
  background: var(--studio-bg);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.character-card-btn:hover {
  border-color: var(--studio-border-hover);
  color: var(--text-main);
  background: rgba(99, 102, 241, 0.05);
}

.character-card-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-main);
}

.char-avatar {
  font-size: 26px;
  margin-bottom: 4px;
  display: block;
}

.char-name {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  display: block;
}

.char-role {
  font-size: 0.65rem;
  color: var(--text-dim);
  display: block;
}

/* Full-Card Scrollable Puzzle & Artwork Gallery */
.asset-gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  min-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 4px 10px 1px;
  scroll-behavior: smooth;
}

.asset-full-card,
.asset-thumb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--studio-surface-elevated);
  border: 1.5px solid var(--studio-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.asset-full-card:hover,
.asset-thumb-card:hover {
  transform: translateY(-2px);
  border-color: var(--studio-border-hover);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.asset-full-card.active,
.asset-thumb-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 8px 24px var(--primary-glow);
}

.asset-full-card .card-media-wrap,
.asset-thumb-card .card-media-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  background: #090a0f;
  overflow: hidden;
}

.asset-full-card img,
.asset-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.asset-full-card:hover img,
.asset-thumb-card:hover img {
  transform: scale(1.04);
}

.asset-full-card .card-badge,
.asset-thumb-card .card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #38bdf8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 0.3px;
  pointer-events: none;
}

.asset-full-card .card-details,
.asset-thumb-card .card-details {
  padding: 9px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--studio-surface-elevated);
}

.asset-full-card .card-title-text,
.asset-thumb-card .card-title-text,
.asset-thumb-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.asset-full-card.active .card-title-text,
.asset-thumb-card.active .card-title-text {
  color: #a5b4fc;
}

/* Custom Upload Drop Area */
.upload-dropzone {
  border: 1px dashed var(--studio-border-hover);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.2s ease;
}
.upload-dropzone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}
.upload-icon {
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--primary);
}
.upload-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ================= Center: Canvas Arena ================= */
.studio-center-stage {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(37, 43, 61, 0.28), transparent 68%),
    #090a0f;
  position: relative;
  overflow: hidden;
}

/* Top Director Bar */
.stage-director-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(24, 27, 36, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--studio-border);
  z-index: 10;
}

.director-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--studio-surface-elevated);
  border: 1px solid var(--studio-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}
.status-dot.active {
  animation: pulseRecording 1.2s infinite;
}

.aspect-ratio-selector {
  display: flex;
  background: var(--studio-bg);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
}

.aspect-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.aspect-btn.active {
  background: var(--studio-surface-elevated);
  color: #fff;
}

/* Camera Mode Selector & Hero Cam */
.camera-controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cam-mode-pills {
  display: flex;
  background: var(--studio-bg);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--studio-border);
}

.cam-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cam-btn:hover {
  color: var(--text-main);
}
.cam-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 6px var(--primary-glow);
}

.pip-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--studio-bg);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pip-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--studio-border-hover);
}
.pip-toggle-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--primary);
  color: #818cf8;
}

/* Canvas Viewport */
.viewport-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.viewport-frame {
  position: relative;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.52),
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 100%;
  max-height: 100%;
}

/* Canvas Elements */
#stage-canvas {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Bottom Director Playback Bar */
.stage-playback-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--studio-surface);
  border-top: 1px solid var(--studio-border);
  gap: 16px;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.play-toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.timeline-progress-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-bar-outer {
  height: 8px;
  background: var(--studio-surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--studio-border);
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-full);
  transition: width 0.15s ease;
}

/* Form Controls & Inputs */
select, input[type="text"], textarea {
  width: 100%;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}
select:focus, input[type="text"]:focus, textarea:focus {
  border-color: var(--primary);
}

select option {
  background-color: #181b24;
  color: #f8fafc;
  padding: 8px 12px;
}

select option:checked,
select option:hover {
  background-color: #4f46e5;
  color: #ffffff;
}

/* Category Dropdown Styling */
.category-select {
  width: 100%;
  font-size: 0.78rem;
  padding: 7px 10px;
  background-color: #181b24 !important;
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-sm);
  color: #f8fafc !important;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.category-select:hover,
.category-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.category-select option {
  background-color: #181b24 !important;
  color: #f8fafc !important;
  padding: 8px 12px;
}

/* Audio & Narration Card */
.audio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.audio-slider {
  width: 100px;
  accent-color: var(--primary);
}

.story-textarea {
  resize: vertical;
  min-height: 85px;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 6px;
}

/* Modal for Video Download */
.studio-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.studio-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.studio-modal-card {
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 90%;
  box-shadow: var(--shadow-subtle);
  text-align: center;
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

button,
select,
input,
textarea,
.upload-dropzone,
.character-card-btn,
.asset-thumb-card {
  -webkit-tap-highlight-color: transparent;
}

:where(button, select, input, textarea, .upload-dropzone, .character-card-btn, .asset-thumb-card):focus-visible {
  outline: 2px solid #a5b4fc;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1100px) {
  .studio-topbar {
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .brand-section {
    flex: 1 1 260px;
  }

  .topbar-actions {
    flex: 0 0 auto;
  }

  .mode-switch-group {
    order: 3;
    flex: 1 1 100%;
    justify-content: center;
  }

  .studio-layout {
    height: auto;
    min-height: calc(100vh - 112px);
    grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.6fr);
    grid-template-rows: minmax(460px, 62vh) auto;
    overflow: visible;
  }

  .studio-center-stage {
    min-width: 0;
    grid-column: 2;
    grid-row: 1;
  }

  .studio-sidebar {
    min-width: 0;
  }

  .sidebar-right {
    grid-column: 1 / -1;
    grid-row: 2;
    border-left: none;
    border-top: 1px solid var(--studio-border);
  }

  .sidebar-right .sidebar-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-items: start;
  }
}

@media (max-width: 700px) {
  .studio-topbar {
    position: relative;
    padding: 10px 14px;
  }

  .brand-section {
    flex-basis: 100%;
  }

  .brand-title {
    font-size: 1rem;
  }

  .brand-badge {
    margin-left: auto;
  }

  .topbar-actions {
    flex: 1 1 100%;
  }

  .topbar-actions .btn-pill {
    width: 100%;
    justify-content: center;
  }

  .mode-switch-group {
    flex-wrap: wrap;
    gap: 2px;
  }

  .mode-tab-btn {
    flex: 1 1 180px;
    justify-content: center;
    padding: 8px 10px;
  }

  .studio-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .studio-center-stage {
    order: -1;
    min-height: 62vh;
  }

  .stage-director-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .camera-controls-group,
  .cam-mode-pills {
    flex-wrap: wrap;
  }

  .viewport-container {
    min-height: 280px;
    padding: 10px;
  }

  .studio-sidebar,
  .sidebar-right {
    overflow: visible;
    border: 0;
    border-top: 1px solid var(--studio-border);
  }

  .sidebar-content {
    overflow: visible;
  }

  .asset-gallery-grid {
    max-height: 220px;
  }
}

/* Output controls remain readable in the narrow director pane. */
.control-card > label { display:block; font-size:.72rem; color:var(--text-muted); margin:8px 0 4px; }
.control-card > select { width:100%; }
button:disabled { opacity:.55; cursor:wait; }
[hidden] { display:none !important; }
