/* =========================================================
   画像透過ツール — スタイル（A案：静けさ）
   方針：装飾を足さず、余白と細い罫線だけで整理する。
   最初に見えるのは「画像を選ぶ → 結果 → 保存」だけ。
   調整UIは畳んでおく。
   ========================================================= */

:root {
  --paper: #fbfbf9;          /* 地色（わずかに温かい白） */
  --surface: #ffffff;        /* 面 */
  --ink: #1b1b19;            /* 文字の主色 */
  --ink-mid: #6e6c66;        /* 本文グレー */
  --ink-soft: #8b8880;       /* 補足・キャプション */
  --rule: #edece7;           /* 細い罫線 */
  --rule-strong: #e7e5de;    /* 面の輪郭 */
  --accent: #3f3d9e;         /* 差し色（沈んだ藍） */
  --accent-hover: #2c2a78;
  --accent-soft: #f1f0fa;
  --danger: #a8342a;
  --sans: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    "Noto Sans JP", Meiryo, system-ui, sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --max: 1160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131313;
    --surface: #1b1b1a;
    --ink: #efeeea;
    --ink-mid: #a8a49b;
    --ink-soft: #837f76;
    --rule: #262624;
    --rule-strong: #2e2e2b;
    --accent: #9290f2;
    --accent-hover: #aeacff;
    --accent-soft: #21212c;
    --danger: #e2705f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* hidden 属性を常に優先する（.workspace 等の display 指定に負けないように） */
[hidden] { display: none !important; }

body {
  margin: 0;
  overflow-x: hidden;        /* 端が切れて見えないように */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.95;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

h1, h2, h3 { font-weight: 700; letter-spacing: -.015em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 26px; }
@media (min-width: 520px) { .wrap { padding: 0 32px; } }

/* 1カラムのときは本文を中央に寄せて、左右に余白を残す */
@media (max-width: 1079px) {
  .layout > main { max-width: 620px; margin: 0 auto; }
}

/* 小見出しラベル（使い方・よくある質問） */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

/* ---------------------------------------------------- ヘッダー */
.site-header { background: var(--paper); }
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  border-bottom: 1px solid var(--rule);
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { text-decoration: none; color: var(--ink); }
.logo-mark {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  background: var(--accent);
}
.logo-text { font-size: 14px; font-weight: 700; letter-spacing: .01em; }
.site-nav { margin-left: auto; display: flex; gap: 20px; font-size: 13px; }
.site-nav a { color: var(--ink-mid); }
@media (max-width: 640px) { .site-nav { display: none; } }

/* ---------------------------------------------------- レイアウト */
.layout { padding-bottom: 56px; }
.sidebar { display: none; }

@media (min-width: 1080px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 40px;
    align-items: start;
  }
  .sidebar { display: block; position: sticky; top: 24px; padding-top: 40px; }
}

/* ---------------------------------------------------- 広告枠 */
.ad-slot { display: none; }
.ad-slot.is-active {
  display: block;
  margin: 24px auto;
  text-align: center;
  overflow: hidden;
}
.ad-slot.is-active::before {
  content: "スポンサーリンク";
  display: block;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.ad-slot[data-ad-slot="header"].is-active,
.ad-slot[data-ad-slot="footer"].is-active { min-height: 100px; }
.ad-slot[data-ad-slot="inContent"].is-active { min-height: 280px; }
.ad-slot[data-ad-slot="sidebar"].is-active { min-height: 620px; }

.consent-bar {
  position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 60;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--r-md); box-shadow: 0 8px 30px rgba(0,0,0,.07);
  padding: 14px 16px; font-size: 13px;
}
.consent-actions { display: flex; gap: 8px; }

/* ---------------------------------------------------- ヒーロー */
.hero { padding: 48px 0 36px; }
.hero h1 {
  font-size: clamp(24px, 6.6vw, 31px);
  line-height: 1.5;
  margin: 0 0 14px;
  text-wrap: balance;
}
.hero p { color: var(--ink-mid); margin: 0; font-size: 14px; line-height: 2; }

/* ---------------------------------------------------- ボタン */
.btn {
  appearance: none;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--accent); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink-soft); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 18px 28px; font-size: 16.5px; }

