:root {
  --bg: #0b0f19;
  --surface: #121826;
  --surface-2: #19202f;
  --line: #242c3d;
  --text: #e9edf4;
  --muted: #8a95a9;
  --accent: #ffd440;
  --accent-ink: #1a1405;
  --ok: #4fd18b;
  --warn: #ffb547;
  --error: #ff6b6b;
  --link: #7cb7ff;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: rgba(11, 15, 25, .86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

.agent { max-width: 640px; margin: 12px auto 0; padding: 0 16px; font-size: 13px; color: var(--warn); }

/* 一覧 */
.list { display: grid; gap: 14px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; }
.card:active { transform: scale(.995); }
.thumb { aspect-ratio: 16 / 9; width: 100%; display: block; object-fit: cover; background: var(--surface-2); }
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.state { font-weight: 600; }
.state.ready { color: var(--accent); }
.state.queued { color: var(--warn); }
.state.done { color: var(--ok); }
.state.error { color: var(--error); }

/* 詳細 */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.seg button { border: 0; background: none; padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.player { width: 100%; border-radius: var(--radius); background: #000; display: block; }
.player.vertical { max-height: 70vh; width: auto; max-width: 100%; margin: 0 auto; aspect-ratio: 9 / 16; }
.section { margin-top: 22px; }
.section h2 { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .06em; margin: 0 0 8px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.big-title { font-size: 17px; font-weight: 700; line-height: 1.45; margin: 4px 0 0; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.desc { white-space: pre-wrap; font-size: 13px; color: #c6cedb; margin-top: 10px; max-height: 320px; overflow: auto; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks svg { flex: none; width: 18px; height: 18px; margin-top: 2px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.checks .ok svg { stroke: var(--ok); }
.checks .warn svg { stroke: var(--warn); }
.checks .block svg { stroke: var(--error); }
.thumbs { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.thumbs img { width: 100%; border-radius: 10px; display: block; background: var(--surface-2); }
.thumbs .v { aspect-ratio: 9 / 16; object-fit: cover; }

.when { display: grid; gap: 14px; }
.when-row label.cap { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); background: var(--surface-2); padding: 7px 12px; border-radius: 999px; font-size: 14px; }
.chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
input[type="datetime-local"] { margin-top: 8px; width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }

.confirm { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.confirm input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }

.actions {
  position: sticky; bottom: 0; margin: 20px -16px 0; padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(transparent, var(--bg) 30%);
}
.primary { width: 100%; border: 0; border-radius: 12px; padding: 14px; font-weight: 700; font-size: 16px; background: var(--accent); color: var(--accent-ink); }
.primary:disabled { background: var(--surface-2); color: var(--muted); }
.secondary { border: 1px solid var(--line); background: none; border-radius: 10px; padding: 9px 14px; font-size: 14px; }

.progress { display: grid; gap: 8px; font-size: 14px; }
.step { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.step i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.step.on { color: var(--text); }
.step.on i { border-color: var(--accent); background: var(--accent); }
.step.err { color: var(--error); }
.step.err i { border-color: var(--error); background: var(--error); }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); font-size: 14px; }
select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); }
