/* Video Converter — mirrors audio panel lightly */

.video-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  margin: 1.25rem 0 1rem;
}

/*
 * Visibility: only the active mode's block must show.
 * - [hidden] must beat display:flex (and any nested flex/grid rules)
 * - data-active is a belt-and-suspenders toggle set by video-converter.js
 */
.video-settings[hidden],
[data-video-settings][hidden],
[data-video-settings]:not([data-active="1"]),
.video-settings .field[hidden],
.video-settings [hidden],
.dropzone-hint[hidden],
#video-gif-duration-field[hidden] {
  display: none !important;
}

.video-settings[data-active="1"]:not([hidden]) {
  display: flex !important;
}

.video-settings .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.video-settings select {
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  min-width: 140px;
}

#tool-workspace.is-locked .video-settings {
  opacity: 0.45;
  pointer-events: none;
}

.video-settings input[type="number"] {
  font: inherit;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  min-width: 120px;
  width: 8rem;
}

[data-tool-panel="video"] .tool-tabs {
  margin-top: 0.25rem;
}

.tool-tab-group {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.75;
  margin-left: 0.35rem;
  padding: 0.35rem 0.25rem;
}

.tool-tabs--video .tool-tab {
  font-size: 0.8125rem;
  padding: 0.4rem 0.75rem;
}

.dropzone--secondary {
  margin-top: 1rem;
  border-style: dashed;
}

[data-tool-panel="video"] .dropzone--secondary[hidden] {
  display: none !important;
}

/* —— Unified Frames studio —— */
.frames-studio {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}

.frames-studio[hidden] {
  display: none !important;
}

.frames-player-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
}

.frames-player {
  display: block;
  width: 100%;
  max-height: 720px;
  min-height: 280px;
  border-radius: var(--radius-md);
  background: #000;
  border: 1px solid var(--border);
  object-fit: contain;
}

.frames-preview-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.frames-preview {
  width: auto;
  max-width: 280px;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.frames-time-readout {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.frames-seek-wrap {
  display: block;
  width: 100%;
}

.frames-seek {
  width: 100%;
  accent-color: var(--accent);
}

.frames-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
}

.frames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.65rem;
  width: 100%;
  margin-top: 0.35rem;
}

.frames-grid[hidden] {
  display: none !important;
}

.frames-thumb {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: center;
  color: inherit;
  font: inherit;
}

.frames-thumb:hover,
.frames-thumb:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.frames-thumb img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
}

.frames-thumb span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}


/* —— Unified Video editor —— */
.video-preview-stage {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 0.85rem;
}

.video-preview-stage[hidden] {
  display: none !important;
}

.video-main-preview {
  display: block;
  width: 100%;
  max-height: 640px;
  min-height: 240px;
  margin-top: 0;
  border-radius: var(--radius-md);
  background: #000;
  border: 1px solid var(--border);
  object-fit: contain;
}

.video-main-preview[hidden] {
  display: none !important;
}

