/* pklacut editor styles. One sheet, organised from tokens to components to layout. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --surface-1: #080809;
  --surface-2: #101012;
  --surface-3: #18181b;
  --line: #1f1f23;
  --line-strong: #2e2e33;
  --text: #f4f5f6;
  --text-2: #a3a6ad;
  --text-3: #7d8189;
  --danger: #ff6b6b;
  --success: #3ecf8e;
  --accent: #2388ff;
  /* Filled controls use a slightly deeper blue so white labels meet WCAG AA. */
  --accent-fill: #1a6fe0;
  --accent-ink: #ffffff;
  --accent-hover: color-mix(in srgb, var(--accent-fill) 88%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --topbar-h: 56px;
  --rail-w: 72px;
  --sidebar-w: 300px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
html[data-theme="red"] { --accent: #f87171; --accent-fill: #f87171; --accent-ink: #0a0a0b; }
html[data-theme="orange"] { --accent: #fb923c; --accent-fill: #fb923c; --accent-ink: #0a0a0b; }
html[data-theme="yellow"] { --accent: #facc15; --accent-fill: #facc15; --accent-ink: #0a0a0b; }
html[data-theme="green"] { --accent: #4ade80; --accent-fill: #4ade80; --accent-ink: #0a0a0b; }
html[data-theme="purple"] { --accent: #c084fc; --accent-fill: #c084fc; --accent-ink: #0a0a0b; }
html[data-theme="pink"] { --accent: #f472b6; --accent-fill: #f472b6; --accent-ink: #0a0a0b; }
html[data-theme="white"] { --accent: #f5f7fa; --accent-fill: #f5f7fa; --accent-ink: #0a0a0b; --accent-hover: #ffffff; }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, p, dl, dd, fieldset { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text);
  background: var(--surface-2);
  font: 600 11px/1.5 var(--font);
  text-align: center;
}

/* Buttons */
.button, .icon-button, .play-button, .tool {
  border: 1px solid transparent;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, opacity 120ms ease-out;
}
.button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}
.button svg { width: 16px; height: 16px; stroke-width: 2; }
.button.small { min-height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.button.large { min-height: 44px; padding: 0 20px; font-size: 14px; }
.button.wide { width: 100%; }
.button.primary { background: var(--accent-fill); color: var(--accent-ink); }
.button.primary:not(:disabled):hover { background: var(--accent-hover); }
.button.secondary { background: var(--surface-2); border-color: var(--line-strong); }
.button.secondary:not(:disabled):hover { background: var(--surface-3); border-color: #3c3c42; }
.button.ghost { background: transparent; color: var(--text-2); }
.button.ghost:not(:disabled):hover { background: var(--surface-3); color: var(--text); }
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
  display: inline-grid;
  place-items: center;
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button.small { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.icon-button.small svg { width: 16px; height: 16px; }
.icon-button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.icon-button:not(:disabled):hover { background: var(--surface-3); color: var(--text); }
:is(.button, .icon-button, .play-button):not(:disabled):active { transform: translateY(0.5px); filter: brightness(.92); }
:is(.button, .icon-button, .play-button, .tool):disabled { opacity: .38; cursor: not-allowed; }

/* Top bar */
.topbar {
  position: relative;
  z-index: 20;
  height: var(--topbar-h);
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-1);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 32px; height: 32px; display: block; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.top-actions { display: flex; align-items: center; gap: 8px; }

/* App layout */
.app-shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--sidebar-w);
  height: calc(100dvh - var(--topbar-h));
  min-height: 460px;
}
.tool-rail {
  padding: 12px 8px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-1);
  overflow-y: auto;
}
.tool {
  min-height: 56px;
  padding: 8px 4px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: var(--text-2);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
}
.tool svg { width: 20px; height: 20px; }
.tool:hover { color: var(--text); background: var(--surface-3); }
.tool[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.workspace > :not(.preview-stage) { flex-shrink: 0; }

/* File bar */
.file-bar { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.file-details { flex: 1; min-width: 0; }
.file-details:has(#file-name:empty) { visibility: hidden; }
.file-details h2 { overflow: hidden; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.file-details p { margin-top: 2px; overflow: hidden; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.file-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.button-group { display: flex; gap: 6px; }
.status {
  min-width: 0;
  max-width: 280px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 12px;
}
.status #status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.status.ready .status-dot { background: var(--success); }
.status.busy .status-dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.status.error { color: var(--danger); }
.status.error .status-dot { background: var(--danger); }

/* Preview */
.preview-stage { position: relative; flex: 1 1 auto; min-height: 180px; }
.video-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #000;
  isolation: isolate;
}
.video-shell video { display: none; width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-shell.has-video video { display: block; }
/* CSS crop preview for browsers without WebGPU; the canvas renders it otherwise. */
.video-shell video.cropped { position: absolute; max-width: none; max-height: none; object-fit: fill; }
#preview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; visibility: hidden; pointer-events: none; }
.video-shell.webgpu-active #preview-canvas { visibility: visible; }
.video-shell.webgpu-active video { opacity: 0; }

.empty-state {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
  background:
    linear-gradient(rgb(255 255 255 / .022) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgb(255 255 255 / .022) 1px, transparent 1px) 0 0 / 40px 40px,
    radial-gradient(ellipse at center, #111113 0, #070708 55%, #000 100%);
}
.video-shell.has-video .empty-state { display: none; }
.empty-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title { max-width: 30ch; font-size: clamp(19px, 2vw, 24px); font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; text-wrap: balance; }
.empty-copy { color: var(--text-2); font-size: 14px; }
.welcome-actions { margin-top: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.format-note { color: var(--text-3); font-size: 12px; }
@media (hover: none) { .pointer-only { display: none; } }

.drop-overlay {
  position: absolute;
  inset: 8px;
  z-index: 6;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  display: none;
  place-items: center;
  background: rgb(0 0 0 / .78);
  pointer-events: none;
}
.drop-overlay span { padding: 8px 14px; border-radius: 999px; color: var(--accent-ink); background: var(--accent-fill); font-weight: 650; }
.video-shell.drag-over .drop-overlay { display: grid; }

.preview-loader { position: absolute; inset: 0; z-index: 5; display: none; place-items: center; background: rgb(0 0 0 / .8); }
.video-shell.loading .preview-loader { display: grid; }
.preview-loader-content { max-width: 360px; padding: 20px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.preview-loader strong { font-size: 14px; font-weight: 650; }
.preview-loader small { color: var(--text-2); font-size: 12px; line-height: 1.45; }
.preview-loader small:empty { display: none; }
.preview-loader .button { margin-top: 8px; }
.spinner { width: 28px; height: 28px; margin-bottom: 6px; border: 2px solid rgb(255 255 255 / .16); border-top-color: var(--accent); border-radius: 50%; animation: spin .85s linear infinite; }

/* Crop overlay */
.crop-overlay {
  position: absolute;
  z-index: 3;
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 9999px rgb(0 0 0 / .6);
  cursor: move;
  touch-action: none;
  user-select: none;
}
.crop-grid { position: absolute; inset: 0; pointer-events: none; }
.crop-grid::before, .crop-grid::after { content: ""; position: absolute; inset: 0; }
.crop-grid::before { left: 33.333%; right: 33.333%; border-inline: 1px dashed rgb(255 255 255 / .55); }
.crop-grid::after { top: 33.333%; bottom: 33.333%; border-block: 1px dashed rgb(255 255 255 / .55); }
.move-mark { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; transform: translate(-50%, -50%); border: 1px solid rgb(255 255 255 / .6); border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(0 0 0 / .5); opacity: 0; transition: opacity 140ms ease; pointer-events: none; }
.move-mark svg { width: 18px; height: 18px; }
.crop-overlay:hover .move-mark, .crop-overlay:focus-visible .move-mark { opacity: 1; }
.crop-overlay:focus-visible { outline-offset: 3px; }
.crop-handle { position: absolute; width: 14px; height: 14px; padding: 0; border: 2px solid #111; border-radius: 50%; background: #fff; }
/* A larger invisible hit area keeps handles usable with touch. */
.crop-handle::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; }
.crop-handle:hover { background: var(--accent); }
.crop-handle.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-handle.n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.crop-handle.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-handle.e { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.crop-handle.se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-handle.s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.crop-handle.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-handle.w { left: -8px; top: calc(50% - 7px); cursor: ew-resize; }
@media (pointer: coarse) { .crop-handle { width: 18px; height: 18px; } .crop-handle::after { inset: -12px; } }

/* Transport */
.transport { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.transport-main, .transport-options { display: flex; align-items: center; gap: 6px; }
.transport-options { gap: 14px; }
.play-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent-fill);
}
.play-button:not(:disabled):hover { background: var(--accent-hover); }
.play-button svg { grid-area: 1 / 1; width: 18px; height: 18px; stroke-width: 2.2; }
.play-button .play-icon path { fill: currentColor; }
.play-button .pause-icon, .play-button.playing .play-icon { display: none; }
.play-button.playing .pause-icon { display: block; }
.time { margin-left: 8px; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-total { color: var(--text-3); }
.compact-field { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; }
.compact-field select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.toggle-chip { position: relative; display: inline-flex; cursor: pointer; }
.toggle-chip input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-chip span { height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); display: inline-flex; align-items: center; color: var(--text-2); background: var(--surface-2); font-size: 12px; font-weight: 600; }
.toggle-chip input:checked + span { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.toggle-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.volume-control { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.volume-control svg { width: 18px; height: 18px; }
.volume-control input { width: 88px; }
input[type="range"] { accent-color: var(--accent); cursor: pointer; }
input[type="range"]:disabled, select:disabled, input:disabled { cursor: not-allowed; }
:is(select, input[type="range"], input[type="number"]):disabled,
.toggle-chip:has(input:disabled) span,
.switch-row:has(input:disabled) { opacity: .45; }

/* Timeline */
.timeline-card { padding: 10px 12px 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-1); }
.timeline-card:has(#seek:focus-visible) .timeline-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline-head { min-height: 28px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.selection-readout { color: var(--text-2); font-size: 12px; }
.selection-readout strong { margin-left: 4px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.timeline-zoom { display: flex; align-items: center; gap: 2px; }
.timeline-zoom output { min-width: 34px; color: var(--text-2); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.timeline-viewport { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.timeline-track {
  position: relative;
  width: 100%;
  min-width: 100%;
  height: 64px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
  touch-action: pan-y;
  user-select: none;
}
.timeline-track.ready { cursor: pointer; }
/* Zoomed on touch: a swipe pans the timeline and a tap moves the playhead. */
.timeline-track.zoomed { touch-action: pan-x pan-y; }
.timeline-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.timeline-track.ready .timeline-empty,
.timeline-track:not(.ready) :is(.trim-shade, #selection-bar, .trim-handle, #playhead) { display: none; }
.timeline-thumbnails { position: absolute; inset: 0; transition: opacity 120ms ease; }
.timeline-thumb { position: absolute; top: 0; height: 100%; display: block; object-fit: cover; object-position: left center; border-right: 1px solid rgb(0 0 0 / .45); pointer-events: none; }
.timeline-thumb.pending { opacity: .55; }
.trim-shade { position: absolute; z-index: 1; inset-block: 0; background: rgb(0 0 0 / .62); pointer-events: none; }
.trim-shade.start { left: 0; }
.trim-shade.end { right: 0; }
#selection-bar { position: absolute; z-index: 2; inset-block: 0; border-block: 2px solid var(--accent); pointer-events: none; }
.trim-handle {
  position: absolute;
  z-index: 3;
  top: 0;
  width: 12px;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--accent);
  cursor: ew-resize;
  touch-action: none;
}
.trim-handle::before { content: ""; width: 2px; height: 18px; border-radius: 1px; background: var(--accent-ink); opacity: .7; }
/* Extends the grab area beyond the visible 12px bar. */
.trim-handle::after { content: ""; position: absolute; inset: 0 -8px; }
.trim-handle[data-edge="start"] { border-radius: var(--radius) 0 0 var(--radius); }
.trim-handle[data-edge="end"] { border-radius: 0 var(--radius) var(--radius) 0; }
.trim-handle:focus-visible { outline-offset: -2px; outline-color: var(--accent-ink); }
#playhead { position: absolute; z-index: 4; inset-block: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .35); pointer-events: none; }
#playhead::before { content: ""; position: absolute; top: -1px; left: -4px; width: 10px; height: 8px; border-radius: 0 0 5px 5px; background: #fff; }
.timeline-ruler { margin-top: 4px; display: flex; justify-content: space-between; color: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Inspector */
.sidebar {
  min-width: 0;
  min-height: 0;
  padding: 20px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  background: var(--surface-1);
}
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel-title h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.panel-title p { margin-top: 4px; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.button-stack { display: grid; gap: 8px; }
.button.spread { justify-content: space-between; }
.button kbd { color: var(--text-2); font-weight: 500; }
.button:disabled kbd { opacity: .6; }
.field { display: grid; gap: 6px; color: var(--text-2); font-size: 12px; font-weight: 550; }
.field input[type="number"], .field select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.field input[type="number"]:not(:disabled):hover, .field select:not(:disabled):hover { border-color: #3c3c42; }
.field-row { display: flex; justify-content: space-between; }
.field-row output { color: var(--text); font-variant-numeric: tabular-nums; }
.range-field input { width: 100%; margin: 0; }
.field-group { padding: 0; border: 0; display: grid; gap: 6px; }
.field-group legend { margin-bottom: 6px; padding: 0; color: var(--text-2); font-size: 12px; font-weight: 550; }
.segmented { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.segmented input:not(:disabled) + span:hover { color: var(--text); border-color: #3c3c42; }
.segmented input:checked + span { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.segmented input:disabled + span { opacity: .45; cursor: not-allowed; }
.switch-row { padding: 12px 0; border-block: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 13px; cursor: pointer; }
.switch-row input {
  appearance: none;
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition: background-color 120ms ease-out;
}
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 140ms var(--ease); }
.switch-row input:checked { background: var(--accent-fill); }
.switch-row input:checked::after { transform: translateX(14px); background: var(--accent-ink); }
.summary { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; background: var(--surface-2); font-size: 12px; }
.summary dt { color: var(--text-2); }
.summary dd { color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.hint { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.shortcuts { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 12px; }
.shortcuts summary { cursor: pointer; font-weight: 600; }
.shortcuts summary:hover { color: var(--text); }
.shortcuts dl { margin-top: 12px; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.shortcuts dt { white-space: nowrap; }

/* Notices */
.notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: min(380px, calc(100vw - 32px));
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  box-shadow: 0 16px 48px rgb(0 0 0 / .6);
}
.notice-icon { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; flex: none; background: var(--accent); }
.notice[data-tone="success"] .notice-icon { background: var(--success); }
.notice[data-tone="error"] { border-color: color-mix(in srgb, var(--danger) 45%, var(--line-strong)); }
.notice[data-tone="error"] .notice-icon { background: var(--danger); }
.notice-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.notice-title { font-size: 13px; font-weight: 650; }
.notice-text { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.notice-text:empty { display: none; }
.notice-progress { height: 4px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--line-strong); }
.notice-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width 200ms linear; }
.notice .button { align-self: center; }
/* On desktop the toast sits over the inspector's empty lower area, clear of the timeline. */
@media (min-width: 1024px) {
  .notice { right: 16px; bottom: 16px; width: calc(var(--sidebar-w) - 32px); }
}

/* Settings dialog */
#settings-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-2);
  box-shadow: 0 24px 90px rgb(0 0 0 / .7);
}
#settings-dialog::backdrop { background: rgb(0 0 0 / .6); }
.settings-heading { margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.settings-heading h2 { font-size: 17px; font-weight: 650; }
.theme-options { padding: 0; border: 0; }
.theme-options legend { margin-bottom: 12px; padding: 0; color: var(--text-2); font-size: 12px; font-weight: 600; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-option { position: relative; padding: 10px 4px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; justify-items: center; gap: 6px; color: var(--text-2); font-size: 12px; cursor: pointer; }
.theme-option:hover { background: var(--surface-3); }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.theme-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-swatch { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--swatch); }
.theme-option input:checked + .theme-swatch::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #0a0a0b; }
.settings-note { margin-top: 16px; color: var(--text-3); font-size: 12px; }

/* Motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .panel:not([hidden]) { animation: rise 180ms var(--ease); }
  .notice:not([hidden]) { animation: rise 200ms var(--ease); }
  #settings-dialog[open] { animation: rise 200ms var(--ease); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Short desktop windows: give the preview every spare pixel. */
@media (min-width: 1024px) and (max-height: 760px) {
  .workspace { padding-block: 8px 12px; gap: 8px; }
  .timeline-track { height: 56px; }
  .empty-icon { display: none; }
}
@media (min-width: 1024px) and (max-width: 1200px) {
  :root { --sidebar-w: 272px; }
  .workspace { padding-inline: 16px; }
}

/* Stacked layout for tablets and phones: preview, timeline, then tool tabs directly above their panel. */
@media (max-width: 1023px) {
  .app-shell { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .workspace { order: 1; padding: 12px 16px 16px; }
  .tool-rail {
    order: 2;
    padding: 8px 16px;
    border-right: 0;
    border-block: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
  }
  .tool { min-height: 44px; display: flex; justify-content: center; gap: 8px; font-size: 13px; }
  .tool svg { width: 18px; height: 18px; }
  .sidebar { order: 3; padding: 20px 16px 32px; border-left: 0; overflow: visible; }
  .panel { max-width: 640px; }
  .preview-stage { flex: none; min-height: 0; }
  .video-shell { position: relative; width: 100%; aspect-ratio: var(--media-aspect, 16 / 9); max-height: 62svh; }
  .video-shell:not(.has-video) { aspect-ratio: auto; min-height: min(460px, 68svh); }
  /* First visit on small screens: just the call to action, no disabled editor chrome. */
  body:not(.has-video) :is(.file-bar, .transport, .timeline-card, .tool-rail, .sidebar) { display: none; }
  .shortcuts { display: none; }
  .notice { left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: auto; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 52px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 16px; }
  .top-actions { gap: 6px; }
  .top-actions .button { padding-inline: 12px; }
  .long-label { display: none; }
  .workspace { padding-inline: 12px; }
  .file-bar { align-items: flex-start; }
  .file-bar:has(#file-name:empty) { display: none; }
  .status { display: none; }
  .transport-options { width: 100%; flex-wrap: wrap; gap: 8px 12px; }
  .volume-control { flex: 1 1 100px; }
  .volume-control input { width: 100%; min-width: 64px; }
  .timeline-track { height: 56px; }
  .empty-title { font-size: 19px; }
  .welcome-actions { width: 100%; max-width: 320px; }
  .welcome-actions .button { flex: 1; padding-inline: 12px; }
  .tool-rail { padding-inline: 12px; }
  .tool { font-size: 12px; gap: 6px; }
  .sidebar { padding-inline: 12px; }
}
