:root {
  --bg: #0f1117;
  --card: #181b24;
  --card2: #1f2330;
  --border: #2a2f3f;
  --text: #e8eaf0;
  --muted: #9aa1b5;
  --accent: #ff5c5c;
  --accent2: #ff8f5c;
  --ok: #3ecf8e;
  --warn: #f5b342;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* ── ログイン ── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1a1e2e 0%, var(--bg) 65%);
}
.login-card {
  width: min(400px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card .logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 12px 14px; margin-bottom: 12px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 16px;
  text-align: center; letter-spacing: 2px;
}

/* ── 共通 ── */
.btn {
  cursor: pointer; border: none; border-radius: 10px;
  padding: 11px 20px; font-size: 15px; font-weight: 600;
  background: var(--card2); color: var(--text);
  transition: transform .06s, filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; width: 100%;
}
.btn.big { padding: 15px; font-size: 17px; margin-top: 20px; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.error { color: var(--accent); font-size: 13px; margin-top: 10px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* ── ヘッダー ── */
header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,17,23,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 860px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { font-weight: 700; font-size: 17px; }
.member-badge { color: var(--muted); font-size: 13px; }
.member-badge input {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 5px 10px;
  font-size: 13px; width: 130px;
}

main { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px; margin-bottom: 24px;
}
.card h2 { font-size: 16px; margin: 18px 0 12px; }
.card h2:first-child { margin-top: 0; }

/* ── タブ ── */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--muted); font-size: 14px; font-weight: 600;
}
.tab.active { color: var(--text); border-color: var(--accent); background: rgba(255,92,92,.08); }

/* ── ドロップゾーン ── */
.dropzone {
  border: 2px dashed var(--border); border-radius: 14px;
  padding: 34px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: rgba(255,92,92,.05);
}
.dz-main { font-size: 16px; font-weight: 600; }
.dz-sub { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.dz-file {
  margin-top: 12px; color: var(--ok); font-weight: 600; font-size: 14px;
}
#tab-url input {
  width: 100%; padding: 13px 14px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 15px;
}

/* ── オプション ── */
.opt-group { margin-bottom: 14px; flex: 1; }
.opt-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.opt-row { display: flex; gap: 16px; }
select {
  width: 100%; padding: 11px 12px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 15px;
}

/* 背景スタイル選択カード */
.style-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.style-card {
  cursor: pointer; text-align: center; padding: 12px 6px 10px;
  background: var(--card2); border: 2px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color .15s;
}
.style-card:has(input:checked) { border-color: var(--accent); background: rgba(255,92,92,.07); }
.style-card input { display: none; }
.style-name { font-weight: 700; font-size: 13.5px; }
.style-desc { color: var(--muted); font-size: 11px; }
.style-preview {
  width: 34px; height: 58px; border-radius: 6px; overflow: hidden;
  position: relative; background: #000; border: 1px solid #333;
  display: block;
}
.style-preview i {
  position: absolute; left: 0; right: 0; top: 50%;
  transform: translateY(-50%); height: 19px;
  background: linear-gradient(135deg, #5c8aff, #8f5cff);
}
.style-preview.blur { background: linear-gradient(135deg, #2c3c66, #3c2c66); }
.style-preview.crop i { height: 100%; background: linear-gradient(135deg, #5c8aff, #8f5cff); }
.style-preview.wide { width: 58px; height: 34px; }
.style-preview.wide i { height: 100%; }

/* ── アップロード進捗 ── */
.upload-progress { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.upload-progress .bar { flex: 1; }
.upload-progress span { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ── ジョブ ── */
.job {
  border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 12px; background: var(--card2);
}
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-title { font-weight: 700; font-size: 14.5px; word-break: break-all; }
.job-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.badge.running { background: rgba(245,179,66,.15); color: var(--warn); }
.badge.queued { background: rgba(154,161,181,.15); color: var(--muted); }
.badge.done { background: rgba(62,207,142,.15); color: var(--ok); }
.badge.error { background: rgba(255,92,92,.15); color: var(--accent); }
.bar {
  height: 8px; background: #0c0e14; border-radius: 6px; overflow: hidden;
  margin-top: 10px;
}
.bar .fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .6s ease;
}
.job-msg { color: var(--muted); font-size: 13px; margin-top: 8px; }
.job-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── クリップ一覧 ── */
.clips { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 680px) { .clips { grid-template-columns: 1fr; } .style-cards { grid-template-columns: repeat(2, 1fr); } .opt-row { flex-direction: column; gap: 0; } }
.clip {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; display: flex; gap: 12px;
}
.clip video {
  width: 96px; border-radius: 8px; background: #000; flex-shrink: 0;
  max-height: 170px;
}
.clip-body { min-width: 0; flex: 1; }
.clip-title { font-weight: 700; font-size: 13.5px; }
.clip-info { color: var(--muted); font-size: 11.5px; margin: 3px 0 6px; }
.clip-score { color: var(--warn); font-weight: 700; }
details.cands { margin-top: 4px; }
details.cands summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details.cands ul { margin: 6px 0 0 16px; font-size: 12px; color: var(--text); }
details.cands li { margin-bottom: 3px; }
.cand-label { color: var(--muted); }
.clip-dl { margin-top: 8px; }
footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 20px; border-top: 1px solid var(--border);
}
