:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .08);
  --field: #f5f5f7;
  --accent: #6e3ff3;
  --accent-soft: rgba(110, 63, 243, .1);
  --ok: #1f9d55;
  --ok-soft: rgba(52, 199, 89, .14);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
  --radius: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --card: #1c1c1e;
    --fg: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, .1);
    --field: #2c2c2e;
    --accent: #a586ff;
    --accent-soft: rgba(165, 134, 255, .16);
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, .16);
    --bad: #ff6961;
    --bad-soft: rgba(255, 105, 97, .16);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3 { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif; margin: 0; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 14px; }

.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 820px; margin: 0 auto; padding: 0 16px; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand img { border-radius: 6px; }
.nav-note { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.nav-note svg { width: 15px; height: 15px; }

main { max-width: 820px; margin: 0 auto; padding: 0 16px; display: grid; gap: 20px; }

.hero { text-align: center; padding: 56px 0 20px; }
.hero h1 { font-size: clamp(36px, 6.4vw, 56px); line-height: 1.06; letter-spacing: -.028em; font-weight: 700; }
.hero p { max-width: 600px; margin: 18px auto 0; font-size: clamp(17px, 2.2vw, 20px); color: var(--muted); letter-spacing: -.01em; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.step { padding: 24px; display: grid; gap: 20px; min-width: 0; }
.step-head { display: flex; gap: 14px; align-items: flex-start; }
.step-head h2 { font-size: 21px; letter-spacing: -.015em; }
.num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 15px; }

.btn { appearance: none; border: 0; border-radius: 99px; padding: 11px 22px; font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; background: var(--field); color: var(--fg); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:not(:disabled):hover { filter: brightness(1.06); }

.pick, .make { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }

.summary { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.summary img { width: 200px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: var(--field); }
.summary-text { flex: 1 1 240px; min-width: 0; display: grid; gap: 4px; }
.folder-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.big { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
details { font-size: 14px; color: var(--muted); }
details summary { cursor: pointer; }
details ul { margin: 6px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; }
details li { overflow-wrap: anywhere; }

.field { display: grid; gap: 8px; min-width: 0; }
.field label { font-size: 14px; font-weight: 600; }
select, input[type=number] { font: inherit; font-size: 16px; color: var(--fg); background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; min-width: 0; }
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dur-row { display: flex; align-items: center; gap: 10px; }
.dur-row input { width: 130px; font-size: 22px; font-weight: 600; }
.unit { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { appearance: none; border: 1px solid var(--line); background: var(--field); color: var(--fg); border-radius: 99px; padding: 6px 13px; font: inherit; font-size: 14px; cursor: pointer; }
.chips button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.opt { font-size: 14px; font-weight: 400; letter-spacing: 0; }
#audioPanel { display: grid; gap: 18px; }
.audio-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.audio-row audio { flex: 1 1 260px; min-width: 0; height: 40px; }
.fit-music { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }

.bar { height: 8px; border-radius: 99px; background: var(--field); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#progress { display: grid; gap: 8px; }
#progText { font-variant-numeric: tabular-nums; }

#result { display: grid; gap: 14px; justify-items: start; }
#result video { width: 100%; border-radius: 14px; background: #000; max-height: 480px; }

.notice { padding: 14px 16px; border-radius: 14px; font-size: 15px; overflow-wrap: anywhere; }
.notice.ok { background: var(--ok-soft); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }

.foot { text-align: center; padding: 32px 16px 48px; font-size: 13px; color: var(--muted); }
.foot p { margin: 0; }
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
