.trim-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: fade-up 0.45s ease both;
}

.trim-workspace.hidden {
  display: none;
}

.trim-guide,
.trim-times {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.trim-times {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.trim-video-wrap {
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  max-height: min(42vh, 360px);
  width: 100%;
}

#trim-source-video,
#trim-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.trim-filmstrip-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.trim-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.trim-zoom-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.trim-zoom-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.trim-zoom-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.trim-zoom-label {
  min-width: 2.4rem;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.trim-filmstrip-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0a0c12;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.trim-filmstrip {
  position: relative;
  width: 100%;
  height: 72px;
  user-select: none;
  -webkit-user-select: none;
}

.trim-filmstrip-frames {
  display: flex;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.trim-filmstrip-frames img {
  flex: 1 1 0;
  width: 0;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.trim-filmstrip-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.82);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.trim-filmstrip-loading[hidden] {
  display: none;
}

.trim-range-track {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  cursor: ew-resize;
}

.trim-keep {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(61, 214, 198, 0.18);
  background: transparent;
}

.trim-keep-left {
  left: 0;
  width: 0;
}

.trim-keep-right {
  right: 0;
  width: 0;
}

.trim-range-selected {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  border-top: 2px solid var(--danger);
  border-bottom: 2px solid var(--danger);
  background: repeating-linear-gradient(
    -45deg,
    rgba(8, 10, 16, 0.78),
    rgba(8, 10, 16, 0.78) 7px,
    rgba(255, 107, 122, 0.28) 7px,
    rgba(255, 107, 122, 0.28) 14px
  );
}

.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  margin-left: -9px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  pointer-events: none;
  z-index: 3;
}

.trim-handle-start {
  left: 0;
}

.trim-handle-end {
  left: 100%;
}

.trim-handle-bar {
  display: block;
  width: 10px;
  height: 100%;
  border-radius: 4px;
  background: var(--danger);
  box-shadow: 0 0 0 1px rgba(8, 16, 18, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35);
  position: relative;
}

.trim-handle-bar::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.75);
  transform: translate(-50%, -50%);
  box-shadow: 4px 0 0 rgba(255, 255, 255, 0.75);
}

.trim-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.55rem;
}

@media (max-width: 380px) {
  .trim-actions {
    grid-template-columns: 1fr;
  }

  .trim-filmstrip {
    height: 64px;
  }
}
