/* =====================================================================================
   画像一括変換・圧縮ツール — 「工房（スタジオ）」がテーマ
   -------------------------------------------------------------------------------------
   ・カードと影を重ねる作りをやめ、温かみのある紙と細い罫線で組む
   ・書体で階層をつくる。数値は大きく、ラベルは小さく字間広めに、余白は多めに
   ・差し色は電気的なバイオレット1色。処理系のUIらしい緊張感を1点だけ足す
   ===================================================================================== */

:root {
  --paper:      #f7f5f1;
  --paper-2:    #fffefc;
  --paper-sunk: #efece6;

  --ink:        #17161a;
  --ink-2:      #4c4952;
  --ink-3:      #8b8792;
  --ink-4:      #c5c1cb;

  --rule:       #ddd8d0;
  --rule-bold:  #17161a;

  --volt:       #5b32e8;
  --volt-lit:   #7a55ff;
  --volt-bg:    #efeaff;

  --good:       #0f7b52;
  --good-bg:    #e6f4ee;
  --bad:        #b3271e;
  --bad-bg:     #fbeae9;

  --radius:     4px;

  /* 共通ナビ（rin-nav）を紙の色に合わせる */
  --rn-fg:       var(--ink);
  --rn-fg-dim:   var(--ink-3);
  --rn-bg:       rgba(255, 254, 252, .94);
  --rn-bg-hover: var(--volt-bg);
  --rn-line:     var(--rule);
  --rn-accent:   var(--volt);
  --rn-radius:   6px;
  --rn-shadow:   0 10px 30px rgba(23, 22, 26, .12);

  /* 遊び方・解説パネル（rin-guide）も紙の色に合わせる。ダークモードでは紙の色ごと切り替わる */
  --rg-bg:       var(--paper);
  --rg-fg:       var(--ink);
  --rg-line:     var(--rule);
  --rg-btn-bg:   var(--paper-2);
  --rg-btn-fg:   var(--ink);
  --rg-btn-line: var(--rule);
  --rg-accent:   var(--volt);
  --rg-max:      1000px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #131215;
    --paper-2:    #1a191e;
    --paper-sunk: #0e0d10;

    --ink:        #f2f0f4;
    --ink-2:      #b6b2bd;
    --ink-3:      #7e7a86;
    --ink-4:      #4a4750;

    --rule:       #2b2930;
    --rule-bold:  #f2f0f4;

    --volt:       #9a7bff;
    --volt-lit:   #b49bff;
    --volt-bg:    #221c3a;

    --good:       #57c496;
    --good-bg:    #14251f;
    --bad:        #e8877f;
    --bad-bg:     #2a1917;

    --rn-fg:       var(--ink);
    --rn-bg:       rgba(26, 25, 30, .94);
    --rn-bg-hover: var(--volt-bg);
    --rn-line:     var(--rule);
    --rn-shadow:   0 10px 30px rgba(0, 0, 0, .5);
  }
}

/* hidden 属性を作者スタイルより優先させる */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  /* 左右はサイドレール広告の逃げ場（--rail-* は ../_shared/rin-ads.css と ../portal/ad-rail.js が決める） */
  padding-left: var(--rail-left);
  padding-right: var(--rail-right);
  background: var(--paper);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont,
               "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1080px, 100%); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: .01em; line-height: 1.4; }
p { margin: 0; }
a { color: var(--volt); text-underline-offset: 3px; }

/* =========================================================
   ヘッダー
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 300;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 62px;
  /* 右上に固定表示される共通ナビ（rin-nav）と重ならないよう逃がす */
  padding-right: 156px;
}
@media (max-width: 480px) {
  .header-inner { padding-right: 58px; }
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--ink);
  text-decoration: none;
}
.logo-mark { width: 26px; height: 26px; flex: none; }
.logo-mark svg { display: block; width: 100%; height: 100%; }
.logo-mark svg rect { fill: var(--volt); }

.header-nav { display: flex; gap: 22px; }
.header-nav a {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .16s ease;
}
.header-nav a:hover { color: var(--volt); }
/* 旧クイックメニューを廃止したので、狭い画面でもページ内リンクは残す */
@media (max-width: 720px) {
  .header-nav { gap: 14px; }
  .header-nav a { font-size: 11.5px; }
}
@media (max-width: 460px) {
  .header-inner { gap: 10px; }
  .logo { font-size: 13px; }
  .header-nav { gap: 10px; }
  .header-nav a { font-size: 11px; }
}

