@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #0d100e;
  --surface: #151916;
  --surface-raised: #1b201c;
  --line: #2c332e;
  --line-strong: #424b44;
  --text: #f2f4ef;
  --muted: #929b94;
  --accent: #d9ff57;
  --accent-ink: #11150b;
  --warm: #ff8a5b;
  --ready: #78d9a6;
  --warning: #f2bd5b;
  --header-height: 68px;
  --sidebar-width: 304px;
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--header-height) minmax(calc(100vh - var(--header-height)), auto);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 16, 14, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "DM Mono", monospace;
  font-size: 17px;
  font-weight: 500;
  transform: skew(-5deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.topbar-actions,
.run-status,
.clip-actions,
.control-group {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 14px;
}

.run-status {
  gap: 8px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.status-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(242, 189, 91, 0.12);
}

.run-status.is-complete .status-light {
  background: var(--ready);
  box-shadow: 0 0 0 4px rgba(120, 217, 166, 0.12);
}

.icon-button,
.round-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  font-size: 18px;
}

.icon-button:hover,
.round-button:hover,
.toggle-button:hover {
  border-color: var(--line-strong);
  background: #242a25;
}

.library {
  position: sticky;
  top: var(--header-height);
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100vh - var(--header-height));
  border-right: 1px solid var(--line);
  background: rgba(18, 22, 19, 0.92);
}

.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 25px 20px 17px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.library h1,
.clip-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.library h1 {
  font-size: 18px;
  line-height: 1.2;
}

.count-badge {
  min-width: 28px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  text-align: center;
}

.filter-row,
.view-control,
.mode-control,
.pipeline-control,
.source-control,
.fps-control {
  display: grid;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
}

.filter-row {
  grid-template-columns: repeat(3, 1fr);
  margin: 0 20px 15px;
}

.filter-button,
.view-button,
.mode-button,
.pipeline-button,
.source-button,
.fps-button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.filter-button.is-active,
.view-button.is-active,
.mode-button.is-active,
.pipeline-button.is-active,
.source-button.is-active,
.fps-button.is-active {
  background: var(--surface-raised);
  color: var(--text);
}

