@font-face { font-family: Geist; src: url(fonts/geist.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/geist-mono.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #09090b;
  --surface: #111113;
  --raised: #1c1c1f;
  --hover: #27272a;
  --line: rgb(255 255 255 / 0.08);
  --line-strong: rgb(255 255 255 / 0.16);
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #8b8b94;
  --accent: #d1ff53;
  --accent-soft: rgb(209 255 83 / 0.16);
  --accent-ink: #10140a;
  --good: #3dd6a8;
  --good-ink: #04261b;
  --bad: #f87171;
  --bad-ink: #2b0707;
  --human: #60a5fa;
  --radius: 20px;
  --radius-sm: 12px;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 0.9375rem/1.5 Geist, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.75rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.015em; }
h3 { font-size: 0.9375rem; font-weight: 600; }
a { color: inherit; }
svg.icon { width: 1.05em; height: 1.05em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100dvh; }
.rail { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 20px 12px 16px; background: var(--bg); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 10px; font-size: 1rem; font-weight: 650; letter-spacing: -0.025em; text-decoration: none; }
.brand svg { box-sizing: content-box; width: 16px; height: 16px; padding: 5px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); stroke-width: 2.25; }
.rail-jobs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.rail-empty { padding: 8px; color: var(--muted); font-size: 0.8125rem; }
.rail-job { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 2px 8px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; transition: background 120ms; }
.rail-job:hover { background: var(--surface); }
.rail-job[aria-current="page"] { background: var(--raised); }
.rail-job .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.875rem; }
.rail-job .sub { grid-column: 2; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dot.running { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
.dot.done { background: var(--good); }
.dot.failed { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }
.rail-link { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: background 120ms, color 120ms; }
.rail-link:hover { background: var(--surface); color: var(--text); }
.rail-link[aria-current="page"] { background: var(--raised); color: var(--text); }
.rail-link.new { justify-content: center; margin-bottom: 4px; border-radius: 999px; background: var(--text); color: var(--bg); font-weight: 600; }
.rail-link.new:hover, .rail-link.new[aria-current="page"] { background: #e4e4e7; color: var(--bg); }
.view { overflow-y: auto; min-width: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }
.page.narrow { max-width: 720px; padding-top: 56px; }

/* Controls */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px; border: 1px solid transparent; border-radius: 999px; background: var(--raised); color: var(--text); font: 500 0.875rem/1 Geist, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background 120ms, border-color 120ms, color 120ms; }
button:hover:not(:disabled), .button:hover { background: var(--hover); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--text); color: var(--bg); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #e4e4e7; }
button.quiet { background: transparent; color: var(--muted); }
button.quiet:hover:not(:disabled) { background: var(--raised); color: var(--text); }
button.quiet[aria-pressed="true"] { color: var(--accent); }
button.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); background: transparent; }
button.block { width: 100%; }
button.large { min-height: 48px; padding: 0 22px; font-size: 0.9375rem; }
label, .label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
input, select, textarea { width: 100%; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); color: var(--text); font: 400 0.9375rem/1.4 Geist, sans-serif; caret-color: var(--accent); transition: border-color 120ms; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: rgb(255 255 255 / 0.32); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 64px; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; margin: 0; color: var(--text); font-size: 0.875rem; cursor: pointer; }
.field { margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.hint { margin-top: 4px; color: var(--muted); font-size: 0.8125rem; }
details > summary { display: flex; align-items: center; gap: 6px; padding: 8px 0; color: var(--muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary svg { transition: transform 150ms; }
details[open] > summary svg { transform: rotate(90deg); }
details > summary:hover { color: var(--text); }

/* Composer */
.composer { position: relative; isolation: isolate; max-width: 820px; padding-top: clamp(40px, 9vh, 96px); }
.composer::before { content: ""; position: absolute; z-index: -1; top: -120px; left: 50%; width: min(900px, 120%); height: 520px; background: radial-gradient(50% 50% at 50% 50%, rgb(209 255 83 / 0.10), transparent 70%); transform: translateX(-50%); pointer-events: none; }
.hero { margin-bottom: 40px; text-align: center; }
.hero h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); font-weight: 650; line-height: 1.05; letter-spacing: -0.04em; }
.lede { max-width: 46ch; text-wrap: balance; margin: 14px auto 32px; color: var(--muted); font-size: 1.0625rem; }
.source { text-align: left; }
.linkbar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 22px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); box-shadow: 0 24px 60px -24px rgb(0 0 0 / 0.8), 0 1px 0 rgb(255 255 255 / 0.04) inset; transition: border-color 150ms, box-shadow 150ms; }
.linkbar:focus-within { border-color: rgb(209 255 83 / 0.55); box-shadow: 0 24px 60px -24px rgb(0 0 0 / 0.8), 0 0 0 4px rgb(209 255 83 / 0.10); }
.linkbar > svg { color: var(--muted); width: 20px; height: 20px; }
.linkbar input[type="url"] { flex: 1; min-width: 0; min-height: 48px; padding: 0; border: 0; background: transparent; font-size: 1.0625rem; }
.linkbar input[type="url"]:focus-visible { outline: none; }
.drop { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; margin-top: 12px; padding: 10px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: transparent; color: var(--muted); font-weight: 400; white-space: normal; }
.drop.over, .drop:hover:not(:disabled) { border-color: var(--accent); color: var(--text); background: rgb(209 255 83 / 0.04); }
.drop.has-file { border-style: solid; border-color: var(--line-strong); color: var(--text); }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 10px 10px 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.875rem; text-align: left; }
.notice .button { min-height: 32px; }
.settings-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-card > h2 { margin-bottom: 20px; }
.settings-card > details { margin-bottom: 0; }
.layouts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.layout-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; padding: 14px 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); color: var(--text); font-size: 0.8125rem; cursor: pointer; transition: border-color 120ms, background 120ms; }
.layout-tile:hover { border-color: var(--line-strong); }
.layout-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.layout-tile:has(input:checked) { border-color: var(--accent); background: rgb(209 255 83 / 0.06); box-shadow: inset 0 0 0 1px var(--accent); }
.layout-tile:has(input:checked) svg { color: var(--accent); }
.layout-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.layout-tile svg { width: 36px; height: 64px; }
.picker { margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); }
.picker-stage { position: relative; margin: 8px 0; touch-action: none; cursor: crosshair; user-select: none; border-radius: 8px; overflow: hidden; background: var(--bg); }
.picker-stage img { display: block; width: 100%; pointer-events: none; }
.picker-box { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.5); pointer-events: none; }

