/* 文章のページ(プライバシーポリシー・運営者情報・お問い合わせ)の見た目。色・書体・見出し・カード・フッターはアプリ本体(index.html)と同じ */
:root {
  --bg: #eef1f5;
  --surface: #fff;
  --ink: #18202c;
  --muted: #586273;
  --line: #d5dbe3;
  --brass: #7a4f0e;
  --brass-soft: #f1e3c4;
  --mute: #c23b3b;
  --ok: #1d8f52;
  --stage: #dde3ea;
  --font-display: "Dela Gothic One", "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Consolas", monospace;
  --radius: 10px;
  /* 指の色(ダイアグラムの丸。アプリ本体と同じ: 人差し指・中指・薬指・小指。白い数字が読める濃さ) */
  --f1: #2f6fd6; --f2: #1f8f63; --f3: #b8620f; --f4: #c23a72;
  --practice: #2f6fdf;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111419; --surface: #191d24; --ink: #e6e9ef; --muted: #98a1af;
    --line: #2a303a; --brass: #e2b552; --brass-soft: #3a3020; --mute: #ef6b6b; --ok: #3ddc84; --stage: #0c0f13;
    --f1: #5c90f2; --f2: #2fbd88; --f3: #f2a443; --f4: #e86c9e; --practice: #7ba5f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111419; --surface: #191d24; --ink: #e6e9ef; --muted: #98a1af;
  --line: #2a303a; --brass: #e2b552; --brass-soft: #3a3020; --mute: #ef6b6b; --ok: #3ddc84; --stage: #0c0f13;
  --f1: #5c90f2; --f2: #2fbd88; --f3: #f2a443; --f4: #e86c9e; --practice: #7ba5f5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.85;
}
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
a { color: var(--brass); text-underline-offset: 3px; }
[hidden] { display: none !important; }

/* 全体: 上にサイト名、まん中に本文、下にフッター */
.app {
  max-width: 1080px; margin: 0 auto; min-height: 100vh;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-block: 0 32px;
  display: grid; grid-template-rows: auto 1fr auto; gap: 14px;
}
/* (ヘッダーと下のタブは site-chrome.css) */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); padding: 10px 22px; font-size: .92rem; font-weight: 700; }
.btn.primary:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: progress; }
/* パンくずリスト(ホーム › ガイド › 記事名)。記事名は長いので、狭い画面では折り返す */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: baseline; margin: 0; padding: 0; list-style: none; font-size: .78rem; line-height: 1.6; color: var(--muted); }
.doc .crumbs li + li { margin-top: 0; }
.crumbs li + li::before { content: "›"; margin: 0 8px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current="page"] { color: var(--ink); }

