.simple-video-editor-page {
  max-width: 1280px;
}

.editor-hero {
  margin-bottom: 20px;
}

.small-note {
  font-size: 0.92rem;
  color: #4b5563;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.panel-full {
  grid-column: 1 / -1;
}

.file-picker {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

.file-picker input[type="file"] {
  margin-top: 6px;
  display: block;
}

.scrubber-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0 8px;
}

.timecode {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 140px;
}

.playhead-scrubber {
  flex: 1;
  min-width: 160px;
}

.timeline-scroll {
  overflow-x: auto;
  border: 1px solid #374151;
  border-radius: 12px;
  background: #111827;
  margin-bottom: 8px;
}

.timeline-inner {
  position: relative;
  min-width: 600px;
}

.timeline-ruler {
  position: relative;
  height: 32px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
}

.timeline-ruler-tick {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: #9ca3af;
  white-space: nowrap;
}

.timeline-stack {
  position: relative;
  background: #111827;
}

.timeline-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: stretch;
  border-bottom: 1px solid #374151;
  min-height: 96px;
}

.timeline-row--lane-a .timeline-row-label {
  border-left: 4px solid #3b82f6;
}

.timeline-row--lane-b .timeline-row-label {
  border-left: 4px solid #a855f7;
}

.timeline-row--lane-c .timeline-row-label {
  border-left: 4px solid #10b981;
}

.timeline-row--has-content .timeline-row-label {
  background: #111827;
}

.timeline-row--flash .timeline-track {
  animation: lane-flash 1.2s ease;
}

