/* =====================================================================
   Audio to MIDI  — PC 向けレイアウトを基本に、末尾でタブレット/モバイルを上書き
   ===================================================================== */
/* ポップな付箋/シール調: 太い輪郭 + ベタ影 + 5 色のパステル */
:root {
  --bg: #f4f1ff;
  --surface: #ffffff;
  --surface-2: #ece7ff;
  --text: #25213f;
  --muted: #5d5878;
  --border: #d9d2f5;
  --ink: #25213f;
  --accent: #5b3df0;
  --accent-hover: #4a2ed6;
  --accent-soft: #e6e0ff;
  --accent-text: #ffffff;
  --ok: #1f8a5b;
  --error: #d6336c;
  /* パステル(文字は常に --on-pop の濃紺) */
  --sun: #ffd43b;
  --pink: #ff8fab;
  --mint: #63e6be;
  --sky: #74c0fc;
  --sun-soft: #fff1a8;
  --pink-soft: #ffd6e0;
  --mint-soft: #c3f5e4;
  --sky-soft: #cfe8ff;
  --on-pop: #25213f;
  --on-pop-muted: #4a4566;
  --hl: #ffe066;
  --roll-bg: #fbfaff;
  --roll-beat: #ece8fb;
  --roll-bar: #c4bcec;
  /* Forge のトラック色(ピアノロール・トラック一覧) */
  --track-0: #5b3df0;
  --track-1: #e8590c;
  --track-2: #2b8a3e;
  --track-3: #ae3ec9;
  --track-4: #0c8599;
  --track-5: #c92a2a;
  --radius: 20px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --header-h: 64px;
  --content-w: 1160px;
  --side-w: 320px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16132b;
    --surface: #221e3d;
    --surface-2: #2c2750;
    --text: #f1eeff;
    --muted: #b4aedb;
    --border: #3a3366;
    --ink: #5a4fb0;
    --accent: #a393ff;
    --accent-hover: #bcb0ff;
    --accent-soft: #332c63;
    --accent-text: #16132b;
    --ok: #63e6be;
    --error: #ff8fab;
    --hl: rgba(255, 212, 59, 0.38);
    --roll-bg: #1b1735;
    --roll-beat: #2a2550;
    --roll-bar: #4a4285;
    --track-0: #a393ff;
    --track-1: #ffa94d;
    --track-2: #69db7c;
    --track-3: #da77f2;
    --track-4: #3bc9db;
    --track-5: #ff8787;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "M PLUS Rounded 1c", "BIZ UDPGothic", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}
a { color: var(--accent); }
img, canvas, svg { display: block; max-width: 100%; }
h1, h2, h3 { line-height: 1.35; font-weight: 800; }
/* 蛍光ペンで線を引いたような見出し */
h2 {
  display: inline-block; margin: 56px 0 18px; font-size: 1.5rem;
  background: linear-gradient(transparent 58%, var(--hl) 58%); padding: 0 4px;
}

/* ---- ヘッダー ---- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  height: var(--header-h);
  /* backdrop-filter(すりガラス)は低性能端末で描画コストが高いため使わない */
  background: var(--surface);
  border-bottom: 3px solid var(--ink);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--content-w); height: 100%; margin: 0 auto; padding: 0 24px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.1rem; font-weight: 800; text-decoration: none; }