.video-wm-overlay {
  position: absolute;
  width: 15%;
  height: auto;
  max-height: 40%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

.video-wm-overlay[hidden] {
  display: none !important;
}

.video-wm-overlay[data-pos="top-left"] {
  top: 10px;
  left: 10px;
}

.video-wm-overlay[data-pos="top-right"] {
  top: 10px;
  right: 10px;
}

.video-wm-overlay[data-pos="bottom-left"] {
  bottom: 10px;
  left: 10px;
}

.video-wm-overlay[data-pos="bottom-right"] {
  bottom: 10px;
  right: 10px;
}

.video-wm-overlay[data-pos="center"] {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Video editor: one studio library column + workspace */
.video-editor-layout {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-top: 0.25rem;
  width: 100%;
  min-width: 0;
}

.studio-library {
  flex: 0 0 300px;
  width: 300px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: sticky;
  top: 5.25rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0.55rem;
  background: #12141a;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}
[data-theme="light"] .studio-library {
  background: var(--bg-elevated);
}

.video-workspace {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.studio-lib-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.studio-lib-tab {
  flex: 1 1 auto;
  min-width: 4.5rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
}
.studio-lib-tab.is-active {
  background: rgba(99, 102, 241, 0.22);
  color: var(--text);
  border-color: rgba(129, 140, 248, 0.55);
}
.studio-lib-pane[hidden] {
  display: none !important;
}
.studio-lib-pane {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.studio-tool-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.studio-tool-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.studio-tool-btn:hover,
.studio-tool-btn:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}
.studio-tool-btn.is-active {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elevated));
  border-color: var(--accent);
  color: var(--text);
}
.studio-lib-timeline-only {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.studio-lib-timeline-only[hidden] {
  display: none !important;
}

/* Desktop: library rail; mobile uses mode <select> / stacked accordion */
@media (max-width: 900px) {
  .video-editor-layout {
    flex-direction: column;
    gap: 0.75rem;
  }
  .studio-library {
    flex: none;
    width: 100%;
    max-width: none;
    position: static;
    max-height: none;
    overflow: visible;
  }
  .studio-tool-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .studio-tool-btn {
    width: auto;
    border-radius: 999px;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .studio-library {
    display: none;
  }
  .video-mode-select-wrap {
    display: block;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
  }
}

[data-tool-panel="video"] .video-settings {
  margin-top: 0.5rem;
}

/* ——— Timeline Studio ——— */
.timeline-studio {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.25rem;
}
.timeline-studio[hidden] {
  display: none !important;
}
.tl-preview-wrap {
  position: relative;
  background: #0a0a0b;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16 / 9; /* fallback; JS sets from video */
  max-height: 480px;
  margin-inline: auto;
  width: 100%;
}
.tl-preview-wrap[data-aspect="portrait"] {
  max-width: 280px;
  max-height: 480px;
}
.tl-preview-wrap[data-aspect="square"] {
  max-width: 360px;
}
.tl-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.tl-subs-overlay {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 0.4rem 0.8rem;
  background: rgba(0, 0, 0, 0.82);
  color: #fff !important;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  border-radius: 6px;
  pointer-events: none;
  white-space: pre-wrap;
  z-index: 12;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.tl-subs-overlay.is-visible {
  opacity: 1;
}
.tl-transport {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tl-time-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.tl-board {
  position: relative;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem 0.65rem;
  overflow-x: auto;
}
.tl-ruler {
  position: relative;
  height: 1.4rem;
  margin-left: 2.2rem;
  margin-bottom: 0.25rem;
}
.tl-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  pointer-events: none;
}
.tl-tick i {
  display: block;
  width: 1px;
  height: 6px;
  background: var(--border);
  margin: 0 auto 2px;
}
.tl-tracks {
  position: relative;
  margin-left: 0;
  min-height: 7rem;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f43f5e;
  z-index: 5;
  pointer-events: none;
  margin-left: 2.2rem;
  left: 0;
}
.tl-playhead::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #f43f5e;
}
.tl-track {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  align-items: center;
  gap: 0;
  margin-bottom: 0.35rem;
}
.tl-track-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.tl-track-lane {
  position: relative;
  height: 2rem;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
}
[data-theme="light"] .tl-track-lane {
  background: rgba(0, 0, 0, 0.04);
}
.tl-clip {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 4px;
  min-width: 8px;
}
.tl-clip--video {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  opacity: 0.92;
}
.tl-clip--audio {
  background: linear-gradient(90deg, #059669, #34d399);
  opacity: 0.9;
}
.tl-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255, 255, 255, 0.85);
  cursor: ew-resize;
  z-index: 2;
}
.tl-handle--in { left: 0; border-radius: 4px 0 0 4px; }
.tl-handle--out { right: 0; border-radius: 0 4px 4px 0; }
.tl-sub-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: rgba(234, 179, 8, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  min-width: 10px;
  pointer-events: auto;
  cursor: grab;
  z-index: 3;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}
.tl-sub-marker:hover,
.tl-sub-marker.is-selected {
  background: rgba(250, 204, 21, 0.95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 4;
}
.tl-sub-marker.is-active {
  outline: 2px solid #38bdf8;
  outline-offset: 0;
}
.tl-sub-marker.is-editing {
  z-index: 6;
  overflow: visible;
}
.tl-sub-marker-label {
  flex: 1;
  min-width: 0;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  line-height: 1.2;
}
.tl-sub-marker .tl-handle {
  pointer-events: auto;
  width: 8px;
  min-width: 8px;
  opacity: 0.85;
}
.tl-sub-inline-edit {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 8rem;
  height: 100%;
  box-sizing: border-box;
  border: 2px solid #38bdf8;
  border-radius: 4px;
  padding: 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fafafa !important;
  background: #0f172a !important;
  caret-color: #fafafa;
  z-index: 8;
  outline: none;
}
.tl-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem 0.85rem;
}
.tl-controls .field--check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-direction: row;
}
.tl-controls .field--check input {
  width: auto;
}
.tl-audio-panel,
.tl-subs-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--bg-elevated);
}
.tl-audio-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.tl-audio-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.tl-subs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.tl-subs-head h4 {
  margin: 0;
  font-size: 0.95rem;
}
.tl-sub-row {
  display: grid;
  grid-template-columns: 5rem 5rem 1fr auto;
  gap: 0.4rem 0.45rem;
  align-items: end;
  margin-bottom: 0.55rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0b1220;
  position: relative;
  z-index: 2;
  cursor: pointer;
}
.tl-sub-row-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}
.tl-sub-tc {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.02em;
}
.tl-sub-idx {
  font-size: 0.7rem;
  color: #94a3b8;
}
.tl-sub-row.is-selected {
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
  background: #111827;
}
.tl-sub-row.is-active {
  border-color: #facc15;
  background: #1a1520;
}
.tl-sub-row .field span {
  color: #cbd5e1;
  font-size: 0.72rem;
}
.tl-sub-row input[type="number"],
.tl-sub-row input[type="text"],
.tl-sub-row .tl-sub-text-input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #f8fafc !important;
  background: #020617 !important;
  border: 1px solid #334155 !important;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  caret-color: #f8fafc;
  -webkit-text-fill-color: #f8fafc;
  opacity: 1;
  position: relative;
  z-index: 3;
}
.tl-sub-row input[type="number"]:focus,
.tl-sub-row input[type="text"]:focus,
.tl-sub-row .tl-sub-text-input:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 0;
  border-color: #38bdf8 !important;
}
.tl-sub-row-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: stretch;
}
.tl-sub-row-actions .btn {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.3rem 0.45rem;
  color: #e2e8f0;
}
@media (max-width: 720px) {
  .tl-sub-row {
    grid-template-columns: 1fr 1fr;
  }
  .tl-sub-row-actions {
    grid-column: 1 / -1;
    flex-direction: row;
  }
  .tl-playhead {
    margin-left: 2.2rem;
  }
}


/* Safe-area margins hint (Reels / TikTok) */
.video-safe-area {
  position: absolute;
  inset: 8% 6%;
  border: 1px dashed rgba(255, 214, 10, 0.65);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  z-index: 3;
}
.video-safe-area[hidden] {
  display: none !important;
}
.video-preview-stage {
  position: relative;
}

.tl-subs-overlay[data-pos="top"] {
  top: 10%;
  bottom: auto;
}
.tl-subs-overlay[data-pos="middle"] {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}
.tl-subs-overlay[data-pos="bottom"] {
  bottom: 10%;
  top: auto;
}

.tl-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.tl-subs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tl-limits-hint {
  margin: 0;
}

.video-result-player {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.video-result-player[hidden] {
  display: none !important;
}
.video-result-video {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius-md);
  background: #000;
  border: 1px solid var(--border);
}

.upload-progress.is-indeterminate .upload-progress-bar {
  width: 40% !important;
  animation: ct-progress-indeterminate 1.1s ease-in-out infinite;
}
@keyframes ct-progress-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

/* ——— Timeline montage MVP (0.9.18) ——— */
.tl-approx-hint {
  margin: 0.15rem 0 0.5rem;
  opacity: 0.85;
}
.tl-range-bar {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.tl-holes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.tl-hole {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0.55),
    rgba(0, 0, 0, 0.55) 4px,
    rgba(220, 60, 60, 0.45) 4px,
    rgba(220, 60, 60, 0.45) 8px
  );
  border-left: 1px solid rgba(255, 120, 120, 0.8);
  border-right: 1px solid rgba(255, 120, 120, 0.8);
}
.tl-seg-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.tl-seg-mark {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  border: 1px solid rgba(120, 200, 255, 0.7);
  background: rgba(80, 160, 255, 0.18);
  box-sizing: border-box;
}
.tl-seg-mark[data-fx="1"] {
  border-color: rgba(255, 200, 80, 0.85);
  background: rgba(255, 180, 60, 0.22);
}
.tl-edit-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(160, 120, 255, 0.28);
  border: 1px dashed rgba(200, 170, 255, 0.9);
  z-index: 3;
  pointer-events: none;
  box-sizing: border-box;
}
.tl-montage-panel,
.tl-export-opts {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--bg-elevated);
  width: 100%;
}
.tl-export-opts h4,
.tl-montage-panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}
.tl-segments-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.55rem;
  max-height: 220px;
  overflow: auto;
}
.tl-seg-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.2fr) 90px 110px auto;
  gap: 0.4rem;
  align-items: end;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 0.8rem;
}
.tl-seg-row .field {
  margin: 0;
}
.tl-seg-row .tl-seg-meta {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  align-self: center;
}
@media (max-width: 720px) {
  .tl-seg-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ——— Timeline Studio shell (0.9.23) — library lives in .studio-library ——— */
.tl-studio-shell {
  display: block;
  min-height: 420px;
}
.tl-controls--compact {
  grid-template-columns: 1fr 1fr;
}
.tl-audio-panel--rail {
  padding: 0.55rem;
}
.tl-studio-main {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  background: #0c0e14;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem;
}
[data-theme="light"] .tl-studio-main {
  background: var(--bg-muted);
}
.tl-studio-main .tl-preview-wrap {
  max-height: 460px;
  flex: 1 1 auto;
  margin-inline: auto;
}
.tl-vignette-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}
.tl-vignette-overlay[hidden] {
  display: none !important;
}