@keyframes lane-flash {
  0%, 100% { background: #0f172a; }
  50% { background: #312e81; }
}

.broll-library-panel {
  margin: 12px 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.broll-library-title {
  margin: 0 0 6px;
  font-size: 1rem;
}

.broll-library-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.broll-library-item {
  display: grid;
  grid-template-columns: auto 56px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  cursor: grab;
}

.broll-library-item.drag-over {
  border-color: #7c3aed;
  background: #f5f3ff;
}

.broll-library-item--dragging {
  opacity: 0.55;
}

.broll-library-grip {
  color: #6b7280;
  font-size: 1.1rem;
  user-select: none;
}

.broll-library-thumb {
  width: 56px;
  height: 36px;
  border-radius: 6px;
  background: #111827 center / cover no-repeat;
  flex-shrink: 0;
}

.broll-library-thumb--empty {
  background: linear-gradient(135deg, #4c1d95, #7c3aed);
}

.broll-library-meta {
  min-width: 0;
}

.broll-library-meta strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.broll-library-meta span {
  font-size: 0.8rem;
  color: #6b7280;
}

.broll-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.broll-library-preview-wrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.broll-library-preview-video {
  width: 100%;
  max-height: 200px;
  border-radius: 10px;
  background: #000;
}

.lane-selection-overlay {
  touch-action: none;
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: rgba(250, 204, 21, 0.4);
  border: 2px solid #facc15;
  border-radius: 4px;
  z-index: 12;
  cursor: grab;
  pointer-events: auto;
}

.lane-selection-overlay:active {
  cursor: grabbing;
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-row-label {
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e7eb;
  background: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-row-tag {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
  background: #374151;
  padding: 1px 5px;
  border-radius: 4px;
}

.timeline-row--audio .timeline-row-label {
  color: #93c5fd;
}

.timeline-track {
  position: relative;
  min-height: 96px;
  background: #0f172a;
  cursor: crosshair;
}

.timeline-track--lane-a {
  background: #0c1424;
}

.timeline-track--lane-b {
  background: #120c1a;
}

.timeline-track--lane-c {
  background: #0c1612;
}

.timeline-row--drag-over .timeline-track,
.timeline-track.drag-over {
  outline: 2px dashed #60a5fa;
  outline-offset: -2px;
  background: #172554;
}

.timeline-row--drag-over .timeline-row-label {
  background: #1e3a8a;
  color: #fff;
}

.timeline-track-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.82rem;
  padding: 8px;
  text-align: center;
}

.timeline-track--audio {
  cursor: default;
  background: #0c1222;
}

.timeline-audio-bar {
  position: absolute;
  inset: 12px 8px;
  border-radius: 8px;
  background: repeating-linear-gradient(
    90deg,
    #1d4ed8 0,
    #1d4ed8 3px,
    #2563eb 3px,
    #2563eb 6px
  );
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-audio-label {
  font-size: 0.78rem;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.75);
  padding: 4px 8px;
  border-radius: 6px;
}

.timeline-segment {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  min-width: 56px;
  z-index: 2;
  cursor: grab;
}

.timeline-segment--lane-a {
  border: 2px solid #60a5fa;
}

.timeline-segment--lane-b {
  border: 2px solid #c084fc;
}

.timeline-segment--lane-c {
  border: 2px solid #34d399;
}

.timeline-segment--dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.timeline-segment-order {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 3;
  display: flex;
  gap: 2px;
}

.timeline-order-btn {
  border: none;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.timeline-order-btn:hover {
  background: #2563eb;
}

.timeline-segment--lane-c .timeline-segment-label {
  padding-right: 52px;
}

.timeline-row--drop-target,
.timeline-row--drag-over {
  outline: 2px dashed #2563eb;
  outline-offset: 2px;
  background: rgba(37, 99, 235, 0.08);
}

.timeline-segment-drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 22px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #fff;
  background: rgba(15, 23, 42, 0.82);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.timeline-segment-drag-handle:active {
  cursor: grabbing;
}

.timeline-segment-grip {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 23, 42, 0.78);
  border-radius: 4px;
  pointer-events: auto;
  cursor: grab;
}

.timeline-segment--lane-c .timeline-segment-grip {
  right: 52px;
}

.timeline-segment-filmstrip {
  display: flex;
  height: 100%;
  margin-left: 22px;
  width: calc(100% - 22px);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.timeline-segment-filmstrip--placeholder {
  background: linear-gradient(90deg, #374151, #6b7280);
}

.timeline-thumb {
  flex: 1 0 auto;
  min-width: 56px;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.timeline-drop-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  margin-left: -1px;
  background: #facc15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.35);
  z-index: 20;
  pointer-events: none;
}

.timeline-drop-marker::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #facc15;
}

.timeline-clip-dragging .timeline-segment--dragging {
  opacity: 0.45;
  pointer-events: none;
}

.timeline-segment-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  cursor: grab;
}

.timeline-segment-label:active {
  cursor: grabbing;
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 640px;
  min-height: 360px;
  background: #0a0a0a;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0;
  border: 1px solid #374151;
}

.preview-playback-toolbar {
  margin: 10px 0 14px;
  padding: 10px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.preview-playback-toolbar .playhead-scrubber {
  flex: 1;
  min-width: 120px;
}

.preview-layer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  max-width: 96%;
  max-height: 96%;
  object-fit: contain;
  background: transparent;
}

.preview-layer--base {
  z-index: 1;
  opacity: 1;
}

.preview-layer--base:not(.is-visible) {
  opacity: 0;
  pointer-events: none;
}

.export-preview-wrap {
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #2563eb;
  border-radius: 12px;
  background: #0f172a;
}

.export-preview-title {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #e2e8f0;
}

.export-preview-video {
  display: block;
  width: 100%;
  max-height: 480px;
  border-radius: 8px;
  background: #000;
}

.export-preview-wrap .button-row {
  margin-top: 12px;
  margin-bottom: 0;
}

.preview-layer--pip {
  z-index: 2;
  left: auto;
  top: auto;
  transform: none;
  width: 42%;
  max-width: 42%;
  max-height: 42%;
  right: 16px;
  bottom: 16px;
  border: 3px solid #c084fc;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.preview-layer--pip.is-visible {
  opacity: 1;
}

.preview-layer--overlay {
  z-index: 3;
  max-width: 96%;
  max-height: 96%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.preview-layer--overlay.is-visible {
  opacity: 1;
}

.preview-layer-label {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  margin: 0;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.88);
  border-radius: 8px;
  pointer-events: none;
}

.preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #4b5563;
}

.preview-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preview-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.preview-legend-dot--v1 { background: #3b82f6; }
.preview-legend-dot--v2 { background: #a855f7; }
.preview-legend-dot--broll { background: #10b981; }

.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 20;
  pointer-events: none;
  transform: translateX(-1px);
}

.timeline-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #ef4444;
}

.selection-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}

.btn-pill--small {
  font-size: 0.85rem;
  padding: 6px 12px;
}

.broll-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.broll-list li {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fafafa;
}

.broll-list a {
  word-break: break-word;
}

.slider-wrap {
  margin: 10px 0;
}

.slider-wrap input[type="range"] {
  width: 100%;
}

#bgTuneSelect {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.setup-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}

.setup-step {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  background: #fafafa;
}

.setup-step--locked {
  opacity: 0.72;
}

.setup-step-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.setup-step-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.setup-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-step--locked .setup-step-num {
  background: #9ca3af;
}

.setup-file-picker {
  margin-bottom: 8px;
}

.setup-file-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.setup-file-picker--inline {
  display: inline-block;
  margin: 0;
}

.setup-clap-actions {
  margin-top: 0.65rem;
}

.setup-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.setup-status {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: #4b5563;
}

.setup-status--done {
  color: #047857;
  font-weight: 600;
}

.setup-status--progress {
  color: #1d4ed8;
  font-weight: 600;
}

.setup-status--error {
  color: #b91c1c;
  font-weight: 600;
}

textarea#scriptInput {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  resize: vertical;
}


.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.status-text {
  margin: 10px 0;
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .timeline-row {
    grid-template-columns: 72px 1fr;
  }
}

.timeline-trim-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}

.timeline-trim-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.72);
  pointer-events: none;
}

.timeline-trim-shade--left {
  left: 0;
}

.timeline-trim-shade--right {
  right: 0;
}

.timeline-trim-keep {
  position: absolute;
  top: 0;
  bottom: 0;
  border-top: 2px solid rgba(255, 255, 255, 0.25);
  border-bottom: 2px solid rgba(255, 255, 255, 0.25);
  border-left: 2px solid #22c55e;
  border-right: 2px solid #ef4444;
  pointer-events: none;
}

.timeline-trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  margin-left: -7px;
  border-radius: 4px;
  cursor: ew-resize;
  pointer-events: auto;
  touch-action: none;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.85);
}

.timeline-trim-handle--start {
  background: #22c55e;
}

.timeline-trim-handle--end {
  background: #ef4444;
  left: auto;
  right: 0;
  margin-left: 0;
  margin-right: -7px;
}

.timeline-trim-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 28px;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.55);
  border-radius: 1px;
  box-shadow: 3px 0 0 rgba(15, 23, 42, 0.55);
}

body.timeline-trim-dragging {
  cursor: ew-resize;
  user-select: none;
}
