:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6a6f76;
  --line: #e2ded6;
  --accent: #2f6f5e;
  --accent-text: #ffffff;
  --accent-soft: #e3efe9;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --stage: #1c1d1f;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161718;
    --card: #202224;
    --text: #e8e6e3;
    --muted: #9da1a6;
    --line: #34373a;
    --accent: #6cc4a8;
    --accent-text: #0f201b;
    --accent-soft: #23352f;
    --danger: #ff8a80;
    --danger-soft: #3a2220;
    --stage: #0c0c0d;
    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(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  /* 日本語は文節で折り返す(文節の区切りにゼロ幅スペースを入れてある) */
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input { font: inherit; color: inherit; }

.top, main, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.top { padding-top: 32px; padding-bottom: 8px; }
.top h1 { margin: 0; font-size: 26px; letter-spacing: 0.04em; }
.lead { margin: 6px 0 0; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
}
.card h2 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.num {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  font-size: 14px; flex: none;
}

.notice {
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--radius); padding: 14px 18px; margin: 16px 0;
}
.error { color: var(--danger); margin: 12px 0 0; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; margin: 10px 0 0; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 150px; padding: 20px;
  border: 2px dashed var(--line); border-radius: var(--radius);
  cursor: pointer; text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-main { font-size: 17px; font-weight: 600; }
.drop-sub { color: var(--muted); }
.file-info { display: grid; gap: 2px; }
.file-name { font-weight: 600; word-break: break-all; }
.file-meta { color: var(--muted); font-size: 14px; }

.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); text-decoration: underline; justify-self: start;
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button {
  border: 0; background: none; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  white-space: nowrap;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.seg.small button { padding: 6px 14px; font-size: 14px; }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.row-label { color: var(--muted); font-size: 14px; min-width: 6em; }

.stamps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.stamps button {
  width: 56px; height: 56px; padding: 6px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card);
}
.stamps button img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stamps button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.custom { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.btn-sub {
  display: inline-block; padding: 7px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--accent); color: var(--accent); font-size: 14px; white-space: nowrap;
}
.hint { color: var(--muted); font-size: 13px; }

.stage {
  position: relative; background: var(--stage); border-radius: 10px; overflow: hidden;
  display: grid; place-items: center; min-height: 180px;
}
.stage canvas { display: block; max-width: 100%; max-height: 62vh; }
.busy {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .25);
}
.busy::after {
  content: ""; width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#seek { width: 100%; margin: 14px 0 4px; accent-color: var(--accent); }
.preview-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.time { font-variant-numeric: tabular-nums; white-space: nowrap; }

.btn-main {
  display: block; width: 100%; margin-top: 16px; padding: 14px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-text); font-size: 17px; font-weight: 700;
}
.btn-main:disabled { opacity: .4; cursor: default; }

.progress { margin-top: 18px; }
.phases { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 10px; font-size: 14px; flex-wrap: wrap; }
.phases li { padding: 3px 12px; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.phases li.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.phases li.finished { color: var(--accent); }
.phases li.finished::before { content: "✓ "; }
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.progress-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }

.done { margin-top: 18px; }
.done-title { font-size: 18px; font-weight: 700; color: var(--accent); margin: 0; }
.done video { width: 100%; max-height: 62vh; margin-top: 10px; border-radius: 10px; background: var(--stage); }

.foot { color: var(--muted); font-size: 12px; padding-top: 8px; padding-bottom: 40px; }
