:root {
  --bg-main: #090a0f;
  --bg-card: rgba(18, 20, 29, 0.85);
  --bg-card-hover: rgba(25, 28, 42, 0.95);
  --bg-input: #12141e;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --accent-primary: #6366f1;
  --accent-secondary: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: 0 0 25px rgba(99, 102, 241, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(236, 72, 153, 0.06) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #272a3a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4058;
}

/* Header */
.app-header {
  height: 72px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 10, 15, 0.88);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--accent-glow);
}

.logo-icon {
  font-size: 20px;
  color: #fff;
}

.app-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

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

.engine-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  font-size: 13px;
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.pulse {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  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); }
}

/* Studio Layout Grid */
.studio-container {
  display: grid;
  grid-template-columns: 390px 1fr 390px;
  gap: 20px;
  padding: 24px;
  flex: 1;
  max-width: 1840px;
  margin: 0 auto;
  width: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.step-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.section-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Input Fields & Buttons */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 18px;
  color: #e1306c;
}

.input-with-icon input {
  padding-left: 44px;
}

.styled-input, input[type="text"], input[type="number"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.styled-input:focus, input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.styled-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.styled-select:focus {
  border-color: var(--border-focus);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

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

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 700;
}

.btn-magic {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  color: #fff;
  box-shadow: 0 6px 25px rgba(168, 85, 247, 0.45);
  letter-spacing: 0.5px;
  width: 100%;
}

.btn-magic:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(236, 72, 153, 0.6);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
  font-size: 28px;
  color: var(--accent-primary);
}

.upload-text {
  font-size: 13px;
  font-weight: 600;
}

.upload-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.selected-clip-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  margin-top: 10px;
  font-size: 13px;
}

.btn-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}
.btn-clear:hover { color: var(--danger); }

/* Asset Tabs */
.asset-tabs {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  gap: 4px;
}

.asset-tab {
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.asset-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Source Preview Box */
.source-preview {
  margin-top: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #0d0f17;
}

.preview-media-wrap video {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.source-meta {
  padding: 12px;
}

.source-meta h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.meta-tags {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Logo Gallery */
.logo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}

.logo-card {
  height: 64px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  padding: 4px;
}

.logo-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
}

.logo-card.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.logo-card img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.no-logo-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.logo-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 9px;
  cursor: pointer;
  display: none;
}
.logo-card:hover .logo-del-btn { display: flex; align-items: center; justify-content: center; }

/* Overlays Gallery */
.overlay-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
}

.overlay-card {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  text-align: center;
}

.overlay-card:hover { border-color: rgba(99, 102, 241, 0.5); }
.overlay-card.active {
  border-color: var(--accent-secondary);
  background: rgba(236, 72, 153, 0.08);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

.overlay-card-thumb {
  width: 100%;
  height: 38px;
  border-radius: 4px;
  background: #1e2230;
  overflow: hidden;
  position: relative;
}

.overlay-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.overlay-card span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Center Panel - Studio Customizer */
.studio-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.studio-split-view {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
  flex: 1;
}

/* Phone Mockup */
.preview-display-column {
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-mockup {
  width: 270px;
  height: 520px;
  background: #0b0c13;
  border-radius: 36px;
  border: 6px solid #232738;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.15);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mockup-header {
  height: 24px;
  background: #0b0c13;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.camera-hole {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #191c28;
}

.mockup-screen {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  flex-direction: column;
}

.canvas-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  text-align: center;
  padding: 20px;
}

.canvas-empty i { font-size: 36px; color: #2e344a; }
.canvas-empty span { font-size: 13px; font-weight: 600; }
.canvas-empty small { font-size: 11px; }

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* Simulated Overlay in Phone */
.simulated-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.sim-box {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  transition: var(--transition);
}

.sim-top {
  height: 50%;
  background: rgba(99, 102, 241, 0.15);
  border-bottom: 2px dashed rgba(255, 255, 255, 0.2);
}

.sim-bottom {
  height: 50%;
  background: rgba(236, 72, 153, 0.15);
}

.sim-overlay-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background-size: cover;
  background-position: center;
}

.sim-logo-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.sim-hook-badge {
  position: absolute;
  top: 47%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.sim-sub-badge {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Controls Column */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: 600px;
  padding-right: 6px;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.control-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sub-label {
  font-size: 12px;
  color: var(--text-dim);
}

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

.slider-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
}

.styled-range {
  width: 100%;
  accent-color: var(--accent-primary);
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
}

/* Ratio Toggle Group */
.ratio-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.ratio-btn {
  padding: 8px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
}

.ratio-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
}

.ratio-btn.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.ratio-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 10px;
}

