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

:root {
  --navy:       #0D1117;
  --navy2:      #161B22;
  --navy3:      #21262D;
  --border-d:   rgba(255,255,255,0.08);
  --accent:     #5865F2;
  --accent2:    #7C3AED;
  --green:      #10B981;
  --red:        #EF4444;
  --text-w:     #F0F6FC;
  --text-muted: rgba(240,246,252,0.45);
  /* Canvas — dark by default */
  --bg:         #0D1117;
  --card:       #161B22;
  --border-l:   rgba(255,255,255,0.08);
  --text:       #F0F6FC;
  --text-sub:   rgba(240,246,252,0.55);
  --radius:     12px;
  --radius-s:   8px;
  --shadow-s:   0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-m:   0 4px 12px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-l:   0 20px 40px rgba(0,0,0,0.5);
  --font:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Theme-aware overlay / text vars */
  --overlay-xs:        rgba(255,255,255,0.05);
  --overlay-sm:        rgba(255,255,255,0.08);
  --overlay-md:        rgba(255,255,255,0.14);
  --border-dash:       rgba(255,255,255,0.14);
  --text-label:        rgba(240,246,252,0.65);
  --text-placeholder:  rgba(240,246,252,0.22);
  --text-dim:          rgba(240,246,252,0.55);
  --text-soft:         rgba(240,246,252,0.75);

  /* Surface tints */
  --accent-tint:    rgba(88,101,242,0.15);
  --surface-muted:  rgba(255,255,255,0.04);
  --surface-subtle: rgba(255,255,255,0.06);
  --surface-hover:  rgba(255,255,255,0.08);
  --ring-color:     rgba(255,255,255,0.12);
}

html[data-theme="light"] {
  /* Sidebar / navbar */
  --navy:              #EFF2F7;
  --navy2:             #FFFFFF;
  --navy3:             #F6F8FA;
  --border-d:          rgba(0,0,0,0.09);
  --text-w:            #1F2328;
  --text-muted:        rgba(31,35,40,0.45);
  --overlay-xs:        rgba(0,0,0,0.03);
  --overlay-sm:        rgba(0,0,0,0.05);
  --overlay-md:        rgba(0,0,0,0.09);
  --border-dash:       rgba(0,0,0,0.15);
  --text-label:        rgba(31,35,40,0.65);
  --text-placeholder:  rgba(31,35,40,0.25);
  --text-dim:          rgba(31,35,40,0.55);
  --text-soft:         rgba(31,35,40,0.75);
  /* Canvas */
  --bg:                #F6F8FA;
  --card:              #FFFFFF;
  --border-l:          #D0D7DE;
  --text:              #1F2328;
  --text-sub:          #656D76;
  --shadow-s:          0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-m:          0 4px 12px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-l:          0 20px 40px rgba(0,0,0,0.15);
  /* Surface tints */
  --accent-tint:       #EEF2FF;
  --surface-muted:     #F6F8FA;
  --surface-subtle:    #F3F4F6;
  --surface-hover:     #EAEEF2;
  --ring-color:        #E5E7EB;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ── Navbar ────────────────────────────────────────────────────── */
.navbar {
  height: 56px;
  background: var(--navy);
  border-bottom: 1px solid var(--border-d);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 8px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 280px;
  flex-shrink: 0;
}
.nav-logo-wrap {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
}
.nav-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-w);
  letter-spacing: -0.4px;
}
.nav-ai {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
}
.nav-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--overlay-xs);
  border: 1px solid var(--border-d);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.btn-nav { margin-left: auto; }
.btn-nav {
  padding: 6px 16px;
  background: var(--overlay-sm);
  border: 1px solid var(--border-d);
  border-radius: 7px;
  color: var(--text-w);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
}
.btn-nav:hover { background: var(--overlay-md); }

