.page-header.timeline-header {
  margin-bottom: 12px;
}

.header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.win-icon-sm.icon-tint,
.win-btn img.win-icon-sm {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  transition: filter 0.15s ease, opacity 0.15s ease;
  filter: brightness(0.9) contrast(1.2);
}

.win-btn.active img.win-icon-sm,
.win-btn.active .icon-tint {
  filter: invert(20%) sepia(85%) saturate(1200%) hue-rotate(170deg) brightness(105%);
}

.win-btn.primary img.win-icon-sm,
.win-btn.primary .icon-tint {
  filter: brightness(0) invert(1);
}

.win-btn.danger img.win-icon-sm,
.win-btn.danger .icon-tint {
  filter: invert(45%) sepia(80%) saturate(1800%) hue-rotate(330deg) brightness(110%);
}

.win-btn.danger:hover img.win-icon-sm {
  filter: brightness(0) invert(1);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-time-display {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  background: #0A0A0C;
  color: #60CDFF;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(96, 205, 255, 0.25);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.5px;
}

.time-divider {
  color: #555560;
  margin: 0 4px;
}

#time-total {
  color: #888890;
}

.zoom-controls {
  display: flex;
  align-items: center;
  background: #18181C;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px;
}

.zoom-badge {
  font-size: 0.72rem;
  font-family: monospace;
  font-weight: 600;
  color: #AAA;
  padding: 0 6px;
  min-width: 38px;
  text-align: center;
}

.win-btn.icon-only {
  padding: 3px 8px;
  min-width: 24px;
}

.win-select.sm {
  background: #18181C;
  color: #EEE;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
}

.win-btn.xs {
  font-size: 0.7rem;
  padding: 2px 6px;
  height: 22px;
  background: #25252A;
  border: 1px solid #3A3A40;
  color: #CCC;
  border-radius: 4px;
}

.win-btn.xs:hover {
  background: #3A3A42;
  color: #FFF;
}

.timeline-inspector-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #16161A;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 8px 14px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: #AAA;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap;
}

.inspector-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inspector-label {
  color: #666670;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.5px;
}

.inspector-val {
  font-family: monospace;
  color: #DDD;
  font-weight: 600;
}

.inspector-val.highlight {
  color: #60CDFF;
  font-weight: 700;
  font-family: inherit;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-nudge-group {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.timeline-card {
  padding: 0;
  max-height: calc(100vh - 220px);
  overflow: auto;
  background: #121214;
  border: 1px solid var(--bg-card-border, #2D2D30);
  border-radius: var(--radius-corner, 8px);
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.timeline-waveform-container {
  display: flex;
  background: #0A0A0C;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 25;
  width: max-content;
}

.ruler-corner-box {
  width: 48px;
  background: #18181C;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  left: 0;
  z-index: 30;
  flex-shrink: 0;
}

.waveform-ruler-wrapper {
  flex: 1;
  position: relative;
  min-width: 0;
}

#timeline-waveform {
  height: 48px;
  width: 100%;
  display: block;
}

.timeline-ruler {
  height: 22px;
  background: #16161A;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  width: 100%;
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.65rem;
  color: #888890;
  padding-left: 4px;
  line-height: 20px;
  font-family: monospace;
}

.timeline-tracks-container {
  display: flex;
  flex-direction: column;
  min-width: 100%;
  padding-bottom: 32px;
  position: relative;
  width: max-content;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 100%;
}

.timeline-playhead {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  background: #FF3B30;
  z-index: 40;
  cursor: ew-resize;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.9);
  will-change: transform, height;
}

.timeline-snap-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  border-left: 1px dashed #60CDFF;
  z-index: 19;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 6px rgba(96, 205, 255, 0.8);
  will-change: transform, height;
}

.timeline-playhead-handle {
  pointer-events: auto;
}

.timeline-playhead-handle {
  position: absolute;
  top: 4px;
  left: -7px;
  width: 16px;
  height: 16px;
  background: #FF3B30;
  clip-path: polygon(0% 0%, 100% 0%, 100% 60%, 50% 100%, 0% 60%);
  cursor: ew-resize;
  pointer-events: auto;
  z-index: 36;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: transform 0.1s ease, background 0.1s ease;
  will-change: top;
}

.timeline-playhead-handle:hover,
.timeline-playhead-handle.dragging {
  transform: scale(1.35);
  background: #FF6057;
}

.timeline-snap-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  border-left: 1px dashed #60CDFF;
  z-index: 19;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 6px rgba(96, 205, 255, 0.8);
}

.timeline-snap-guide.active {
  display: block;
}

.timeline-row {
  display: flex;
  height: 42px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  transition: background 0.15s ease;
}

.timeline-row.active-playing-row {
  background: rgba(96, 205, 255, 0.05);
}

.timeline-row.bg-row {
  background: rgba(255, 185, 0, 0.03);
}

.timeline-row-label {
  width: 48px;
  background: #18181C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-color, #60CDFF);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  left: 0;
  z-index: 15;
  user-select: none;
  flex-shrink: 0;
  cursor: help;
}

.timeline-row-content {
  flex: 1;
  position: relative;
  height: 100%;
}

.timeline-word-block {
  position: absolute;
  top: 5px;
  height: 31px;
  background: rgba(0, 120, 212, 0.35);
  border: 1px solid var(--accent-color, #0078D4);
  border-radius: 4px;
  color: #FFFFFF;
  font-size: clamp(9px, 0.75rem, 12px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  cursor: grab;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  box-sizing: border-box;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  will-change: left, width;
}

.timeline-word-block.too-small {
  font-size: 0;
  color: transparent;
}

.timeline-word-block:hover {
  background: rgba(0, 120, 212, 0.6);
  border-color: #60CDFF;
}

.timeline-word-block.selected {
  border-color: #60CDFF;
  box-shadow: 0 0 0 2px #60CDFF, 0 4px 12px rgba(96, 205, 255, 0.4);
  z-index: 8;
  background: rgba(0, 120, 212, 0.7);
}

.timeline-word-block.dragging {
  cursor: grabbing;
  opacity: 0.92;
  z-index: 10;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7);
}

.timeline-word-block.unsynced {
  background: rgba(120, 120, 128, 0.2);
  border-color: #555560;
  color: #AAAAAA;
  border-style: dashed;
}

.timeline-word-block.line-block {
  background: rgba(255, 185, 0, 0.25);
  border-color: #FFB900;
}

.timeline-resize-handle-left,
.timeline-resize-handle-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 5;
  cursor: ew-resize;
  opacity: 0.25;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.timeline-resize-handle-left {
  left: 0;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.timeline-resize-handle-right {
  right: 0;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.timeline-resize-handle-left:hover,
.timeline-resize-handle-right:hover {
  opacity: 1;
  background: #60CDFF;
}

.win-btn.active {
  background: rgba(96, 205, 255, 0.15);
  border-color: #1f343d;
  color: #60CDFF;
}

.timeline-word-input {
  background: #1F1F24;
  border: 1px solid #60CDFF;
  color: #FFF;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 3px;
  padding: 2px 4px;
  text-align: center;
  width: 90%;
  outline: none;
}