/* ===== Timeline ===== */
#timeline {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--timeline-h);
  background: rgba(25, 28, 34, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #d7dde6;
  z-index: 10;
}

#timeline .tl-toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#timeline .tl-btn {
  width: 30px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e9eef7;
  cursor: pointer;
  user-select: none;
}

#timeline .tl-btn:active {
  transform: translateY(1px);
}

#timeline .tl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#timeline .tl-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
  font-size: 12px;
}

#timeline .tl-meta-value {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#timeline .tl-meta-input {
  width: 80px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e9eef7;
  font-size: 12px;
  text-align: center;
}

#timeline .tl-meta-input:focus {
  outline: none;
  border-color: rgba(46, 140, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
}

#timeline .tl-meta-input.error {
  border-color: rgba(255, 80, 80, 0.6);
}

#timeline .tl-ruler {
  height: 46px;
  padding: 8px 10px 0 10px;
}

#timeline .tl-ruler-track {
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

#timeline .tl-ticks {
  height: 100%;
  display: flex;
  align-items: end;
  padding: 0 var(--tl-pad) 4px var(--tl-pad);
  position: relative;
}

#timeline .tl-tick {
  position: absolute;
  display: block;
  height: 100%;
  bottom: 0;
}

#timeline .tl-tick::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
}

#timeline .tl-tick.minor::before {
  height: 9px;
  opacity: 0.55;
}

#timeline .tl-tick.major::before {
  height: 16px;
  opacity: 0.95;
}

#timeline .tl-tick.major i {
  position: absolute;
  bottom: 16px;
  left: 0;
  font-style: normal;
  font-size: 11px;
  color: rgba(220, 230, 245, 0.9);
  white-space: nowrap;
  user-select: none;
  transform: translateX(-50%);
}

#timeline .tl-tick.major:first-child i {
  transform: translateX(0);
}

#timeline .tl-tick.major:last-child i {
  transform: translateX(-100%);
}

#timeline .tl-clip {
  height: calc(var(--timeline-h) - 36px - 46px);
  padding: 8px 10px 10px 10px;
}

#timeline .tl-clip-track {
  height: 100%;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

#timeline .tl-rows {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  bottom: 6px;
  padding: 0 var(--tl-pad);
  overflow: auto;
  overscroll-behavior: contain;
}

#timeline .tl-row {
  display: flex;
  align-items: center;
  gap: var(--tl-row-gap);
  height: 30px;
  margin: 4px 0;
}

#timeline .tl-row-track {
  position: relative;
  flex: 1;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#timeline .tl-row-track .tl-clip-range {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(46, 140, 255, 0.55),
    rgba(46, 140, 255, 0.25)
  );
  border: 1px solid rgba(46, 140, 255, 0.65);
  display: flex;
  align-items: stretch;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  cursor: grab;
  touch-action: none;
  transition: all 0.2s;
}

#timeline .tl-row-track .tl-clip-range.dragging {
  cursor: grabbing;
  opacity: 0.95;
}

#timeline .tl-row-track .tl-clip-range.resizing {
  cursor: ew-resize;
  opacity: 0.95;
}

#timeline .tl-row-track .tl-clip-range.selected {
  background: linear-gradient(
    90deg,
    rgba(255, 165, 0, 0.65),
    rgba(255, 165, 0, 0.35)
  );
  border: 2px solid rgba(255, 165, 0, 0.85);
  box-shadow: 0 6px 18px rgba(255, 165, 0, 0.3), 0 0 0 2px rgba(255, 165, 0, 0.2);
}

#timeline .tl-row-track .tl-range-body {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 8px;
  user-select: none;
  pointer-events: none;
}

#timeline .tl-row-track .tl-range-label {
  font-size: 12px;
  color: rgba(235, 245, 255, 0.95);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

#timeline .tl-row-track .tl-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 12px;
  cursor: ew-resize;
  background: transparent;
  z-index: 2;
}

#timeline .tl-row-track .tl-resize-handle::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: 3px;
  width: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  transition: background 0.2s;
}

#timeline .tl-row-track .tl-resize-handle:hover::after {
  background: rgba(255, 255, 255, 0.6);
}

#timeline .tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--tl-pad);
  width: 2px;
  background: rgba(255, 80, 80, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 80, 80, 0.2), 0 0 8px rgba(255, 80, 80, 0.4);
  pointer-events: none;
  z-index: 10;
}