/* ── Shell ─────────────────────────────────────────────────────── */
.shell {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* ── Slim scrollbars (webkit) ───────────────────────────────────── */
::-webkit-scrollbar        { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(165,174,255,0.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(165,174,255,0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(165,174,255,0.25) transparent; }

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 300px;
  background: var(--navy2);
  border-right: 1px solid var(--border-d);
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 16px;
  gap: 8px;
}

.sb-section {
  margin-bottom: 8px;
}
.sb-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 4px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: 4px;
  transition: color .15s;
}
.sb-label:hover { color: var(--text-soft); }

.sb-chevron {
  font-size: 12px;
  opacity: 0.5;
  transition: transform .2s ease;
  flex-shrink: 0;
  margin-left: 6px;
}
.sb-section.collapsed .sb-chevron { transform: rotate(-90deg); }

.sb-body {
  overflow: hidden;
  max-height: 600px;
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}
.sb-section.collapsed .sb-body {
  max-height: 0;
  opacity: 0;
}

.field { margin-bottom: 10px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-label);
  margin-bottom: 5px;
}
.field input {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy3);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-s);
  color: var(--text-w);
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input::placeholder { color: var(--text-placeholder); }
.field input:focus {
  border-color: var(--accent);
  background: rgba(88,101,242,0.08);
}

/* Textarea (script prompt) */
.field textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy3);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-s);
  color: var(--text-w);
  font-size: 13px;
  font-family: var(--font);
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field textarea::placeholder { color: var(--text-placeholder); }
.field textarea:focus {
  border-color: var(--accent);
  background: rgba(88,101,242,0.08);
}

/* Optional label tag */
.sb-optional {
  font-size: 9px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-placeholder);
  margin-left: 4px;
}

/* Small upload card variant */
.upload-card-sm { padding: 10px 14px; }

/* ── Voice recorder ──────────────────────────────────────────── */
.btn-record {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  background: rgba(239,68,68,0.12);
  border: 1.5px solid rgba(239,68,68,0.35);
  border-radius: var(--radius-s);
  color: #FDA4A4;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: 8px;
}
.btn-record:hover {
  background: rgba(239,68,68,0.2);
  border-color: rgba(239,68,68,0.6);
}
.btn-record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #EF4444;
  flex-shrink: 0;
}

.rec-or {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

/* Recording active */
.rec-live {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-s);
  margin-bottom: 10px;
}
.rec-pulse {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #EF4444;
  flex-shrink: 0;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}
.rec-label {
  font-size: 13px;
  font-weight: 500;
  color: #FDA4A4;
  flex: 1;
}
.rec-timer {
  font-size: 13px;
  font-weight: 700;
  color: #EF4444;
  font-variant-numeric: tabular-nums;
}
.btn-rec-stop {
  width: 100%;
  padding: 10px;
  background: var(--navy3);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-s);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s;
}
.btn-rec-stop:hover { background: var(--overlay-sm); }
.stop-icon { font-size: 10px; }

/* Done state */
.rec-done-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.rec-done-check {
  width: 20px; height: 20px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}
.rec-done-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}
.rec-audio {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  margin-bottom: 8px;
  accent-color: var(--accent);
}
.rec-done-actions { display: flex; gap: 6px; }
.btn-rerecord {
  flex: 1;
  padding: 7px 10px;
  background: var(--navy3);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-s);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
}
.btn-rerecord:hover { background: var(--overlay-sm); color: var(--text-w); }

/* ── Phase buttons ───────────────────────────────────────────── */
.btn-generate-video {
  margin-top: 8px;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.btn-generate-video:hover { opacity: 0.9; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
  margin-left: auto;
}
.btn-link:hover { background: var(--accent-tint); }

/* ── Voice panel (main canvas) ───────────────────────────────── */
.voice-panel-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Script reading box */
.script-read-box {
  background: var(--card);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-s);
}
.script-read-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-sub);
  margin-bottom: 14px;
}
.script-lines {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}
.script-line {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.script-line-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.script-line-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

/* Recorder box (right side) */
.recorder-box {
  background: var(--card);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-s);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.recorder-box-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.recorder-box-hint {
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.5;
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 10px 12px;
}
.rec-state { display: flex; flex-direction: column; gap: 10px; }

.btn-upload-voice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border-l);
  border-radius: var(--radius-s);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
}
.btn-upload-voice:hover { background: var(--surface-hover); color: var(--text); }

