:root {
  color-scheme: light;
  --canvas: oklch(96.8% 0.006 305);
  --surface: oklch(99% 0.004 305);
  --surface-raised: oklch(100% 0.003 305);
  --surface-muted: oklch(94.3% 0.009 305);
  --ink: oklch(24% 0.025 303);
  --ink-secondary: oklch(45% 0.023 303);
  --ink-tertiary: oklch(59% 0.018 303);
  --line: oklch(87.5% 0.012 303);
  --line-strong: oklch(76% 0.018 303);
  --accent: oklch(50% 0.165 303);
  --accent-hover: oklch(44% 0.17 303);
  --accent-soft: oklch(92.5% 0.035 303);
  --extra: oklch(78% 0.145 82);
  --extra-soft: oklch(95.5% 0.045 82);
  --danger: oklch(56% 0.19 26);
  --danger-soft: oklch(95% 0.04 26);
  --success: oklch(52% 0.12 151);
  --success-soft: oklch(95% 0.035 151);
  --info: oklch(55% 0.13 240);
  --shadow-sm: 0 1px 2px oklch(22% 0.025 303 / 0.06), 0 5px 14px oklch(22% 0.025 303 / 0.04);
  --shadow-md: 0 18px 50px oklch(22% 0.025 303 / 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --topbar-height: 64px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.has-segment-editor { overflow: hidden; }

button, input, select { font: inherit; }
button { color: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 800;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-xl);
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: oklch(98.6% 0.005 305 / 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 720;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 9px;
  background: var(--ink);
}
.brand-mark i { border-radius: 50%; background: var(--surface); }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { background: var(--extra); }

.project-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--ink-secondary);
  font-size: 0.875rem;
}
.project-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--success); }

.topbar-actions { display: flex; align-items: center; gap: var(--space-sm); }
.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: var(--space-sm);
  color: var(--ink-secondary);
  font-size: 0.75rem;
}
.local-badge > span { color: var(--success); font-size: 0.625rem; }

.button,
.analyze-button,
.view-tab,
.icon-button,
.step-action,
.toast button,
.time-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 40px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 0.8125rem;
  font-weight: 650;
  transition: background 180ms cubic-bezier(.16, 1, .3, 1), color 180ms cubic-bezier(.16, 1, .3, 1), transform 180ms cubic-bezier(.16, 1, .3, 1), border-color 180ms cubic-bezier(.16, 1, .3, 1);
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--accent); color: var(--surface); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.button-secondary:hover { border-color: var(--ink-tertiary); }
.button-quiet { background: transparent; color: var(--ink-secondary); }
.button-quiet:hover { background: var(--surface-muted); color: var(--ink); }
.button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

main { width: min(100%, 1600px); margin: 0 auto; padding: 0 28px 80px; }

.intro-section {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3xl);
  padding: 56px 0 36px;
}
.eyebrow {
  margin: 0 0 var(--space-sm);
  color: var(--accent);
  font-size: 0.6875rem;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
h1, h2, h3, p { text-wrap: pretty; }
h1 {
  max-width: 18ch;
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.16;
  font-weight: 740;
  letter-spacing: -0.045em;
}
.intro-copy { max-width: 58ch; margin: 16px 0 0; color: var(--ink-secondary); font-size: 0.9375rem; }
.intro-stat {
  align-self: flex-end;
  min-width: 280px;
  padding: 4px 0 4px 24px;
  border-left: 1px solid var(--line-strong);
}
.intro-stat strong, .intro-stat span { display: block; }
.intro-stat strong { font-size: 0.875rem; }
.intro-stat span { margin-top: var(--space-xs); color: var(--ink-tertiary); font-size: 0.75rem; }

.upload-panel {
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-xl); }
.section-heading > div { display: flex; align-items: baseline; gap: var(--space-md); }
.section-heading h2 { margin: 0; font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.025em; }
.section-heading p { max-width: 60ch; margin: 0; color: var(--ink-tertiary); font-size: 0.8125rem; }
.section-heading.compact { align-items: center; }
.step-number { color: var(--accent); font-size: 0.6875rem; font-weight: 760; font-variant-numeric: tabular-nums; }

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-md);
  margin-top: 20px;
}
.dropzone {
  position: relative;
  min-height: 112px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  column-gap: var(--space-md);
  align-items: center;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--canvas);
  cursor: pointer;
  transition: border-color 180ms cubic-bezier(.16, 1, .3, 1), background 180ms cubic-bezier(.16, 1, .3, 1);
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.lane-badge { position: absolute; top: 10px; right: 10px; padding: 3px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; }
.lane-a { background: var(--ink); color: var(--surface); }
.lane-b { background: var(--accent-soft); color: var(--accent-hover); }
.upload-icon {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--accent);
  font-size: 1.25rem;
}
.dropzone-title { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; font-weight: 680; }
.dropzone-meta { align-self: start; color: var(--ink-tertiary); font-size: 0.75rem; }

