/* Phase J1 (rev2): カードクイズ画面（純サーバーレンダ）専用スタイル
   /{lang}/quiz/boosters/{setId}/{cardNo}
   - 配色: 背景#f4f6fa / ヘッダ#ffffff / カード#ffffff / アクセント#1d4ed8
   - フォント: M PLUS 1p / Hiragino

   Phase J10: タグ + 類似裁定セクション追加
*/

/* === Phase J10: タグ表示 === */
.cq-qa-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 14px 0 0;
}
.cq-qa-tag {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background 0.15s, transform 0.1s;
}
.cq-qa-tag:hover {
  background: #bfdbfe;
}
.cq-qa-tag:active {
  transform: scale(0.97);
}

/* === Phase J10: 類似裁定セクション === */
.cq-qa-similar {
  margin: 12px 0 0;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  background: #ffffff;
}
.cq-qa-similar > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: 0.04em;
}
.cq-qa-similar > summary::-webkit-details-marker { display: none; }
.cq-qa-similar > summary::before {
  content: '▶';
  display: inline-block;
  font-size: 9px;
  margin-right: 6px;
  transition: transform 0.15s;
}
.cq-qa-similar[open] > summary::before { transform: rotate(90deg); }
.cq-qa-similar > summary:hover { background: #eff6ff; }

.cq-qa-similar-list {
  display: flex;
  flex-direction: column;
  border-top: 1px dashed #d5dae5;
}
.cq-qa-similar-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px dashed #eef1f6;
  color: inherit;
  transition: background 0.15s;
}
.cq-qa-similar-item:last-child { border-bottom: none; }
.cq-qa-similar-item:hover { background: #f4f6fa; }
.cq-qa-similar-card {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 2px 7px;
  border-radius: 4px;
  min-width: 70px;
  text-align: center;
  letter-spacing: 0.03em;
}
.cq-qa-similar-q {
  flex: 1;
  font-size: 12.5px;
  line-height: 1.6;
  color: #171f55;
  word-break: break-word;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.cq-body {
  background: #f4f6fa;
  color: #171f55;
  font-family: 'M PLUS 1p', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Apple SD Gothic Neo', 'PingFang SC', sans-serif;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

.cq-page {
  width: 100%;
  max-width: 500px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 0 100px;
}

/* ===== ヘッダー（サイトタイトル・スティッキー）===== */
.cq-header {
  background: #ffffff;
  border-bottom: 1px solid #eef1f6;
  padding: 14px 20px 12px;
  text-align: center;
}
.cq-site-title {
  font-size: 15px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.05em;
  text-decoration: none;
  display: block;
  padding-bottom: 6px;
}
.cq-back {
  display: inline-block;
  font-size: 11px;
  color: #7a829a;
  text-decoration: none;
  padding: 2px 0;
}
.cq-back:hover { color: #1d4ed8; }

/* ===== カード番号タイトル（前後ナビ含むサブヘッダ）===== */
.cq-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 16px 0;
}
.cq-subhead-center {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #7a829a;
  letter-spacing: 0.03em;
}
.cq-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  background: #ffffff;
  color: #1d4ed8;
  border: 1px solid #d5dae5;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.cq-nav-btn:hover { background: #eef1f6; }
.cq-nav-btn.disabled {
  visibility: hidden;
}

/* ===== カード画像 ===== */
.cq-card-img-wrap {
  padding: 16px 8px 0;
  display: flex;
  justify-content: center;
}
.cq-card-img {
  width: 100%;
  max-width: 480px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #c5cbdc;
  background: #ffffff;
  display: block;
}

/* ===== カードラベル＋設問ブロック ===== */
.cq-q-block {
  padding: 20px 20px 0;
}
.cq-card-label {
  display: inline-block;
  background: #ffffff;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

/* ===== Q&A セクション ===== */
.cq-qas-title {
  font-size: 13px;
  font-weight: 700;
  color: #7a829a;
  letter-spacing: 0.05em;
  padding: 24px 20px 0;
  margin-bottom: -4px;
}
.cq-qa {
  padding: 20px 20px 0;
  scroll-margin-top: 60px;
}
.cq-qa-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cq-qa-no {
  background: #1d4ed8;
  color: #fafbfd;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
}
.cq-qa-id {
  color: #9aa1b3;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cq-qa-question {
  font-size: 15px;
  line-height: 1.75;
  color: #171f55;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 4px;
}

/* ===== 裁定を見る（reveal）ボタン ===== */
.cq-qa-answer {
  margin: 16px 0 0;
}
.cq-qa-answer summary {
  display: block;
  width: 100%;
  background: #1d4ed8;
  border: none;
  border-radius: 12px;
  color: #fafbfd;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  list-style: none;
  user-select: none;
  letter-spacing: 0.03em;
}
.cq-qa-answer summary::-webkit-details-marker { display: none; }
.cq-qa-answer summary:active { opacity: 0.8; }
.cq-qa-answer[open] summary {
  background: #ffffff;
  color: #7a829a;
  font-size: 13px;
  font-weight: 700;
  padding: 10px;
  border: 1px solid #d5dae5;
}

/* ===== 公式裁定（answer 本文）===== */
.cq-qa-answer-body {
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  padding: 16px;
}
.cq-qa-answer-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}
.cq-qa-answer-text {
  font-size: 14px;
  line-height: 1.85;
  color: #171f55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== 次のカードへ進むボタン（Q&A ごと）=====
   Phase J4 (検索ページ) 完成後は、検索コンテキストがある場合に
   JS でこの a 要素の href を「次の検索結果」へ書き換える予定
*/
.cq-qa-next {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px 12px;
  background: #ffffff;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.05em;
}
.cq-qa-next:hover {
  background: #1d4ed8;
  color: #fafbfd;
}
.cq-qa-next:active { opacity: 0.85; }

/* ===== Q&A アクション（ブックマーク／URL コピー）===== */
.cq-qa-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.cq-qa-next + .cq-qa-actions {
  margin-top: 8px;
}

/* === 「裁定を見る」を開くまで、操作ボタン群を非表示にする ===
   <details class="cq-qa-answer"> が [open] になったときだけ、
   兄弟要素の .cq-qa-next（次のカード）と .cq-qa-actions（ブックマーク・URLコピー）を表示する。
   兄弟結合子 ~ は「同じ親の中の後続兄弟要素」にマッチする。
*/
.cq-qa-next,
.cq-qa-actions {
  display: none;
}
.cq-qa-answer[open] ~ .cq-qa-next {
  display: block;
}
.cq-qa-answer[open] ~ .cq-qa-actions {
  display: flex;
}
.cq-qa-actions button {
  flex: 1;
  padding: 10px;
  background: #ffffff;
  color: #171f55;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cq-qa-actions button:hover { background: #eef1f6; }
.cq-bookmark-btn.on {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #1d4ed8;
}

/* ===== 言及カード（質問/回答が他カードを引用しているとき）
       本体のカード画像と同じ大きさ・スタイルで縦に並べる ===== */
.cq-qa-mentioned {
  margin: 16px 0 0;
}
.cq-qa-mentioned-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cq-qa-mentioned-card {
  display: block;
  text-decoration: none;
  color: inherit;
}
.cq-qa-mentioned-card img {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid #c5cbdc;
  background: #ffffff;
}
.cq-qa-mentioned-card:hover img { border-color: #1d4ed8; }
.cq-qa-mentioned-no {
  display: inline-block;
  margin: 8px auto 0;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
}
.cq-qa-mentioned-card { text-align: center; }

.cq-empty {
  margin: 20px;
  background: #ffffff;
  border: 1px dashed #c5cbdc;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: #9aa1b3;
  font-size: 13px;
}

/* ===== 同弾の他カード ===== */
.cq-related {
  padding: 28px 20px 0;
}
.cq-related-title {
  font-size: 13px;
  font-weight: 700;
  color: #7a829a;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.cq-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (min-width: 480px) {
  .cq-related-grid { grid-template-columns: repeat(4, 1fr); }
}
.cq-related-card {
  display: block;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.cq-related-card:hover { border-color: #1d4ed8; }
.cq-related-card img {
  width: 100%;
  display: block;
  background: #ffffff;
}
.cq-related-no {
  padding: 5px 6px;
  font-size: 10px;
  color: #1d4ed8;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* ===== クイックナビ ===== */
.cq-quick-nav {
  display: flex;
  gap: 8px;
  padding: 24px 20px 0;
}
.cq-quick-nav a {
  flex: 1;
  padding: 12px 10px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  color: #171f55;
  text-decoration: none;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}
.cq-quick-nav a:hover {
  background: #eef1f6;
  color: #171f55;
}

/* ===== フッター ===== */
.cq-footer {
  margin-top: 32px;
  padding: 18px 20px 0;
  border-top: 1px solid #eef1f6;
  text-align: center;
  font-size: 11px;
  color: #9aa1b3;
  line-height: 2.0;
}
.cq-footer a {
  color: #1d4ed8;
  text-decoration: none;
  margin: 0 4px;
}
.cq-footer a:hover { text-decoration: underline; }
.cq-footer .sep { color: #c5cbdc; margin: 0 4px; }

/* ===== トースト ===== */
.cq-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(40, 40, 40, 0.95);
  color: #171f55;
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 9999;
}
.cq-toast.show { opacity: 1; }
