:root {
  color-scheme: light;
  /* 白うさぎ×ラベンダー（2026-07-29刷新・フラット）: アクセントはラベンダー1色、他は白とグレーのみ */
  --bg: #fafafc;
  --ink: #3b3947;
  --muted: #767185;
  --accent: #8172d2;
  --accent-deep: #5a4ca4;
  --soft: #f1eff8;
  --line: #e4e2ec;
  --shadow: 0 12px 32px rgba(59, 57, 71, 0.08);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}
button, input { font: inherit; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
.bg-bunny { position: fixed; z-index: -1; opacity: 0.16; font-size: clamp(5rem, 12vw, 12rem); filter: blur(0.5px); }
.bg-bunny-1 { top: 4rem; right: 4vw; transform: rotate(10deg); }
.bg-bunny-2 { bottom: 4rem; left: 5vw; transform: rotate(-18deg); }

.hero, .app-shell { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.hero { padding: 64px 0 28px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--accent-deep); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.4rem, 6vw, 5.2rem); line-height: 1.05; }
h1 span { display: block; margin-top: 0.25em; font-size: 0.42em; color: var(--muted); }
.lead { width: min(780px, 100%); margin: 22px auto 0; color: var(--muted); font-size: 1.05rem; line-height: 1.9; }
.hero-badges { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-badges span, .status-pill { border: 1px solid var(--line); background: rgba(255,255,255,0.72); border-radius: 999px; padding: 7px 13px; font-weight: 700; }

.app-shell { display: grid; gap: 22px; padding-bottom: 64px; }
.drop-card, .video-card, .settings-card, .results-card { background: #ffffff; border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.drop-zone { margin: 16px; padding: 42px 20px; border: 3px dashed #b7abe7; border-radius: 26px; text-align: center; background: #fdfdfe; cursor: pointer; transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.drop-zone.drag-over, .drop-zone:focus-visible { outline: none; transform: translateY(-2px); border-color: var(--accent-deep); background: #f5f3fb; }
.bunny-mark { width: 86px; height: 86px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 50%; background: white; box-shadow: inset 0 -8px 0 #ded7f2; font-size: 3.2rem; }
.drop-zone h2, .section-heading h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.2rem); }
.drop-zone p { max-width: 760px; margin: 12px auto; color: var(--muted); line-height: 1.8; }
.upload-actions, .bulk-actions, .item-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
input[type="file"] { display: none; }
.button { border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 900; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .18s ease, box-shadow .18s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--accent); box-shadow: 0 8px 20px rgba(90, 76, 164, 0.26); }
.button.secondary { color: var(--ink); background: #e3ddf4; }
.button.ghost { color: var(--muted); background: var(--soft); }
.button[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.privacy-note { font-size: .9rem; }
.upload-summary { margin: 0 16px 16px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.72); }
.upload-summary-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.upload-summary h2 { margin: 0; font-size: 1.45rem; }
.upload-summary p { margin: 6px 0 0; color: var(--muted); font-weight: 700; line-height: 1.5; }
.upload-summary-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.upload-queue { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.upload-queue-item { display: grid; grid-template-columns: 54px minmax(0, 1fr) 38px; gap: 10px; align-items: center; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 18px; background: var(--soft); }
.queue-thumb { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; background: #f0eef5; border: 1px solid var(--line); }
.queue-thumb-placeholder { display: grid; place-items: center; color: var(--muted); font-size: .78rem; font-weight: 900; }
.queue-meta { min-width: 0; }
.queue-meta strong, .queue-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-meta strong { font-weight: 900; }
.queue-meta span { margin-top: 3px; color: var(--muted); font-size: .86rem; font-weight: 800; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; display: inline-grid; place-items: center; color: var(--muted); background: var(--soft); font-weight: 900; cursor: pointer; transition: transform .18s ease, background .18s ease, color .18s ease; }
.icon-button:hover { transform: translateY(-1px); color: #b03a52; background: #f9e3e7; }
.icon-button[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.video-card, .settings-card, .results-card { padding: 24px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.control-group, .field { display: grid; gap: 10px; align-content: start; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: #fbfafd; }
.control-group { margin: 0; }
legend, .field span { font-weight: 900; color: var(--ink); }
.control-group label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 700; }
.field input[type="number"], .field input[type="text"], .field select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 12px; color: var(--ink); background: white; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.compact { padding: 0; border: 0; background: transparent; }
.filename-settings { grid-row: span 2; }

.video-tool { display: grid; gap: 16px; }
.video-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.video-picker .status-message { flex: 1; min-width: min(100%, 320px); }
.video-settings { display: grid; grid-template-columns: 180px minmax(220px, 1fr) 160px; gap: 16px; align-items: stretch; }
.compact-group { padding: 12px 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.toggle-field label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 800; }
.video-workspace { display: grid; gap: 16px; }
.video-workspace.has-result { grid-template-columns: 1fr 1fr; }
.video-preview { min-width: 0; }
.video-preview video { display: block; width: 100%; max-height: 340px; background: #232130; }
.video-meta { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.video-meta div { padding: 11px; border-radius: 16px; background: var(--soft); min-width: 0; }
.video-meta span { display: block; color: var(--muted); font-size: .82rem; font-weight: 800; }
.video-meta strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.video-workspace .item-actions { grid-column: 1 / -1; }

.status-message { padding: 14px 16px; border-radius: 18px; background: var(--soft); color: var(--muted); font-weight: 700; }
.file-list { display: grid; gap: 16px; margin-top: 16px; }
.file-item { border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.72); padding: 16px; }
.file-item-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.file-item-tools { display: flex; gap: 8px; align-items: center; }
.select-row { display: flex; gap: 8px; align-items: center; font-weight: 900; }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
figure { margin: 0; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); background-color: #f7f6fa; background-image: linear-gradient(45deg, #e9e7f0 25%, transparent 25%), linear-gradient(-45deg, #e9e7f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e9e7f0 75%), linear-gradient(-45deg, transparent 75%, #e9e7f0 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
figcaption { padding: 9px 12px; background: rgba(255,255,255,.88); font-weight: 900; color: var(--muted); }
figure img { display: block; width: 100%; height: 260px; object-fit: contain; }
.file-meta { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.file-meta div { padding: 11px; border-radius: 16px; background: var(--soft); min-width: 0; }
.file-meta span { display: block; color: var(--muted); font-size: .82rem; font-weight: 800; }
.file-meta strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.item-error { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: #f9e3e7; color: #b03a52; font-weight: 700; }
.status-pill.done { color: #2f6b46; background: #e6f4ea; border-color: #c2e2cd; }
.status-pill.error { color: #b03a52; background: #f9e3e7; border-color: #f0cdd6; }

@media (max-width: 900px) {
  .settings-grid, .file-meta, .video-meta { grid-template-columns: 1fr 1fr; }
  .comparison { grid-template-columns: 1fr; }
  .video-settings, .video-workspace.has-result { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { padding-top: 36px; }
  .settings-grid, .file-meta, .video-meta { grid-template-columns: 1fr; }
  .section-heading, .bulk-actions, .upload-summary-header, .upload-summary-actions, .video-picker { align-items: stretch; }
  .upload-summary-header { display: grid; }
  .convert-button, .bulk-actions .button, .upload-summary-actions .button, .video-picker .button { width: 100%; }
  figure img { height: 210px; }
}

/* ============================================================
   Phase 1: タイポ調整 — フォントと余白を落ち着かせる（2026-05-27）
   styles.css の末尾に追記。元に戻したいときはこのブロックごと削除
   ============================================================ */

/* ヒーロー：特大タイトルをコンパクトに */
.hero { padding: 40px 0 20px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; }
h1 span { margin-top: 0.3em; font-size: 0.5em; }
.lead { width: min(720px, 100%); margin: 16px auto 0; font-size: 0.95rem; line-height: 1.75; }
.eyebrow { font-weight: 700; }

/* セクション見出し：ひと回り小さく */
.drop-zone h2, .section-heading h2 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
.upload-summary h2 { font-size: 1.2rem; }

/* 極太(900)を700へ — 画面の「叫んでる感」を抑える */
.button { font-weight: 700; }
legend, .field span { font-weight: 700; }
.queue-meta strong { font-weight: 700; }
.select-row { font-weight: 700; }
.icon-button { font-weight: 700; }

/* 小さなメタ表示(800)も少し軽く */
.queue-meta span,
.file-meta span,
.video-meta span,
.toggle-field label { font-weight: 600; }

/* ============================================================
   Phase 2: タブ化（画像 / 動画の切り替え）2026-05-27
   ============================================================ */
.tab-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tab-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 26px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.tab-button:hover { transform: translateY(-1px); }
.tab-button.is-active {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(90, 76, 164, 0.26);
}
/* アクティブなタブのパネルだけ表示 */
.app-shell[data-active="image"] > [data-tab="video"],
.app-shell[data-active="video"] > [data-tab="image"] { display: none; }

/* ============================================================
   Phase 3-①: ステップ番号（①②③）2026-05-27
   ============================================================ */
.app-shell [data-step] { position: relative; }
.app-shell [data-step]::before {
  content: attr(data-step);
  position: absolute;
  top: -16px;
  left: 24px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 4px 12px rgba(90, 76, 164, 0.26);
  z-index: 2;
}

/* ============================================================
   Phase 3-②: 変換ボタンを1つに（画面下の固定バー）2026-05-27
   ============================================================ */
/* 重複していた画像の変換ボタンを隠す（DOMには残すのでJSは無傷）*/
#convertButton,
#uploadConvertButton { display: none; }

/* 画面下の固定バー */
.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  background: rgba(250, 250, 252, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.sticky-bar .button {
  width: min(420px, 100%);
  padding: 14px 20px;
  font-size: 1.05rem;
}

/* 動画タブのときは固定バーを隠す（動画は専用ボタンを使う）*/
.app-shell[data-active="video"] ~ .sticky-bar { display: none; }

/* 固定バーに隠れないよう本文の下に余白を確保 */
.app-shell[data-active="image"] { padding-bottom: 120px; }

/* ============================================================
   Phase 3-③: 詳細設定アコーディオン 2026-05-27
   ============================================================ */
.advanced-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfafd;
  overflow: hidden;
}
.advanced-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.advanced-details > summary::-webkit-details-marker { display: none; }
.advanced-details > summary::before {
  content: "▸";
  color: var(--accent-deep);
  font-size: 0.9em;
  transition: transform .18s ease;
}
.advanced-details[open] > summary::before { transform: rotate(90deg); }
.advanced-details > summary:hover { color: var(--accent-deep); }
.advanced-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 4px 18px 18px;
}
@media (max-width: 640px) {
  .advanced-body { grid-template-columns: 1fr; }
}

/* ============================================================
   切り抜き位置のミニ図解ボタン（2026-07-29）: 図の色つき部分＝残る範囲
   ============================================================ */
.crop-position-options { display: flex; gap: 8px; }
.crop-pos {
  position: relative;
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.crop-pos input { position: absolute; opacity: 0; pointer-events: none; }
.crop-pos > span:last-child { font-size: .84rem; white-space: nowrap; }
.crop-pos:has(input:checked) { border-color: var(--accent); background: #f5f3fb; color: var(--accent-deep); }
.crop-pos:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.crop-pos:hover { border-color: #b7abe7; }
.crop-pos-diagram {
  width: 30px;
  height: 40px;
  border-radius: 6px;
  border: 1.5px solid #b7abe7;
  background: var(--soft);
  position: relative;
  overflow: hidden;
}
.crop-pos-diagram::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 45%;
  background: #cfc5ee;
}
.crop-pos input:checked + .crop-pos-diagram::before { background: var(--accent); }
.crop-pos-diagram[data-keep="top"]::before { top: 0; }
.crop-pos-diagram[data-keep="center"]::before { top: 50%; transform: translateY(-50%); }
.crop-pos-diagram[data-keep="bottom"]::before { bottom: 0; }
.crop-position-note { margin: 2px 0 0; font-size: .8rem; color: var(--muted); font-weight: 600; line-height: 1.5; }

/* シリーズフッター（sticky-barに隠れないよう下余白を確保） */
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 16px 110px; }
.site-footer a { color: var(--accent-deep); }

/* ヒーローの姉妹ツールチップ（スクロールなしで見える導線） */
.series-badge {
  border: 1px solid var(--accent);
  color: var(--accent-deep);
  background: #ffffff;
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .18s ease, background .18s ease;
}
.series-badge:hover { transform: translateY(-1px); background: #f5f3fb; }