.analyze-button {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  transition: background 180ms cubic-bezier(.16, 1, .3, 1), transform 180ms cubic-bezier(.16, 1, .3, 1);
}
.analyze-button:hover:not(:disabled) { background: var(--accent); transform: translateY(-1px); }
.analyze-button:disabled { cursor: not-allowed; opacity: 0.35; }

.trim-step { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.trim-summary-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border-block: 1px solid var(--line); }
.trim-summary { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px 18px 16px 0; }
.trim-summary + .trim-summary { padding-inline: 18px 0; border-left: 1px solid var(--line); }
.trim-summary .lane-badge { position: static; }
.trim-summary > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trim-summary strong, .trim-summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trim-summary strong { font-size: 0.8125rem; }
.trim-summary > div span { color: var(--ink-tertiary); font-size: 0.6875rem; }
.trim-summary .button { min-height: 34px; padding-inline: 10px; font-size: 0.75rem; }
.trim-actions { display: flex; align-items: center; justify-content: flex-end; padding-top: 18px; }
.trim-actions .analyze-button { min-width: 200px; min-height: 48px; padding: 10px 18px; border: 0; }

.segment-editor-backdrop { position: fixed; inset: 0; z-index: 450; display: grid; place-items: center; padding: 20px; background: oklch(18% 0.018 303 / 0.64); }
.segment-editor { width: min(1180px, 100%); height: min(900px, calc(100vh - 40px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 28px 90px oklch(16% 0.03 303 / 0.34); }
.segment-editor-header { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.segment-editor-header > div { min-width: 0; display: flex; align-items: center; gap: 12px; }
.segment-editor-header .lane-badge { position: static; }
.segment-editor-header h2 { margin: 0; font-size: 1rem; }
.segment-editor-header div div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.segment-editor-header div div span { overflow: hidden; color: var(--ink-tertiary); font-size: 0.6875rem; text-overflow: ellipsis; white-space: nowrap; }
.segment-editor-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; padding: 20px 24px 18px; }
.segment-video-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; place-items: center; gap: 12px; border-radius: var(--radius-md); background: var(--canvas); }
.segment-video-frame { position: relative; width: 100%; height: 100%; min-height: 0; max-height: 520px; overflow: hidden; background: var(--ink); }
.segment-video-frame video, .segment-video-frame img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--ink); object-fit: contain; }
.segment-video-frame img { z-index: 2; image-rendering: auto; }
.segment-playback { display: flex; align-items: center; justify-content: center; gap: 7px; padding-bottom: 12px; color: var(--ink-tertiary); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.segment-play-button { width: 34px; height: 34px; display: grid; place-items: center; margin-right: 4px; border-radius: 50%; background: var(--ink); color: var(--surface); font-size: 0.75rem; }
.segment-editor-controls { display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.segment-editor-controls > div:first-child { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.segment-editor-controls .segment-file-name { overflow: hidden; max-width: 100%; margin-bottom: 6px; letter-spacing: 0; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.segment-editor-controls > div:first-child strong { font-size: 1.125rem; }
.segment-editor-controls > div:first-child > span { color: var(--ink-tertiary); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.segment-editor-controls > p:last-child { margin: auto 0 0; color: var(--ink-tertiary); font-size: 0.75rem; line-height: 1.55; }
.segment-timeline-area { padding: 16px 24px 12px; border-top: 1px solid var(--line); }
.segment-timeline-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; }
.segment-timeline-copy strong { font-size: 0.75rem; }
.segment-timeline-copy span { color: var(--ink-tertiary); font-size: 0.6875rem; }
.segment-timeline { position: relative; height: 92px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-muted); cursor: crosshair; }
.segment-filmstrip { position: absolute; inset: 0; display: flex; }
.segment-frame { flex: 1; min-width: 0; background-position: center; background-size: cover; border-right: 1px solid oklch(99% 0.004 305 / 0.45); }
.segment-blocks { position: absolute; inset: 0; }
.segment-block { position: absolute; inset-block: 0; overflow: hidden; padding: 0; border: 1px solid oklch(98% 0.006 303 / 0.8); background: transparent; color: transparent; }
.segment-block.is-excluded { background: oklch(22% 0.025 303 / 0.68); }
.segment-block.is-selected { z-index: 3; outline: 4px solid var(--accent); outline-offset: -4px; box-shadow: inset 0 0 0 999px oklch(50% 0.165 303 / 0.2); }
.segment-block.is-selected::before { content: "当前片段"; position: absolute; top: 6px; right: 6px; z-index: 2; padding: 3px 6px; border-radius: 5px; background: var(--accent); color: var(--surface); font-size: 0.625rem; font-weight: 700; }
.segment-block::after { content: attr(data-label); position: absolute; left: 6px; bottom: 5px; z-index: 2; padding: 2px 5px; border-radius: 4px; background: oklch(20% 0.02 303 / 0.78); color: oklch(96% 0.006 303); font-size: 0.625rem; }
.segment-block.is-excluded::after { content: "不分析 · " attr(data-label); }
.segment-playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 6; width: 2px; background: var(--accent); pointer-events: none; }
.segment-playhead::before { content: ""; position: absolute; top: 0; left: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); }
.segment-hover-time { position: absolute; top: 6px; left: 0; z-index: 8; padding: 3px 6px; border-radius: 5px; background: oklch(20% 0.02 303 / 0.88); color: oklch(96% 0.006 303); font-size: 0.625rem; font-variant-numeric: tabular-nums; pointer-events: none; transform: translateX(-50%); }
.segment-ticks { display: flex; justify-content: space-between; padding-top: 6px; color: var(--ink-tertiary); font-size: 0.625rem; font-variant-numeric: tabular-nums; }
.segment-editor-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }

.analysis-progress { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.progress-copy { display: flex; justify-content: space-between; gap: var(--space-lg); margin-bottom: var(--space-sm); font-size: 0.75rem; }
.progress-copy span { color: var(--ink-tertiary); }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-muted); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 250ms cubic-bezier(.16, 1, .3, 1); }

.results-section { padding-top: 48px; }
.results-header { display: flex; align-items: end; justify-content: space-between; gap: var(--space-xl); }
.view-tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.view-tab { min-height: 34px; padding: 0 13px; border-radius: 7px; background: transparent; color: var(--ink-secondary); font-size: 0.75rem; font-weight: 650; }
.view-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.view-panel { margin-top: 22px; }
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}
.metric-item { min-width: 0; padding: 18px 24px; border-right: 1px solid var(--line); }
.metric-item:first-child { padding-left: 0; }
.metric-item:last-child { border-right: 0; }
.metric-label { display: block; color: var(--ink-tertiary); font-size: 0.6875rem; font-weight: 650; }
.metric-values { display: flex; align-items: baseline; gap: var(--space-sm); margin-top: var(--space-sm); font-variant-numeric: tabular-nums; }
.metric-values strong { font-size: 1.25rem; line-height: 1; letter-spacing: -0.03em; }
.metric-values span { color: var(--ink-tertiary); font-size: 0.75rem; }
.metric-delta { display: inline-flex; margin-top: var(--space-sm); padding: 2px 7px; border-radius: 99px; background: var(--surface-muted); color: var(--ink-secondary); font-size: 0.6875rem; }
.metric-delta.is-warn { background: var(--extra-soft); color: oklch(44% 0.1 68); }