.rec-done-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* voice status tag */
.section-tag.recorded {
  background: #ECFDF5;
  color: #065F46;
}

/* Upload cards */
.upload-card {
  background: var(--navy3);
  border: 1.5px dashed var(--border-dash);
  border-radius: var(--radius-s);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 8px;
}
.upload-card:hover {
  border-color: var(--accent);
  background: rgba(88,101,242,0.06);
}
.upload-card.ready {
  border-style: solid;
  border-color: var(--green);
  background: rgba(16,185,129,0.07);
}
.upload-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.upload-icon-wrap { font-size: 20px; flex-shrink: 0; }
.upload-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}
.upload-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.sb-spacer { flex: 1; }

/* Generate button */
.btn-generate {
  width: 100%;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  border-radius: var(--radius-s);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.2px;
  transition: opacity .15s, transform .15s;
  box-shadow: 0 4px 14px rgba(88,101,242,0.4);
}
.btn-generate:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-generate-icon { font-size: 15px; }

/* ── Canvas ────────────────────────────────────────────────────── */
.canvas {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 60px 20px;
}
.empty-art {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.empty-circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.12;
}
.c1 {
  width: 100px; height: 100px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.c2 {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
}
.empty-emoji { font-size: 36px; position: relative; z-index: 1; }
.empty-title { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.empty-sub { font-size: 14px; color: var(--text-sub); max-width: 340px; line-height: 1.5; }
.empty-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.chip {
  padding: 5px 12px;
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.section-tag {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--surface-subtle);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Scenes row */
.scenes-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.scene-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border-l);
  overflow: hidden;
  box-shadow: var(--shadow-s);
  transition: transform .2s, box-shadow .2s;
}
.scene-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-m);
}
.scene-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.scene-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: fadeIn .4s ease;
}
.scene-thumb-placeholder {
  font-size: 12px;
  font-weight: 600;
  color: #C8D0D8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* spinner inside thumb */
.thumb-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ring-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scene-body { padding: 12px; }
.scene-num {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent);
  margin-bottom: 4px;
}
.scene-copy {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.scene-dur {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 5px;
}

/* ── Scene card edit ──────────────────────────────────────────────── */
.scene-card { position: relative; }

.scene-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  padding: 0;
  color: #fff;
}
.scene-card:hover .scene-edit-btn { opacity: 1; }
.scene-edit-btn:hover { background: var(--accent2); transform: scale(1.08); }

.scene-edit-panel {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-l);
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scene-edit-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-sub);
}
.scene-edit-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border-l);
  border-radius: var(--radius-s);
  font-size: 12.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--card);
  resize: none;
  outline: none;
  line-height: 1.45;
  transition: border-color .15s;
}
.scene-edit-textarea:focus { border-color: var(--accent); }

