* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --unchanged: #484f58;
  --removed: #f85149;
  --removed-bg: rgba(248, 81, 73, 0.15);
  --added: #3fb950;
  --added-bg: rgba(63, 185, 80, 0.15);
  --video-changed: #d29922;
  --video-changed-bg: rgba(210, 153, 34, 0.15);
  --audio-changed: #58a6ff;
  --audio-changed-bg: rgba(88, 166, 255, 0.15);
  --fully-changed: #bc8cff;
  --fully-changed-bg: rgba(188, 140, 255, 0.15);
  --trimmed: #f0883e;
  --trimmed-bg: rgba(240, 136, 62, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header .meta {
  color: var(--text-muted);
  font-size: 13px;
}

/* Summary Bar */
.summary {
  display: flex;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}

.summary .stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Filter Bar */
.filters {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--text-muted);
}

.filter-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Timeline */
.timeline-container {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.timeline-scroll::-webkit-scrollbar {
  height: 6px;
}

.timeline-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.timeline-inner {
  min-width: 100%;
  /* Width is set dynamically via JS based on segment count */
}

.timeline-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-track {
  width: 100%;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: 4px;
  border: 1px solid var(--border);
  position: relative;
}

.timeline-row {
  display: flex;
  height: 32px;
  gap: 1px;
  border-radius: 4px;
  overflow: hidden;
}

/* Viewport indicator — shows which segments are visible in the card list */
.timeline-viewport-indicator {
  position: absolute;
  top: 0;
  height: 100%;
  border: 2px solid var(--text);
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
  opacity: 0.5;
  transition: left 0.15s ease, width 0.15s ease;
}

.timeline-viewport-box {
  position: relative;
}

.timeline-seg {
  height: 100%;
  cursor: pointer;
  transition: opacity 0.15s;
  position: relative;
  min-width: 3px;
}

.timeline-seg:hover {
  opacity: 0.8;
}

.timeline-seg.selected {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  z-index: 1;
}

.timeline-gap {
  height: 100%;
  min-width: 3px;
  cursor: pointer;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.04) 3px,
    rgba(255, 255, 255, 0.04) 6px
  );
}

.timeline-gap:hover {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.08) 3px,
    rgba(255, 255, 255, 0.08) 6px
  );
}

.timeline-seg.unchanged { background: var(--unchanged); }
.timeline-seg.removed { background: var(--removed); }
.timeline-seg.added { background: var(--added); }
.timeline-seg.video_changed { background: var(--video-changed); }
.timeline-seg.audio_changed { background: var(--audio-changed); }
.timeline-seg.fully_changed { background: var(--fully-changed); }
.timeline-seg.trimmed { background: var(--trimmed); }

/* Segment List */
.segment-list {
  padding: 0 24px 24px;
}

.segment-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.segment-card:hover {
  border-color: var(--text-muted);
}

.segment-card.selected {
  border-color: var(--text);
}

.segment-card.hidden {
  display: none;
}

.segment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.segment-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-unchanged { background: var(--unchanged); color: var(--text); }
.badge-removed { background: var(--removed-bg); color: var(--removed); }
.badge-added { background: var(--added-bg); color: var(--added); }
.badge-video_changed { background: var(--video-changed-bg); color: var(--video-changed); }
.badge-audio_changed { background: var(--audio-changed-bg); color: var(--audio-changed); }
.badge-fully_changed { background: var(--fully-changed-bg); color: var(--fully-changed); }
.badge-trimmed { background: var(--trimmed-bg); color: var(--trimmed); }

.segment-time {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.segment-similarity {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

.segment-detail {
  display: none;
  padding: 0 16px 16px;
}

.segment-card.expanded .segment-detail {
  display: block;
}

/* Side-by-side comparison */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.comparison.single {
  grid-template-columns: 1fr;
}

.comp-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.comp-panel .label {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.comp-panel img,
.comp-panel video {
  width: 100%;
  display: block;
}

.comp-panel .placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Waveforms */
.waveforms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.waveforms img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Metrics */
.metrics {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.metrics strong {
  color: var(--text);
}

/* Notes */
.note-area {
  display: flex;
  gap: 8px;
}

.note-area textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 36px;
}

.note-area textarea:focus {
  outline: none;
  border-color: var(--audio-changed);
}

/* Export bar */
.export-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.export-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--added);
  color: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.export-btn:hover {
  opacity: 0.9;
}

.keyboard-hint {
  font-size: 12px;
  color: var(--text-muted);
}

kbd {
  background: var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
}

/* Bottom padding for export bar */
.segment-list {
  padding-bottom: 72px;
}
