/* ============================================================
   Timeline editor
   ============================================================ */

.timeline-modal { width: min(1100px, calc(100vw - 40px)) !important; }
.timeline-modal .modal-head { padding: 14px 18px 10px; }
.timeline-modal .modal-body { padding: 0 14px 12px; }
.timeline-modal .modal-foot { padding: 12px 16px; }

.tl { display: flex; flex-direction: column; gap: 12px; }
.tl-main { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 14px; }
.tl-left { min-width: 0; }

.tl-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  background: #080809;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.tl-preview > img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.92; }
.tl-subtitle {
  position: absolute;
  left: 6%; right: 6%;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  color: #fff;
  pointer-events: none;
  white-space: pre-wrap;
}
.tl-subtitle[data-pos="bottom"] { bottom: 8%; }
.tl-subtitle[data-pos="center"] { top: 50%; transform: translateY(-50%); }
.tl-subtitle[data-pos="top"] { top: 8%; }
.tl-bigplay {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(10,10,11,0.48);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24);
  backdrop-filter: blur(8px);
  transition: opacity 0.15s;
}
.tl-bigplay:hover { background: rgba(10,10,11,0.68); }

.tl-transport {
  height: 34px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tl-transport .icon-btn { width: 26px; height: 26px; }
.tl-time { font-size: 10px; color: #8c8c94; font-variant-numeric: tabular-nums; }
.tl-scrub {
  position: relative;
  flex: 1;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.tl-scrub::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  border-radius: 3px;
  background: #2c2c30;
}
.tl-scrub i { position: absolute; left: 0; height: 3px; background: #e8e8ec; border-radius: 3px; }
.tl-scrub b {
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-4px);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.3);
}

/* inspector */
.tl-inspector {
  background: #141415;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.075);
  padding: 10px 11px;
  min-height: 300px;
  max-height: 420px;
  overflow-y: auto;
}
.tl-sec { font-size: 10.5px; color: #74747c; letter-spacing: 0.04em; text-transform: uppercase; margin: 2px 0 10px; }
.tl-field { margin-bottom: 9px; display: flex; flex-direction: column; gap: 5px; }
.tl-field > label { font-size: 10px; color: #7e7e86; }
.tl-field.half { flex-direction: row; gap: 8px; }
.tl-field.half > div { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tl-field input, .tl-field select, .tl-field textarea {
  width: 100%;
  background: #0e0e0f;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  padding: 6px 7px;
  font-size: 11px;
  color: #e2e2e6;
  outline: none;
  resize: none;
}
.tl-field input:focus, .tl-field select:focus, .tl-field textarea:focus { border-color: rgba(110,168,255,0.6); }
.tl-field input[type="color"] { height: 27px; padding: 2px; }
.tl-static { font-size: 10.5px; color: #9a9aa2; }
.tl-check { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: #9a9aa2; margin: 4px 0 10px; }
.tl-check input { accent-color: #6ea8ff; }
.tl-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tl-row .btn { height: 26px; padding: 0 8px; font-size: 10.5px; }
.tl-row .btn.danger { color: #ff9b9b; }
.tl-empty { font-size: 11px; color: #66666e; padding: 20px 4px; line-height: 1.7; }

/* timeline */
.tl-timeline {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 10px;
}
.tl-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tl-tools .btn { height: 26px; padding: 0 8px; font-size: 10.5px; }
.tl-hint { font-size: 9.5px; color: #5f5f67; }
.tl-scroll { position: relative; }
.tl-ruler {
  position: relative;
  height: 18px;
  margin-left: 44px;
  margin-bottom: 3px;
}
.tl-tick {
  position: absolute;
  top: 0;
  font-size: 8.5px;
  color: #5f5f67;
  transform: translateX(-50%);
  white-space: nowrap;
}
.tl-tick i { display: block; width: 1px; height: 4px; background: #3a3a40; margin: 0 auto 2px; }

.tl-track { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: stretch; }
.tl-head {
  font-size: 9px;
  color: #6a6a72;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.tl-lane {
  position: relative;
  height: 58px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: #121213;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.045);
  overflow: hidden;
}
.tl-track:nth-child(4) .tl-lane { height: 40px; }
.tl-track:nth-child(5) .tl-lane { height: 36px; }

.tl-clip {
  position: absolute;
  top: 5px; bottom: 5px;
  min-width: 18px;
  border-radius: 4px;
  overflow: hidden;
  background: #1c1c1f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  cursor: grab;
}
.tl-clip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.68; }
.tl-clip::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.55));
}
.tl-clip.is-selected { box-shadow: inset 0 0 0 1.5px #8fc0ff, 0 0 0 1px rgba(110,168,255,0.25); }
.tl-clip.is-active { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.7); }
.tl-clip-name {
  position: absolute;
  left: 6px; right: 6px; bottom: 5px;
  z-index: 2;
  font-size: 8.5px;
  color: #ececf0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.tl-clip-dur {
  position: absolute;
  right: 5px; top: 4px;
  z-index: 2;
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(0,0,0,0.55);
  color: #d6d6dc;
}
.tl-clip-trans {
  position: absolute;
  left: 4px; top: 4px;
  z-index: 2;
  font-size: 7.5px;
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(20,32,52,0.75);
  color: #9dc2ff;
}
.tl-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 7px;
  z-index: 3;
  cursor: ew-resize;
  background: rgba(255,255,255,0.001);
}
.tl-handle.left { left: 0; }
.tl-handle.right { right: 0; }
.tl-clip:hover .tl-handle { background: rgba(143,192,255,0.35); }

.tl-sub-block {
  position: absolute;
  top: 8px;
  height: 24px;
  padding: 0 6px;
  border-radius: 3px;
  background: rgba(255,196,120,0.16);
  box-shadow: inset 0 0 0 1px rgba(255,196,120,0.32);
  font-size: 9px;
  line-height: 24px;
  color: #ffd9a8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.tl-sub-block.is-selected { background: rgba(255,196,120,0.28); box-shadow: inset 0 0 0 1px #ffc478; }

.tl-audio-wave {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  opacity: 0.55;
}
.tl-audio-wave i { flex: 1; background: #4a5b6d; border-radius: 1px; min-height: 2px; }

.tl-playhead {
  position: absolute;
  top: 18px;
  bottom: 4px;
  width: 1px;
  background: #ff6b6b;
  pointer-events: none;
  z-index: 5;
}
.tl-playhead::before {
  content: "";
  position: absolute;
  top: -3px; left: -4px;
  width: 9px; height: 6px;
  background: #ff6b6b;
  border-radius: 2px 2px 0 0;
}

@media (max-width: 900px) {
  .tl-main { grid-template-columns: 1fr; }
  .tl-inspector { max-height: none; }
}

/* 片段拖拽排序 */
body.tl-dragging { cursor: grabbing; }
body.tl-dragging .tl-clip { cursor: grabbing; }
body.tl-dragging .tl-clip:hover { outline: 1px dashed rgba(110,168,255,0.6); }