.scene-edit-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.scene-edit-divider {
  height: 1px;
  background: var(--border-l);
  margin: 2px 0;
}
.scene-edit-label-premium {
  display: flex;
  align-items: center;
  gap: 6px;
}
.premium-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.btn-regen-scene {
  padding: 5px 10px;
  background: var(--accent-tint);
  border: 1px solid #C7D2FE;
  border-radius: 6px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-regen-scene:hover { background: #E0E7FF; }
.btn-edit-scene {
  padding: 5px 10px;
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(239,68,68,0.15));
  border: 1px solid rgba(245,158,11,0.4);
  border-radius: 6px;
  color: #F59E0B;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-edit-scene:hover { background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(239,68,68,0.25)); }
.btn-scene-cancel {
  padding: 5px 10px;
  background: none;
  border: 1px solid var(--border-l);
  border-radius: 6px;
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s;
}
.btn-scene-cancel:hover { background: var(--surface-muted); }
.btn-scene-save {
  padding: 5px 12px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s;
}
.btn-scene-save:hover { opacity: 0.85; }

/* Output section */
.output-wrap {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border-l);
  padding: 24px;
  box-shadow: var(--shadow-s);
}
.video-shell {
  max-width: 480px;
  margin: 0 auto;
  background: #000;
  border-radius: var(--radius-s);
  overflow: hidden;
  aspect-ratio: 1;
}
.video-shell video { width: 100%; height: 100%; display: block; }

.btn-dl {
  padding: 9px 22px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-s);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  margin-left: auto;
  transition: background .15s;
}
.btn-dl:hover { background: #059669; }

/* ── Progress modal ────────────────────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(13,17,23,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(6px);
}
.modal {
  background: var(--card);
  border-radius: 18px;
  padding: 30px;
  width: 420px;
  box-shadow: var(--shadow-l);
  border: 1px solid var(--border-l);
}
.modal-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}
.modal-spinner {
  width: 42px; height: 42px; flex-shrink: 0;
  border: 4px solid var(--accent-tint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.modal-sub { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

.step-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.step-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--text-sub);
  transition: background .2s, color .2s;
}
.step-row.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 500;
}
.step-row.done {
  background: #ECFDF5;
  color: #065F46;
}
.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #D1D5DB;
  flex-shrink: 0;
  transition: background .2s;
}
.step-row.active .step-dot { background: var(--accent); }
.step-row.done  .step-dot { background: var(--green); }

.step-check {
  margin-left: auto;
  font-size: 13px;
  opacity: 0;
  transition: opacity .2s;
}
.step-row.done .step-check { opacity: 1; }

.modal-bar-wrap {
  height: 5px;
  background: var(--ring-color);
  border-radius: 3px;
  overflow: hidden;
}
.modal-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  width: 0%;
  transition: width .5s ease;
}

/* ── Video mode toggle (sidebar) ────────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.mode-btn {
  flex: 1;
  padding: 8px 6px;
  background: var(--navy3);
  border: 1.5px solid var(--border-d);
  border-radius: var(--radius-s);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.mode-btn.active {
  background: rgba(88,101,242,0.18);
  border-color: var(--accent);
  color: #A5AEFF;
  font-weight: 600;
}
.mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: var(--text-label);
}
.mode-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 2px 0;
  line-height: 1.4;
}

/* Required tag (avatar mode) */
.sb-required {
  font-size: 9px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: #F87171;
  margin-left: 4px;
}

/* Face missing hint below Generate Video button */
.face-missing-hint {
  font-size: 11.5px;
  color: #F87171;
  text-align: center;
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(239,68,68,0.08);
  border-radius: 6px;
}

/* ── Voice mode toggle (canvas) ─────────────────────────────────── */
.voice-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.voice-mode-btn {
  flex: 1;
  padding: 10px 14px;
  background: var(--card);
  border: 1.5px solid var(--border-l);
  border-radius: var(--radius-s);
  color: var(--text-sub);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  transition: background .15s, border-color .15s, color .15s;
}
.voice-mode-btn.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.voice-mode-btn:hover:not(.active) {
  background: var(--surface-muted);
  border-color: var(--border-l);
  color: var(--text);
}

/* Record mode: voice record panel layout */
#voice-record-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* AI voice notice */
.ai-voice-notice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--card);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
}
.ai-voice-icon { font-size: 32px; flex-shrink: 0; }
.ai-voice-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.ai-voice-hint {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.4;
}

/* Skipped step in modal */
.step-row.skipped {
  opacity: 0.3;
}
.step-row.skipped .step-check { display: none; }

