/* ==========================================================
   prompt_guide.css ― キャラクター作成ガイド専用スタイル
   ・すべて .pg 配下にスコープ（サイト共通CSSとは独立）
   ・読み疲れ対策：広い行間／短い行長／折りたたみ／追従目次／
     章ごとの要点ボックス／ダークモード／スマホ最適化
   ========================================================== */

/* ---------- 変数 ---------- */
.pg {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --text: #2a2926;
  --muted: #6b675f;
  --line: #e7e4dc;

  --accent: #4a5ad0;
  --accent-ink: #35429e;
  --accent-soft: #edeffc;
  --on-accent: #ffffff;

  --good: #1f7a57;
  --good-soft: #e5f4ec;
  --bad: #b13f58;
  --bad-soft: #fbeaee;
  --warn: #9a5710;
  --warn-soft: #fdf1df;
  --mark: #ffe9a3;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 28, 20, .05), 0 6px 20px rgba(30, 28, 20, .05);
}

@media (prefers-color-scheme: dark) {
  .pg {
    --bg: #16161a;
    --surface: #1e1f25;
    --surface-2: #23242b;
    --text: #e9e7e2;
    --muted: #a09c93;
    --line: #33343c;

    --accent: #8c9aff;
    --accent-ink: #b5beff;
    --accent-soft: #2a2d4a;
    --on-accent: #14152b;

    --good: #6fd1a4;
    --good-soft: #1b3329;
    --bad: #f08aa0;
    --bad-soft: #3a2229;
    --warn: #f0b36a;
    --warn-soft: #3a2d1a;
    --mark: #6b5a1f;

    --shadow: none;
  }
}

/* ---------- ベース ---------- */
html:has(.pg) { scroll-behavior: smooth; }

.pg,
.pg *,
.pg *::before,
.pg *::after { box-sizing: border-box; }

.pg {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
               "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: .02em;
  line-break: strict;
  word-break: auto-phrase;      /* 文節単位で改行（対応ブラウザのみ。未対応なら通常どおり） */
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}

.pg :where(p) { margin: 0 0 1.1em; text-wrap: pretty; }
.pg strong { font-weight: 700; }
.pg :where(a) { color: var(--accent-ink); }
.pg :where(ul, ol) { margin: 0 0 1.2em; padding-left: 1.3em; }
.pg :where(li) { margin: .3em 0; }
.pg :where(li)::marker { color: var(--accent); }

.pg :focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.pg-nb { white-space: nowrap; }

.pg-mark {
  background: linear-gradient(transparent 60%, var(--mark) 60%);
  font-weight: 700;
}

/* ---------- 上部バー・進捗 ---------- */
.pg-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px; width: 0;
  background: var(--accent);
  z-index: 100;
  transition: width .08s linear;
}

.pg-top {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 20px 0;
}

.pg-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: .85rem;
}
.pg-breadcrumb a { color: var(--muted); text-decoration: none; }
.pg-breadcrumb a:hover { text-decoration: underline; }

/* ---------- ヘッダー ---------- */
.pg-header { padding: 32px 0 12px; }

.pg-header h1 {
  margin: 0 0 .6em;
  font-size: clamp(1.5rem, 4.6vw, 2.05rem);
  line-height: 1.5;
  letter-spacing: .03em;
}

.pg-lead {
  max-width: 40em;
  margin: 0 0 1.2em;
  font-size: 1.02rem;
}

.pg-readtime {
  margin: 0 0 1.4em;
  font-size: .88rem;
  color: var(--muted);
}

.pg-paths {
  display: grid;
  gap: 12px;
  margin: 0 0 8px;
}
@media (min-width: 640px) {
  .pg-paths { grid-template-columns: 1fr 1fr; }
}

.pg-path {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.pg-path:hover { border-color: var(--accent); transform: translateY(-1px); }
.pg-path__who  { display: block; font-size: .82rem; color: var(--muted); line-height: 1.6; }
.pg-path__go   { display: block; margin: .1em 0; font-weight: 700; line-height: 1.6; }
.pg-path__time { display: block; font-size: .82rem; color: var(--accent-ink); line-height: 1.6; }

/* ---------- 全体レイアウト ---------- */
.pg-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 20px 96px;
}

@media (min-width: 1024px) {
  .pg-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
  }
}

.pg-main { min-width: 0; }

/* ---------- 目次（スマホ：折りたたみ／PC：左に追従） ---------- */
.pg-toc { margin: 0 0 32px; }

.pg-toc details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pg-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.pg-toc summary::-webkit-details-marker { display: none; }
.pg-toc summary::after {
  content: "";
  width: .5em; height: .5em;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
.pg-toc details[open] summary::after { transform: rotate(-135deg); }

.pg-toc ol { margin: 0; padding: 2px 10px 14px; list-style: none; }
.pg-toc li { margin: 0; }

.pg-toc__group {
  padding: 10px 8px 2px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--muted);
}

