:root {
  --bg: #FBF8F2; --card: #fff; --ink: #16233F; --muted: #5b6478; --line: #e6e0d4;
  --accent: #F2B935; --on-accent: #16233F; --primary: #16233F; --on-primary: #fff; --error: #b42318; --ok: #146c43;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1626; --card: #172036; --ink: #eef1f7; --muted: #a8b0c2; --line: #2a3550; --primary: #F2B935; --on-primary: #16233F; --error: #ff8a80; --ok: #7bd3a3; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans", Roboto, sans-serif; }
a { color: inherit; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; font-size: 18px; }
.brand span:last-child { font-weight: 500; color: var(--muted); }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 13px; margin-right: 4px; }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
nav a { text-decoration: none; font-weight: 600; }
main { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
main.wide { max-width: 1180px; }
footer { display: flex; gap: 16px; justify-content: center; padding: 24px 16px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.narrow { max-width: 460px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > form, form.stack { margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
button, .button { font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px; background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.small { padding: 8px 12px; font-size: 14px; }
.link { background: none; padding: 0; color: var(--ink); text-decoration: underline; font-weight: 600; }
form.inline { display: inline; }
button.danger { background: var(--error); color: #fff; }
.danger { border-top: 1px solid var(--line); padding-top: 14px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.error { color: var(--error); font-weight: 600; margin: 0; }
.flash { color: var(--ok); font-weight: 600; margin: 0; }
.hero { padding: 24px 0 32px; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); max-width: 18ch; }
.lead { font-size: 18px; color: var(--muted); max-width: 60ch; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.points > div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.points p { color: var(--muted); margin: 0; }
.prose { max-width: 720px; margin: 0 auto; }
.prose h2 { margin-top: 20px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { flex-direction: row; font-weight: 500; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.pill input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px; align-items: start; }
.controls { display: flex; flex-direction: column; gap: 14px; }
.preview { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; }
#stage { width: 100%; max-height: 70vh; object-fit: contain; background: #16233F; border-radius: 14px; }
.preview #stage { aspect-ratio: auto; }
.file { position: relative; overflow: hidden; align-self: flex-start; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.strip { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.thumb-n { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; border-radius: 6px; padding: 0 6px; }
.thumb-tools { display: flex; justify-content: space-between; }
.thumb-tools button { flex: 1; padding: 6px 0; background: transparent; color: var(--ink); border-radius: 0; font-size: 14px; }
progress { width: 100%; height: 10px; }
#result-video { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; }
@media (max-width: 820px) {
  .maker { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  #stage { max-height: 52vh; }
}