/* 本文 */
.doc { width: 100%; max-width: 760px; margin: 0 auto; display: grid; gap: 14px; align-content: start; padding-top: 8px; }
.doc h1 { margin: 6px 0 2px; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 1.1rem + 1.3vw, 1.9rem); line-height: 1.35; letter-spacing: .02em; text-wrap: balance; }
.lead { margin: 0; color: var(--muted); max-width: 38em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px clamp(16px, 4vw, 28px); min-width: 0; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.doc h2 { margin: 0 0 10px; font-size: 1.18rem; font-weight: 700; line-height: 1.4; text-wrap: balance; }
.doc h3 { margin: 22px 0 4px; font-size: 1rem; font-weight: 700; line-height: 1.5; }
.doc p { margin: 0 0 10px; max-width: 38em; } /* 1行は全角で38字ほどまで */
.doc ul { margin: 0 0 10px; padding-left: 1.3em; max-width: 38em; }
.doc li + li { margin-top: 4px; }
.label { font-size: .72rem; letter-spacing: .12em; color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.note { color: var(--muted); font-size: .86rem; }
.url { font-family: var(--font-mono); font-size: .84rem; overflow-wrap: anywhere; }

/* 表(外部サービス)。狭い画面では表だけ横にずらして読む */
.table-wrap { overflow-x: auto; margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 480px; font-size: .88rem; line-height: 1.6; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { background: var(--bg); color: var(--muted); font-size: .76rem; letter-spacing: .08em; font-weight: 700; white-space: nowrap; }

/* 運営者の表(項目と内容) */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.facts dt { color: var(--muted); font-size: .88rem; font-weight: 700; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* お問い合わせフォーム */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.req { font-size: .7rem; font-weight: 700; letter-spacing: .06em; padding: 0 7px; border-radius: 999px; background: var(--brass-soft); color: var(--brass); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; line-height: 1.6;
}
.field textarea { min-height: 11em; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.field .hint { margin: 0; color: var(--muted); font-size: .8rem; }
.policy-note { margin: 0; font-size: .86rem; color: var(--muted); }
.form-error { margin: 0; color: var(--mute); font-size: .88rem; }
.sent { border-left: 3px solid var(--ok); padding: 6px 0 6px 14px; }
.sent p { margin: 0; }
/* ロボットよけの入力欄(人には見せない) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- ガイド記事 ---- */
.kicker { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .14em; color: var(--brass); }
.kicker a { color: inherit; text-decoration: none; }
.doc h1 .h1-sub { display: block; margin-top: 6px; font-family: var(--font-body); font-weight: 700; font-size: .5em; letter-spacing: .02em; color: var(--muted); }
.article { padding-block: 26px 30px; }
.article h2 { margin: 34px 0 10px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 1.24rem; }
.article > h2:first-child, .article > .stage3d:first-child + h2 { margin-top: 0; }
.article h3 { margin-top: 18px; }
.article strong { font-weight: 700; background: linear-gradient(transparent 64%, var(--brass-soft) 64%); }
.article ol { margin: 0 0 10px; padding-left: 1.5em; max-width: 38em; }
.article ol li + li { margin-top: 4px; }
/* コツ: 左に真鍮色の線を引いた囲み */
.tip { margin: 12px 0 14px; padding: 10px 16px 11px; border-left: 3px solid var(--brass); background: color-mix(in srgb, var(--brass-soft) 55%, transparent); border-radius: 0 8px 8px 0; max-width: 38em; }
.tip b { display: block; font-size: .78rem; letter-spacing: .12em; color: var(--brass); margin-bottom: 2px; }
.more { margin: 4px 0 12px; }
.more a { font-weight: 700; }
/* コード名のリンク(関連するコード)。アプリの「関連するコード」と同じ形 */
.chord-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.doc .chord-links { padding: 0; } /* 本文の箇条書きの字下げ(.doc ul)を入れない */
.doc .chord-links li + li { margin-top: 0; } /* 本文の箇条書きの行間(.doc li + li)を入れると、最初のボタンだけ上にずれる */
.chord-links a { display: inline-block; border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 3px 11px; font-family: var(--font-mono); font-size: .86rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.chord-links a:hover { border-color: var(--muted); }
td a { font-family: var(--font-mono); font-weight: 700; }

/* 3D(ステージの埋め込み)と「よくある失敗」「正しい形」の切り替え */
.stage3d { margin: 18px 0 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.stage3d-frame { position: relative; aspect-ratio: 16 / 10; max-width: 100%; background: var(--stage); }
.stage3d-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage3d-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px 0; }
.stage3d-bar button { font: inherit; font-size: .86rem; font-weight: 700; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.stage3d-bar button:hover { border-color: var(--muted); }
/* 選んでいるボタン: コード・利き手は黒、「よくある失敗」は赤、「正しい形」は緑 */
.stage3d-bar button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.stage3d-bar button[data-value="fail"][aria-pressed="true"] { background: var(--mute); border-color: var(--mute); }
.stage3d-bar button[data-value="ok"][aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }
.stage3d-bar button[data-key="chord"] { font-family: var(--font-mono); min-width: 3.2em; padding-inline: 12px; }
/* 持ち替えの自動再生。押している間は真鍮色の枠 */
.stage3d-bar button[data-play] { display: inline-flex; align-items: center; gap: 6px; }
.stage3d-bar button[data-play]::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; }
.stage3d-bar button[data-play][aria-pressed="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--ink); }
.stage3d-bar button[data-play][aria-pressed="true"]::before { width: 8px; height: 9px; border: 0; border-left: 3px solid currentColor; border-right: 3px solid currentColor; box-sizing: border-box; }
.stage3d-bar .sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--line); }
.stage3d-bar .drag { margin-left: auto; font-size: .76rem; color: var(--muted); }
/* スイッチ(ドレミの「3つのパターンを重ねて表示」) */
.stage3d-bar .switch { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); cursor: pointer; }
.stage3d-bar .switch input { accent-color: var(--brass); margin: 0; }
.stage3d figcaption { padding: 8px 14px 12px; font-size: .88rem; line-height: 1.75; }
.stage3d figcaption b { color: var(--muted); font-size: .78rem; letter-spacing: .08em; margin-right: 6px; }
@media (max-width: 720px) {
  .stage3d-frame { aspect-ratio: 4 / 3; }
  .stage3d-bar { gap: 6px; padding-inline: 12px; }
  .stage3d-bar .drag { display: none; }
  /* スマホの幅でも、コードのボタン4つと「再生」が1行に収まるように詰める */
  .stage3d-bar button { padding: 6px 13px; }
  .stage3d-bar button[data-key="chord"] { min-width: 2.7em; padding-inline: 9px; }
}

/* 広告。広告枠(.pr-slot)は今は空で hidden。中身を入れて hidden を外すと、タイトルの下の「広告を含みます」が自動で出る */
.pr-slot { margin: 24px 0; }
.pr-note { margin: 0; justify-self: start; font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; }
.doc:has(.pr-slot:not([hidden])) .pr-note { display: block !important; }
/* 広告の候補地(.spot)。今は空で hidden。広告コードを入れるときは hidden を外して中に貼る。
   高さ(--spot-h)を先に取っておくので、広告が読み込まれても下の文章がずれない。
   class 名に "ad" を含めない(広告ブロッカーに枠ごと消されて、レイアウトが崩れるのを防ぐ)。
   3D・ボタンとの間はあけて、誤タップを防ぐ(3D のすぐ下に来る記事では、さらに広くあける) */
.spot:not([hidden]) { display: block; min-height: var(--spot-h, 280px); margin-block: 32px; }
.spot:not([hidden])::before { content: "スポンサーリンク"; display: block; margin-bottom: 6px; font-size: .7rem; letter-spacing: .08em; color: var(--muted); text-align: center; }
.stage3d + .spot:not([hidden]) { margin-top: 48px; }
/* 広告のカード:本文と区別できるよう、真鍮色の左線と「PR」のラベル。価格は書かず、ボタンの横に小さく案内だけ */
.pr-card { display: grid; gap: 6px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--brass); border-radius: var(--radius); }
.pr-card p { margin: 0; }
.pr-label { justify-self: start; font-size: .68rem; font-weight: 700; letter-spacing: .12em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.doc .pr-card .pr-title { margin: 2px 0 0; font-size: 1rem; }
.pr-name { font-weight: 700; }
.pr-desc { font-size: .9rem; color: var(--muted); line-height: 1.75; }
.pr-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; }
.pr-price { font-size: .76rem; color: var(--muted); }

/* 次に読む(記事の最後)。上に3Dのサムネイル(失敗の形と正しい形など)、下にタグ・タイトル・1行の説明 */
.next-read { margin-top: 12px; }
.doc .next-read h2 { margin: 0 0 10px; font-size: .74rem; font-weight: 700; letter-spacing: .14em; color: var(--muted); }
/* パソコンは3列(2枚の記事は左から2枠)、スマホは1列。幅で列の数を変えると、3枚目だけが下の段に残ることがあるので固定する */
.doc .next-cards { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.doc .next-cards li + li { margin-top: 0; }
.next-card { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s ease; }
.next-card:hover { border-color: var(--muted); }
.next-card:hover .next-title { text-decoration: underline; text-underline-offset: 3px; }
.next-card img { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--stage); border-bottom: 1px solid var(--line); }
.next-body { display: grid; gap: 4px; align-content: start; padding: 11px 14px 14px; }
.next-title { font-weight: 700; font-size: .94rem; line-height: 1.5; text-wrap: balance; word-break: auto-phrase; } /* 日本語は文節で折り返す */
.next-desc { color: var(--muted); font-size: .8rem; line-height: 1.6; }
/* タグ: 悩み(赤)・入門(緑)・左利き(真鍮)・練習(青)・スケール(ピンク) */
.tag { justify-self: start; font-size: .7rem; font-weight: 700; letter-spacing: .08em; line-height: 1.7; padding: 0 9px; border-radius: 999px; }
.tag-trouble { color: var(--mute); background: color-mix(in srgb, var(--mute) 12%, transparent); }
.tag-intro { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tag-lefty { color: var(--brass); background: var(--brass-soft); }
.tag-practice { color: var(--practice); background: color-mix(in srgb, var(--practice) 12%, transparent); }
.tag-scale { color: var(--f4); background: color-mix(in srgb, var(--f4) 12%, transparent); }
/* スケールの記事の最後: スケールの画面(/scale)を開くボタン */
.practice-cta { margin: 26px 0 0; }

/* ダイアグラムと3Dを並べる(記事15)。左にサイトと同じ縦型のダイアグラム、右に同じ向きの3D(縦長の枠)。スマホでも横に並べる */
.stage3d.with-diagram .stage3d-pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0; align-items: stretch; }
.stage3d-diagram { display: grid; place-items: center; padding: 14px; border-right: 1px solid var(--line); background: var(--surface); }
.stage3d-diagram svg { width: 100%; max-width: 190px; height: auto; }
.stage3d.with-diagram .stage3d-frame { aspect-ratio: 3 / 4; }
@media (max-width: 720px) { .doc .next-cards { grid-template-columns: minmax(0, 1fr); } }

/* ---- ガイドの一覧ページ(/guide/) ---- */
.doc.guide-home { max-width: 1080px; gap: 18px; }
/* ファーストビュー: 左に見出しと説明、右に3D(狭い画面では縦に積む) */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px 32px; align-items: center; padding-block: 30px; }
.hero-text { display: grid; gap: 12px; align-content: center; }
.doc .hero h1 { margin: 0; font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.6rem); line-height: 1.3; }
.doc .hero-lead { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.9; max-width: 26em; }
.hero .stage3d { margin: 0; }
/* 見出し(まずはここから・悩みから探す・コードから探す) */
.guide-section { display: grid; gap: 12px; margin-top: 12px; }
.doc .section-title { margin: 0; font-size: 1.24rem; line-height: 1.4; }
.guide-cat { display: grid; gap: 10px; }
.guide-cat + .guide-cat { margin-top: 12px; }
.doc .guide-cat h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.doc .guide-cat h3::before { content: ""; width: 4px; height: 1em; border-radius: 2px; background: var(--brass); }
/* まずはここから: 大きいカード1枚(左にサムネイル、右に説明) */
.feature-card { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s ease; }
.feature-card:hover { border-color: var(--muted); }
.feature-card img { display: block; width: 100%; max-width: 100%; height: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--stage); }
.feature-body { display: grid; gap: 8px; align-content: center; justify-items: start; padding: 20px clamp(16px, 3vw, 28px); }
.feature-title { font-weight: 700; font-size: 1.25rem; line-height: 1.45; text-wrap: balance; word-break: auto-phrase; }
.feature-card:hover .feature-title { text-decoration: underline; text-underline-offset: 4px; }
.feature-desc { color: var(--muted); font-size: .88rem; line-height: 1.8; }
.feature-more { margin-top: 4px; color: var(--brass); font-size: .9rem; font-weight: 700; }
.feature-more::after { content: " →"; }
/* 悩みから探す: カードは「次に読む」と同じ形で、パソコンは3列・スマホは1列。最後の段に1枚だけ残るときは、
   その1枚を段いっぱいの横長のカード(左にほかのカードと同じ幅のサムネイル、右に説明)にする */