.ratio-btn.active .ratio-badge {
  background: var(--accent-primary);
  color: #fff;
}

/* Layout Button Toggle */
.layout-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.layout-btn {
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}

.layout-btn.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  color: #fff;
}

.layout-icon-preview {
  width: 50px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.box-top, .box-bot {
  flex: 1;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #181b28;
}

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

/* Label with AI pill */
.label-with-ai {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-pill-btn {
  background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.ai-pill-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.4);
}

/* Quick Preset Chips */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Color Picker Wrap */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.color-picker-wrap input[type="color"] {
  border: none;
  width: 28px;
  height: 28px;
  background: none;
  cursor: pointer;
}

/* Position Toggle Group */
.pos-toggle-group, .sub-pos-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pos-btn, .sub-pos-btn {
  padding: 8px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.pos-btn.active, .sub-pos-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

/* 20 Subtitle Styles Grid */
.subtitle-styles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.sub-style-card {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
}

.sub-style-card:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(255, 255, 255, 0.03);
}

.sub-style-card.active {
  border-color: #ffe600;
  background: rgba(255, 230, 0, 0.06);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.2);
}

.sub-style-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
}

.sub-style-category {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.sub-style-preview {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  text-align: center;
  margin-top: 2px;
  user-select: none;
}

/* Highlight Box */
.highlight-box {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  padding: 14px;
}

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

.switch-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}

