/* MarchinZ 本体のトンマナ(白基調・ネイビー/ブルー/アンバー3色)に統一。
   トークンは styles.css の :root と同値。レイアウトは変えず色だけ差し替える */
: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;
  --cream: #fefcef;
  --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; }
/* hidden属性は常に効かせる。
   display を指定したクラス(.admin-video-btn / .photo-tabs 等)が付いた要素では
   ブラウザ既定の [hidden]{display:none} が負けて、hidden でも見えてしまうため。
   ——管理者専用の「動画を選ぶ」が誰にでも見えていた原因。 */
[hidden] { display: none !important; }
html { background: #eef1f5; }
html, body { color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, 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;
}

/* ヘッダーは本体TOPと同じクリーム地+ネイビー文字。
   セレクタは必ず .topbar で限定する(2026-07-25)。以前は裸の `header {}` だったため、
   sitechrome.js が差し込む共有ブランドバー <header class="mzsc-brand"> にも適用され、
   .mzsc-brand-inner が shrink-to-fit になってロゴ右端にハンバーガーが重なっていた。
   mzsc- 接頭辞での衝突回避は要素セレクタからは守ってくれない。他3本と同じ形。 */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  background: var(--cream);
}
/* MarchinZ本体のロゴを先頭に置き、あくまでMarchinZページ内であることを示す */
.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: var(--navy); white-space: nowrap; padding-left: 10px; border-left: 1px solid var(--line);
}
.pill {
  font-size: 11px; color: var(--sub); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap; background: #fff;
}
.pill.ready { color: var(--ok); border-color: #b7dfc6; background: #eef9f2; }

/* MarchinZ 統合(ベータ版バッジ+戻るリンク)。バッジは本体 .mz-ctools-beta と同配色 */
.beta-badge {
  flex-shrink: 0; font-size: 10px; font-weight: 700; color: #866a19; background: #fdf3d7;
  border: 1px solid #ecd9a0; border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.back-link { font-size: 12px; color: var(--accent); text-decoration: none; white-space: nowrap; padding: 4px 2px; }
.back-link:hover { color: var(--accent-dark); text-decoration: underline; }
footer .foot-link { color: var(--accent); }
/* 狭幅では状態ピルを畳んでヘッダー1行を守る(状態はトースト/ボタン活性でも分かる) */
@media (max-width: 430px) {
  header .pill { display: none; }
  .mz-logo { height: 28px; }
  .tool-name { font-size: 13px; padding-left: 8px; }
}

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; color: var(--navy); font-weight: 700; }
.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.accent { background: var(--accent); }
.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; }
.hint { font-size: 12px; color: var(--sub); line-height: 1.7; margin-bottom: 12px; }