/* Job header and progress */
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.job-head > div:first-child { flex: 1; min-width: 0; }
.job-head .row { flex-wrap: nowrap; }
.job-head h1 { overflow: hidden; font-size: 1.5rem; white-space: nowrap; text-overflow: ellipsis; }
.progress { margin-bottom: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.progress-stage { font-size: 1.0625rem; font-weight: 600; }
.progress-note { margin: 12px 0 0; color: var(--muted); font-size: 0.8125rem; }
.bar { height: 6px; margin-top: 12px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1); }
.error-box { margin-bottom: 16px; padding: 12px; border: 1px solid var(--bad); border-radius: var(--radius); overflow-wrap: anywhere; font-size: 0.875rem; }
.log { max-height: 240px; margin: 8px 0 0; padding: 12px; overflow: auto; border-radius: var(--radius-sm); background: var(--bg); color: var(--muted); font: 0.75rem/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Timeline */
.timeline { margin-bottom: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.timeline-head { display: flex; align-items: center; gap: 8px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.timeline-head h2 { margin-right: auto; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.75rem; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.track { position: relative; height: 134px; touch-action: none; cursor: crosshair; user-select: none; }
.curve { position: absolute; inset: 0 0 62px 0; width: 100%; height: calc(100% - 62px); animation: wipe 900ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.curve path { fill: rgb(209 255 83 / 0.16); stroke: rgb(209 255 83 / 0.5); stroke-width: 1; vector-effect: non-scaling-stroke; }
.band { position: absolute; top: 0; bottom: 62px; background: oklch(1 0 0 / 0.05); pointer-events: none; }
.band.picked { background: oklch(1 0 0 / 0.14); }
.band.failed { background: rgb(248 113 113 / 0.16); }
.readout { min-height: 1.5em; overflow: hidden; color: var(--muted); font-size: 0.8125rem; white-space: nowrap; text-overflow: ellipsis; }
.heard-entry > summary { padding: 4px 0; font-size: 0.8125rem; }
.heard-list { max-height: 220px; margin: 4px 0 0; padding: 0; overflow-y: auto; list-style: none; font-size: 0.8125rem; }
.heard-list li { color: var(--muted); }
.heard-list button.quiet { justify-content: flex-start; width: 138px; padding: 0 4px; color: inherit; }
.heard-list li.picked { color: var(--text); }
.lane-line { position: absolute; left: 0; right: 0; bottom: 62px; height: 1px; background: var(--line); pointer-events: none; }
.pin { position: absolute; top: 0; bottom: 20px; width: 1px; background: var(--line-strong); pointer-events: none; }
.pin.current { z-index: 1; background: var(--accent); }
.marks { position: absolute; inset: 0; pointer-events: none; }
.mark { position: absolute; pointer-events: auto; height: 18px; min-height: 0; padding: 0 2px; border: 0; border-radius: 999px; font: 600 0.6875rem/18px var(--mono); cursor: pointer; }
.mark:hover:not(:disabled) { filter: brightness(1.15); }
.mark.clip { z-index: 1; background: var(--hover); color: var(--text); transform: translateX(-50%); }
.mark.clip:hover:not(:disabled) { background: var(--muted); color: var(--bg); }
.mark.clip:active:not(:disabled) { transform: translateX(-50%); }
.mark.clip.approved { background: var(--good); color: var(--good-ink); }
.mark.clip.rejected { background: var(--raised); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.mark.clip[aria-current="true"] { z-index: 2; background: var(--accent); color: var(--accent-ink); }
.mark.moment { bottom: 0; height: 14px; min-width: 4px; background: var(--human); pointer-events: none; }
.mark.moment:hover:not(:disabled) { background: var(--human); }
.draft { position: absolute; top: 0; bottom: 0; background: rgb(96 165 250 / 0.3); pointer-events: none; }
.cursor { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text); pointer-events: none; }
.cursor span { position: absolute; top: 0; padding: 1px 6px; border-radius: 999px; background: var(--text); color: var(--bg); font: 0.6875rem/1.5 var(--mono); transform: translateX(-50%); white-space: nowrap; }
.axis { position: relative; height: 18px; margin-top: 4px; color: var(--muted); font: 0.6875rem/18px var(--mono); }
.axis span { position: absolute; transform: translateX(-50%); }
.axis span:first-child { transform: none; }
.scroller { overflow-x: auto; overflow-y: hidden; }
.canvas { position: relative; min-width: 100%; }
.zoom { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.75rem; }
.zoom button { min-height: 26px; padding: 0 10px; font-size: 0.75rem; }
.zoom span { min-width: 3.5ch; text-align: center; }
.moments { display: flex; align-items: center; gap: 4px 12px; margin-top: 4px; flex-wrap: wrap; font-size: 0.8125rem; }
.moment-entry { margin-left: auto; }
.moment-entry > summary { padding: 4px 0; font-size: 0.8125rem; }
.moment-entry[open] { flex-basis: 100%; margin-left: 0; }
.score { font-size: 0.8125rem; }
.score b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; border: 1px solid var(--line-strong); border-radius: 999px; font: 0.75rem var(--mono); }
.chip button { min-height: 24px; padding: 0 6px; border: 0; background: transparent; color: var(--muted); }
.moment-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.moment-form > div { width: 120px; }

/* Find a moment */
.finder { margin: 20px 0 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.find-row { display: flex; gap: 8px; }
.find-row input { flex: 1; min-width: 0; }
.hits { margin-top: 8px; }
.hit-list { max-height: 260px; margin: 6px 0 0; padding: 0; overflow-y: auto; list-style: none; font-size: 0.8125rem; }
.hit-list li, .heard-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 3px 0; border-top: 1px solid var(--line); }
.hit-list button, .heard-list button { min-height: 26px; padding: 0 10px; font-size: 0.8125rem; }
.hit-text b { font-weight: 500; }

/* Review desk */
.job-page { display: flex; flex-direction: column; }
.job-page > * { min-width: 0; }
.desk { --stage: clamp(340px, calc(100dvh - 424px), 640px); display: grid; grid-template-columns: 272px auto minmax(300px, 1fr); gap: 20px; align-items: start; }
.clip-column { position: sticky; top: 16px; }
.clip-head { margin-bottom: 8px; }
.clip-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(var(--stage) - 64px); overflow-y: auto; }
.clip-row { display: grid; flex: none; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 0; padding: 6px; border: 1px solid transparent; border-radius: 16px; background: transparent; text-align: left; white-space: normal; font-weight: 400; line-height: 1.35; }
.clip-row:hover:not(:disabled) { background: var(--surface); }
.clip-row[aria-current="true"] { background: var(--raised); border-color: var(--accent); }
.thumb { display: block; width: 54px; height: 96px; border-radius: 10px; object-fit: cover; background: var(--raised); }
.clip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.clip-row .hook { margin-bottom: 2px; font-weight: 600; overflow-wrap: anywhere; }
.clip-row .state { color: var(--muted); }
.clip-row .state.approved { color: var(--good); }
.clip-row .state.rejected { color: var(--bad); }
.clip-row .meta { color: var(--muted); font: 0.75rem var(--mono); }
.clip-row.rejected .hook { color: var(--muted); text-decoration: line-through; }
.player { position: sticky; top: 16px; width: min-content; }
.player video, .player canvas { display: block; width: auto; height: calc(var(--stage) - 38px); aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 10px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.modes button { min-height: 28px; background: transparent; color: var(--muted); font-size: 0.8125rem; }
.modes button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.modes button[aria-pressed="true"]:hover:not(:disabled) { background: #e4e4e7; }
.stage { position: relative; width: fit-content; border-radius: var(--radius); overflow: hidden; background: #000; }
.stage video, .stage canvas { cursor: pointer; }
.player-time { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 0.6875rem; text-shadow: 0 1px 2px #000; }
.player-time span:last-child { color: var(--muted); }
.player-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 10px 8px; background: linear-gradient(transparent, rgb(0 0 0 / 0.8)); }
.player-buttons { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--text); font-size: 0.75rem; }
.player-buttons button { flex: none; width: 28px; min-height: 28px; padding: 0; border-color: transparent; background: rgb(255 255 255 / 0.14); backdrop-filter: blur(8px); font-size: 0.75rem; }
.player-buttons button:hover:not(:disabled) { background: rgb(255 255 255 / 0.26); }
.player-buttons button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.player-buttons span { flex: 1; }
.player-buttons button:nth-of-type(3) { width: 38px; }
.player-flash { position: absolute; top: 12px; left: 50%; padding: 4px 12px; border-radius: 999px; background: rgb(0 0 0 / 0.7); font-size: 0.8125rem; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.trimbar { position: relative; height: 14px; border-radius: 999px; background: oklch(1 0 0 / 0.2); touch-action: none; cursor: pointer; }
.bar-tip { position: absolute; bottom: 40px; padding: 1px 6px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 0.6875rem; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.stage:fullscreen { display: grid; place-items: center; width: 100vw; height: 100vh; border-radius: 0; }
.stage:fullscreen video, .stage:fullscreen canvas { width: auto; height: 100vh; max-width: 100vw; border-radius: 0; }
.stage:fullscreen .player-bar { left: 50%; right: auto; width: min(100vw, 56.25vh); transform: translateX(-50%); }
.trim-range { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: rgb(209 255 83 / 0.3); pointer-events: none; }
.trim-playhead { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.trim-handle { position: absolute; top: -5px; width: 10px; min-height: 0; height: 24px; margin-left: -6px; padding: 0; border: 0; border-radius: 999px; background: var(--accent); cursor: ew-resize; touch-action: none; }
.trim-handle:hover:not(:disabled) { background: #e2ff8a; }
.trim-handle:active:not(:disabled) { transform: none; }
.trim-handle:disabled { background: var(--faint); }
.render-note { margin-top: 8px; font-size: 0.8125rem; color: var(--muted); }
.render-note.failed { color: var(--bad); overflow-wrap: anywhere; }
.editor { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.verdict { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.verdict button { min-height: 40px; }
.verdict button[aria-pressed="true"].approve { background: var(--good); border-color: var(--good); color: var(--good-ink); }
.verdict button[aria-pressed="true"].reject { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }
.why { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-size: 0.875rem; }
.why p + p { margin-top: 6px; }
.heard { color: var(--muted); font-size: 0.8125rem; }
.heard b { font-weight: 500; color: var(--text); }
.stats { display: flex; gap: 16px; margin-bottom: 6px; color: var(--muted); font: 0.75rem var(--mono); }
.cam-summary > summary .mono { color: var(--text); font-size: 0.8125rem; }
.cam-summary .adjust { margin-left: auto; text-decoration: underline; text-underline-offset: 3px; }
.cam-summary[open] .adjust { display: none; }
.word-entry > summary { padding: 8px 0 4px; }
.words { display: flex; flex-wrap: wrap; gap: 4px; max-height: 190px; margin-top: 8px; overflow-y: auto; }
input.word { width: auto; min-height: 28px; padding: 2px 8px; border-radius: 8px; font-size: 0.8125rem; field-sizing: content; }
.post-row { flex-wrap: nowrap; align-items: flex-start; }
.share-row { flex-wrap: nowrap; }
.share-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.8125rem; }
.text-button { display: inline; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-decoration: underline; cursor: pointer; }
.post-row span { min-width: 0; overflow-wrap: anywhere; }
.editor textarea { field-sizing: content; min-height: 64px; max-height: 180px; }
.trim { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nudge { display: flex; gap: 4px; margin-top: 4px; }
.nudge button { flex: 1; min-height: 28px; padding: 0 6px; font: 0.75rem var(--mono); }
.editor-actions { position: sticky; bottom: 0; z-index: 2; display: flex; gap: 8px; margin-top: 4px; padding: 10px 0 12px; flex-wrap: wrap; border-top: 1px solid var(--line); background: var(--bg); }
.editor-actions .grow { flex: 1; }
.empty { padding: 48px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty h2 { margin-bottom: 4px; color: var(--text); }
.keys { margin-top: 12px; padding: 0 6px; color: var(--muted); font-size: 0.75rem; }
kbd { padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 5px; font: 0.6875rem var(--mono); }
.skeleton { height: 210px; margin-bottom: 16px; border-radius: var(--radius); background: var(--surface); }

/* Settings */
.section { margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.section h2 { margin-bottom: 12px; }
.status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 0.875rem; }

/* Toasts and gate */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--raised); box-shadow: 0 12px 32px -8px rgb(0 0 0 / 0.6); font-size: 0.875rem; overflow-wrap: anywhere; }
.toast.error { border-color: var(--bad); }

/* Confirmation box: centered on a desk, a sheet from the bottom on a phone */
dialog.confirm { width: min(400px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px -16px rgb(0 0 0 / 0.8); }
dialog.confirm::backdrop { background: rgb(0 0 0 / 0.6); }
.confirm-body { padding: 24px; }
.confirm-body h2 { margin: 0 0 8px; font-size: 1.0625rem; font-weight: 600; }
.confirm-body p { margin: 0; color: var(--muted); font-size: 0.875rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
button.destructive { background: var(--bad); color: var(--bad-ink); font-weight: 600; }
button.destructive:hover:not(:disabled) { background: #fca5a5; }
@media (max-width: 760px) {
  dialog.confirm { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; }
  .confirm-body { padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); }
  .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .confirm-actions button { min-height: 48px; }
}
.shell:has(.rail.hidden) { grid-template-columns: minmax(0, 1fr); }
.gate { display: grid; place-items: center; min-height: 100%; padding: 16px; }
.gate form { width: min(360px, 100%); }
.gate h1 { margin-bottom: 8px; font-size: 1.75rem; }
.gate p { margin-bottom: 16px; color: var(--muted); }

@media (max-width: 1320px) {
  .editor-actions svg { display: none; }
  .editor-actions { flex-wrap: nowrap; }
  .editor-actions > * { padding: 0 10px; }
}
@media (max-width: 1120px) {
  .desk { --stage: clamp(340px, calc(100dvh - 200px), 560px); grid-template-columns: auto minmax(0, 1fr); }
  .clip-column { position: static; grid-column: 1 / -1; }
  .clip-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .clip-row { flex: 0 0 250px; }
  .keys { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-flow: row wrap; align-items: center; gap: 4px 8px; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-right: auto; white-space: nowrap; }
  .rail-link { padding: 7px 12px; white-space: nowrap; }
  .rail-link svg { display: none; }
  .rail-link.new { margin: 0; order: 0; }
  .brand { padding-bottom: 2px; }
  .rail-jobs { order: 1; flex: 1 0 100%; flex-direction: row; margin: 0; padding: 0; overflow-x: auto; }
  .rail-empty { display: none; }
  .rail-job { flex: 0 0 150px; }
  .rail-job .sub { display: none; }
  .page, .page.narrow { padding: 16px 16px 40px; }
  .job-head { flex-direction: column; }
  .job-head > div:first-child { width: 100%; }
  .job-head h1 { white-space: normal; overflow-wrap: anywhere; }
  .desk { --stage: min(64dvh, 560px); order: 1; grid-template-columns: minmax(0, 1fr); }
  .timeline { order: 2; margin-top: 16px; }
  .job-page > details { order: 3; }
  .player { position: static; width: min(100%, calc((var(--stage) - 38px) * 9 / 16)); margin: 0 auto; }
  .player video, .player canvas { width: 100%; height: auto; }
  .stage { width: 100%; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .find-row { flex-wrap: wrap; }
  .find-row input { flex-basis: 100%; }
  .finder { order: 2; }
  .composer { padding-top: 32px; }
  .linkbar { flex-wrap: wrap; padding: 8px 8px 8px 18px; border-radius: var(--radius); }
  .linkbar input[type="url"] { flex-basis: calc(100% - 40px); }
  .linkbar button { flex-basis: 100%; }
  .notice { border-radius: var(--radius-sm); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.rail-account { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8125rem; }
.rail-account span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rail-account a { color: var(--text); text-underline-offset: 3px; }
@media (max-width: 760px) { .rail-account { display: none; } }

/* Clip gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 28px 20px; }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-frame { position: relative; aspect-ratio: 9 / 16; border-radius: 16px; overflow: hidden; background: var(--raised); }
.card-frame img, .card-frame video { display: block; width: 100%; height: 100%; object-fit: cover; background: #000; }
.card-play { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: linear-gradient(transparent 55%, rgb(0 0 0 / 0.55)); }
.card-play:hover:not(:disabled) { background: linear-gradient(rgb(0 0 0 / 0.12), rgb(0 0 0 / 0.6)); }
.play-disc { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: rgb(0 0 0 / 0.45); backdrop-filter: blur(8px); transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1); }
.card-play:hover .play-disc { transform: scale(1.08); }
.play-disc svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.card-length { position: absolute; right: 10px; bottom: 10px; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / 0.6); font-size: 0.75rem; pointer-events: none; }
.card-busy { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 600; pointer-events: none; }
.card-head { display: flex; align-items: flex-start; gap: 4px; }
.card-hook { flex: 1; min-width: 0; margin: 6px 0 0; font-weight: 600; line-height: 1.3; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-actions button { padding: 0 10px; }
button.icon-button { flex: none; width: 36px; padding: 0; background: transparent; color: var(--muted); }
button.icon-button:hover:not(:disabled) { background: var(--raised); color: var(--text); }
button.icon-button svg { width: 20px; height: 20px; }

/* Menu: a popover on a desk, a sheet on a phone */
dialog.menu { position: fixed; inset: auto; margin: 0; min-width: 210px; padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--raised); color: var(--text); box-shadow: 0 20px 48px -12px rgb(0 0 0 / 0.8); }
dialog.menu::backdrop { background: transparent; }
.menu-body { display: flex; flex-direction: column; padding: 6px; }
.menu-body button { justify-content: flex-start; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border-radius: 10px; background: transparent; }
.menu-body button:hover:not(:disabled), .menu-body button:focus-visible { background: var(--hover); }
.menu-body .danger-item { color: var(--bad); }

/* Full-screen player on a phone */
dialog.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: var(--text); }
dialog.viewer[open] { display: flex; flex-direction: column; }
dialog.viewer::backdrop { background: #000; }
dialog.viewer video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; }
.viewer-top { position: absolute; top: 0; left: 0; right: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: calc(8px + env(safe-area-inset-top)) 12px 16px; background: linear-gradient(rgb(0 0 0 / 0.6), transparent); }
.viewer-count { padding: 2px 10px; border-radius: 999px; background: rgb(0 0 0 / 0.5); font-size: 0.8125rem; }
dialog.viewer .icon-button { width: 44px; min-height: 44px; background: rgb(0 0 0 / 0.45); color: var(--text); }
.viewer-bottom { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.viewer-hook { margin: 0 0 10px; font-weight: 600; overflow-wrap: anywhere; }
.viewer-actions { display: grid; grid-template-columns: 1fr 1fr 48px; gap: 8px; }
.viewer-actions button { min-height: 48px; }
dialog.viewer .viewer-actions .icon-button { width: 48px; min-height: 48px; background: var(--raised); }

/* Edit page */
.clip-page { max-width: 1120px; }
.clip-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.clip-head h1 { flex: 1; min-width: 0; margin: 0; overflow: hidden; font-size: 1.25rem; white-space: nowrap; text-overflow: ellipsis; }
.back { display: inline-flex; flex: none; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px 0 8px; border-radius: 999px; background: var(--raised); color: var(--text); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.back:hover { background: var(--hover); }
.edit-layout { --stage: clamp(360px, calc(100dvh - 150px), 700px); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: start; }
.edit-layout .player video, .edit-layout .player canvas { height: var(--stage); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-bottom: 20px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.tabs button { min-height: 36px; background: transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.tabs button[aria-selected="true"]:hover:not(:disabled) { background: #e4e4e7; }
.tab-panel { min-height: 240px; }
.clip-page .editor-actions button { min-height: 44px; }

@media (max-width: 760px) {
  .gallery { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
  .card-actions { display: none; }
  .card-hook { font-size: 0.875rem; }
  button.icon-button { width: 44px; min-height: 44px; }
  dialog.menu { inset: auto 0 0 0; width: 100%; max-width: none; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
  dialog.menu::backdrop { background: rgb(0 0 0 / 0.6); }
  .menu-body { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .menu-body button { min-height: 56px; font-size: 1rem; }
  .menu-body .menu-cancel { justify-content: center; margin-top: 6px; background: var(--hover); }
  .toasts { top: calc(12px + env(safe-area-inset-top)); right: 16px; bottom: auto; left: 16px; max-width: none; }
  .clip-head { margin-bottom: 8px; }
  .clip-head .muted { display: none; }
  .edit-layout { --stage: 44dvh; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .clip-page .player { position: sticky; top: 0; z-index: 3; width: 100%; padding: 8px 0; background: var(--bg); }
  .clip-page .stage { width: fit-content; margin: 0 auto; }
  .clip-page .player video, .clip-page .player canvas { width: auto; height: var(--stage); }
  .tab-panel { min-height: 0; }
  .clip-page .editor-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .clip-page .editor-actions button { min-height: 48px; }
}