.logo img { border-radius: 8px; transition: transform 0.2s; }
.logo:hover img { transform: rotate(-8deg) scale(1.08); }
.header-right { display: flex; align-items: center; gap: 8px; }
.site-nav { display: flex; gap: 4px; }
.lang-switch {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border: 2px solid var(--ink); border-radius: 999px;
  color: var(--text); font-size: 0.82rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.lang-switch::before { content: ""; width: 14px; height: 14px; margin-right: 6px; background: currentColor; opacity: 0.7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20M12 2a15 15 0 0 1 0 20M12 2a15 15 0 0 0 0 20'/%3E%3C/svg%3E") center / contain no-repeat; }
.lang-switch:hover { background: var(--sky-soft); color: var(--on-pop); }
.footer-links .lang-switch { min-height: 28px; padding: 0 10px; font-size: 0.78rem; vertical-align: middle; }
.site-nav a {
  padding: 8px 14px; border-radius: 999px; color: var(--muted);
  font-size: 0.92rem; font-weight: 700; text-decoration: none;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.site-nav a.nav-tools { background: var(--sun); color: var(--on-pop); }
.site-nav a.nav-tools:hover { background: var(--sun-soft); }

/* ---- 2 カラムレイアウト(PC) ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
  gap: 40px;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 36px 24px 64px;
}
.side-col { display: flex; flex-direction: column; gap: 24px; }
.side-col .ad-sidebar { position: sticky; top: calc(var(--header-h) + 20px); }

/* ---- ヒーロー ---- */
/* ヒーロー上部のピアノロール風の飾り(音がカラフルなブロックになるイメージ) */
.hero::before {
  content: ""; display: block; height: 56px; margin-bottom: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 356 56' stroke='%2325213f' stroke-width='3'%3E%3Crect x='2' y='34' width='40' height='18' rx='9' fill='%23ff8fab'/%3E%3Crect x='50' y='20' width='28' height='18' rx='9' fill='%23ffd43b'/%3E%3Crect x='86' y='4' width='60' height='18' rx='9' fill='%2363e6be'/%3E%3Crect x='154' y='28' width='34' height='18' rx='9' fill='%2374c0fc'/%3E%3Crect x='196' y='12' width='44' height='18' rx='9' fill='%235b3df0'/%3E%3Crect x='248' y='34' width='56' height='18' rx='9' fill='%23ff8fab'/%3E%3Crect x='312' y='6' width='40' height='18' rx='9' fill='%23ffd43b'/%3E%3C/svg%3E") left center / auto 56px no-repeat;
}
.hero h1 { margin: 0 0 10px; font-size: 2.6rem; font-weight: 800; letter-spacing: 0; line-height: 1.25; }
.lead { margin: 0 0 16px; color: var(--muted); font-size: 1.05rem; font-weight: 500; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.badges li {
  padding: 3px 14px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--sun-soft); color: var(--on-pop);
  font-size: 0.82rem; font-weight: 700;
}
.badges li:nth-child(4n+2) { background: var(--mint-soft); }
.badges li:nth-child(4n+3) { background: var(--pink-soft); }
.badges li:nth-child(4n+4) { background: var(--sky-soft); }

/* ---- ツール ---- */
.card { background: var(--surface); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.tool { padding: 28px; }

.dropzone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 200px; padding: 24px;
  border: 3px dashed var(--ink); border-radius: 16px;
  background: var(--sun-soft); color: var(--on-pop);
  text-align: center; cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.dropzone:hover, .dropzone.dragover, .dropzone:focus-within { background: var(--mint-soft); transform: scale(1.01); }
.dropzone.dragover { border-style: solid; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-icon {
  width: 68px; height: 68px; padding: 15px; border: 3px solid var(--ink); border-radius: 50%;
  background: var(--sun); color: var(--on-pop); box-shadow: var(--shadow-sm);
}
.dropzone:hover .dropzone-icon, .dropzone.dragover .dropzone-icon { background: var(--pink); }
.dropzone-text { font-size: 1.05rem; font-weight: 800; word-break: break-all; }
.dropzone-hint { color: var(--on-pop-muted); font-size: 0.82rem; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.option { display: flex; flex-direction: column; gap: 8px; }
.option-label { display: flex; justify-content: space-between; font-weight: 800; font-size: 0.95rem; }
.option-label output {
  padding: 0 10px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--sun); color: var(--on-pop); font-variant-numeric: tabular-nums;
}
.option-help { color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.option input[type="number"] {
  width: 100%; height: 44px; padding: 0 12px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 700;
}
.option input[type="range"] { width: 100%; height: 28px; accent-color: var(--accent); }

.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 28px;
  border: 3px solid var(--ink); border-radius: 14px; font-family: inherit; font-size: 1rem; font-weight: 800;
  box-shadow: 0 4px 0 var(--ink);
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, transform 0.08s, box-shadow 0.08s;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.btn-primary:active, .btn-secondary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; transform: none; box-shadow: 0 4px 0 var(--ink); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--sky-soft); color: var(--on-pop); }
#submit { width: 100%; }

.progress { margin-top: 24px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.steps li {
  padding: 4px 14px; border-radius: 999px; border: 2px solid var(--border);
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
}
.steps li.active { border-color: var(--ink); background: var(--sun); color: var(--on-pop); }
.steps li.complete { border-color: var(--ink); background: var(--mint); color: var(--on-pop); }
.steps li.complete::before { content: "✓ "; }
progress { width: 100%; height: 14px; margin: 14px 0 4px; accent-color: var(--accent); }
#status-message { margin: 4px 0 0; font-size: 0.92rem; }
#status-message.error { color: var(--error); font-weight: 800; }

.result { margin-top: 28px; padding-top: 28px; border-top: 3px dashed var(--ink); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 16px; }
.result-stats div { padding: 12px 16px; border: 3px solid var(--ink); border-radius: 16px; background: var(--sun-soft); color: var(--on-pop); box-shadow: var(--shadow-sm); }
.result-stats div:nth-child(2) { background: var(--mint-soft); }
.result-stats div:nth-child(3) { background: var(--pink-soft); }
.result-stats dt { color: var(--on-pop-muted); font-size: 0.8rem; font-weight: 700; }
.result-stats dd { margin: 0; font-size: 1.6rem; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.piano-roll { width: 100%; height: 240px; border: 3px solid var(--ink); border-radius: 16px; }
.result-actions { display: flex; gap: 14px; margin-top: 20px; }
.result-actions .btn-primary { flex: 1; }

/* ---- Forge への導線(トップページ) ---- */
.site-nav a.nav-forge { color: var(--accent); }
.forge-cta {
  display: inline-block; margin-top: 18px; padding: 6px 16px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--pink-soft); color: var(--on-pop); font-weight: 800; text-decoration: none;
}
.forge-cta:hover { background: var(--pink); }

/* ---- ツール一覧(トップページ)・フッターのツールリンク ---- */
.tool-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; padding: 0; list-style: none; }
.tool-cards a {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px 20px;
  border: 3px solid var(--ink); border-radius: 18px; background: var(--sun-soft); box-shadow: var(--shadow-sm);
  color: var(--on-pop); text-decoration: none; transition: transform 0.12s, box-shadow 0.12s;
}
.tool-cards li:nth-child(4n+2) a { background: var(--mint-soft); }
.tool-cards li:nth-child(4n+3) a { background: var(--pink-soft); }
.tool-cards li:nth-child(4n+4) a { background: var(--sky-soft); }
.tool-cards a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.tool-cards a:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.tool-cards strong { font-size: 1.1rem; font-weight: 800; }
.tool-cards span { color: var(--on-pop-muted); font-size: 0.88rem; }
.footer-tools a { color: var(--muted); }

/* ---- MIDI Forge ---- */
.workspace { margin-top: 20px; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 6px; }
.btn-small { min-height: 42px; padding: 0 16px; border-width: 2px; border-radius: 12px; font-size: 0.9rem; box-shadow: 0 3px 0 var(--ink); }
.btn-secondary:disabled { opacity: 0.5; cursor: default; }
.play-time { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.panel-heading { margin: 24px 0 10px; font-size: 1.1rem; }
.track-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.track {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 2px solid var(--ink); border-left: 10px solid var(--swatch, var(--accent)); border-radius: 12px;
  background: var(--surface); font-size: 0.9rem;
}
.track input { width: 18px; height: 18px; accent-color: var(--accent); }
.track-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.track-meta { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.track-badge { padding: 0 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--sun); color: var(--on-pop); font-size: 0.72rem; font-weight: 800; }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border: 3px solid var(--ink); border-radius: 18px; background: var(--surface-2); box-shadow: var(--shadow-sm); }
.panel .panel-heading { margin: 0; }
.panel .option-help { margin: 0; }
.panel .btn-primary { margin-top: auto; }
.option-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.select {
  width: 100%; height: 44px; padding: 0 10px;
  border: 2px solid var(--ink); border-radius: 12px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 0.95rem; font-weight: 700;
}
.checks { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.9rem; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.analysis { margin: 0; padding: 8px 14px; border: 2px dashed var(--ink); border-radius: 12px; background: var(--surface); font-size: 0.85rem; word-break: break-word; }
.workspace .result-actions { flex-wrap: wrap; margin-top: 24px; }

/* ---- 音声ツール共通(マスタリング・復元・ステム分離) ---- */
.btn-wide { width: 100%; }
.dropzone-small { min-height: 96px; padding: 14px; }
.ref-box { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.ref-box .btn-small { align-self: flex-start; }
.targets { display: flex; flex-direction: column; gap: 8px; margin: 0 0 20px; padding: 14px 18px; border: 3px solid var(--ink); border-radius: 16px; }
.targets legend { padding: 0 6px; }
.select:disabled { opacity: 0.5; }
.progress { display: flex; align-items: center; gap: 12px; }
.progress progress { flex: 1; margin: 0; }
.result h3 { margin: 24px 0 10px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.chart { margin: 0; }
.chart figcaption { margin-bottom: 8px; }
.chart-area { position: relative; }
.eq-chart { display: block; width: 100%; height: 200px; border: 3px solid var(--ink); border-radius: 16px; background: var(--roll-bg); touch-action: none; }
.chart-grid { stroke: var(--roll-beat); stroke-width: 1; }
.chart-zero { stroke: var(--roll-bar); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--sun); stroke: var(--ink); stroke-width: 2.5; }
.chart-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; white-space: pre;
  padding: 4px 10px; border-radius: 8px; background: var(--text); color: var(--surface); font-size: 0.78rem; font-variant-numeric: tabular-nums;
}
.table-wrap { overflow-x: auto; }
.stats { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.stats th:first-child, .stats td:first-child { text-align: left; }
.stats thead th { color: var(--muted); font-weight: 600; }
.explain-list { margin: 0; padding-left: 1.2em; color: var(--text); font-size: 0.9rem; }
.explain-list li { margin-bottom: 4px; }
.ab-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.ab-button[aria-pressed="true"] { background: var(--sun); color: var(--on-pop); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.wave-wrap { position: relative; }
.waveform { width: 100%; height: 120px; border: 3px solid var(--ink); border-radius: 16px; cursor: pointer; }
.playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--error); pointer-events: none; }
.waveform-select { cursor: crosshair; touch-action: none; }
.selection-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 16px; font-size: 0.85rem; color: var(--muted); }
.restore-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin: 0 0 20px; }
.restore-options .check { display: flex; }
.slider-row { display: grid; grid-template-columns: auto 1fr 3.2em; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.slider-row input { width: 100%; accent-color: var(--accent); }
.slider-row output { text-align: right; font-variant-numeric: tabular-nums; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }

/* ---- コンテンツ ---- */
.howto { counter-reset: step; margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.howto li {
  counter-increment: step;
  display: grid; grid-template-columns: 48px 1fr; column-gap: 16px; align-items: center;
  padding: 16px 20px; border: 3px solid var(--ink); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.howto li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid; place-items: center; width: 48px; height: 48px;
  border: 3px solid var(--ink); border-radius: 50%; background: var(--sun); color: var(--on-pop); font-size: 1.2rem; font-weight: 800;
}
.howto li:nth-child(4n+2)::before { background: var(--mint); }
.howto li:nth-child(4n+3)::before { background: var(--pink); }
.howto li:nth-child(4n+4)::before { background: var(--sky); }
.howto strong { font-size: 1.05rem; font-weight: 800; }
.howto span { color: var(--muted); font-size: 0.92rem; }

.features { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; }
.features div { padding: 18px 22px; border: 3px solid var(--ink); border-radius: 18px; background: var(--sun-soft); color: var(--on-pop); box-shadow: var(--shadow-sm); }
.features div:nth-child(4n+2) { background: var(--mint-soft); }
.features div:nth-child(4n+3) { background: var(--pink-soft); }
.features div:nth-child(4n+4) { background: var(--sky-soft); }
.features dt { margin-bottom: 6px; font-size: 1.05rem; font-weight: 800; }
.features dd { margin: 0; color: var(--on-pop-muted); font-size: 0.92rem; }

.usecases { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; }
.usecases li { position: relative; padding: 12px 16px 12px 52px; border-radius: 14px; background: var(--surface); border: 2px solid var(--ink); font-size: 0.92rem; font-weight: 700; }
.usecases li::before {
  content: "✓"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 50%;
  background: var(--mint); color: var(--on-pop); font-size: 0.85rem; font-weight: 800;
}

details { margin-bottom: 12px; border: 2px solid var(--ink); border-radius: 16px; background: var(--surface); }
details[open] { box-shadow: var(--shadow-sm); }
summary { position: relative; padding: 14px 52px 14px 18px; cursor: pointer; font-weight: 800; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%;
  background: var(--sun); color: var(--on-pop); font-size: 1.15rem; font-weight: 800; line-height: 1;
}
details[open] summary::after { content: "−"; background: var(--mint); }
details[open] summary { border-bottom: 2px dashed var(--border); }
details p { margin: 0; padding: 14px 18px 16px; color: var(--muted); font-size: 0.92rem; }

/* ---- 広告(CLS を防ぐため高さを確保) ---- */
.ad { margin: 40px 0; text-align: center; }
.ad-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.05em; }
.adsbygoogle { display: block; }
.ad-fluid { min-height: 180px; }
.ad-block { min-height: 250px; }
.ad-multiplex .ad-block { min-height: 320px; }
.ad-sidebar { margin: 0; }

/* ---- おすすめ(アフィリエイト) ---- */
.recommend h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.05rem; }
.pr-label {
  padding: 0 6px; border: 2px solid var(--muted); border-radius: 6px;
  color: var(--muted); font-size: 0.7rem; font-weight: 600; line-height: 1.6;
}
.rec-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.rec-item { padding: 14px 16px; border: 3px solid var(--ink); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.rec-item h3 { margin: 0 0 4px; font-size: 0.95rem; }
.rec-item p { margin: 0 0 10px; color: var(--muted); font-size: 0.82rem; line-height: 1.6; }
.shops { display: flex; flex-wrap: wrap; gap: 6px; }
.shop {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border-radius: 10px; font-size: 0.8rem; font-weight: 800; text-decoration: none; color: #fff;
}
.shop-amazon { background: #232f3e; }
.shop-rakuten { background: #bf0000; }
.shop-dmm { background: #1f4e8c; }
.shop:hover { filter: brightness(1.15); }
.pr-note { margin: 10px 0 0; color: var(--muted); font-size: 0.72rem; }

/* ---- フッター ---- */
.site-footer { border-top: 3px solid var(--ink); background: var(--surface); }
.site-footer-inner { max-width: var(--content-w); margin: 0 auto; padding: 28px 24px 40px; color: var(--muted); font-size: 0.82rem; }
.site-footer p { margin: 0 0 8px; }
.disclosure { font-size: 0.75rem; }

/* ---- 単独ページ(プライバシーポリシー・404) ---- */
.page { max-width: 800px; margin: 0 auto; padding: 40px 24px 64px; }
.page h1 { font-size: 1.9rem; }
.page h2 { margin-top: 36px; font-size: 1.25rem; }
.page p, .page li { font-size: 0.95rem; }

/* ---- アクセシビリティ ---- */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 20; padding: 8px 12px; background: var(--accent); color: var(--accent-text); border-radius: 6px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* =====================================================================
   タブレット(〜1024px): サイドバーを本文の下へ
   ===================================================================== */
@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 780px; }
  .side-col { margin-top: 40px; }
  /* 本文中に広告があるため、1 カラム時はサイドバー広告を出さない(広告の連続を避ける) */
  .side-col .ad-sidebar { display: none; }
  .rec-list { grid-template-columns: 1fr 1fr; }
}

/* =====================================================================
   モバイル(〜640px)
   ===================================================================== */
@media (max-width: 640px) {
  :root { --header-h: 52px; }
  body { font-size: 15px; }
  h2 { margin: 40px 0 14px; font-size: 1.25rem; }
  :root { --shadow: 4px 4px 0 var(--ink); --shadow-sm: 2px 2px 0 var(--ink); }

  .site-header-inner { padding: 0 16px; }
  .site-nav a { padding: 6px 10px; font-size: 0.8rem; white-space: nowrap; }
  .site-nav a:not(.nav-tools) { display: none; } /* 狭い画面ではツール導線だけ残す */
  .logo { font-size: 1rem; white-space: nowrap; }
  .header-right { gap: 4px; }
  .lang-switch { min-height: 32px; padding: 0 10px; }
  .lang-switch::before { display: none; }

  .layout { padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); }
  .hero h1 { font-size: 1.8rem; }
  .hero::before { height: 44px; margin-bottom: 14px; background-size: auto 44px; }
  .lead { font-size: 0.95rem; }
  .badges { margin-bottom: 16px; }

  .tool { padding: 16px; border-radius: 18px; }
  .dropzone { min-height: 150px; padding: 18px 12px; }
  .options { grid-template-columns: 1fr; gap: 18px; margin: 18px 0; }
  /* iOS で入力時に拡大されないよう 16px 以上 */
  .option input[type="number"] { font-size: 16px; }
  .option input[type="range"] { height: 36px; }
  .btn-primary, .btn-secondary { min-height: 52px; }

  .result-stats { gap: 8px; }
  .result-stats div { padding: 8px 10px; }
  .result-stats dd { font-size: 1.2rem; }
  .piano-roll { height: 180px; }
  .result-actions { flex-direction: column; }
  .panels, .option-row, .result-grid, .restore-options { grid-template-columns: 1fr; }
  .select { font-size: 16px; }
  .play-time { margin-left: 0; width: 100%; }

  .howto li { grid-template-columns: 38px 1fr; column-gap: 12px; padding: 14px; }
  .howto li::before { width: 38px; height: 38px; font-size: 1rem; }
  .features, .usecases, .rec-list, .tool-cards { grid-template-columns: 1fr; }
  .ad { margin: 28px 0; }
  .ad-fluid { min-height: 140px; }

  .site-footer-inner { padding: 24px 16px calc(32px + env(safe-area-inset-bottom)); }
  .page { padding: 24px 16px 48px; }
}

@media (max-width: 380px) {
  .site-nav a:nth-child(2) { display: none; } /* 極小画面ではナビを 2 項目に */
  html[lang="en"] .site-nav a:nth-child(1) { display: none; } /* 英語は文言が長いので 1 項目に */
  .result-stats { grid-template-columns: 1fr 1fr; }
}
