.timeline-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-app);
  position: relative;
}

.precount-hud {
  position: absolute;
  left: 50%;
  top: 80px;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease-out;
}

.precount-hud:not([hidden]) {
  opacity: 1;
}

.precount-hud__digit {
  display: block;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
  transform: scale(0.92);
  transition: transform 90ms ease-out, color 120ms ease-out, opacity 120ms ease-out;
}

.precount-hud--pulse .precount-hud__digit {
  transform: scale(1);
}

.precount-hud--downbeat .precount-hud__digit {
  color: rgba(255, 255, 255, 0.98);
  font-weight: 600;
}

.precount-hud--final .precount-hud__digit {
  color: rgba(251, 191, 36, 0.95);
}

.precount-hud--out {
  opacity: 0;
}

.precount-hud--out .precount-hud__digit {
  transform: scale(0.75);
  opacity: 0;
}

.timeline-ruler-wrap {
  height: var(--ruler-height);
  flex-shrink: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  position: relative;
}

.timeline-ruler {
  display: block;
  height: 100%;
}

.timeline-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.timeline-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
  backface-visibility: hidden;
}

.timeline-grid {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.timeline-lanes {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.timeline-lane {
  flex: 1 1 0;
  min-height: var(--track-min-height);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  background: var(--bg-track);
}

.timeline-lane:last-child {
  border-bottom: none;
}

.timeline-lane--reference {
  background: var(--track-ref-bg);
  box-shadow: inset 3px 0 0 var(--track-ref-accent);
}

.timeline-lane--overdub-1 {
  background: var(--track-od1-bg);
  box-shadow: inset 3px 0 0 var(--track-od1-accent);
}

.timeline-lane--overdub-2 {
  background: var(--track-od2-bg);
  box-shadow: inset 3px 0 0 var(--track-od2-accent);
}

.timeline-lane--overdub-3 {
  background: var(--track-od3-bg);
  box-shadow: inset 3px 0 0 var(--track-od3-accent);
}

.timeline-lane--overdub-4 {
  background: var(--track-od4-bg);
  box-shadow: inset 3px 0 0 var(--track-od4-accent);
}

.timeline-lane__clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  border-radius: 4px;
  pointer-events: none;
  overflow: hidden;
}

.timeline-lane__clip--draggable {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.timeline-lane__clip--dragging {
  cursor: grabbing;
  z-index: 30;
  opacity: 0.95;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.65),
    0 8px 24px rgba(0, 0, 0, 0.4);
  filter: brightness(1.08);
}

.timeline-lane__clip--ghost {
  opacity: 0.28;
  pointer-events: none;
  z-index: 5;
  box-shadow: none;
  filter: none;
}

.timeline-lanes--dragging {
  cursor: grabbing;
}

.timeline-lanes--track-change {
  cursor: grabbing;
}

.timeline-lanes--track-change .timeline-lane--drop-source {
  opacity: 0.45;
}

.timeline-lane--drop-target,
.timeline-lane--drop-hover {
  background: rgba(59, 130, 246, 0.14) !important;
  box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.7);
  transition: background 80ms ease, box-shadow 80ms ease;
}

.timeline-lane--drop-target-invalid {
  background: rgba(239, 68, 68, 0.1) !important;
  box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.65);
  transition: background 80ms ease, box-shadow 80ms ease;
}

.timeline-lane--drop-source {
  opacity: 0.55;
  transition: opacity 80ms ease;
}

.timeline-lane__clip--track-change {
  z-index: 40;
  box-shadow:
    0 0 0 2px rgba(96, 165, 250, 0.85),
    0 10px 28px rgba(0, 0, 0, 0.45);
}

body.clip-drag-active {
  cursor: grabbing;
  user-select: none;
}