/* 旧クイックメニューは共通ナビ(rin-nav)に置き換えたので隠す */
.top-cluster { display: none; }

/* =========================================================
   ヒーロー
   ========================================================= */
.hero { padding: 84px 0 56px; border-bottom: 1px solid var(--rule); }

.hero h1 {
  max-width: 15em;
  font-size: clamp(32px, 6.4vw, 58px);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -.015em;
  margin-bottom: 22px;
}

.hero-lead {
  max-width: 34em;
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink-2);
  margin-bottom: 26px;
}
.hero-lead strong { color: var(--ink); font-weight: 800; }

.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  padding: 6px 13px 7px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink-2);
  background: var(--paper-2);
}

/* 広告（ツールの直下に1枠） */
/* 上の余白：AdSense はゲームから150px以上離すことを推奨している */
.ad-slot { padding-top: 150px; }
.ad-label {
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-3);
}

/* =========================================================
   ツール本体
   ========================================================= */
.tool-section { padding: 56px 0 64px; border-bottom: 1px solid var(--rule); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 62px 24px;
  border: 1.5px dashed var(--ink-4);
  border-radius: var(--radius);
  background: var(--paper-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, background .18s ease;
}
.dropzone:hover { border-color: var(--volt); background: var(--volt-bg); }
.dropzone:focus-visible { outline: 2px solid var(--volt); outline-offset: 3px; }
.dropzone.dragover { border-color: var(--volt); border-style: solid; background: var(--volt-bg); }

.dropzone-icon { width: 38px; height: 38px; color: var(--volt); margin-bottom: 6px; }
.dropzone-title { font-size: 17px; font-weight: 800; color: var(--ink); }
.dropzone-sub { font-size: 13.5px; color: var(--ink-2); }
.dropzone-formats {
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--ink-3);
}

/* 設定 */
.options-panel {
  margin-top: 26px;
  padding: 26px 0 4px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 760px) { .options-panel { grid-template-columns: 1fr; gap: 22px; } }

.option-group label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.option-note { font-weight: 600; letter-spacing: 0; color: var(--ink-3); }

.option-group select,
.option-group input[type="number"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.option-group select:focus,
.option-group input[type="number"]:focus {
  border-color: var(--volt);
  box-shadow: 0 0 0 3px var(--volt-bg);
}
.option-group input[type="range"] { width: 100%; accent-color: var(--volt); }

.option-group--checkbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.option-group--checkbox label { margin-bottom: 0; }
.checkbox-label {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .01em !important;
  color: var(--ink) !important;
  cursor: pointer;
  white-space: nowrap;
}
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--volt); }
.option-group--checkbox input[type="number"] { width: 110px; }
.option-unit { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

/* かんたん設定（プリセット） */
.option-group--presets { grid-column: 1 / -1; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  appearance: none;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.preset:hover { border-color: var(--volt); color: var(--volt); }
.preset.is-on { border-color: var(--volt); background: var(--volt); color: #fff; }

/* 変換結果の合計 */
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin: 30px 0 0;
  padding: 22px 0;
  border-top: 1px solid var(--rule-bold);
  border-bottom: 1px solid var(--rule);
}
.summary-row { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.summary-label { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--ink-3); }
.summary-sizes {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.summary-arrow { margin: 0 8px; color: var(--ink-4); }
.summary-after { color: var(--volt); }
.summary-badge {
  padding: 7px 16px 8px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.summary-badge.good { background: var(--good-bg); color: var(--good); }
.summary-badge.bad  { background: var(--bad-bg);  color: var(--bad); }

/* ファイル一覧 */
.file-list { margin-top: 26px; display: flex; flex-direction: column; }

.file-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.file-item:first-child { border-top: 1px solid var(--rule); }

.file-thumb {
  width: 46px;
  height: 46px;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper-sunk);
}
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: 2px; }
.file-meta .reduced { color: var(--good); font-weight: 800; }
/* プレビューを表示できない形式（HEIC など）は拡張子を出す */
.file-thumb--text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.file-note { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }

.file-status {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 4px 11px 5px;
  border-radius: 999px;
  white-space: nowrap;
}
.file-status.pending    { background: var(--paper-sunk); color: var(--ink-3); }
.file-status.processing { background: var(--volt-bg);    color: var(--volt); }
.file-status.done       { background: var(--good-bg);    color: var(--good); }
.file-status.error      { background: var(--bad-bg);     color: var(--bad); }

.file-remove {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease;
}
.file-remove:hover { border-color: var(--bad); color: var(--bad); }

.file-download {
  flex: none;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--volt);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}

/* 操作ボタン */
.actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  appearance: none;
  padding: 14px 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .12s ease;
}
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px); }