.tl-vignette-overlay--heavy {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.72) 100%);
}
.tl-vignette-overlay--horror {
  background: radial-gradient(ellipse at center, transparent 28%, rgba(80, 0, 0, 0.45) 70%, rgba(0, 0, 0, 0.82) 100%);
}
.tl-cinematic-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(to bottom, #000 0, #000 12%, transparent 12%, transparent 88%, #000 88%, #000 100%);
}
.tl-cinematic-overlay[hidden] {
  display: none !important;
}
@keyframes tl-shake-kf {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(3px, -2px); }
  40% { transform: translate(-3px, 2px); }
  60% { transform: translate(2px, 3px); }
  80% { transform: translate(-2px, -1px); }
}
.tl-preview-wrap.tl-shake-active > video,
.tl-preview-wrap.tl-shake-active > .tl-player,
.tl-shake-active video#tl-player,
.tl-shake-active #tl-player {
  animation: tl-shake-kf 0.32s linear infinite;
}

.tl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.25rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tl-toolbar-spacer {
  flex: 1 1 auto;
}
.tl-tool-btn {
  font-weight: 600;
}

/* Timeline toolbar inline SVG icons (0.9.56) */
.tl-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
  opacity: 0.92;
  pointer-events: none;
}
.tl-ico-btn {
  gap: 0.35rem;
}
.tl-transport .tl-ico-btn,
.tl-toolbar .tl-ico-btn {
  white-space: nowrap;
}
.tl-toolbar .tl-ico-check,
.tl-transport .tl-ico-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
.tl-toolbar .tl-ico-check .tl-ico,
.tl-transport .tl-ico-check .tl-ico {
  width: 13px;
  height: 13px;
  opacity: 0.85;
}
.tl-zoom-btn.tl-ico-btn {
  padding: 0.2rem 0.4rem;
  min-width: 1.7rem;
}
.tl-zoom-btn .tl-ico {
  width: 13px;
  height: 13px;
}
#tl-export-btn .tl-ico {
  width: 15px;
  height: 15px;
}
.tl-ico--pause[hidden],
.tl-ico--play[hidden] {
  display: none !important;
}
.tl-fx-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.tl-fx-cat {
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.tl-fx-cat.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.tl-fx-cat:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.tl-fx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}
.tl-fx-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.tl-fx-tile.is-selected {
  border-color: rgba(129, 140, 248, 0.85);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35);
  background: rgba(99, 102, 241, 0.15);
}
.tl-fx-swatch {
  height: 44px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-size: cover;
  background-position: center;
}
.tl-fx-tile span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.tl-fx-scope {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
}
.tl-fx-hint {
  margin: 0;
  opacity: 0.8;
}
.tl-seg-mark.is-selected {
  border-color: rgba(250, 204, 21, 0.95) !important;
  background: rgba(250, 204, 21, 0.28) !important;
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.5);
}
.tl-seg-row.is-selected {
  border-color: rgba(250, 204, 21, 0.75);
  background: rgba(250, 204, 21, 0.08);
}
.tl-seg-markers {
  pointer-events: auto;
}
.tl-seg-mark {
  pointer-events: auto;
  cursor: pointer;
}


/* ——— Multi audio tracks + detach (0.9.24) ——— */
.tl-a-tracks {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.tl-track-lane--drop {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  opacity: 0.85;
}
.tl-a-drop-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  pointer-events: none;
}
.tl-audio-tracks-ui {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.45rem;
}
.tl-audio-track-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  background: var(--bg);
}
.tl-audio-track-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}
.tl-detach-mute-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  margin: 0;
  color: var(--text-secondary);
}
.tl-preview-wrap.is-dragover,
.tl-studio-main.is-dragover,
.tl-track-lane--drop:hover {
  outline: 2px dashed rgba(99, 102, 241, 0.7);
  outline-offset: 2px;
}
.tl-clip--audio {
  background: linear-gradient(90deg, #059669, #34d399);
}
.tl-track[data-track="a2"] .tl-clip--audio {
  background: linear-gradient(90deg, #0d9488, #2dd4bf);
}
.tl-track[data-track="a3"] .tl-clip--audio {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

/* ——— Working aspect toggle (0.9.24) ——— */
.tl-aspect-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-left: 0.15rem;
  background: rgba(0, 0, 0, 0.25);
}
.tl-aspect-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}
.tl-aspect-btn + .tl-aspect-btn {
  border-left: 1px solid var(--border);
}
.tl-aspect-btn.is-active {
  background: rgba(99, 102, 241, 0.35);
  color: var(--text);
}
.tl-aspect-ico {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  opacity: 0.9;
}
.tl-aspect-ico--land {
  width: 14px;
  height: 9px;
}
.tl-aspect-ico--port {
  width: 9px;
  height: 14px;
}
.tl-preview-wrap[data-format="9:16"] {
  max-width: 260px;
  max-height: 480px;
}
.tl-preview-wrap[data-format="16:9"] {
  max-width: 720px;
  max-height: 420px;
}
.tl-transport {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}


/* ——— Timeline Studio 0.9.25: multi-clip + speed-as-effect ——— */
.tl-v-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}
.tl-v-row .tl-track {
  flex: 1;
  min-width: 0;
}
.tl-add-clip-btn {
  flex: 0 0 2rem;
  align-self: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  border: 1px dashed var(--border, #475569);
  background: transparent;
  color: var(--text, #e2e8f0);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tl-add-clip-btn:hover,
.tl-add-clip-btn:focus-visible {
  border-color: var(--accent, #38bdf8);
  color: var(--accent, #38bdf8);
}
.tl-v-row.is-dragover .tl-add-clip-btn,
.tl-track-lane.is-dragover {
  outline: 1px dashed var(--accent, #38bdf8);
}
/* ——— Audio timeline + button (0.9.48) ——— */
.tl-a-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}
.tl-a-row .tl-a-tracks {
  flex: 1;
  min-width: 0;
}
.tl-a-row.is-dragover .tl-add-clip-btn {
  outline: 1px dashed var(--accent, #38bdf8);
}

.tl-v-blocks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.tl-v-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.35));
  border: 1px solid rgba(56, 189, 248, 0.5);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text, #e2e8f0);
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  z-index: 1;
}
.tl-v-block.is-active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.55), rgba(34, 197, 94, 0.45));
  border-color: #38bdf8;
}
.tl-clip--video .tl-handle,
.tl-clip--video .tl-holes,
.tl-clip--video .tl-seg-markers,
.tl-clip--video .tl-edit-range {
  z-index: 2;
}
.tl-clips-panel {
  margin: 0.5rem 0 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border, #334155);
}
.tl-clip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
  font-size: 0.8rem;
}
.tl-clip-row.is-active {
  color: var(--accent, #38bdf8);
}
.studio-lib-media-hint {
  margin: 0 0 0.6rem;
}
.studio-tool-list--effects {
  margin-top: 0.5rem;
  max-height: 50vh;
  overflow: auto;
}
.tl-fx-tile[data-fx-id^="speed-"] .tl-fx-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}