/* ── Platform selector ────────────────────────────────────────────── */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}
.platform-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  background: var(--navy3);
  border: 1px solid var(--border-d);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  text-align: left;
  width: 100%;
  min-width: 0;
}
.platform-btn.active {
  background: rgba(88,101,242,0.18);
  border-color: var(--accent);
  color: #A5AEFF;
  font-weight: 600;
}
.platform-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: var(--text-soft);
}
.platform-icon { font-size: 11px; flex-shrink: 0; }
.platform-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.platform-tag {
  font-size: 8.5px;
  font-weight: 700;
  background: var(--overlay-sm);
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
  color: rgba(240,246,252,0.5);
}
.platform-btn.active .platform-tag {
  background: rgba(88,101,242,0.3);
  color: #A5AEFF;
}
.platform-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 2px 0;
}

.logo-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 2px 0;
}

/* ── Narrator picker ──────────────────────────────────────────────── */
.narrator-selected-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--overlay-sm);
  border: 1px solid var(--border-d);
  border-radius: var(--radius-s);
}
.narrator-sel-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
}
.narrator-sel-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.narrator-sel-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-left: auto;
}
.narrator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.narrator-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  background: var(--card);
  border: 1.5px solid var(--border-l);
  border-radius: var(--radius-s);
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.narrator-btn.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.narrator-btn:hover:not(.active) { background: var(--surface-muted); border-color: var(--border-l); color: var(--text); }

.narrator-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.narrator-tag-m { background: #DBEAFE; color: #1D4ED8; }
.narrator-tag-f { background: #FCE7F3; color: #9D174D; }

/* ── Avatar custom script ────────────────────────────────────────── */
.script-source-toggle {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.ss-btn {
  padding: 5px 14px;
  background: var(--card);
  border: 1.5px solid var(--border-l);
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ss-btn.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.ss-btn:hover:not(.active) { background: var(--surface-muted); }

.custom-script-textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--card);
  border: 1.5px solid var(--border-l);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  box-shadow: var(--shadow-s);
  transition: border-color .15s;
}
.custom-script-textarea:focus { border-color: var(--accent); }
.custom-script-textarea::placeholder { color: #9CA3AF; }
.custom-script-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}
.custom-script-hint {
  font-size: 12px;
  color: var(--text-sub);
}
.script-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  transition: color .2s;
}
.script-counter.limit-warn { color: #D97706; }
.script-counter.limit-near { color: #EA580C; }
.script-counter.limit-hit  { color: var(--red); }

/* ── Clone voice button ──────────────────────────────────────────── */
.btn-clone-voices {
  width: 100%;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius-s);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 2px;
}
.btn-clone-voices:hover { opacity: 0.88; }

.clone-hint {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.4;
  margin-top: 4px;
  background: var(--surface-muted);
  border-radius: 6px;
  padding: 8px 10px;
}

/* ── Voice version cards ─────────────────────────────────────────── */
.versions-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.version-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.version-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--border-l);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-s);
  transition: border-color .2s;
}
.version-card.loading {
  opacity: 0.6;
}
.vc-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--ring-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.vc-info { flex: 1; min-width: 0; }
.vc-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.vc-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.vc-audio {
  width: 100%;
  height: 32px;
  accent-color: var(--accent);
}
.btn-use-voice {
  padding: 8px 16px;
  background: var(--accent-tint);
  border: 1.5px solid #C7D2FE;
  border-radius: var(--radius-s);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-use-voice:hover { background: #E0E7FF; }
.btn-use-voice.selected {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* rec-live-label */
.rec-live-label {
  font-size: 13px;
  font-weight: 500;
  color: #FDA4A4;
  flex: 1;
}

/* ── Theme toggle ────────────────────────────────────────────────── */
.btn-theme {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--overlay-sm);
  border: 1px solid var(--border-d);
  color: var(--text-w);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-theme:hover { background: var(--overlay-md); }