.btn-primary { background: var(--volt); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--volt-lit); }

.btn-secondary { background: transparent; border-color: var(--rule-bold); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--ink); color: var(--paper); }

.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { color: var(--ink); }

.progress-wrap { margin-top: 20px; height: 2px; background: var(--rule); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--volt); transition: width .2s ease; }

.status-text { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.status-text.error { color: var(--bad); font-weight: 700; }
.status-text.ok    { color: var(--good); font-weight: 700; }

/* =========================================================
   特徴 / 使い方 / FAQ
   ========================================================= */
.features, .steps, .faq { padding: 72px 0; border-bottom: 1px solid var(--rule); }

.features h2, .steps h2, .faq h2 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 36px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.feature-card { padding: 28px 24px 26px; background: var(--paper); transition: background .18s ease; }
.feature-card:hover { background: var(--paper-2); }
.feature-icon { font-size: 24px; line-height: 1; margin-bottom: 14px; }
.feature-card h3 { font-size: 15.5px; font-weight: 800; margin-bottom: 8px; }
.feature-card p { font-size: 13.5px; line-height: 1.9; color: var(--ink-2); }

.steps-list { list-style: none; margin: 0; padding: 0; }
.steps-list li { display: flex; gap: 22px; padding: 26px 0; border-bottom: 1px solid var(--rule); }
.steps-list li:first-child { border-top: 1px solid var(--rule); }
.step-num {
  flex: none;
  width: 40px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.steps-list h3 { font-size: 16px; font-weight: 800; margin-bottom: 7px; }
.steps-list p { font-size: 14px; line-height: 1.9; color: var(--ink-2); }
.steps-list p strong { color: var(--ink); font-weight: 800; }

.faq-list { display: flex; flex-direction: column; }
.faq-list details { border-bottom: 1px solid var(--rule); }
.faq-list details:first-child { border-top: 1px solid var(--rule); }
.faq-list summary {
  position: relative;
  padding: 20px 48px 20px 0;
  list-style: none;
  cursor: pointer;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
  transition: color .16s ease;
}
.faq-list summary:hover { color: var(--volt); }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform .22s ease;
}
.faq-list details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-list p { padding: 0 48px 22px 0; font-size: 14px; line-height: 1.95; color: var(--ink-2); }

/* =========================================================
   関連アプリ / パンくず
   ========================================================= */
.related-section { padding: 64px 0 72px; }

.crumbs { font-size: 12.5px; color: var(--ink-3); margin: 0 0 28px; }
.crumbs a { color: var(--ink-3); text-decoration: none; font-weight: 700; }
.crumbs a:hover { color: var(--volt); text-decoration: underline; }

.related-section h2 { font-size: clamp(20px, 3.4vw, 26px); font-weight: 800; margin: 40px 0 20px; }

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.related-card {
  display: block;
  padding: 22px 20px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: background .18s ease;
}
.related-card:hover { background: var(--volt-bg); }
.related-card b { display: block; font-size: 15px; font-weight: 800; margin-bottom: 5px; }
.related-card span { font-size: 12.5px; color: var(--ink-2); line-height: 1.75; }

/* =========================================================
   このツールについて（ページ上に常に見える短い説明）
   ========================================================= */
.about { padding: 56px 0 64px; }
.about h2 { font-size: clamp(20px, 3.4vw, 26px); font-weight: 800; margin-bottom: 14px; }
.about p { max-width: 44em; font-size: 14.5px; line-height: 1.95; color: var(--ink-2); }
.about .about-cta { margin-top: 22px; }
.about-related { margin-top: 30px; }
a.btn { display: inline-block; text-decoration: none; }

/* 遊び方・解説パネルの中では、各セクションの余白を詰める */
.rin-guide .wrap { width: 100%; padding: 0; }
.rin-guide .features,
.rin-guide .steps,
.rin-guide .faq { padding: 0 0 48px; border-bottom: 0; }
.rin-guide .features h2,
.rin-guide .steps h2,
.rin-guide .faq h2 { margin-bottom: 24px; }
.rin-guide .related-section { padding: 0 0 24px; }
.rin-guide .related-section h2 { margin-top: 0; }

/* =========================================================
   フッター
   ========================================================= */
.site-footer { padding: 34px 0 46px; border-top: 1px solid var(--rule); }
.site-footer p { font-size: 12.5px; color: var(--ink-3); }