/* ——— Movavi-style library (0.9.29) ——— */
.studio-library--movavi {
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  flex: 0 0 300px;
  width: 300px;
  max-width: 320px;
}
.studio-lib-icons {
  flex: 0 0 52px;
  width: 52px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem 0.25rem;
  border-right: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
  overflow-y: auto;
}
[data-theme="light"] .studio-lib-icons {
  background: rgba(0,0,0,0.04);
}
.studio-lib-icon {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 0.35rem 0.15rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font: inherit;
  line-height: 1.1;
}
.studio-lib-icon > span:first-child {
  font-size: 1.05rem;
  font-weight: 800;
}
.studio-lib-icon-label {
  font-size: 0.58rem;
  font-weight: 700;
  text-align: center;
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-lib-icon.is-active {
  background: rgba(99, 102, 241, 0.28);
  color: var(--text);
}
.studio-lib-icon:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.studio-lib-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}
.studio-lib-cats {
  flex: 0 0 78px;
  width: 78px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.3rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
}
.studio-lib-cats:empty {
  display: none;
}
.studio-lib-cat {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 650;
  padding: 0.4rem 0.35rem;
  border-radius: 8px;
  cursor: pointer;
}
.studio-lib-cat.is-active {
  background: rgba(99, 102, 241, 0.22);
  color: var(--text);
}
.studio-lib-main {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
}
.studio-library--movavi .studio-lib-pane {
  gap: 0.45rem;
}
.studio-library--movavi .studio-lib-timeline-only {
  border-top: none;
  padding-top: 0;
}
.studio-library--movavi .tl-fx-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.studio-library--movavi .tl-fx-swatch {
  height: 40px;
}
.tl-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.tl-ov-item {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  max-width: 80%;
  transform: translate(-50%, -50%);
}
.tl-ov-item--text {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 8px rgba(0,0,0,0.5);
  font-weight: 700;
  white-space: nowrap;
  padding: 0.15rem 0.4rem;
}
.tl-ov-item--sticker img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
  display: block;
}
.tl-ov-item.is-selected {
  outline: 2px solid rgba(129,140,248,0.9);
  outline-offset: 2px;
}
.tl-tr-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.tl-tr-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 10px;
  margin-left: -5px;
  border-radius: 4px;
  background: linear-gradient(180deg, #a78bfa, #6366f1);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 0.55rem;
  color: #fff;
  font-weight: 800;
  padding-top: 2px;
}
.tl-tr-marker.is-drop-target {
  width: 16px;
  margin-left: -8px;
  background: linear-gradient(180deg, #34d399, #059669);
}
.tl-v-row.is-tr-drag-over .tl-track-lane {
  outline: 2px dashed rgba(167, 139, 250, 0.7);
  outline-offset: -2px;
}
.tl-overlay-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
}
.tl-overlay-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tl-overlay-row button {
  margin-left: auto;
}
.tl-text-editor {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.tl-fx-tile[draggable="true"] {
  cursor: grab;
}
.video-workspace {
  flex: 1 1 auto;
  min-width: 0;
}
@media (max-width: 900px) {
  .studio-library--movavi {
    flex-direction: column;
    width: 100%;
    max-width: none;
    flex: none;
    overflow: visible;
  }
  .studio-lib-icons {
    flex-direction: row;
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .studio-lib-body {
    flex-direction: column;
  }
  .studio-lib-cats {
    flex-direction: row;
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
}

/* Text / titles track (T) */
.tl-track--text .tl-track-label {
  color: #fbbf24;
}
.tl-clip--text {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  opacity: 0.95;
  color: #111;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  z-index: 2;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}
.tl-clip--text.is-selected {
  outline: 2px solid rgba(251, 191, 36, 0.95);
  outline-offset: 1px;
  z-index: 3;
}
.tl-clip--text .tl-handle {
  background: rgba(255,255,255,0.9);
}
.tl-overlay-row.is-selected {
  background: rgba(251, 191, 36, 0.12);
}
.tl-tx-opacity-val {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.tl-ov-item--text.has-bg {
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}
.tl-ov-item--text.no-shadow {
  text-shadow: none;
}


/* 0.9.29 — rotation / logo / export modal / selection */
.tl-rot-quick { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.25rem 0 0.5rem; }
.tl-rot-quick .btn { padding: 0.2rem 0.45rem; font-size: 0.75rem; }
.tl-sticker-editor, .tl-logo-editor { margin-top: 0.5rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; }
.tl-logo-editor h4 { margin: 0 0 0.4rem; font-size: 0.9rem; }

/* 0.9.57 — editable A-track clips (drag / trim), TTS marker */
.tl-clip--audio {
  cursor: grab;
  pointer-events: auto;
  z-index: 2;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}
.tl-clip--audio.is-dragging {
  cursor: grabbing;
  opacity: 0.88;
  z-index: 4;
}
.tl-clip--audio .tl-clip-label {
  flex: 1;
  min-width: 0;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #042f2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  line-height: 1.2;
}
.tl-clip--audio .tl-handle {
  pointer-events: auto;
  z-index: 3;
  opacity: 0.9;
}
.tl-clip--tts {
  background: linear-gradient(90deg, #7c3aed, #a78bfa) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.tl-clip--tts .tl-clip-label {
  color: #f5f3ff;
}

.tl-clip--audio.is-selected, .tl-ov-item--sticker.is-selected, .tl-ov-item--logo {
  outline: 2px solid var(--accent, #6c8cff);
}
.tl-ov-item--logo { z-index: 6; pointer-events: none; }
.tl-ov-item--text, .tl-ov-item--sticker { transform-origin: center center; }
.tl-export-modal-card { max-width: 480px; }
.tl-export-result-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.tl-share-block {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, rgba(127,127,127,0.35));
}
.tl-share-heading {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.tl-platform-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}
.tl-platform-btn {
  appearance: none;
  border: 1px solid var(--border, rgba(127,127,127,0.4));
  background: var(--surface-2, transparent);
  color: inherit;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1.2;
}
.tl-platform-btn.is-active {
  border-color: var(--accent, #6c8cff);
  background: color-mix(in srgb, var(--accent, #6c8cff) 18%, transparent);
  font-weight: 600;
}
.tl-platform-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* WIP badge on platform — still selectable so manual share works */
.tl-platform-btn.is-soon {
  /* keep full interactivity; badge signals API upload is WIP */
}
.tl-soon {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-left: 0.2rem;
  text-transform: lowercase;
}
.tl-platform-btn .wip-badge,
.tl-platform-wip {
  margin-left: 0.35rem;
  font-size: 0.62rem;
  padding: 0.05rem 0.35rem;
  vertical-align: middle;
}
.tl-share-block .field { margin-bottom: 0.55rem; }
.tl-share-block textarea {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
}
.tl-share-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.tl-share-tip { margin-top: 0.65rem; }
/* 0.9.66 — YouTube direct upload */
.tl-share-yt-privacy { display: flex; flex-direction: column; gap: 0.3rem; }
.tl-share-yt-privacy[hidden] { display: none; }
.tl-share-yt-privacy select { max-width: 16rem; }
.tl-share-yt-note { font-size: 0.78rem; opacity: 0.8; margin: 0; }
.tl-share-yt-result a { word-break: break-all; font-weight: 600; }
.tl-overlay-row.is-selected { background: color-mix(in srgb, var(--accent) 18%, transparent); }

/* 0.9.29 — start over / never clear source on last cut */


/* Auto-subtitles library pane */
.tl-subs-gen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.tl-subs-gen-row .field {
  flex: 1 1 7rem;
  min-width: 6rem;
}
.tl-subs-panel--mini .tl-subs-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.tl-subs-overlay[data-pos="top"] {
  top: 8%;
  bottom: auto;
}
.tl-subs-overlay[data-pos="middle"] {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}
.studio-lib-pane[data-studio-lib-pane="subtitles"] .tl-subs-list {
  max-height: min(28rem, 55vh);
  overflow: auto;
  margin-top: 0.55rem;
  position: relative;
  z-index: 2;
}


/* 0.9.31 — subtitle editor UX */
.studio-lib-pane[data-studio-lib-pane="subtitles"] .tl-subs-list {
  max-height: min(28rem, 55vh);
  overflow: auto;
  margin-top: 0.55rem;
  padding-right: 0.15rem;
  position: relative;
  z-index: 2;
}
.tl-subs-edit-hint {
  margin: 0.35rem 0 0.5rem;
  color: #cbd5e1;
  font-size: 0.8rem;
}
.tl-subs-empty {
  margin: 0.4rem 0;
}
.tl-track[data-track="s"] .tl-track-lane {
  min-height: 2rem;
}
.tl-track[data-track="s"] {
  min-height: 2.15rem;
}

/* Freemium lock: dim studio chrome; action buttons stay clickable for tooltips */
#tool-workspace.is-locked .timeline-studio,
#tool-workspace.is-locked .frames-studio {
  opacity: 0.72;
}
#tool-workspace.is-locked #tl-export-btn,
#tool-workspace.is-locked #tl-export-confirm,
#tool-workspace.is-locked #video-frames-download-btn,
#tool-workspace.is-locked #video-frames-suggest-btn,
#tool-workspace.is-locked #tl-sub-generate,
#tool-workspace.is-locked #video-process-btn {
  cursor: not-allowed;
}
button.is-paywall-locked,
a.is-paywall-locked {
  opacity: 0.55;
  cursor: not-allowed !important;
}
/* Disabled paywall buttons still show native title tooltips */
button.is-paywall-locked[disabled] {
  pointer-events: auto;
}

/* ===== 0.9.35 Timeline Studio Pack ===== */
.tl-zoom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.35rem;
}
.tl-zoom-wrap input[type="range"] {
  width: 5.5rem;
  accent-color: var(--accent, #6366f1);
}
.tl-zoom-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 2.4rem;
}
.tl-zoom-btn {
  padding: 0.15rem 0.45rem;
  min-width: 1.6rem;
}
.tl-viz-toggle {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  white-space: nowrap;
}
.tl-v2-row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
  margin-top: 0.2rem;
}
.tl-v2-row .tl-track {
  flex: 1;
}
.tl-v2-row.is-dragover .tl-track-lane--pip {
  outline: 2px dashed var(--accent, #6366f1);
  background: color-mix(in srgb, var(--accent, #6366f1) 12%, transparent);
}
.tl-track-lane--pip {
  position: relative;
  min-height: 2rem;
}
.tl-clip--pip {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  z-index: 2;
}
.tl-clip--pip.is-selected {
  outline: 2px solid #fbbf24;
}
.tl-pip-preview {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 6px;
  max-height: 45%;
  aspect-ratio: 9/16;
}
.tl-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.5rem 0;
}
.tl-fx-heavy {
  margin: 0.6rem 0;
  padding: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.tl-fx-heavy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.tl-pip-editor {
  margin-top: 0.6rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tl-filmstrip {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  opacity: 0.85;
  pointer-events: none;
  border-radius: 3px;
}
.tl-filmstrip img {
  flex: 1 1 0;
  height: 100%;
  object-fit: cover;
  min-width: 0;
}
.tl-waveform {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  padding: 2px;
  pointer-events: none;
  opacity: 0.7;
}
.tl-waveform i {
  flex: 1 1 0;
  min-width: 1px;
  background: rgba(56, 189, 248, 0.85);
  border-radius: 1px 1px 0 0;
  align-self: flex-end;
}
.tl-cover-picker {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.tl-board .tl-tracks {
  transform-origin: left top;
}

/* ===== 0.9.36 Timeline Studio: karaoke, track, ramp, compound, proxy ===== */
.tl-subs-overlay.is-karaoke {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2em;
  max-width: 92%;
}
.tl-subs-overlay .tl-kw {
  transition: color 0.08s linear, text-shadow 0.08s linear;
}
.tl-subs-overlay .tl-kw.is-active {
  color: var(--tl-karaoke-hl, #ffff00);
  text-shadow: 0 0 8px rgba(0,0,0,0.85), 0 1px 2px rgba(0,0,0,0.9);
}
.tl-karaoke-row {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}
.tl-speed-ramp-editor,
.tl-color-match-panel,
.tl-track-hint {
  margin-top: 0.65rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, rgba(0,0,0,0.12));
}
.tl-ramp-keys {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.4rem 0;
}
.tl-ramp-key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.tl-ramp-key-row input[type="number"] {
  width: 4.5rem;
}
.tl-compound-block {
  background: linear-gradient(135deg, rgba(168,85,247,0.45), rgba(56,189,248,0.35)) !important;
  border: 1px dashed rgba(255,255,255,0.35);
  font-weight: 600;
}
.tl-tool-btn.is-active,
#tl-track-mode.is-active {
  outline: 2px solid var(--accent, #38bdf8);
  background: rgba(56, 189, 248, 0.15);
}
.tl-proxy-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 20;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(0,0,0,0.65);
  color: #fde68a;
  pointer-events: none;
}
.tl-audio-role {
  min-width: 5.5rem;
}

/* ===== 0.9.40 WYSIWYG font picker ===== */
.sp-font-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0);
}
.sp-font-picker {
  position: relative;
  width: 100%;
}
.sp-font-picker__btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.sp-font-picker__btn:hover {
  border-color: rgba(129, 140, 248, 0.55);
}
.sp-font-picker.is-open .sp-font-picker__btn {
  border-color: rgba(129, 140, 248, 0.85);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.3);
}
.sp-font-picker__list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f172a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.sp-font-picker__opt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.sp-font-picker__opt:hover {
  background: rgba(99, 102, 241, 0.12);
}
.sp-font-picker__opt.is-selected {
  border-color: rgba(129, 140, 248, 0.75);
  background: rgba(99, 102, 241, 0.2);
}
.sp-font-picker__sample {
  font-size: 1.15rem;
  line-height: 1.25;
  color: #f8fafc;
}
.sp-font-picker__name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: system-ui, sans-serif !important;
}

/* Text style tiles: sample in actual font */
.tl-fx-tile .tl-tx-sample {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.01em;
  overflow: hidden;
  padding: 0 0.25rem;
}

/* ===== 0.9.40 on-canvas transform box ===== */
.tl-ov-item {
  touch-action: none;
}
.tl-ov-item.is-selected {
  outline: none;
}
.tl-ov-xform {
  position: absolute;
  inset: -6px;
  border: 1.5px solid rgba(129, 140, 248, 0.95);
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.35);
  z-index: 2;
}
.tl-ov-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #e0e7ff;
  border: 1.5px solid #6366f1;
  pointer-events: auto;
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
.tl-ov-handle--nw { left: -5px; top: -5px; cursor: nwse-resize; }
.tl-ov-handle--ne { right: -5px; top: -5px; cursor: nesw-resize; }
.tl-ov-handle--sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.tl-ov-handle--se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.tl-ov-handle--rot {
  left: 50%;
  top: -28px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  cursor: grab;
  background: #a5b4fc;
}
.tl-ov-rot-line {
  position: absolute;
  left: 50%;
  top: -22px;
  width: 1.5px;
  height: 16px;
  margin-left: -0.75px;
  background: rgba(129, 140, 248, 0.9);
  pointer-events: none;
}
.tl-ov-item--sticker.is-selected,
.tl-ov-item--text.is-selected {
  outline: none;
}
.tl-ov-content {
  position: relative;
  z-index: 1;
}

.tl-reverse-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 8;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.9);
  color: #0f172a;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.tl-fx-tile--anim .tl-fx-swatch {
  background-size: contain !important;
}

/* ===== 0.9.41 Transition library animated previews ===== */
.tl-fx-tile--tr .tl-tr-preview {
  position: relative;
  height: 52px;
  overflow: hidden;
  background: #0b1c2c;
  isolation: isolate;
}
.studio-library--movavi .tl-fx-tile--tr .tl-tr-preview {
  height: 48px;
}
.tl-tr-layer,
.tl-tr-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tl-tr-layer {
  background: center / cover no-repeat url("/static/img/tr-preview-sea.svg");
}
.tl-tr-layer--a {
  z-index: 1;
  filter: saturate(0.95) brightness(0.96);
}
.tl-tr-layer--b {
  z-index: 2;
  filter: hue-rotate(28deg) saturate(1.15) brightness(1.05);
  opacity: 0;
}
.tl-tr-fx {
  z-index: 3;
}

/* fade — soft opacity crossfade */
.tl-tr-preview[data-tr="fade"] .tl-tr-layer--b {
  animation: tl-tr-fade 2.4s ease-in-out infinite;
}
@keyframes tl-tr-fade {
  0%, 100% { opacity: 0; }
  45%, 55% { opacity: 1; }
}

/* fadeblack — dip to black */
.tl-tr-preview[data-tr="fadeblack"] .tl-tr-fx {
  background: #000;
  opacity: 0;
  animation: tl-tr-fadeblack 2.6s ease-in-out infinite;
}
.tl-tr-preview[data-tr="fadeblack"] .tl-tr-layer--b {
  opacity: 0;
  animation: tl-tr-fadeblack-b 2.6s ease-in-out infinite;
}
@keyframes tl-tr-fadeblack {
  0%, 100% { opacity: 0; }
  35% { opacity: 1; }
  50% { opacity: 1; }
  65% { opacity: 0; }
}
@keyframes tl-tr-fadeblack-b {
  0%, 40% { opacity: 0; }
  55%, 100% { opacity: 1; }
}

/* fadewhite — flash through white */
.tl-tr-preview[data-tr="fadewhite"] .tl-tr-fx {
  background: #fff;
  opacity: 0;
  animation: tl-tr-fadeblack 2.6s ease-in-out infinite;
}
.tl-tr-preview[data-tr="fadewhite"] .tl-tr-layer--b {
  opacity: 0;
  animation: tl-tr-fadeblack-b 2.6s ease-in-out infinite;
}

/* dissolve — soft blur + opacity */
.tl-tr-preview[data-tr="dissolve"] .tl-tr-layer--b {
  animation: tl-tr-dissolve 2.8s ease-in-out infinite;
}
@keyframes tl-tr-dissolve {
  0%, 100% { opacity: 0; filter: hue-rotate(28deg) saturate(1.15) blur(0); }
  40% { opacity: 0.55; filter: hue-rotate(28deg) saturate(1.15) blur(1.2px); }
  50% { opacity: 1; filter: hue-rotate(28deg) saturate(1.15) blur(0); }
}

/* wipe L/R/U/D via clip-path */
.tl-tr-preview[data-tr="wipeleft"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-wipe-l 2.4s ease-in-out infinite;
}
.tl-tr-preview[data-tr="wiperight"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-wipe-r 2.4s ease-in-out infinite;
}
.tl-tr-preview[data-tr="wipeup"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-wipe-u 2.4s ease-in-out infinite;
}
.tl-tr-preview[data-tr="wipedown"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-wipe-d 2.4s ease-in-out infinite;
}
@keyframes tl-tr-wipe-l {
  0%, 8% { clip-path: inset(0 100% 0 0); }
  45%, 55% { clip-path: inset(0 0 0 0); }
  92%, 100% { clip-path: inset(0 0 0 100%); }
}
@keyframes tl-tr-wipe-r {
  0%, 8% { clip-path: inset(0 0 0 100%); }
  45%, 55% { clip-path: inset(0 0 0 0); }
  92%, 100% { clip-path: inset(0 100% 0 0); }
}
@keyframes tl-tr-wipe-u {
  0%, 8% { clip-path: inset(100% 0 0 0); }
  45%, 55% { clip-path: inset(0 0 0 0); }
  92%, 100% { clip-path: inset(0 0 100% 0); }
}
@keyframes tl-tr-wipe-d {
  0%, 8% { clip-path: inset(0 0 100% 0); }
  45%, 55% { clip-path: inset(0 0 0 0); }
  92%, 100% { clip-path: inset(100% 0 0 0); }
}

/* diagonal wipe */
.tl-tr-preview[data-tr="diagtl"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-diag 2.5s ease-in-out infinite;
}
@keyframes tl-tr-diag {
  0%, 8% { clip-path: polygon(0 0, 0 0, 0 0); }
  45%, 55% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
  92%, 100% { clip-path: polygon(100% 100%, 100% 100%, 100% 100%); }
}

/* slide / push */
.tl-tr-preview[data-tr="slideleft"] .tl-tr-layer--b,
.tl-tr-preview[data-tr="smoothleft"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-slide-l 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.tl-tr-preview[data-tr="slideright"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-slide-r 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.tl-tr-preview[data-tr="slideleft"] .tl-tr-layer--a {
  animation: tl-tr-push-l 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.tl-tr-preview[data-tr="slideright"] .tl-tr-layer--a {
  animation: tl-tr-push-r 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.tl-tr-preview[data-tr="smoothleft"] .tl-tr-layer--a {
  animation: tl-tr-push-l 2.8s ease-in-out infinite;
}
.tl-tr-preview[data-tr="smoothleft"] .tl-tr-layer--b {
  animation-duration: 2.8s;
  animation-timing-function: ease-in-out;
}
@keyframes tl-tr-slide-l {
  0%, 8% { transform: translateX(100%); }
  45%, 55% { transform: translateX(0); }
  92%, 100% { transform: translateX(-100%); }
}
@keyframes tl-tr-slide-r {
  0%, 8% { transform: translateX(-100%); }
  45%, 55% { transform: translateX(0); }
  92%, 100% { transform: translateX(100%); }
}
@keyframes tl-tr-push-l {
  0%, 8% { transform: translateX(0); }
  45%, 55% { transform: translateX(-30%); }
  92%, 100% { transform: translateX(0); }
}
@keyframes tl-tr-push-r {
  0%, 8% { transform: translateX(0); }
  45%, 55% { transform: translateX(30%); }
  92%, 100% { transform: translateX(0); }
}

/* circle crop / open */
.tl-tr-preview[data-tr="circlecrop"] .tl-tr-layer--b {
  opacity: 1;
}
.tl-tr-preview[data-tr="circlecrop"] .tl-tr-layer--a {
  z-index: 3;
  animation: tl-tr-circle-crop 2.6s ease-in-out infinite;
}
.tl-tr-preview[data-tr="circleopen"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-circle-open 2.6s ease-in-out infinite;
}
@keyframes tl-tr-circle-crop {
  0%, 8% { clip-path: circle(75% at 50% 50%); }
  45%, 55% { clip-path: circle(0% at 50% 50%); }
  92%, 100% { clip-path: circle(75% at 50% 50%); }
}
@keyframes tl-tr-circle-open {
  0%, 8% { clip-path: circle(0% at 50% 50%); }
  45%, 55% { clip-path: circle(75% at 50% 50%); }
  92%, 100% { clip-path: circle(0% at 50% 50%); }
}

/* radial / iris sweep */
.tl-tr-preview[data-tr="radial"] .tl-tr-layer--b {
  opacity: 1;
  animation: tl-tr-radial 2.8s linear infinite;
}
@keyframes tl-tr-radial {
  0% { clip-path: circle(0% at 50% 50%); }
  40% { clip-path: circle(70% at 50% 50%); }
  50% { clip-path: circle(70% at 50% 50%); }
  90%, 100% { clip-path: circle(0% at 50% 50%); }
}

/* pixelize — mosaic grid + crossfade */
.tl-tr-preview[data-tr="pixelize"] .tl-tr-layer--a {
  animation: tl-tr-pixel-a 2.5s ease-in-out infinite;
}
.tl-tr-preview[data-tr="pixelize"] .tl-tr-layer--b {
  animation: tl-tr-pixel-b 2.5s ease-in-out infinite;
}
.tl-tr-preview[data-tr="pixelize"] .tl-tr-fx {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(15, 23, 42, 0.35) 5px 6px),
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(15, 23, 42, 0.35) 5px 6px);
  opacity: 0;
  animation: tl-tr-pixel-fx 2.5s ease-in-out infinite;
}
@keyframes tl-tr-pixel-a {
  0%, 100% { filter: saturate(0.95) brightness(0.96); transform: scale(1); }
  35%, 50% { filter: saturate(0.7) contrast(1.25); transform: scale(1.04); }
}
@keyframes tl-tr-pixel-b {
  0%, 35% { opacity: 0; }
  55%, 100% { opacity: 1; }
}
@keyframes tl-tr-pixel-fx {
  0%, 100% { opacity: 0; background-size: 100% 100%; }
  30%, 55% { opacity: 1; background-size: 100% 100%; }
  70% { opacity: 0.2; }
}

/* horizontal blur */
.tl-tr-preview[data-tr="hblur"] .tl-tr-layer--a {
  animation: tl-tr-hblur 2.5s ease-in-out infinite;
}
.tl-tr-preview[data-tr="hblur"] .tl-tr-layer--b {
  animation: tl-tr-hblur-b 2.5s ease-in-out infinite;
}
@keyframes tl-tr-hblur {
  0%, 100% { filter: saturate(0.95) brightness(0.96); transform: scaleX(1); }
  40%, 55% { filter: saturate(0.95) brightness(0.96) blur(3px); transform: scaleX(1.35); }
}
@keyframes tl-tr-hblur-b {
  0%, 35% { opacity: 0; filter: hue-rotate(28deg) saturate(1.15) blur(3px); transform: scaleX(1.35); }
  55%, 100% { opacity: 1; filter: hue-rotate(28deg) saturate(1.15) blur(0); transform: scaleX(1); }
}

/* distance / zoom */
.tl-tr-preview[data-tr="distance"] .tl-tr-layer--a {
  animation: tl-tr-zoom-out 2.6s ease-in-out infinite;
  transform-origin: center;
}
.tl-tr-preview[data-tr="distance"] .tl-tr-layer--b {
  animation: tl-tr-zoom-in 2.6s ease-in-out infinite;
  transform-origin: center;
}
@keyframes tl-tr-zoom-out {
  0%, 100% { transform: scale(1); opacity: 1; }
  45%, 55% { transform: scale(1.45); opacity: 0.15; }
}
@keyframes tl-tr-zoom-in {
  0%, 8% { opacity: 0; transform: scale(0.55); }
  45%, 55% { opacity: 1; transform: scale(1); }
  92%, 100% { opacity: 0; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .tl-tr-preview .tl-tr-layer,
  .tl-tr-preview .tl-tr-fx {
    animation: none !important;
  }
  .tl-tr-preview .tl-tr-layer--b {
    opacity: 0.55;
    clip-path: none;
    transform: none;
  }
}


/* —— Stage B: presets / silence / CTA / word filter / batch —— */
.tl-preset-picker, .tl-tpl-extras, .tl-silence-controls, .tl-cta-grid, .tl-batch-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.tl-silence-panel, .tl-cta-panel, .tl-wordfilter, .tl-batch-export {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, rgba(127,127,127,0.3));
}
.tl-silence-panel .field, .tl-wordfilter .field { margin-bottom: 0.45rem; }
.tl-cta-panel h4, .tl-wordfilter h4, .tl-batch-results h4 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
}
.tl-wf-diff {
  white-space: pre-wrap;
  max-height: 10rem;
  overflow: auto;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}
.tl-batch-links { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.4rem; }
.tl-preset-picker .tl-tpl-btn.is-active,
.tl-cta-btn.is-active {
  border-color: var(--accent, #6c8cff);
  font-weight: 600;
}

/* Stage C: brand kit */
.tl-brand-panel { margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--border, rgba(127,127,127,0.3)); }
.tl-brand-panel h4 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.tl-brand-row, .tl-brand-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.45rem 0; }
.tl-brand-swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }
.tl-brand-swatch {
  width: 1.6rem; height: 1.6rem; border-radius: 999px; border: 1px solid var(--border, #888);
  cursor: pointer; padding: 0;
}
.tl-brand-colors { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tl-brand-colors input[type=color] { width: 2.2rem; height: 2rem; padding: 0; border: none; background: transparent; }


/* Studio TTS (Voice library pane) */
.tl-tts-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.15rem 0 0.5rem;
}
.tl-tts-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}
.tl-tts-text-field textarea {
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  font: inherit;
  line-height: 1.35;
}
.tl-tts-count {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted, #888);
  text-align: right;
}
.tl-tts-voice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-end;
}
.tl-tts-voice-row .field {
  flex: 1 1 10rem;
  min-width: 0;
}
.tl-tts-voice-row select {
  width: 100%;
}
.tl-tts-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tl-tts-actions .btn-primary {
  width: 100%;
}
#tl-tts-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.85rem;
}
.studio-lib-pane[data-studio-lib-pane="voice"] .dropzone-hint {
  margin: 0;
}