.switch-desc {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #272a3a;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

input:checked + .slider:before {
  transform: translateX(20px);
}

.sound-select-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* Right Panel: Export Engine */
.export-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.progress-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #1e2230;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Terminal Drawer */
.terminal-drawer {
  background: #08090d;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 160px;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #0e1017;
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.btn-clear-terminal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
}
.btn-clear-terminal:hover { color: #fff; }

.terminal-body {
  padding: 10px 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line { color: #cbd5e1; }

/* Export Result Box */
.export-result-box {
  background: var(--bg-input);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.badge-success-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

.export-result-box video {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  background: #000;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Recent Exports */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  width: 90%;
  max-width: 480px;
}

.modal-lg {
  max-width: 820px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.field-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

.field-hint a { color: var(--accent-primary); text-decoration: none; }

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

/* AI Scene Splitter Timeline */
.split-top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.scenes-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px 0;
}

.scene-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scene-card-thumb {
  width: 100%;
  height: 100px;
  background: #000;
  object-fit: cover;
}

.scene-card-info {
  padding: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
}

.empty-scenes-msg {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.empty-scenes-msg i { font-size: 32px; color: #2e344a; }

/* Utilities */
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.gap-2 { gap: 8px; }
.flex-row { display: flex; }
.items-center { align-items: center; }

@media (max-width: 1440px) {
  .studio-container {
    grid-template-columns: 340px 1fr 340px;
    gap: 16px;
    padding: 16px;
  }
}

@media (max-width: 1100px) {
  .studio-container {
    grid-template-columns: 1fr;
  }
  .studio-split-view {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   CapCut-Style Font Picker & Typography Controls
   ========================================================================== */
.font-selector-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 12px;
}

.capcut-browse-btn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #fff;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  transition: all 0.2s ease;
}
.capcut-browse-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(236, 72, 153, 0.45));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.active-font-preview-card {
  margin-top: 8px;
  background: #111422;
  border: 1.5px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.active-font-preview-card:hover {
  background: #15192c;
  border-color: #818cf8;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.active-font-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.font-tag-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  text-transform: uppercase;
}
.active-font-title {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}
.active-font-sample-text {
  font-size: 20px;
  color: #ffffff;
  letter-spacing: 0.5px;
  line-height: 1.2;
  word-break: break-word;
}

/* Quick Font Strip */
.quick-font-strip {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.quick-font-strip::-webkit-scrollbar {
  height: 4px;
}
.quick-font-strip::-webkit-scrollbar-thumb {
  background: #2a2e45;
  border-radius: 4px;
}
.quick-font-pill {
  flex-shrink: 0;
  padding: 5px 10px;
  background: #161928;
  border: 1px solid #282d47;
  border-radius: 16px;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.quick-font-pill:hover {
  background: #21263d;
  color: #fff;
  border-color: #4b5563;
}
.quick-font-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

/* Font Picker Modal */
.font-picker-modal-box {
  max-width: 860px !important;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.font-modal-icon {
  font-size: 22px;
}
.sub-muted {
  font-size: 12px;
  color: #64748b;
  display: block;
}

.font-modal-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  background: #0f121e;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.font-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.font-search-wrap .search-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  font-size: 13px;
}
.font-search-input {
  padding-left: 38px !important;
  font-size: 13px;
  background: #171b2d !important;
}

.font-category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.font-category-tabs::-webkit-scrollbar {
  display: none;
}
.font-cat-tab {
  padding: 6px 14px;
  background: #171a2c;
  border: 1px solid #282d46;
  border-radius: 20px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.font-cat-tab:hover {
  background: #232842;
  color: #fff;
}
.font-cat-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.font-modal-body {
  overflow-y: auto;
  max-height: 56vh;
  padding: 16px 20px;
}
.font-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* Individual CapCut Font Card */
.font-card {
  background: #131726;
  border: 1.5px solid #23283f;
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 105px;
  position: relative;
}
.font-card:hover {
  background: #181d31;
  border-color: #4f5780;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.font-card.active {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

.font-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.font-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}
.font-card-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.font-card-sample {
  font-size: 22px;
  line-height: 1.25;
  color: #ffffff;
  word-break: break-word;
  margin-top: 4px;
}

.font-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: #0f121e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.font-footer-count {
  font-size: 12px;
  color: #64748b;
}

/* ==========================================================================
   Creation Mode Switcher (Split-Screen vs Faceless Viral Reel)
   ========================================================================== */
.mode-switcher-card {
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: linear-gradient(135deg, rgba(20, 24, 40, 0.8), rgba(15, 18, 30, 0.9));
}
.mode-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #141829;
  border: 1.5px solid #282d46;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}
.mode-btn i {
  font-size: 20px;
  color: #64748b;
}
.mode-btn.active {
  background: rgba(99, 102, 241, 0.16);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.25);
}
.mode-btn.active i {
  color: var(--accent-primary);
}
.mode-text-wrap {
  display: flex;
  flex-direction: column;
}
.mode-title {
  font-size: 13px;
  font-weight: 700;
}
.mode-sub {
  font-size: 10px;
  color: #64748b;
}

/* Simulation Bottom Description Card */
.sim-bottom-desc-badge {
  position: absolute;
  bottom: 60px;
  left: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  z-index: 15;
}

/* 30 Trending Effects Section */
.active-effect-preview-card {
  margin-top: 8px;
  background: #111422;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.active-effect-preview-card:hover {
  background: #181d31;
  border-color: #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}
.active-effect-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.active-effect-title {
  font-size: 13px;
  font-weight: 700;
  color: #fbbf24;
}
.active-effect-desc {
  font-size: 12px;
  color: #94a3b8;
  display: block;
  line-height: 1.3;
}

.quick-effect-strip {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.quick-effect-strip::-webkit-scrollbar {
  height: 4px;
}
.quick-effect-strip::-webkit-scrollbar-thumb {
  background: #2a2e45;
  border-radius: 4px;
}
.quick-effect-pill {
  flex-shrink: 0;
  padding: 5px 10px;
  background: #161928;
  border: 1px solid #282d47;
  border-radius: 16px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.quick-effect-pill:hover {
  background: #21263d;
  color: #fff;
  border-color: #f59e0b;
}
.quick-effect-pill.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* 3-Mode Toggle Group */
.mode-toggle-group-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mode-toggle-group-3 .mode-btn {
  padding: 8px 6px;
  flex-direction: column;
  text-align: center;
  align-items: center;
  gap: 4px;
}
.mode-toggle-group-3 .mode-btn i {
  font-size: 16px;
}
.mode-toggle-group-3 .mode-title {
  font-size: 11px;
}
.mode-toggle-group-3 .mode-sub {
  font-size: 9px;
  opacity: 0.8;
  display: block;
}

/* 8-Layouts Grid (4 Half-Half + 4 Alternate) */
.layout-group-heading {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin: 6px 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.layout-grid-8 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .layout-grid-8 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.layout-btn {
  background: #111422;
  border: 1px solid #232840;
  border-radius: 8px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.layout-btn:hover {
  background: #1b2036;
  border-color: #6366f1;
}
.layout-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}
.layout-btn-title {
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  text-align: center;
}
.layout-btn.active .layout-btn-title {
  color: #818cf8;
}

.layout-icon-preview {
  width: 44px;
  height: 52px;
  border-radius: 4px;
  border: 1px solid #333a59;
  background: #090b14;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.layout-icon-preview span {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: #94a3b8;
}
.layout-icon-preview .box-top {
  height: 50%;
  border-bottom: 1px dashed #333a59;
}
.layout-icon-preview .box-bot {
  height: 50%;
}
.layout-icon-preview .active-box {
  background: rgba(99, 102, 241, 0.4);
  color: #e0e7ff;
}

/* Side-by-side Layout Icon */
.layout-icon-side {
  flex-direction: row;
}
.layout-icon-side .box-left {
  width: 50%;
  height: 100%;
  border-right: 1px dashed #333a59;
}
.layout-icon-side .box-right {
  width: 50%;
  height: 100%;
}

/* PIP Layout Icon */
.layout-icon-pip {
  position: relative;
}
.layout-icon-pip .box-full {
  width: 100%;
  height: 100%;
  background: #111422;
  font-size: 8px;
}
.pip-bubble-icon {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  border: 1px solid #fff;
}
.pip-rect-icon {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 16px;
  height: 20px;
  border-radius: 3px;
  background: #6366f1;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6px;
  border: 1px solid #fff;
}

/* Subtitle Position 5 Quick Buttons */
.sub-pos-group-5 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.sub-pos-group-5 .sub-pos-btn {
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  border-radius: 6px;
}

/* Background Swatches Grid */
.bg-swatches-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bg-swatch {
  background: #111422;
  border: 1px solid #232840;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.bg-swatch:hover {
  border-color: #6366f1;
  background: #1a1e35;
}
.bg-swatch.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}
.swatch-preview {
  width: 100%;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.swatch-blur {
  background: linear-gradient(135deg, #3b82f6, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
}
.swatch-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}
.bg-swatch.active .swatch-label {
  color: #818cf8;
}

/* Multi Clips Gallery */
.multi-clips-gallery {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.multi-clip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #131726;
  border: 1px solid #22273d;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.multi-clip-tag {
  background: #6366f1;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-right: 8px;
}

/* Detected Clips Strip */
.detected-clips-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.detected-clip-card {
  flex-shrink: 0;
  width: 100px;
  background: #111422;
  border: 1px solid #282d47;
  border-radius: 6px;
  overflow: hidden;
  font-size: 10px;
}
.detected-clip-thumb {
  width: 100%;
  height: 60px;
  object-fit: cover;
  background: #000;
}
.detected-clip-meta {
  padding: 4px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: #94a3b8;
}