.difference-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin: 24px 0;
  padding: 14px 16px;
  border: 1px solid oklch(88% 0.07 82);
  border-radius: var(--radius-md);
  background: var(--extra-soft);
}
.difference-icon { width: 22px; height: 22px; display: grid; flex: none; place-items: center; border-radius: 50%; background: var(--extra); color: oklch(29% 0.07 70); font-size: 0.75rem; font-weight: 800; }
.difference-note strong { display: block; font-size: 0.8125rem; }
.difference-note p { margin: 2px 0 0; color: oklch(45% 0.045 72); font-size: 0.75rem; }
.difference-note > div { min-width: 0; flex: 1; }
.difference-note > button { flex: none; align-self: center; }
.difference-note.is-empty { border-color: var(--line); background: var(--surface-muted); }
.difference-note.is-empty .difference-icon { background: var(--line-strong); color: var(--ink-secondary); }
.difference-note.is-empty p { color: var(--ink-secondary); }

.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xl); margin-bottom: var(--space-md); }
.board-toolbar > div:first-child { display: flex; align-items: baseline; gap: var(--space-md); }
.board-toolbar strong { font-size: 0.875rem; }
.board-toolbar span { color: var(--ink-tertiary); font-size: 0.6875rem; }
.board-toolbar-actions { display: flex; align-items: center; gap: var(--space-xl); }
.button-compact { min-height: 34px; padding-inline: 11px; font-size: 0.75rem; }
.legend { display: flex; gap: var(--space-lg); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.neutral { background: var(--line-strong); }
.legend-dot.extra { background: var(--extra); }
.legend-dot.interruption { background: var(--danger); }

.range-bar {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 340;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  width: min(760px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 14px;
  border: 1px solid oklch(82% 0.055 303);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}
.range-bar > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.range-bar strong { font-size: 0.8125rem; }
.range-bar span { color: var(--ink-secondary); font-size: 0.6875rem; }
.range-actions { display: flex; align-items: center; gap: var(--space-sm); }
.button-danger { border-color: oklch(82% 0.075 26); background: var(--danger-soft); color: var(--danger); }
.button-danger:hover:not(:disabled) { border-color: var(--danger); background: oklch(92% 0.055 26); }

.board-scroller {
  overflow: auto;
  max-height: min(calc(100vh - 80px), 980px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}
.flow-board {
  min-width: max-content;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
}
.lane-row { width: max-content; display: grid; grid-template-columns: 96px repeat(var(--lane-columns), 180px); gap: 1px; background: var(--line); }
.flow-board.is-empty {
  width: 100%;
  min-width: 0;
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(520px, auto);
  place-items: center;
  background: var(--surface);
}
.board-empty {
  width: min(440px, calc(100% - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.board-empty-visual {
  width: 104px;
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
}
.board-empty-visual i {
  position: relative;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}
.board-empty-visual i::before,
.board-empty-visual i::after {
  content: "";
  position: absolute;
  top: 50%;
  height: 5px;
  border-radius: 99px;
  background: var(--line-strong);
  transform: translateY(-50%);
}
.board-empty-visual i::before { left: 10px; width: 22px; }
.board-empty-visual i::after { left: 39px; right: 10px; }
.board-empty strong { font-size: 1rem; }
.board-empty p { max-width: 38ch; margin: 8px 0 18px; color: var(--ink-secondary); font-size: 0.8125rem; line-height: 1.6; }
.board-empty .button { min-height: 40px; }
.lane-heading, .step-cell { background: var(--surface); }
.board-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--ink-tertiary);
  font-size: 0.6875rem;
  font-weight: 650;
}
.difference-cell {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 8px;
  color: var(--ink-tertiary);
  font-size: 0.625rem;
  font-weight: 650;
}
.difference-index { flex: none; color: var(--ink-tertiary); font-size: 0.5625rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.difference-label { overflow: hidden; min-width: 0; white-space: nowrap; text-overflow: ellipsis; }
.difference-cell.is-extra { background: var(--extra-soft); color: oklch(42% 0.1 72); }
.difference-cell.is-interruption { background: var(--danger-soft); color: var(--danger); }
.difference-cell.is-extra .difference-index, .difference-cell.is-interruption .difference-index { color: currentColor; opacity: 0.72; }
.lane-heading {
  position: sticky;
  left: 0;
  z-index: 10;
  min-height: 432px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 10px;
}
.lane-heading strong { font-size: 0.75rem; }
.lane-heading span { color: var(--ink-tertiary); font-size: 0.625rem; writing-mode: vertical-rl; text-orientation: mixed; }
.lane-heading .lane-badge { position: static; align-self: flex-start; writing-mode: initial; transform: none; }

.step-cell { min-height: 432px; padding: 6px; }
.step-cell.is-empty { display: flex; align-items: center; justify-content: center; background: var(--canvas); }
.empty-step { display: grid; place-items: center; gap: var(--space-sm); color: var(--ink-tertiary); text-align: center; font-size: 0.6875rem; }
.empty-step::before { content: ""; width: 28px; height: 1px; background: var(--line-strong); }

.step-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.step-card[data-type="success"] .status-tag { background: var(--success-soft); color: var(--success); }
.step-card[data-type="input"] .status-tag { background: var(--accent-soft); color: var(--accent-hover); }
.step-card[data-type="loading"] .status-tag { background: oklch(94% 0.035 240); color: var(--info); }
.step-card[data-type="failure"] .status-tag, .step-card[data-type="interruption"] .status-tag { background: var(--danger-soft); color: var(--danger); }
.time-button { position: absolute; top: 5px; right: 5px; z-index: 5; min-height: 24px; padding: 0 6px; border-radius: 5px; background: oklch(95% 0.012 303 / 0.94); color: var(--accent-hover); font-size: 0.625rem; font-variant-numeric: tabular-nums; opacity: 0; pointer-events: none; transition: opacity 160ms ease-out; }
.time-button:hover { background: var(--accent-soft); }
.step-card:hover .time-button, .step-card:focus-within .time-button { opacity: 1; pointer-events: auto; }
.phone-shot {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 1206 / 2622;
  border-radius: 2px;
  background: var(--surface-muted);
  box-shadow: none;
  appearance: none;
  cursor: pointer;
}
.phone-shot img { width: 100%; height: 100%; display: block; object-fit: cover; }
.phone-shot::after { content: "查看视频"; position: absolute; inset: auto 8px 8px; padding: 5px 7px; border-radius: 6px; background: oklch(22% 0.025 303 / 0.84); color: oklch(96% 0.006 303); font-size: 0.625rem; text-align: center; opacity: 0; transform: translateY(4px); transition: opacity 180ms cubic-bezier(.16, 1, .3, 1), transform 180ms cubic-bezier(.16, 1, .3, 1); }
.phone-shot:hover::after { opacity: 1; transform: translateY(0); }
.card-mask { position: absolute; z-index: 2; border-radius: 3px; background: oklch(26% 0.02 303 / 0.9); backdrop-filter: blur(8px); }
.card-mask.partial { background: repeating-linear-gradient(90deg, oklch(30% 0.02 303 / 0.88) 0 4px, oklch(58% 0.018 303 / 0.88) 4px 7px); }
.step-title-input { width: 100%; padding: 2px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); font-size: 0.6875rem; line-height: 1.25; font-weight: 680; text-overflow: ellipsis; }
.step-title-input:hover { border-color: var(--line); }
.step-title-input:focus { border-color: var(--accent); background: var(--surface-raised); outline: 0; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.status-tag { overflow: hidden; max-width: 78px; padding: 3px 5px; border-radius: 99px; background: var(--surface-muted); color: var(--ink-secondary); font-size: 0.5625rem; white-space: nowrap; text-overflow: ellipsis; transition: opacity 160ms ease-out; }
.status-tag.needs-review { background: var(--extra-soft); color: oklch(44% 0.1 68); }
.step-actions { position: absolute; right: 0; bottom: 0; z-index: 5; display: flex; gap: 1px; padding: 2px; border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none; transition: opacity 160ms ease-out; }
.step-card:hover .step-actions, .step-card:focus-within .step-actions { opacity: 1; pointer-events: auto; }
.step-card:hover .status-tag, .step-card:focus-within .status-tag { opacity: 0; }
.batch-select-indicator { position: absolute; top: 7px; left: 7px; z-index: 7; width: 22px; height: 22px; display: none; place-items: center; border: 1px solid oklch(80% 0.035 303); border-radius: 50%; background: oklch(98% 0.006 303 / 0.94); color: transparent; font-size: 0.6875rem; font-weight: 800; box-shadow: var(--shadow-sm); }
.flow-board.is-batch-selecting .batch-select-indicator { display: grid; }
.flow-board.is-batch-selecting .step-card { cursor: pointer; }
.flow-board.is-batch-selecting .step-actions, .flow-board.is-batch-selecting .time-button { display: none; }
.flow-board.is-batch-selecting .phone-shot::after { content: "点选页面"; }
.step-card.is-batch-selected .phone-shot { outline: 3px solid var(--accent); outline-offset: 2px; }
.step-card.is-batch-selected .step-title-input { color: var(--accent-hover); }
.step-card.is-batch-selected .batch-select-indicator { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.step-action { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: transparent; color: var(--ink-tertiary); font-size: 0.6875rem; }
.step-action:hover { background: var(--surface-muted); color: var(--ink); }
.step-action.delete:hover { background: var(--danger-soft); color: var(--danger); }

.metrics-layout { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(600px, 2fr); gap: 64px; padding: 36px 0; border-block: 1px solid var(--line); }
.metrics-summary h3 { max-width: 15ch; margin: 0; font-size: 1.75rem; line-height: 1.22; letter-spacing: -0.04em; }
.metrics-summary > p:last-child { max-width: 42ch; margin: 16px 0 0; color: var(--ink-secondary); font-size: 0.875rem; }
.metrics-table-wrap { overflow-x: auto; }
.metrics-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.metrics-table th, .metrics-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.metrics-table th { color: var(--ink-tertiary); font-size: 0.6875rem; font-weight: 650; }
.metrics-table td:first-child { font-weight: 650; }
.table-delta { color: var(--ink-secondary); }
.table-delta.warn { color: oklch(44% 0.11 72); font-weight: 680; }
.feedback-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--line); }
.feedback-item { padding: 20px; background: var(--surface); }
.feedback-item span { color: var(--ink-tertiary); font-size: 0.6875rem; }
.feedback-item strong { display: block; margin-top: 8px; font-size: 0.875rem; }
.feedback-item.is-empty strong { color: var(--ink-tertiary); font-weight: 550; }
.feedback-bars { display: flex; gap: 4px; margin-top: 14px; }
.feedback-bars i { height: 5px; flex: 1; border-radius: 99px; background: var(--surface-muted); }
.feedback-bars i.a { background: var(--ink-secondary); }
.feedback-bars i.b { background: var(--accent); }

.inspector {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 400;
  width: min(420px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateX(105%);
  transition: transform 240ms cubic-bezier(.16, 1, .3, 1);
}
.inspector.is-open { transform: translateX(0); }
.inspector-backdrop { position: fixed; inset: 0; z-index: 350; background: oklch(20% 0.02 303 / 0.24); }
.inspector-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); padding: 16px 20px; border-bottom: 1px solid var(--line); }
.inspector-header .eyebrow { margin-bottom: 2px; }
.inspector-header h2 { margin: 0; font-size: 1.125rem; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-muted); color: var(--ink-secondary); font-size: 1.25rem; }
.icon-button:hover { background: var(--line); color: var(--ink); }
.inspector-body { overflow-y: auto; display: flex; flex-direction: column; padding: 20px; }
.inspector video { width: 100%; max-height: 290px; border-radius: var(--radius-md); background: var(--ink); }
.timestamp-row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 22px; color: var(--ink-tertiary); font-size: 0.75rem; }
.timestamp-row button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 0.75rem; }
.field-label { margin: 12px 0 6px; color: var(--ink-secondary); font-size: 0.6875rem; font-weight: 650; }
.text-field { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); font-size: 0.8125rem; }
.text-field:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.segment-tools { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.segment-tools strong, .segment-tools span { display: block; }
.segment-tools strong { font-size: 0.8125rem; }
.segment-tools span { max-width: 44ch; margin-top: 3px; color: var(--ink-tertiary); font-size: 0.6875rem; }
.segment-tool-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-top: 12px; }
.privacy-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-md); margin: 24px 0 10px; }
.privacy-heading strong, .privacy-heading span { display: block; }
.privacy-heading strong { font-size: 0.8125rem; }
.privacy-heading span { margin-top: 2px; color: var(--ink-tertiary); font-size: 0.6875rem; }
.privacy-heading select { min-height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 0.75rem; }
.mask-stage { position: relative; align-self: center; overflow: hidden; width: min(260px, 100%); border-radius: 15px; background: var(--surface-muted); box-shadow: 0 0 0 1px var(--line); user-select: none; touch-action: none; }
.mask-stage.is-drawing { cursor: crosshair; box-shadow: 0 0 0 2px var(--accent); }
.mask-stage img { width: 100%; display: block; pointer-events: none; }
#maskLayer { position: absolute; inset: 0; pointer-events: none; }
.editable-mask { position: absolute; border: 1px solid oklch(94% 0.02 303); border-radius: 3px; background: oklch(25% 0.02 303 / 0.88); box-shadow: 0 0 0 1px var(--accent); }
.editable-mask.partial { background: repeating-linear-gradient(90deg, oklch(26% 0.02 303 / 0.9) 0 6px, oklch(64% 0.015 303 / 0.88) 6px 10px); }
.editable-mask.preview { opacity: 0.65; }
.mask-actions { display: flex; gap: var(--space-sm); justify-content: center; margin-top: 12px; }
.privacy-note { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-tertiary); font-size: 0.6875rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 500;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 260px;
  padding: 12px 14px 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.75rem;
}
.toast button { margin-left: auto; padding: 5px 8px; border-radius: 6px; background: oklch(34% 0.04 303); color: var(--extra); font-size: 0.75rem; font-weight: 680; }