/* Cloud projects panel (Media pane) */
.tl-projects-panel {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, rgba(127,127,127,0.3));
}
.tl-projects-panel h4 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.tl-projects-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.45rem 0;
}
.tl-projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 14rem;
  overflow: auto;
  margin-top: 0.35rem;
}
.tl-project-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border, rgba(127,127,127,0.25));
  border-radius: 8px;
  background: var(--surface-2, rgba(127,127,127,0.06));
}
.tl-project-row.is-active {
  border-color: var(--accent, #6c8cff);
}
.tl-project-meta {
  flex: 1 1 8rem;
  min-width: 0;
}
.tl-project-meta strong {
  display: block;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-project-meta span {
  display: block;
  font-size: 0.75rem;
  opacity: 0.75;
}
.tl-project-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.tl-audio-track-row.is-needs-reupload {
  outline: 1px dashed var(--warning, #f59e0b);
}
.tl-audio-needs-flag {
  font-size: 0.75rem;
  color: var(--warning, #f59e0b);
  margin-left: 0.35rem;
}


/* Audio volume / role (0.9.59) */
.tl-audio-vol-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.tl-audio-vol-slider {
  width: 90px;
  accent-color: var(--accent, #6366f1);
}
.tl-audio-vol-num {
  width: 4.2rem;
}
.tl-audio-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #312e81;
  color: #e0e7ff;
}
.tl-audio-badge--voice {
  background: #0f766e;
  color: #ccfbf1;
}
.tl-niche-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

/* 0.9.63 — centered export progress modal */
.tl-export-progress {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}
.tl-export-progress h3 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tl-export-progress-pct {
  font-size: clamp(2.4rem, 8vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text, #f4f4f5);
  margin: 0.35rem 0 1rem;
  font-variant-numeric: tabular-nums;
}
.tl-export-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.22);
  overflow: hidden;
  margin: 0 auto 0.85rem;
}
.tl-export-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent, #6c8cff), #a78bfa);
  transition: width 0.2s ease;
}
.tl-export-progress-wrap.is-indeterminate .tl-export-progress-bar,
.tl-export-progress-track.is-indeterminate .tl-export-progress-bar {
  width: 40% !important;
  animation: ct-progress-indeterminate 1.1s ease-in-out infinite;
}
.tl-export-progress-status {
  margin: 0 0 1rem;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.9rem;
  min-height: 1.35em;
}
.tl-export-progress-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
#tl-export-modal.is-exporting .modal-close,
#tl-export-modal.is-exporting [data-tl-export-close] {
  pointer-events: none;
  opacity: 0.35;
}
#tl-export-modal.is-exporting .modal-close {
  display: none;
}
#tl-export-modal.is-exporting .modal-backdrop {
  pointer-events: none;
  cursor: default;
}
@media (max-width: 480px) {
  .tl-export-modal-card:has(#tl-export-modal-progress:not([hidden])) {
    max-width: 100%;
  }
  .tl-export-progress-pct {
    font-size: 2.35rem;
  }
}
