:root {
  --bg: #f4f2ee;
  --card: #fff;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #dedbd4;
  --accent: #b3261e;
  --radius: 10px;
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2 { margin: 0 0 0.75rem; font-weight: 650; }
h1 span { color: var(--muted); font-weight: 400; font-size: 0.6em; margin-left: 0.5rem; }

header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem 0; max-width: 1100px; margin: 0 auto; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem 3rem; display: grid; gap: 1.5rem; }

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

label { display: grid; gap: 0.3rem; font-weight: 550; margin-bottom: 0.9rem; }
input, select, textarea { font: inherit; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 6px; padding: 0.6rem 1.2rem; background: var(--ink); color: #fff; }
button:disabled { opacity: 0.5; cursor: wait; }
button.link { background: none; color: var(--muted); padding: 0.2rem; text-decoration: underline; }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 0.9rem; }

.frames { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.9rem; align-items: stretch; }
.frame-actions { display: grid; place-items: center; }
.frame-actions button { background: var(--bg); color: var(--ink); font-size: 1.3rem; padding: 0.4rem 0.7rem; }
.drop { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); min-height: 190px; padding: 0.75rem; display: grid; place-items: center; cursor: pointer; margin: 0; }
.drop.over { border-color: var(--accent); background: #fff6f5; }
.drop-title { position: absolute; top: 0.5rem; left: 0.75rem; font-size: 0.85rem; }
.drop-title em { color: var(--muted); font-weight: 400; }
.drop img { max-width: 100%; max-height: 240px; border-radius: 6px; margin-top: 1.2rem; }
.drop .hint { color: var(--muted); font-weight: 400; }
.drop .clear { position: absolute; top: 0.3rem; right: 0.5rem; }

.note { color: var(--muted); min-height: 1em; margin: 0.5rem 0 0.9rem; }
.error { color: var(--accent); margin: 0.25rem 0; padding-left: 1.1rem; }
.error:empty { display: none; }

.runs { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.run-head { display: grid; grid-template-columns: auto auto 1fr auto; gap: 0.75rem; align-items: start; }
.thumb { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--bg); }
.run-meta p { margin: 0.25rem 0 0; }
.run-meta .when, .run-meta .settings { color: var(--muted); font-size: 0.9rem; margin-left: 0.5rem; }
.run-meta .settings { margin-left: 0; }
.run[data-status='failed'] .status { color: var(--accent); }
.run[data-status='done'] .status { color: #1b7f3b; }
.run progress { width: 100%; margin-top: 0.75rem; }
.reuse { background: var(--bg); color: var(--ink); }
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.clips:empty { display: none; }
.clips figure { margin: 0; }
.clips video { width: 100%; border-radius: 6px; background: #000; }

body.login { min-height: 100vh; display: grid; place-items: center; }
body.login form { width: min(360px, 90vw); }

@media (max-width: 720px) {
  .frames { grid-template-columns: 1fr; }
  .run-head { grid-template-columns: auto 1fr; }
}