.video-list {
  flex: 1;
  min-height: 0;
  padding: 0 9px 14px;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.video-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 8px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  margin-bottom: 3px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.video-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.video-item.is-selected {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.item-number {
  color: #69716a;
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.item-copy {
  min-width: 0;
}

.item-name,
.item-meta {
  display: block;
}

.item-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.item-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.video-item[data-status="ready"] .item-status {
  background: var(--ready);
}

.empty-list {
  padding: 28px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.path-details {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.path-button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.path-popover {
  position: absolute;
  z-index: 15;
  bottom: 42px;
  left: 12px;
  width: calc(100% - 24px);
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #202520;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.path-popover p {
  margin: 0;
}

.path-popover p + p {
  margin-top: 11px;
}

.path-popover strong,
.path-popover span {
  display: block;
}

.path-popover strong {
  margin-bottom: 4px;
  color: var(--text);
}

.path-popover span {
  overflow-wrap: anywhere;
  font-family: "DM Mono", monospace;
  font-size: 9px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 25px clamp(18px, 3vw, 46px) 34px;
}

.pipeline-bar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: -1px 0 24px;
  padding: 13px 15px;
  border-block: 1px solid var(--line);
  background: rgba(23, 28, 24, 0.72);
}

.pipeline-heading .eyebrow {
  margin-bottom: 4px;
}

.pipeline-heading > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.pipeline-bar .pipeline-control {
  flex: 0 0 auto;
}

.pipeline-option {
  position: relative;
}

.pipeline-bar .pipeline-button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.pipeline-info {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  opacity: 0.72;
}

.pipeline-tooltip {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 20;
  display: block;
  width: 330px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #202620;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.pipeline-tooltip::before {
  position: absolute;
  right: 17px;
  bottom: 100%;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: #202620;
  content: "";
  transform: translateY(5px) rotate(45deg);
}

.pipeline-tooltip strong,
.pipeline-tooltip span {
  display: block;
}

.pipeline-tooltip strong {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
}

.pipeline-tooltip span {
  color: #c4cbc5;
}

.pipeline-option:hover .pipeline-tooltip,
.pipeline-option:focus-within .pipeline-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.clip-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  margin-bottom: 18px;
}

.clip-header h2 {
  max-width: min(700px, 64vw);
  overflow: hidden;
  font-size: 23px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-actions {
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-control {
  grid-template-columns: repeat(2, 1fr);
}

.mode-control {
  grid-template-columns: repeat(2, max-content);
}

.pipeline-control,
.fps-control {
  grid-template-columns: repeat(2, max-content);
}

.source-control {
  grid-template-columns: repeat(3, max-content);
}

.mode-button,
.pipeline-button,
.source-button,
.fps-button {
  padding-inline: 11px;
}

.source-button:disabled,
.fps-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.view-button {
  min-width: 52px;
}

.viewer {
  --media-aspect: 16 / 10;
  --overlay-position: 50%;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  background: var(--line);
}

.viewer,
.transport {
  width: min(100%, var(--comparison-width, 100%));
  margin-inline: auto;
}

.video-pane {
  min-width: 0;
  background: #080a08;
}

.pane-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.resolution {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 400;
  text-transform: none;
}

.video-frame {
  position: relative;
  display: grid;
  aspect-ratio: var(--media-aspect);
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background-color: #080a08;
  background-image:
    linear-gradient(45deg, #0c0f0c 25%, transparent 25%),
    linear-gradient(-45deg, #0c0f0c 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #0c0f0c 75%),
    linear-gradient(-45deg, transparent 75%, #0c0f0c 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.video-frame video {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050605;
}

.viewer[data-fit="cover"] .video-frame video {
  object-fit: cover;
}

.video-frame.has-video video {
  display: block;
}

.video-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 280px;
  padding: 24px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.video-frame.has-video .video-empty {
  display: none;
}

.processing-state strong {
  color: var(--text);
  font-size: 12px;
}

.processing-mark {
  width: 22px;
  height: 22px;
  margin-bottom: 5px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--warning);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.divider {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  transform: translate(-50%, -50%);
}

.overlay-control {
  display: none;
}

.viewer[data-mode="overlay"] {
  display: block;
  aspect-ratio: var(--media-aspect);
  border-radius: 6px 6px 0 0;
}

.viewer[data-mode="overlay"] .video-pane {
  position: absolute;
  inset: 0;
}

.viewer[data-mode="overlay"] .video-pane:first-of-type {
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--overlay-position)) 0 0);
}

.viewer[data-mode="overlay"] .video-pane:last-of-type {
  z-index: 1;
}

.viewer[data-mode="overlay"] .video-frame {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.viewer[data-mode="overlay"] .pane-label {
  position: absolute;
  z-index: 3;
  top: 12px;
  width: auto;
  height: 30px;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(13, 16, 14, 0.78);
  backdrop-filter: blur(10px);
}

.viewer[data-mode="overlay"] .video-pane:first-of-type .pane-label {
  left: 12px;
}

.viewer[data-mode="overlay"] .video-pane:last-of-type .pane-label {
  right: 12px;
}

.viewer[data-mode="overlay"] .divider {
  display: none;
}

.viewer[data-mode="overlay"] .overlay-control {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: block;
}

.overlay-control input[type="range"] {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  opacity: 0;
  cursor: ew-resize;
  touch-action: none;
}

.overlay-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--overlay-position);
  width: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
  transform: translateX(-1px);
}

.overlay-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(13, 16, 14, 0.84);
  color: white;
  font-size: 15px;
  transform: translate(-50%, -50%);
}

.viewer[data-mode="overlay"] .video-pane .pane-label,
.viewer[data-mode="overlay"] .video-pane video {
  pointer-events: none;
}

.transport {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: var(--surface);
}

.timing-panel {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 27px;
}

.timing-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.timing-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

.worker-badge {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.run-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px 6px 0 0;
  background: var(--surface);
}

.metric-block {
  min-width: 0;
  padding: 16px 18px;
}

.metric-block + .metric-block {
  border-left: 1px solid var(--line);
}

.metric-block span,
.metric-block strong,
.metric-block small,
.clip-stat span,
.clip-stat strong {
  display: block;
}

.metric-block span,
.clip-stat span,
.section-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.metric-block strong {
  margin-top: 7px;
  font-family: "DM Mono", monospace;
  font-size: 20px;
  font-weight: 500;
}

.metric-block small {
  margin-top: 5px;
  overflow: hidden;
  color: #69716a;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-timing {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: rgba(18, 22, 19, 0.72);
}

.clip-timing-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(100px, 0.65fr));
  align-items: center;
  gap: 16px;
  min-height: 84px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.clip-timing-summary > div:first-child strong,
.clip-timing-summary > div:first-child small {
  display: block;
}

.clip-timing-summary > div:first-child strong {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-timing-summary > div:first-child small {
  margin-top: 4px;
  color: #69716a;
  font-family: "DM Mono", monospace;
  font-size: 9px;
}

.clip-stat {
  padding-left: 15px;
  border-left: 1px solid var(--line);
}

.clip-stat strong {
  margin-top: 6px;
  font-family: "DM Mono", monospace;
  font-size: 13px;
  font-weight: 500;
}

.stage-chart {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.stage-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 66px 44px;
  align-items: center;
  gap: 11px;
}

.stage-name,
.stage-time,
.stage-share {
  font-size: 9px;
}

.stage-name {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stage-track {
  height: 7px;
  overflow: hidden;
  background: #272d28;
}

.stage-fill {
  height: 100%;
  min-width: 2px;
  background: var(--accent);
  transform-origin: left;
  animation: grow 500ms ease both;
}

.stage-row:nth-child(2) .stage-fill {
  background: var(--warm);
}

.stage-row:nth-child(3) .stage-fill {
  background: var(--ready);
}

.stage-row:nth-child(4) .stage-fill {
  background: #79a8e8;
}

.stage-time,
.stage-share {
  font-family: "DM Mono", monospace;
  text-align: right;
}

.stage-time {
  color: var(--text);
}

.stage-share {
  color: var(--muted);
}

.timing-empty {
  padding: 14px 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.timeline-row {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) 45px;
  align-items: center;
  gap: 10px;
}

.timecode {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.timecode:last-child {
  text-align: right;
}

input[type="range"] {
  height: 4px;
  margin: 0;
  border-radius: 0;
  accent-color: var(--accent);
}

.timeline {
  width: 100%;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 13px;
}

.control-group {
  gap: 9px;
}

.right-controls {
  justify-content: flex-end;
}

.round-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 11px;
}

.primary-control {
  width: 38px;
  height: 38px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-control:hover {
  border-color: #e4ff82;
  background: #e4ff82;
}

.volume {
  width: 72px;
}

.playback-state {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  text-align: center;
  text-transform: uppercase;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.speed-control select {
  height: 32px;
  padding: 0 24px 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.toggle-button {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 10px;
}

.toggle-button[aria-pressed="true"] {
  border-color: #64702e;
  color: var(--accent);
}

.toast {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #242a25;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
}

.pipeline-bar,
.clip-header,
.viewer,
.transport {
  animation: enter 420ms ease both;
}

.clip-header {
  animation-delay: 40ms;
}

.viewer {
  animation-delay: 80ms;
}

.transport {
  animation-delay: 120ms;
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 242px;
  }

  .volume,
  .playback-state,
  .speed-control > span {
    display: none;
  }

  .video-frame {
    min-height: 250px;
  }

  .run-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-block:nth-child(3) {
    border-left: 0;
  }

  .metric-block:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .clip-timing-summary {
    grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(86px, 0.65fr));
  }
}

@media (max-width: 700px) {
  :root {
    --header-height: 60px;
  }

  .app-shell {
    display: block;
  }

  .topbar {
    height: var(--header-height);
    padding: 0 14px;
  }

  .run-status {
    max-width: 150px;
  }

  .library {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .library-heading {
    padding: 18px 15px 12px;
  }

  .filter-row {
    margin: 0 15px 12px;
  }

  .video-list {
    display: flex;
    gap: 7px;
    padding: 0 15px 13px;
    overflow-x: auto;
  }

  .video-item {
    flex: 0 0 210px;
    margin: 0;
  }

  .path-details {
    display: none;
  }

  .workspace {
    padding: 18px 12px 25px;
  }

  .pipeline-bar {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
  }

  .pipeline-heading > p:last-child {
    max-width: 210px;
  }

  .clip-header {
    align-items: center;
    min-height: 48px;
    margin-bottom: 13px;
  }

  .clip-header h2 {
    max-width: 53vw;
    font-size: 17px;
  }

  .clip-header {
    flex-wrap: wrap;
  }

  .clip-actions {
    margin-left: auto;
  }

  .viewer {
    grid-template-columns: 1fr;
  }

  .video-frame {
    aspect-ratio: var(--media-aspect);
    min-height: 0;
  }

  .viewer[data-mode="overlay"] {
    aspect-ratio: var(--media-aspect);
  }

  .divider {
    top: 50%;
    left: auto;
    right: 12px;
    transform: translateY(-50%);
  }

  .control-row {
    grid-template-columns: 1fr auto;
  }

  .playback-state {
    display: none;
  }

  .timing-panel {
    margin-top: 28px;
  }

  .clip-timing-summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .clip-timing-summary > div:first-child {
    grid-column: 1 / -1;
  }

  .clip-stat:nth-child(2) {
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 430px) {
  .brand small,
  .run-status span:last-child,
  .view-control {
    display: none;
  }

  .mode-button {
    padding-inline: 8px;
    font-size: 9px;
  }

  .source-button,
  .fps-button {
    padding-inline: 8px;
    font-size: 9px;
  }

  .pipeline-bar {
    display: block;
    padding-inline: 0;
    background: transparent;
  }

  .pipeline-heading {
    margin-bottom: 10px;
    padding-inline: 2px;
  }

  .pipeline-heading > p:last-child {
    max-width: none;
  }

  .pipeline-bar .pipeline-control {
    width: 100%;
  }

  .pipeline-bar .pipeline-button {
    justify-content: center;
    padding-inline: 7px;
    font-size: 9px;
  }

  .pipeline-tooltip {
    right: -3px;
    width: min(330px, calc(100vw - 30px));
  }

  .clip-header h2 {
    max-width: 68vw;
  }

  .transport {
    padding-inline: 11px;
  }

  .speed-control select {
    width: 58px;
  }

  .metric-block {
    padding: 13px;
  }

  .metric-block strong {
    font-size: 16px;
  }

  .stage-row {
    grid-template-columns: 62px minmax(0, 1fr) 57px;
  }

  .stage-share {
    display: none;
  }
}

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