.doc .next-cards.wide > li:last-child:nth-child(3n+1) { grid-column: 1 / -1; }
.next-cards.wide > li:last-child:nth-child(3n+1) .next-card { flex-direction: row; }
.next-cards.wide > li:last-child:nth-child(3n+1) .next-card img { flex: none; width: calc((100% - 28px) / 3); border-bottom: 0; border-right: 1px solid var(--line); }
.next-cards.wide > li:last-child:nth-child(3n+1) .next-body { align-content: center; padding: 14px clamp(16px, 2.5vw, 24px); }
/* コードから探す: よく使うコードと、コード帳のコード一覧へのボタン */
.chord-search { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; margin-top: 12px; }
.chord-search > div { min-width: 0; flex: 1 1 360px; }
.doc .chord-search p { margin: 6px 0 12px; color: var(--muted); }
.chord-search .chord-links { margin: 0; }
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 22px 24px; }
  .feature-card { grid-template-columns: minmax(0, 1fr); }
  .feature-card img { height: auto; }
}
@media (max-width: 720px) {
  /* スマホは1列なので、横長のカードもほかと同じ縦の形に戻す */
  .next-cards.wide > li:last-child:nth-child(3n+1) .next-card { flex-direction: column; }
  .next-cards.wide > li:last-child:nth-child(3n+1) .next-card img { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .next-cards.wide > li:last-child:nth-child(3n+1) .next-body { padding: 11px 14px 14px; }
  /* スマホの幅でも、3D の下のボタン3つが1行に収まるように */
  .hero { padding-inline: 12px; }
  .hero .stage3d-bar .sep { display: none; }
}

/* フッター(アプリ本体と同じ) */
.site-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-foot a[aria-current="page"] { color: var(--ink); }
.site-foot p { margin: 0; }

@media (max-width: 720px) {
  .app { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}
