/*
 * 状態異常ガイド（pages/status/*.html）の追加スタイル。
 * 基調は assets/character-page.css と共通で、こちらは
 * ガイド固有の箱（ひとことで・一覧表・関連効果・出典）だけを足す。
 * ページは scripts/build-status-guides.mjs が生成するので、ここを変えたら再生成すること。
 */

/* 見出し直下の「最終横断確認」。日付は data/status/*.json の手入力。 */
.guide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.guide-meta-note {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.guide-list {
  display: grid;
  gap: 16px;
}

.guide-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.guide-card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-faint);
}

.guide-card-head h2 {
  margin-bottom: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.3;
}

.guide-card-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.guide-card-body > p {
  margin-bottom: 0;
  line-height: 1.9;
}

/*
 * 「ひとことで」。説明文と上限の補足を置き、その下に図解を1枚だけ中央に出す。
 * 図解のある状態異常は data/status/*.json の illustration に書く（無いガイドでは枠ごと出ない）。
 */
.oneline {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.oneline-text {
  display: grid;
  gap: 10px;
  width: 100%;
}

.oneline-text p { margin-bottom: 0; line-height: 1.9; }

/*
 * 図解は中央の大きめ1枚。読むための図なので縮め過ぎない。
 * 740px までは原寸に近い幅で出し、それより狭い画面では横幅いっぱいまで縮める。
 * img の width / height 属性は原寸のまま残してあり、縦横比はここで height:auto に任せる。
 */
.oneline-figure {
  width: 100%;
  max-width: 740px;
  margin: 0;
}

.oneline-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.key-rule {
  padding: 12px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--accent-faint);
  font-weight: 900;
}

/* 一覧表。6列あるので狭い画面では表だけ横スクロールさせる（本文は折り返す）。 */
.guide-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.guide-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
}

.guide-table th,
.guide-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}

