:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1b1b1a;
  --muted: #6b6b66;
  --line: #e4e3de;
  --accent: #e8483b;
  --accent-soft: #fdecea;
  --ok: #1f8a4c;
  --err: #b42318;
  --err-soft: #fef3f2;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --card: #1c1c1b;
    --text: #f1f0ec;
    --muted: #a09f98;
    --line: #2f2f2d;
    --accent-soft: #3a1d1a;
    --err: #f97066;
    --err-soft: #2d1614;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: inherit; }
button, input { font-family: inherit; font-size: inherit; color: inherit; }
main { max-width: 720px; margin: 0 auto; padding: 32px 16px 48px; }

header { margin-bottom: 20px; position: relative; }
.who { position: absolute; right: 0; top: 6px; font-size: 14px; color: var(--muted); }
.who a { color: var(--muted); }
h1 { display: flex; align-items: center; gap: 10px; font-size: 28px; margin: 0 0 6px; letter-spacing: -0.02em; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.tag { margin: 0; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

.len { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; font-weight: 600; }
.len-input { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
.len input { width: 96px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: right; font-size: 17px; color: var(--text); }
.len input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-err { color: var(--err); margin: -8px 0 12px; font-size: 14px; }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 44px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop-icon { color: var(--accent); margin-bottom: 8px; }
.drop-main { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.drop-sub { margin: 0; color: var(--muted); font-size: 14px; }

.file-row { margin-bottom: 18px; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }

.step { margin-bottom: 18px; }
.step-head { display: flex; justify-content: space-between; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.step-sub { color: var(--muted); font-size: 13px; margin-top: 6px; min-height: 1em; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.bar.indeterminate > div { width: 30% !important; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
.step.complete .bar > div { background: var(--ok); }

.save-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 18px; }
.save-box p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.save-box.saved { border-color: var(--ok); }
.save-note { margin: -8px 0 18px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; line-height: 1.5; }
.clip-actions { display: flex; gap: 6px; flex: none; }
.save-box.saved strong { color: var(--ok); }

.error { background: var(--err-soft); color: var(--err); padding: 12px 14px; border-radius: 10px; margin: 0 0 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; font-size: 15px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: default; }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.results-head h2 { margin: 0; font-size: 19px; }
.notes { list-style: none; padding: 0; margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.clips { list-style: none; padding: 0; margin: 0; }
.clip { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.clip:first-child { border-top: none; }
.clip-num { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.clip-info { flex: 1; min-width: 0; }
.clip-name { font-weight: 600; overflow-wrap: anywhere; }
.clip-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.clip .btn { padding: 8px 12px; font-size: 14px; }
.clip.pending { opacity: .5; }

.actions { margin-top: 18px; text-align: center; }
.recent { margin-top: 20px; }
.recent h2 { font-size: 15px; margin: 0 0 8px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.recent li a { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.recent li span { color: var(--muted); white-space: nowrap; }
footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 20px; }

@media (max-width: 520px) {
  main { padding-top: 20px; }
  .save-box { flex-direction: column; align-items: stretch; }
  .results-head .btn { width: 100%; }
  .drop { padding: 36px 12px; }
}
