/* ============================================================
   攻略記事の目次 — guide-toc.css
   ・記事頭の目次（#guide-toc）は固定しない。検索向けのアンカー一覧を兼ねる
   ・追従メニューは guide-toc.js が目次を複製して作る。#guide が画面にある間だけ出る
       スマホ = 上端の現在地バー（章の名称 ＋ 節）→ タップで目次シート
       PC（幅 1040px〜）= 本文の右に追従する目次
   モック = docs/mockups/gomoku/guide-toc-v1.html
   ============================================================ */

/* ---- 記事頭の目次 ---- */
.guide-toc { margin: 14px 0; padding: 12px 14px; background: var(--bg); border-radius: 12px; }
.section .guide-toc-title { margin: 0 0 6px; font-weight: 900; color: var(--ink); }
.section .guide-toc-list, .section .guide-toc-list ol { list-style: none; padding: 0; margin: 0; }
.section .guide-toc-list > li { margin: 0 0 6px; }
.section .guide-toc-list ol { padding-left: 12px; }
.section .guide-toc-list ol li { margin: 0; }
.guide-toc-group { display: block; font-size: 11px; font-weight: 900; color: var(--ink-mute); letter-spacing: .05em; }
.guide-toc-list a { display: block; padding: 3px 8px; border-radius: 8px; color: var(--ink-soft);
  text-decoration: none; font-weight: 700; font-size: 13.5px; }
.guide-toc-list a:hover { background: var(--bg-soft); }
.guide-toc-list a.is-cur { background: var(--accent); color: #fff; }

#guide, #guide h3[id] { scroll-margin-top: 64px; }

/* 記事・FAQ の見出しは h2（記事名）＋ h3（節）。h3 は旧 h4 の見た目（左の縦線）を引き継ぐ */
.guide-section h3, .faq-section h3 {
  font-size: 14px; font-weight: 900; color: var(--ink);
  margin: 16px 0 6px; border-left: 4px solid var(--accent); padding-left: 8px;
}

/* ---- 対局前の画面から記事への入口（対局中は隠す） ---- */
.guide-jump { display: table; margin: -10px auto 14px; padding: 5px 14px; border-radius: 999px;
  background: var(--bg-soft); color: var(--accent-deep); font-size: 13px; font-weight: 700; text-decoration: none; }
.guide-jump:hover { background: var(--bg-deep); }
.stage[data-state="playing"] .guide-jump { display: none; }

/* ---- 追従メニュー共通 ---- */
.gtoc-follow { opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
body.gtoc-in .gtoc-follow { opacity: 1; pointer-events: auto; }
.gtoc-follow .guide-toc-list, .gtoc-follow .guide-toc-list ol { list-style: none; padding: 0; margin: 0; }
.gtoc-follow .guide-toc-list > li { margin: 0 0 6px; }
.gtoc-follow .guide-toc-list ol { padding-left: 12px; }
.gtoc-follow .guide-toc-title { margin: 0 0 6px; font-weight: 900; color: var(--ink); }

/* ---- スマホ: 上端の現在地バー ---- */
.gtoc-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; transform: translateY(-100%);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--bg-deep); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
body.gtoc-in .gtoc-bar { transform: none; }
.gtoc-bar-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 12px; }
.gtoc-bar-cur { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0;
  background: none; font: inherit; color: var(--ink); text-align: left; padding: 6px 0; cursor: pointer; }
.gtoc-bar-cur .gtoc-chap { flex: none; font-size: 11px; font-weight: 900; color: var(--accent-deep); }
.gtoc-bar-cur .gtoc-now { font-size: 14px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gtoc-bar-cur .gtoc-car { flex: none; font-size: 11px; color: var(--ink-mute); }
.gtoc-game { flex: none; border: 0; border-radius: 999px; background: var(--ink); color: #fff;
  font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1; padding: 8px 12px; cursor: pointer; }
.gtoc-prog { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--accent); }

.gtoc-sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .35); display: none; }
.gtoc-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 75vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .22s; visibility: hidden; }
.gtoc-sheet .guide-toc-title { display: flex; justify-content: space-between; align-items: center; }
.gtoc-sheet .guide-toc-list a { font-size: 15px; padding: 9px 10px; }
.gtoc-sheet-x { border: 0; background: var(--bg-soft); border-radius: 999px; width: 30px; height: 30px;
  font-size: 16px; color: var(--ink); cursor: pointer; }
body.gtoc-sheet-open .gtoc-sheet-bg { display: block; }
body.gtoc-sheet-open .gtoc-sheet { transform: none; visibility: visible; }

/* ---- PC: 本文の右に追従する目次 ---- */
.gtoc-side { display: none; }
@media (min-width: 1040px) {
  .gtoc-bar, .gtoc-sheet, .gtoc-sheet-bg { display: none !important; }
  .gtoc-side { display: block; position: fixed; top: 24px; z-index: 40;
    left: calc(50% + 296px); width: 220px; max-height: calc(100vh - 48px); overflow-y: auto;
    background: #fff; border: 2px solid var(--bg-deep); border-radius: 16px; padding: 12px; }
  .gtoc-side .guide-toc-list a { font-size: 13px; }
  .gtoc-side .gtoc-game { display: block; width: 100%; margin-top: 10px; border-radius: 10px;
    background: var(--bg-soft); color: var(--ink); padding: 9px; }
  #guide, #guide h3[id] { scroll-margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .gtoc-follow, .gtoc-sheet { transition: none; }
}