.guide-table thead th {
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.guide-table tbody th {
  font-weight: 900;
  white-space: nowrap;
}

.guide-table tbody tr:last-child th,
.guide-table tbody tr:last-child td { border-bottom: 0; }

/* 付与確率・ダメージ・持続は短い値なので折り返さない（「2ター／ン」を作らない）。
   折り返してよいのは最後の「特徴」だけ。 */
.guide-table td:nth-child(2),
.guide-table td:nth-child(3),
.guide-table td:nth-child(4) { white-space: nowrap; }

/* article型の表（比較表・キャラ表）は短い値ではなく文章が入るので折り返す。
   上の nowrap を打ち消すため、クラスを2つ重ねて具体度を上げてある。 */
.guide-table.guide-table--wrap th,
.guide-table.guide-table--wrap td { white-space: normal; }

.guide-table a { color: var(--accent-strong); font-weight: 900; }

/* 表やリストの下に置く注意書き。 */
.guide-notes {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.guide-notes li { padding-left: 1em; text-indent: -1em; }
.guide-notes li::before { content: "※"; }

/* 「毒を利用するキャラ」。付与／参照／強化の3見出し。 */
.guide-sub {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 900;
}

.guide-links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-links li { line-height: 1.8; }

.guide-links a {
  color: var(--accent-strong);
  font-weight: 900;
}

.guide-link-text {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

/* 関連する効果（結界・劇化など）と出典。 */
.guide-defs {
  display: grid;
  gap: 12px;
  margin: 0;
}

.guide-defs dt {
  color: var(--accent-strong);
  font-weight: 900;
}

.guide-defs dd {
  margin: 4px 0 0;
  line-height: 1.9;
}

.guide-source {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

/* 入口ページ（pages/status/index.html）の一覧。 */
.guide-index {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-index-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.guide-index-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 20px;
}

.guide-index-card span {
  display: block;
  color: var(--ink);
  line-height: 1.8;
}

.guide-index-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* article型の部品。箇条書きと、要点をまとめる囲み。 */
.guide-bullets {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.3em;
  line-height: 1.9;
}

.guide-callout {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--accent-soft);
  border-radius: 8px;
  background: var(--accent-faint);
}

.guide-callout p { margin-bottom: 0; line-height: 1.9; }

.guide-callout-title { font-weight: 900; }

/*
 * 図解スライド。何枚かを同じ場所に重ねて置き、フェードだけで切り替える。
 * 高さは1枚分で、img の width / height 属性で読み込み前から場所を確保する
 * （読み込みで本文が下にずれないため）。
 * JSが動かない環境では1枚目（.is-active）だけが見えて、操作列は出ない。
 */
.guide-slides {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.guide-slides-viewport { display: grid; }

.guide-slide {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  /* 消える側は visibility の切り替えを遅らせて、フェードし終わってから外す。 */
  transition: opacity .4s ease, visibility 0s linear .4s;
}

.guide-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity .4s ease, visibility 0s linear 0s;
}

.guide-slide img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* 静止画1枚の図解（figure）。幅の決め方はスライドと同じ。 */
.guide-figure {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/*
 * 縦長の図解の組（figure の mobile）。横に並べてスワイプで1枚ずつ送る（scroll-snap）。
 * 図は枠いっぱいの幅で出す（文字の多い図を読みやすくするため。2026-10-10 夢爽決定）。
 * 続きがあることは、操作列のドット・「1 / 3」・前後ボタンで伝える。
 * 横長の1枚がある図解では狭い画面だけで出し、無い図解（.is-only）は広い画面でも出す。
 */
.guide-figure-mobile { display: none; }

.guide-figure-mobile.is-only {
  display: block;
  max-width: 480px;
  margin: 0 auto;
}

.guide-series-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.guide-series-track::-webkit-scrollbar { display: none; }

.guide-series-track:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.guide-figure-panel {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
}

.guide-figure-panel a { display: block; }

.guide-figure-panel img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.guide-series-controls button:disabled {
  opacity: .3;
  cursor: default;
}

.guide-series-count {
  min-width: 3.5em;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

.guide-figure-note {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

/* 案内文は広い画面では「‹ ›」、狭い画面では「スワイプ」の言い方にする。 */
.guide-figure-note .is-narrow { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .guide-series-track { scroll-behavior: smooth; }
}

/* 操作列は本文より目立たせない。狭い画面ではドットが次の行へ回る。 */
.guide-slides-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 4px;
  margin-top: 6px;
}

.guide-slides-controls[hidden] { display: none; }

/* 見た目は小さくても、指で押せる44pxのタップ領域は確保する。 */
.guide-slides-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.guide-slides-controls button:hover,
.guide-slides-controls button:focus-visible { color: var(--accent-strong); }

.guide-slides-dots {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
}

/* ドットは見た目8px。今いる位置だけアクセント色にする。 */
.guide-slides-dots button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .35;
}

.guide-slides-dots button[aria-current="true"]::before {
  background: var(--accent-strong);
  opacity: 1;
}

/* 動きを減らす設定のときはフェードしない（自動送り自体も js 側で止めてある）。 */
@media (prefers-reduced-motion: reduce) {
  .guide-slide,
  .guide-slide.is-active { transition: none; }
}

/*
 * 狭い画面では6列の表を横スクロールさせず、1行＝1枚のまとまりに積み直す。
 * 値の前に data-label の見出しを出すので、列見出しを見失わずに読める。
 * 見出し行は読み上げのために残し、目には見せない。
 */
@media (max-width: 560px) {
  .guide-table-wrap { overflow-x: visible; }

  .guide-table {
    display: block;
    min-width: 0;
  }

  .guide-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .guide-table tbody,
  .guide-table tr,
  .guide-table th,
  .guide-table td { display: block; }

  .guide-table tbody tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .guide-table tbody tr:first-child { padding-top: 0; }
  .guide-table tbody tr:last-child { padding-bottom: 0; border-bottom: 0; }

  .guide-table tbody th {
    padding: 0 0 6px;
    border-bottom: 0;
    font-size: 15px;
    white-space: normal;
  }

  .guide-table td,
  .guide-table td:nth-child(2),
  .guide-table td:nth-child(3),
  .guide-table td:nth-child(4) {
    padding: 2px 0;
    border-bottom: 0;
    white-space: normal;
  }

  .guide-table td::before {
    content: attr(data-label) "：";
    color: var(--muted);
    font-weight: 800;
  }

  .guide-table td:empty { display: none; }

  /* 狭い画面では図解をカードの左右いっぱいまで広げる
     （負のマージンは .guide-card-body の padding と同じ16px）。 */
  .guide-slides,
  .guide-figure {
    width: auto;
    max-width: none;
    margin-left: -16px;
    margin-right: -16px;
  }

  .guide-slide img,
  .guide-figure img { border-radius: 0; }

  /* 縦長の図解の組がある図解は、狭い画面では横長の1枚と入れ替える。
     組は左右いっぱいまで広げる（負のマージンは .guide-card-body の padding と同じ16px）。 */
  .guide-figure.has-mobile { display: none; }

  .guide-figure-mobile,
  .guide-figure-mobile.is-only {
    display: block;
    max-width: none;
    margin-left: -16px;
    margin-right: -16px;
  }

  .guide-figure-note { margin: 0 16px; }

  .guide-figure-note .is-wide { display: none; }

  .guide-figure-note .is-narrow { display: inline; }

  /* 枠いっぱいに出すので、角の丸みは付けない（横長の図解と同じ）。 */
  .guide-figure-panel img { border-radius: 0; }
}


/*
 * 状態異常対策キャラ検索（pages/status/countermeasures.html）。
 * 表は既存の guide-table をそのまま使い、狭い画面では1行＝1枚に積み直す。
 */
.cm-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 14px 0 6px;
}

.cm-filters[hidden] { display: none; }

.cm-filter {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 800;
}

.cm-filter select {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 700;
}

.cm-count {
  margin: 10px 0;
  font-weight: 900;
}

.cm-empty {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.cm-empty[hidden] { display: none; }
.cm-empty p { margin: 0 0 8px; }

.cm-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cm-empty-actions button {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.cm-attr {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.cm-table tr[hidden] { display: none; }

/* 「このスキルを見る →」は、積み直したカードの下にだけ出す（広い画面ではスキル名がリンク）。 */
.cm-table .cm-more { display: none; }

@media (max-width: 560px) {
  .cm-filters { grid-template-columns: 1fr; }

  .cm-table td.cm-more {
    display: block;
    padding-top: 8px;
  }

  /* リンクだけの欄なので、見出しの「○○：」は出さない（data-label を持たない）。 */
  .cm-table td.cm-more::before { content: none; }
}