.pg-toc a {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  line-height: 1.6;
  text-decoration: none;
}
.pg-toc a:hover { background: var(--surface-2); }
.pg-toc a.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}

@media (min-width: 1024px) {
  .pg-toc {
    position: sticky;
    top: 20px;
    margin: 0;
    max-height: calc(100vh - 40px);
    overflow: auto;
  }
}

/* ---------- 章 ---------- */
.pg-sec { margin: 0 0 56px; scroll-margin-top: 16px; }

.pg-group {
  display: flex;
  align-items: center;
  gap: .9em;
  margin: 72px 0 28px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent-ink);
}
.pg-group:first-child { margin-top: 0; }
.pg-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.pg-h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3em .7em;
  margin: 0 0 .9em;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: .03em;
}

.pg-h2__t { flex: 1 1 0; min-width: 0; }

.pg-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.9em; height: 1.9em;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
}

.pg-chip {
  display: inline-block;
  padding: 0 .8em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: .76rem;
  font-weight: 700;
  line-height: 2;
  letter-spacing: .04em;
  white-space: nowrap;
}

.pg-sec h3 {
  margin: 2em 0 .6em;
  padding-left: .7em;
  border-left: 3px solid var(--accent);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* ---------- 要点ボックス・注記 ---------- */
.pg-point {
  display: grid;
  gap: 2px;
  margin: 0 0 1.5em;
  padding: 12px 16px 12px 18px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
}
.pg-point__label {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent-ink);
}
.pg-point p { margin: 0; font-weight: 700; line-height: 1.8; }

.pg-note {
  margin: 0 0 1.5em;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: .95rem;
  line-height: 1.85;
}
.pg-note p:last-child { margin: 0; }
.pg-note__t { display: block; margin-bottom: .2em; font-weight: 700; }
.pg-note--warn { background: var(--warn-soft); border-color: transparent; }
.pg-note--warn .pg-note__t { color: var(--warn); }

/* ---------- タグ（良い／悪い） ---------- */
.pg-tag {
  display: inline-block;
  margin-right: .6em;
  padding: 0 .7em;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.9;
  vertical-align: .08em;
}
.pg-tag--good { background: var(--good-soft); color: var(--good); }
.pg-tag--bad  { background: var(--bad-soft);  color: var(--bad); }

.pg-vs { padding-left: 0; list-style: none; }
.pg-vs li { margin: .6em 0; }