.clip-drag-hud {
  position: absolute;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(20, 20, 24, 0.94);
  border: 1px solid rgba(59, 130, 246, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  pointer-events: none;
  white-space: nowrap;
}

.clip-drag-hud__bars {
  color: var(--accent-play);
}

.clip-drag-hud__sep {
  color: var(--text-muted);
}

.clip-drag-hud__time {
  color: var(--text-secondary);
}

.clip-drag-hud__hint {
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border-subtle);
  color: var(--accent-selection);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clip-drag-hud--shift {
  border-color: rgba(96, 165, 250, 0.6);
}

.clip-drag-hud--shift .clip-drag-hud__hint {
  color: #60a5fa;
}

.clip-drag-hud--invalid {
  border-color: rgba(248, 113, 113, 0.55);
}

.clip-drag-hud--invalid .clip-drag-hud__hint {
  color: #f87171;
}

.timeline-lane__clip--reference {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.08);
}

.timeline-lane__clip--reference.timeline-lane__clip--draggable:hover:not(.timeline-lane__clip--dragging) {
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: inset 0 0 16px rgba(56, 189, 248, 0.12);
}

.timeline-lane__waveform {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  overflow: hidden;
  pointer-events: none;
}

.timeline-lane__waveform--reference {
  background: transparent;
  isolation: isolate;
}

.timeline-lane__waveform--reference > div {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  border: none !important;
  background: transparent !important;
}

.timeline-lane__waveform--reference audio,
.timeline-lane__waveform--reference video,
.timeline-lane__waveform--reference button {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  left: -9999px !important;
}

.timeline-lane__waveform--reference > div::part(cursor),
.timeline-lane__waveform--reference > div::part(scroll),
.timeline-lane__waveform--reference > div::part(wrapper),
.timeline-lane__waveform--reference > div::part(canvases),
.timeline-lane__waveform--reference > div::part(progress) {
  border: none !important;
  outline: none !important;
}

.timeline-lane__waveform--reference > div::part(cursor) {
  display: none !important;
  width: 0 !important;
  opacity: 0 !important;
}

.timeline-lane__waveform--reference > div::part(scroll) {
  overflow: hidden !important;
  scrollbar-width: none !important;
}

.timeline-lane__waveform--reference > div::part(scroll)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.timeline-lane__clip--overdub-1 {
  background: rgba(249, 115, 22, 0.22);
  border: 1px solid rgba(249, 115, 22, 0.45);
}

.timeline-lane__clip--overdub-2 {
  background: rgba(234, 179, 8, 0.22);
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.timeline-lane__clip--overdub-3 {
  background: rgba(34, 197, 94, 0.22);
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.timeline-lane__clip--overdub-4 {
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid rgba(168, 85, 247, 0.45);
}

.timeline-lane__clip--draggable:hover:not(.timeline-lane__clip--dragging):not(.timeline-lane__clip--recording) {
  filter: brightness(1.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-lane__precount {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--accent-rec);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.65);
  pointer-events: none;
  z-index: 12;
  animation: precount-pulse 0.65s ease-in-out infinite;
}

@keyframes precount-pulse {
  0%, 100% { opacity: 1; transform: scaleX(1); }
  50% { opacity: 0.45; transform: scaleX(1.6); }
}

.timeline-lane__clip--recording {
  border: 1px solid var(--accent-rec);
  animation: clip-recording 1s ease-in-out infinite;
}

.timeline-lane--overdub-1 .timeline-lane__clip--recording { background: rgba(249, 115, 22, 0.35); }
.timeline-lane--overdub-2 .timeline-lane__clip--recording { background: rgba(234, 179, 8, 0.35); }
.timeline-lane--overdub-3 .timeline-lane__clip--recording { background: rgba(34, 197, 94, 0.35); }
.timeline-lane--overdub-4 .timeline-lane__clip--recording { background: rgba(168, 85, 247, 0.35); }

@keyframes clip-recording {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  z-index: 50;
  pointer-events: none;
  will-change: transform;
}

.playhead__head {
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: var(--ruler-height);
  background: var(--accent-playhead);
  clip-path: polygon(50% 100%, 0 25%, 100% 25%);
  filter: drop-shadow(0 0 4px rgba(255, 59, 59, 0.6));
}

.playhead__line {
  position: absolute;
  top: var(--ruler-height);
  bottom: 0;
  left: -1px;
  width: var(--playhead-width);
  background: var(--accent-playhead);
  box-shadow: 0 0 8px rgba(255, 59, 59, 0.5);
}