@media (max-width: 1080px) {
  .local-badge { display: none; }
  .upload-grid { grid-template-columns: 1fr 1fr; }
  .trim-summary-grid { grid-template-columns: 1fr; }
  .trim-summary + .trim-summary { padding-inline: 0; border-top: 1px solid var(--line); border-left: 0; }
  .metrics-layout { grid-template-columns: 1fr; gap: 28px; }
  .metrics-summary h3 { max-width: none; }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr; gap: var(--space-md); padding: 0 16px; }
  .project-name { display: none; }
  .topbar-actions { justify-self: end; }
  .topbar-actions .button-quiet, .topbar-actions .button-secondary { display: none; }
  main { padding-inline: 16px; }
  .intro-section { flex-direction: column; padding-top: 36px; }
  .intro-stat { align-self: stretch; }
  h1 { font-size: 1.875rem; }
  .upload-panel { padding: 18px; }
  .section-heading, .results-header { align-items: flex-start; flex-direction: column; }
  .upload-grid { grid-template-columns: 1fr; }
  .trim-actions { align-items: stretch; flex-direction: column; gap: 12px; }
  .trim-actions p { text-align: left; }
  .trim-actions .analyze-button { width: 100%; }
  .segment-editor-backdrop { padding: 0; }
  .segment-editor { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .segment-editor-workspace { grid-template-columns: 1fr; gap: 12px; padding: 14px 16px; overflow: auto; }
  .segment-video-frame { max-height: 46vh; }
  .segment-editor-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .segment-editor-controls > div:first-child, .segment-editor-controls > p:last-child { grid-column: 1 / -1; }
  .segment-timeline-area { padding-inline: 16px; }
  .view-tabs { width: 100%; }
  .view-tab { flex: 1; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-item { padding: 16px; border-bottom: 1px solid var(--line); }
  .metric-item:first-child { padding-left: 16px; }
  .metric-item:nth-child(2) { border-right: 0; }
  .metric-item:nth-child(n+3) { border-bottom: 0; }
  .board-toolbar { align-items: flex-start; flex-direction: column; }
  .board-toolbar-actions { width: 100%; align-items: flex-start; justify-content: space-between; }
  .range-bar { align-items: flex-start; flex-direction: column; }
  .range-actions { width: 100%; justify-content: flex-end; }
  .legend { flex-wrap: wrap; }
  .feedback-grid { grid-template-columns: 1fr; }
  .inspector { width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