/* 文字リンク型のボタン（副次的な操作） */
.btn-link {
  appearance: none; background: none; border: 0; padding: 2px 0;
  font-family: inherit; font-size: 13px; color: var(--ink-mid); cursor: pointer;
}
.btn-link:hover { color: var(--accent); }

/* ---------------------------------------------------- 画像を選ぶ面 */
.dropzone {
  display: block;
  width: 100%;
  appearance: none;
  font-family: inherit;
  color: inherit;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 46px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-hidden { display: none; }
.dz-icon {
  width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.dz-title { font-size: 17px; font-weight: 700; }
.dz-sub { color: var(--ink-soft); font-size: 12.5px; margin: 12px 0 0; line-height: 1.75; }
.dz-note { color: var(--ink-soft); font-size: 12px; margin: 16px 2px 0; line-height: 1.85; }
#file-input { display: none; }

/* ---------------------------------------------------- ワークスペース */
.workspace { display: grid; gap: 22px; }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--rule); }
.tab {
  border: 0; background: none; color: var(--ink-soft);
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 4px 0 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; cursor: pointer;
}
.tab.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

.preview {
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  background-color: #f5f4f0;
  background-image: repeating-conic-gradient(#e9e7e1 0% 25%, #f7f6f2 0% 50%);
  background-size: 22px 22px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  .preview {
    background-color: #1e1e1c;
    background-image: repeating-conic-gradient(#252523 0% 25%, #1a1a18 0% 50%);
  }
}
#preview-canvas { max-width: 100%; max-height: 54vh; display: block; }
#preview-canvas.is-picker { cursor: crosshair; }
@media (min-width: 700px) { #preview-canvas { max-height: 62vh; } }

.main-actions { display: grid; gap: 20px; }
.main-actions #download { width: 100%; }
.sub-actions { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; }
@media (min-width: 620px) {
  .main-actions { display: flex; align-items: center; gap: 26px; }
  .main-actions #download { width: auto; min-width: 240px; }
  .sub-actions { justify-content: flex-start; }
}

.thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb {
  flex: 0 0 auto; width: 58px; height: 58px; padding: 0; overflow: hidden;
  border-radius: 12px; border: 2px solid var(--rule-strong); background: var(--surface); cursor: pointer;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-current { border-color: var(--accent); }
.thumb.is-working { opacity: .45; }

/* ---------------------------------------------------- 折りたたみ設定 */
.settings { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.settings > summary {
  cursor: pointer;
  padding: 20px 2px;
  font-size: 14.5px;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary::after,
details.faq summary::after {
  content: "";
  width: 8px; height: 8px; margin: -5px 4px 0 0;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  transition: transform .15s;
  flex: 0 0 auto;
}
.settings[open] > summary::after,
details.faq[open] summary::after { transform: rotate(225deg); margin-top: 3px; }

.settings-body {
  padding: 6px 2px 28px;
  display: grid;
  gap: 30px;
  border-top: 1px solid var(--rule);
}
@media (min-width: 760px) {
  .settings-body { grid-template-columns: 1fr 1fr; gap: 30px 40px; }
}

.control-group { display: grid; gap: 14px; align-content: start; }
.control-group h3 {
  margin: 0; font-size: 11px; color: var(--ink-soft);
  font-weight: 700; letter-spacing: .18em;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; }

.field { display: grid; gap: 6px; font-size: 13px; }
.field label { display: flex; justify-content: space-between; color: var(--ink-mid); }
.field input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.field select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 15px;
}
.hint-text { font-size: 12.5px; color: var(--ink-soft); line-height: 1.85; margin: 0; }

.bg-options { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.bg-option {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--rule-strong); padding: 0; background: var(--surface);
}
.bg-option.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bg-option[data-bg="transparent"] {
  background-image: repeating-conic-gradient(#dcdad4 0% 25%, #ffffff 0% 50%);
  background-size: 12px 12px;
}
#bg-color { width: 38px; height: 38px; padding: 0; border: 2px solid var(--rule-strong); border-radius: 10px; background: none; cursor: pointer; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.chip { width: 32px; height: 32px; border-radius: 9px; border: 2px solid var(--rule-strong); cursor: pointer; padding: 0; }

.progress { display: grid; gap: 8px; }
.progress-track { height: 4px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress-fill.indeterminate { animation: slide 1.2s ease-in-out infinite; }
@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-text { font-size: 13px; color: var(--ink-mid); }

.error {
  border: 1px solid var(--danger); color: var(--danger);
  border-radius: var(--r-md);
  padding: 12px 16px; font-size: 14px;
}

.device-badge {
  font-size: 10.5px; letter-spacing: .06em; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--rule-strong); color: var(--ink-soft); white-space: nowrap;
}

/* ---------------------------------------------------- トップの文章 */
.content { padding-top: 56px; }
.content h2 { font-size: 19px; margin: 0 0 16px; }

/* 使い方 */
.steps { display: flex; flex-direction: column; }
.step {
  display: flex; gap: 18px; align-items: flex-start;
  padding: 20px 0; border-top: 1px solid var(--rule);
}
.step:last-child { border-bottom: 1px solid var(--rule); }
.step .num {
  font-size: 13px; font-weight: 700; color: var(--accent);
  line-height: 1.9; min-width: 22px;
}
.step h3 { font-size: 15px; font-weight: 700; margin: 0 0 4px; letter-spacing: 0; }
.step p { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--ink-mid); }

details.faq { border-bottom: 1px solid var(--rule); }
details.faq summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 2px; font-size: 14.5px; font-weight: 500; color: var(--ink);
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq p { margin: 0 2px 22px; font-size: 13.5px; line-height: 1.95; color: var(--ink-mid); }

.more-link { margin: 20px 2px 0; font-size: 13.5px; }

/* ---------------------------------------------------- 下層ページ */
.page { max-width: 680px; margin: 0 auto; padding: 34px 0 48px; }
.page h1 { font-size: 26px; line-height: 1.5; margin: 0 0 16px; }
.page h2 { font-size: 17px; margin: 40px 0 12px; }
.page p, .page li { color: var(--ink-mid); font-size: 14.5px; }
.page li { margin-bottom: 6px; }
.page .updated { font-size: 12.5px; color: var(--ink-soft); }
.page details.faq p { margin-bottom: 20px; }

/* ---------------------------------------------------- フッター */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0 40px;
  margin-top: 52px;
  font-size: 12.5px;
  color: var(--ink-mid);
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 14px; }
.footer-nav a { color: var(--ink-mid); }
.site-footer p { margin: 0; font-size: 11.5px; color: var(--ink-soft); }

/* ---------------------------------------------------- ガイド記事 */
.cta {
  margin: 32px 0;
  padding: 24px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-align: center;
}
.cta p { margin: 0 0 16px; font-size: 14px; color: var(--ink-mid); }
.cta a.btn { display: inline-block; text-decoration: none; }
.cta a.btn:hover { text-decoration: none; color: #fff; }

.guide-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.guide-list li { border-top: 1px solid var(--rule); }
.guide-list li:last-child { border-bottom: 1px solid var(--rule); }
.guide-list a { display: block; padding: 20px 2px; color: var(--ink); }
.guide-list a:hover { color: var(--accent); text-decoration: none; }
.guide-list .t { font-size: 15.5px; font-weight: 700; }
.guide-list .d { font-size: 13px; color: var(--ink-mid); margin-top: 2px; }

.crumbs { font-size: 12px; color: var(--ink-soft); margin: 0 0 18px; }
.crumbs a { color: var(--ink-soft); }