/* ② プレビュー */
.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;
  min-height: 44px; padding: 10px 12px; margin: -8px -6px;   /* 視覚サイズは保ちタップ領域だけ44pxへ */
}
.preview-wrap { border-radius: 10px; overflow: hidden; background: #000; }
#previewCanvas { display: block; width: 100%; height: auto; cursor: pointer; }
.hidden-video { position: fixed; width: 2px; height: 2px; opacity: 0; pointer-events: none; left: -10px; top: -10px; }
.transport { display: flex; align-items: center; gap: 10px; 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;
  min-height: 44px;   /* 指で確実に押せる高さ(Apple基準) */
}
.mini-btn:hover { border-color: var(--accent); background: #f4f7ff; }
.transport input[type="range"] { flex: 1; accent-color: var(--accent); height: 44px; }
body[data-kind="image"] .video-only { display: none !important; }
.time { font-size: 12px; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 設定 */
.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; }
.setting input[type="range"] { width: 100%; accent-color: var(--accent); height: 28px; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 12px 0; font-size: 14px; border-radius: 10px; cursor: pointer;
  background: #fff; color: var(--sub); border: 1px solid var(--line);
}
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.setting.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chk { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; color: var(--fg) !important; font-size: 13px; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
select {
  background: #fff; color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}

/* 進捗 */
.bar { height: 10px; background: rgba(15, 33, 56, 0.08); 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; padding-bottom: calc(16px + env(safe-area-inset-bottom)); font-size: 11px; color: var(--sub); }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--navy); 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; box-shadow: 0 8px 32px rgba(15, 33, 56, 0.18);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* iOS Safariはfont-size<16pxのselectフォーカスでページをズームするため16px固定 */
@media (max-width: 900px) {
  select { font-size: 16px; }
}

/* ベータ免責バナー(Reangle/Switcher と共通のトーン) */
.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; }

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

/* 保存前の掛かり漏れ最終確認の促し(v2026-07-18レビュー反映) */
.check-note {
  margin: 10px 0; padding: 9px 12px; font-size: 12px; line-height: 1.6; text-align: left;
  color: #876b3a; background: #fbf6e6; border: 1px solid #eadfbf; border-radius: 10px;
}
.check-note i { margin-right: 3px; }

/* 写真のときだけ表示(video-onlyの逆) */
body:not([data-kind="image"]) .image-only { display: none !important; }

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

.step-title { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.step-lead { margin: 0 0 10px; font-size: 12px; color: var(--sub); 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); }
.detect-status.ok { background: #e8f6ee; color: var(--ok); 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; }

.hint-tight { margin-top: 4px; margin-bottom: 0; }
.inline-label { display: inline-block; margin-right: 8px; }

/* 範囲選択フェーズ(60秒超の動画・インスタ風トリム) */
.range-preview { margin-bottom: 10px; }
#rangeCanvas { width: 100%; display: block; border-radius: 10px; background: #0d1117; }
.range-label {
  margin: 0 0 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
#reRangeBtn { margin-bottom: 10px; }

/* インスタ風トリムUI: フィルムストリップ+ドラッグできる選択窓 */
.trim-strip {
  position: relative;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  background: #0d1117;
  touch-action: none;           /* ドラッグ中のスクロールを止める(iOS) */
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: 6px;
}
#stripCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.trim-shade {
  position: absolute; top: 0; bottom: 0;
  background: rgba(10, 12, 16, 0.62);
  pointer-events: none;
}
.trim-window {
  position: absolute; top: 0; bottom: 0;
  border: 3px solid #f5c518;   /* インスタ同様の黄色い選択枠 */
  border-left-width: 14px;
  border-right-width: 14px;
  border-radius: 8px;
  box-sizing: border-box;
  cursor: grab;
}
.trim-handle {
  position: absolute; top: 0; bottom: 0;
  width: 34px;                  /* 44px級のタップ領域(枠14px+外20px) */
  cursor: ew-resize;
}
.trim-handle-l { left: -24px; }
.trim-handle-r { right: -24px; }
/* 取っ手のグリップ線 */
.trim-window::before, .trim-window::after {
  content: "";
  position: absolute; top: 50%;
  width: 3px; height: 18px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.65);
}
.trim-window::before { left: -8.5px; }
.trim-window::after { right: -8.5px; }

/* 複数写真のタブ(サムネで切り替え・最大4枚) */
.photo-tabs { display: flex; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.photo-tab {
  position: relative;
  width: 60px; height: 44px;
  border-radius: 8px;
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: #0d1117;
  padding: 0;
  flex: none;
}
.photo-tab canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tab.on { border-color: var(--accent); }
.photo-tab .photo-tab-badge {
  position: absolute; left: 3px; top: 2px;
  font-size: 10px; font-weight: 800; color: #fff;
  background: rgba(15, 23, 42, 0.7); border-radius: 4px; padding: 0 4px;
  line-height: 1.4;
}

/* 管理者ログイン中の上限なし表示 */
.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;   /* タップしやすく */
}

/* タップ操作の案内(2行) */
.tap-guide {
  list-style: none; margin: 0 0 12px; padding: 10px 14px;
  background: #f0f2f6; border-radius: 10px;
  font-size: 12.5px; line-height: 2.0; color: var(--sub);
}
.tap-guide i { width: 20px; text-align: center; color: var(--accent); margin-right: 2px; }
.tap-guide strong { color: var(--navy); }

/* 管理者テスト用の動画ボタン(一般には出さない。動画の精度が実用に達したら開放する) */
.admin-video-btn { display: block; margin: 10px auto 0; color: var(--sub); }

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