:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1b1f27;
  --muted: #5f6775;
  --line: #dde1e7;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e4ecfd;
  --ok: #15803d;
  --warn: #b45309;
  --warn-bg: #fff4e5;
  --err: #b91c1c;
  --err-bg: #fdecec;
  --range-fill: rgba(37, 99, 235, .25);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --panel: #181b21;
    --text: #e8eaf0;
    --muted: #9aa3b2;
    --line: #2a2f39;
    --accent: #5b8def;
    --accent-ink: #0b1220;
    --accent-soft: #1d2a45;
    --ok: #4ade80;
    --warn: #fbbf24;
    --warn-bg: #2b2210;
    --err: #f87171;
    --err-bg: #2e1616;
    --range-fill: rgba(91, 141, 239, .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); }
main { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }
.hidden { display: none !important; }
.dim { color: var(--muted); }

.top {
  max-width: 920px; margin: 0 auto; padding: 18px 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: .2px; }
.logo {
  display: inline-block; width: 18px; height: 18px; border-radius: 5px; background: var(--accent);
  align-self: center; position: relative;
}
.logo::after {
  content: ""; position: absolute; left: 5px; top: 4px; border-left: 8px solid #fff;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.tagline { color: var(--muted); font-size: 14px; }
.version { color: var(--muted); font-size: 12px; font-family: var(--mono); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; align-self: center; }

button {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; border-color: var(--line); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; padding: 10px 18px; }
button.ghost { background: transparent; }
button.small { padding: 5px 10px; font-size: 13px; }

.notes { margin: 8px 0 14px; display: grid; gap: 8px; }
.note { padding: 10px 12px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); border: 1px solid transparent; font-size: 14px; }
.note.err { background: var(--err-bg); color: var(--err); }

.dropzone {
  margin-top: 12px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel);
  min-height: 260px; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dz-icon { font-size: 34px; color: var(--accent); }
.dz-title { font-size: 18px; margin: 6px 0 4px; font-weight: 600; }
.dz-sub { margin: 0; color: var(--muted); }

.fileinfo {
  display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--muted);
  padding: 8px 0 10px;
}
.fileinfo b { color: var(--text); font-weight: 600; }

.preview { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; }
.preview video, .preview canvas { width: 100%; height: 100%; object-fit: contain; display: block; }

.transport { padding: 10px 0 4px; }
.timeline { position: relative; height: 34px; }
.tl-track { position: absolute; left: 0; right: 0; top: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.tl-range { position: absolute; top: 11px; height: 12px; border-radius: 3px; background: var(--range-fill); pointer-events: none; }
.tl-mark { position: absolute; top: 6px; width: 2px; height: 22px; background: var(--accent); pointer-events: none; transform: translateX(-1px); }
.tl-mark::after { content: ""; position: absolute; top: -4px; left: -4px; width: 10px; height: 6px; background: var(--accent); border-radius: 2px; }
.timeline input[type=range] {
  position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 34px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.timeline input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 34px; }
.timeline input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 24px; margin-top: 5px; border-radius: 4px;
  background: var(--text); border: 2px solid var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.timeline input[type=range]::-moz-range-track { background: transparent; height: 34px; }
.timeline input[type=range]::-moz-range-thumb { width: 14px; height: 24px; border-radius: 4px; background: var(--text); border: 2px solid var(--bg); }
.transport-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.tbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.tbtns button { min-width: 48px; padding: 6px 10px; }
.timecode { font-family: var(--mono); font-size: 14px; }

.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: none; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 14px;
  color: var(--muted); font-weight: 600; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

.panel { padding: 14px 2px 4px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.row label { min-width: 120px; color: var(--muted); }
input.time, select {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
input.time { font-family: var(--mono); width: 130px; }
input.time:focus, select:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; min-height: 1em; }
.hint .warn { color: var(--warn); }
.hint .err { color: var(--err); }
.hint .ok { color: var(--ok); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 680px) { .options { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 10px 14px 12px; margin: 0; min-width: 0; }
legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
label.radio { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
label.radio input { margin-top: 4px; }
label.radio span { font-size: 14px; }
#keyframeInfo { font-family: var(--mono); font-size: 12.5px; }
#keyframeInfo button { margin-left: 4px; }

.action { margin-top: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress { flex: 1 1 220px; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.status { flex-basis: 100%; margin: 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

footer { max-width: 920px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: 12.5px; }
footer p { margin: 0; }
footer .credit { margin-top: 6px; }
