/* MarchinZ 本体・他クリエイターツール(Privacy/Switcher)と同一トークンでライト統一 */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: rgba(15, 33, 56, 0.12);
  --fg: #0c0f14;
  --sub: rgba(12, 15, 20, 0.65);
  --navy: #0f2138;
  --accent: #1e4fd6;
  --accent-dark: #163b9e;
  --ok: #1e7a43;
  --shadow-card: 0 1px 2px rgba(15, 33, 56, 0.05), 0 4px 16px rgba(15, 33, 56, 0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: #eef1f5; }
html, body { color: var(--fg); font-family: -apple-system, "Hiragino Sans", sans-serif; }
body { min-height: 100dvh; display: flex; flex-direction: column; background: transparent; }

/* 3ツール共通: キービジュアルの上に白い透明を重ねた背景(iOS配慮でposition:fixed) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.88)), url("/images/lp/hero-show.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

/* MarchinZ 標準ヘッダ(Switcher/Privacy と同一・本体白基調)。
   本文はダークテーマのため、ヘッダのみ実色で自己完結させる(reangleの--line等と混ざらないよう変数不使用) */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: #fefcef; border-bottom: 1px solid rgba(15, 33, 56, 0.12);
  padding-top: calc(10px + env(safe-area-inset-top));
}
.head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mz-home { display: inline-flex; align-items: center; flex-shrink: 0; }
.mz-logo { height: 34px; width: auto; display: block; }
.tool-name {
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700;
  color: #0f2138; white-space: nowrap; padding-left: 10px; border-left: 1px solid rgba(15, 33, 56, 0.12);
}
.beta-badge {
  font-size: 10px; font-weight: 700; color: #866a19; background: #fdf3d7;
  border: 1px solid #ecd9a0; border-radius: 999px; padding: 2px 8px;
  white-space: nowrap; vertical-align: 2px;
}
.head-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ベータ免責バナー(Switcher/Privacy と共通のトーン) */
.beta-disclaimer {
  margin: 0; padding: 8px 16px; font-size: 12px; line-height: 1.5;
  color: #876b3a; background: #fbf6e6; border-bottom: 1px solid #eadfbf; text-align: center;
}
.beta-disclaimer i { margin-right: 2px; }
.caps-badge { font-size: 12px; color: rgba(12, 15, 20, 0.55); background: #fff; border: 1px solid rgba(15, 33, 56, 0.12); padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.caps-badge.ready { color: #1e7a43; border-color: #bfe6cd; }
.back-link { font-size: 12px; color: #1e4fd6; text-decoration: none; white-space: nowrap; }
.back-link:hover { color: #163b9e; text-decoration: underline; }
@media (max-width: 700px) { .head-right .caps-badge { display: none; } }

/* display指定のあるクラスは [hidden] より詳細度で勝つため、hidden を常に優先させる */
[hidden] { display: none !important; }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-card);
}

/* ① 選択 */
.drop { text-align: center; padding: 40px 20px; }
.drop.drag { border-color: var(--accent); }
.drop-title { font-size: 15px; margin-bottom: 20px; line-height: 1.6; }
.big-btn {
  display: block; width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
  color: #fff; background: var(--accent); border: none; border-radius: 12px;
  cursor: pointer;
}
.big-btn:hover { background: var(--accent-dark); }
.big-btn:disabled { opacity: 0.5; }
.note { font-size: 12px; color: var(--sub); margin-top: 12px; line-height: 1.7; }

/* ② プレビュー */
.clip-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.clip-name { font-size: 13px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-btn { background: none; border: none; color: var(--accent); font-size: 13px; cursor: pointer; flex-shrink: 0; }
.preview-wrap { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
/* スマホ: スライダー調整中もプレビューが見えるよう、ジャーニーバーの下へ貼り付く */
@media (max-width: 640px) {
  #editorSection .preview-card {
    position: sticky;
    top: var(--mzj-h, calc(48px + env(safe-area-inset-top, 0px)));
    z-index: 30;
  }
}
#previewCanvas { display: block; width: 100%; height: auto; }
#cornerOverlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hidden-video { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: -10px; top: -10px; }
.transport { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.mini-btn {
  background: #fff; color: var(--navy); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.mini-btn.compare { user-select: none; -webkit-user-select: none; touch-action: none; }
.mini-btn.compare.on { background: var(--accent-dark); color: #fff; }
.transport input[type="range"] { flex: 1; min-width: 40px; }
.time { font-size: 12px; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ルーペ */
#loupe {
  position: fixed; z-index: 50; width: 120px; height: 120px;
  border-radius: 50%; overflow: hidden; pointer-events: none;
  border: 2px solid var(--accent); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  background: #000;
}
#loupe canvas { width: 120px; height: 120px; display: block; }

/* タブ+パネル */
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 12px 0; font-size: 14px; border-radius: 10px; cursor: pointer;
  background: var(--bg); color: var(--sub); border: 1px solid var(--line);
}
.seg button.on { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); font-weight: 700; }
.panel { margin-top: 16px; }
.hint { font-size: 12px; color: var(--sub); line-height: 1.7; margin-bottom: 12px; }
/* 取り込みを断った理由(トーストが消えたあとも読み直せるように残す) */
.load-err-note { color: #b45309; background: rgba(180, 83, 9, .08); border-radius: 8px; padding: 8px 12px; margin-top: 10px; }
.btn-row { display: flex; gap: 8px; }

/* 設定 */
.setting { margin-bottom: 16px; }
.setting:last-child { margin-bottom: 0; }
.setting label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.setting label b { color: var(--fg); margin-left: 6px; font-variant-numeric: tabular-nums; }
.setting input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.setting.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.inline-label { margin: 0 !important; }
select {
  background: var(--bg); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}

/* 進捗 */
.bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 14px; }
#progressBar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
#progressWrap { text-align: center; }
#progressWrap .text-btn { margin-top: 10px; }
.done { font-size: 14px; margin-top: 14px; color: var(--ok); line-height: 1.6; word-break: break-all; }
#saveBtn { margin: 14px 0 10px; }

footer { text-align: center; padding: 16px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--sub); }

#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: #262b36; color: #fff; font-size: 13px; padding: 10px 18px;
  border-radius: 999px; opacity: 0; pointer-events: none; transition: all 0.25s;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* フッタ: ツール間の連続導線(v2026-07-18レビュー反映) */
.foot-tools { margin-top: 4px; }
.foot-tools a { color: #1e4fd6; text-decoration: none; }
.foot-tools a:hover { text-decoration: underline; }

/* ============ ステップ画面(見出し・リード・遷移ボタン) ============ */

.step-title { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.step-lead { margin: 0 0 10px; font-size: 12px; color: var(--sub, rgba(12, 15, 20, 0.55)); line-height: 1.6; }

.detect-status {
  display: block;
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}
.detect-status.busy { background: rgba(15, 33, 56, 0.06); color: var(--sub, rgba(12, 15, 20, 0.6)); }
.detect-status.ok { background: #e8f6ee; color: #1e7a43; border: 1px solid #bfe6cd; }
.detect-status.ng { background: #fbf6e6; color: #876b3a; border: 1px solid #eadfbf; }
.detect-status i { margin-right: 4px; }

.step-next { width: 100%; margin-top: 12px; }
.step-next i { font-size: 0.85em; margin-left: 4px; }

.step-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.step-nav .big-btn { flex: 1; margin-top: 0; }
.step-nav .mini-btn { flex: none; }

/* カラープリセット(実描画サムネ) */
.fx-label { display: flex; align-items: center; gap: 6px; }
.fx-label i { color: #1e4fd6; font-size: 0.9em; }
.fx-note { font-size: 10px; font-weight: 400; color: var(--sub, rgba(12, 15, 20, 0.5)); }

.preset-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 2px 8px;
  -webkit-overflow-scrolling: touch;
}

.preset-item {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: none;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sub, rgba(12, 15, 20, 0.6));
}

.preset-item canvas {
  width: 96px;
  height: 54px;
  border-radius: 8px;
  background: #0d1117;
  display: block;
}

.preset-item.on {
  border-color: #1e4fd6;
  color: #1e4fd6;
  background: rgba(30, 79, 214, 0.06);
}

.hint-tight { margin-top: 4px; margin-bottom: 0; }

/* チェックボックス行(切れた箇所の自動補正) */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1e4fd6;
  flex: none;
}

/* 管理者ログイン中の上限なし表示 */
.admin-limit-badge {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  background: rgba(37, 99, 235, 0.08); border: 1px solid rgba(37, 99, 235, 0.25);
  color: #1d4ed8; font-size: 12px; line-height: 1.6; font-weight: 700;
}

/* ベータ免責の開閉(1行要約+タップで詳細) */
.beta-disclaimer .disc-more { display: inline; }
.beta-disclaimer .disc-more summary {
  display: inline; cursor: pointer; color: inherit;
  text-decoration: underline; font-weight: 600; padding: 8px 2px;   /* タップしやすく */
}

/* iPhone: ダブルタップズームの誤発火を防ぐ(スクロール/ピンチは妨げない) */
button, select, input, label, .btn { touch-action: manipulation; }