/* ---------- コピーできるコード枠 ---------- */
.pg-code {
  margin: 0 0 1.5em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.pg-code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  color: var(--muted);
}
.pg-code pre {
  margin: 0;
  padding: 16px 18px;
  font-family: inherit;
  font-size: .92rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pg-copy {
  min-height: 36px;
  padding: .35em 1.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.pg-copy:hover { border-color: var(--accent); }
.pg-copy.is-done { background: var(--good-soft); border-color: transparent; color: var(--good); }

/* ---------- 要素カード ---------- */
.pg-spec {
  display: grid;
  gap: 12px;
  margin: 0 0 1.5em;
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) {
  .pg-spec { grid-template-columns: 1fr 1fr; }
}

.pg-spec__item {
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pg-spec__item--key { border-color: var(--accent); background: var(--accent-soft); }
.pg-spec__item--wide { grid-column: 1 / -1; }

.pg-spec__t {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2em .6em;
  margin: 0 0 .2em;
  font-weight: 700;
}
.pg-spec__n { color: var(--accent); }
.pg-spec__d {
  margin: 0 0 .6em;
  font-size: .93rem;
  line-height: 1.75;
  color: var(--muted);
}
.pg-spec__item--key .pg-spec__d { color: var(--text); }
.pg-spec__ex {
  margin: 0;
  padding: .5em .8em;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.75;
}
.pg-spec__ex::before { content: "例　"; font-size: .78rem; color: var(--muted); }

/* ---------- 形容詞 → 振る舞い の書き換え表 ---------- */
.pg-swap { display: grid; gap: 14px; margin: 0 0 1.5em; padding: 0; list-style: none; }
.pg-swap__row { display: grid; gap: 4px; margin: 0; }
@media (min-width: 640px) {
  .pg-swap__row { grid-template-columns: 6.5em auto 1fr; gap: 10px; align-items: center; }
}
.pg-swap__bad {
  padding: .4em .9em;
  background: var(--bad-soft);
  border-radius: 10px;
  color: var(--bad);
  font-weight: 700;
  line-height: 1.7;
}
.pg-swap__arrow { text-align: center; color: var(--muted); line-height: 1.2; }
.pg-swap__arrow::before { content: "↓"; }
@media (min-width: 640px) {
  .pg-swap__arrow::before { content: "→"; }
}
.pg-swap__good {
  padding: .6em .9em;
  background: var(--good-soft);
  border-radius: 10px;
  font-size: .95rem;
  line-height: 1.8;
}

/* 長めの文を並べる書き換え表（1章用） */
.pg-swap--wide .pg-swap__bad { font-size: .95rem; font-weight: 500; line-height: 1.8; }
@media (min-width: 640px) {
  .pg-swap--wide .pg-swap__row { grid-template-columns: 1fr auto 1.7fr; }
}

/* 「願い → 性格・行動」の変換表：左は悪い例ではないので、ピンクではなく強調色にする */
.pg-swap--convert .pg-swap__bad { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- 折りたたみ ---------- */
.pg-fold {
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pg-fold > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3em .7em;
  padding: 16px 48px 16px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  list-style: none;
  position: relative;
}
.pg-fold > summary::-webkit-details-marker { display: none; }
.pg-fold > summary::after {
  content: "";
  position: absolute;
  right: 20px; top: 50%;
  width: .55em; height: .55em;
  margin-top: -.45em;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
.pg-fold[open] > summary::after { transform: rotate(-135deg); margin-top: -.15em; }
.pg-fold__title { flex: 1 1 0; min-width: 0; margin: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.6; }
.pg-fold__body { padding: 8px 20px 22px; border-top: 1px solid var(--line); }
.pg-fold__body > h3:first-child { margin-top: 1.2em; }

.pg-fold--small > summary { padding: 12px 44px 12px 16px; font-size: .95rem; font-weight: 700; }
.pg-fold--small { box-shadow: none; }

/* ---------- 良い例／悪い例 ---------- */
.pg-sample {
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.pg-sample > summary {
  position: relative;
  padding: 10px 44px 10px 16px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.pg-sample > summary::-webkit-details-marker { display: none; }
.pg-sample > summary::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  width: .5em; height: .5em;
  margin-top: -.4em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s;
}
.pg-sample[open] > summary::after { transform: rotate(-135deg); margin-top: -.1em; }
.pg-sample--bad  > summary { background: var(--bad-soft);  color: var(--bad); }
.pg-sample--good > summary { background: var(--good-soft); color: var(--good); }
.pg-sample pre {
  margin: 0;
  padding: 16px 18px;
  font-family: inherit;
  font-size: .92rem;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pg-why { margin: 0 0 1.6em; padding: 0; list-style: none; font-size: .95rem; }
.pg-why li { display: flex; gap: .6em; margin: .4em 0; line-height: 1.8; }
.pg-why li::before { flex: none; font-weight: 700; }
.pg-why--bad  li::before { content: "✕"; color: var(--bad); }
.pg-why--good li::before { content: "✓"; color: var(--good); }

/* ---------- NGボックス ---------- */
.pg-ng {
  margin: 0 0 1.2em;
  padding: 16px 20px;
  background: var(--bad-soft);
  border-left: 5px solid var(--bad);
  border-radius: 12px;
}
.pg-ng ul { margin: 0; padding: 0; list-style: none; }
.pg-ng li { display: flex; gap: .6em; margin: .4em 0; font-weight: 700; line-height: 1.8; }
.pg-ng li::before { content: "✕"; flex: none; color: var(--bad); }

/* ---------- 困ったとき ---------- */
.pg-trouble { display: grid; gap: 10px; margin: 0; }
.pg-trouble__row {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
@media (min-width: 640px) {
  .pg-trouble__row { grid-template-columns: 13em 1fr; gap: 16px; align-items: baseline; }
}
.pg-trouble dt { font-weight: 700; line-height: 1.7; }
.pg-trouble dd { margin: 0; font-size: .95rem; line-height: 1.8; }

/* ---------- フッターCTA・ページ上部へ ---------- */
.pg-cta { margin: 56px 0 0; text-align: center; }
.pg-btn {
  display: inline-block;
  padding: .9em 2.4em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}
.pg-btn:hover { opacity: .9; }

.pg-topbtn {
  position: fixed;
  right: 16px; bottom: 16px;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent-ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 90;
}
.pg-topbtn.is-show { opacity: 1; pointer-events: auto; }

/* ---------- 小さい画面の微調整 ---------- */
@media (max-width: 480px) {
  .pg-h2 { font-size: 1.25rem; }
  .pg-sec { margin-bottom: 48px; }
}

/* ---------- 動きを減らす設定 ---------- */
@media (prefers-reduced-motion: reduce) {
  html:has(.pg) { scroll-behavior: auto; }
  .pg *, .pg *::before, .pg *::after { transition: none !important; }
}
