/* Phase J2.1: クイズ TOP（メニュー型ランディング）専用スタイル
   /{lang}/quiz および /{lang}/quiz/{learn|general-rule|attention} のスタブ
   - 旧 SPA TOP（quiz-{lang}.js シェル）の置換
   - 配色: 背景#f4f6fa / ヘッダ#ffffff / カード#ffffff / アクセント#1d4ed8
   - フォント: M PLUS 1p / Hiragino
*/

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

body.qt-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%;
}

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

/* ===== ヘッダー（サイトタイトル）===== */
/* sticky は dn-brandbar に譲って解除 */
.qt-header {
  background: #ffffff;
  border-bottom: 1px solid #eef1f6;
  padding: 20px 20px 18px;
  text-align: center;
}
.qt-site-title {
  font-size: 18px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.05em;
  display: block;
  text-decoration: none;
  line-height: 1.4;
}
.qt-site-subtitle {
  font-size: 11px;
  color: #7a829a;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* ===== メニューリスト（TOP）===== */
.qt-menu {
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qt-menu-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.qt-menu-card:hover {
  border-color: #1d4ed8;
  background: #eef1f6;
}
.qt-menu-card:active { opacity: 0.85; }

.qt-menu-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}
.qt-menu-text {
  flex: 1;
  min-width: 0;
}
.qt-menu-title {
  font-size: 16px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.qt-menu-desc {
  font-size: 12px;
  color: #5a6275;
  line-height: 1.5;
  word-break: break-word;
}
.qt-menu-arrow {
  color: #9aa1b3;
  font-size: 18px;
  flex-shrink: 0;
}
.qt-menu-card:hover .qt-menu-arrow { color: #1d4ed8; }

/* ===== Featured（強調）バリアント =====
   ブースター/デッキのQ&A など、最重要メニューを目立たせるためのスタイル */
.qt-menu-card.featured {
  background: linear-gradient(135deg, #171f55 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  padding: 22px 18px;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
  position: relative;
}
.qt-menu-card.featured .qt-menu-title {
  color: #ffffff;
  font-size: 18px;
}
.qt-menu-card.featured .qt-menu-desc {
  color: #dbeafe;
}
.qt-menu-card.featured .qt-menu-arrow {
  color: #ffffff;
  font-size: 22px;
}
.qt-menu-card.featured:hover {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  border-color: #1d4ed8;
}
.qt-menu-card.featured:hover .qt-menu-arrow { color: #ffffff; }
.qt-menu-card.featured .qt-menu-featured-tag {
  position: absolute;
  top: -8px;
  right: 14px;
  background: #ffd60a;
  color: #171f55;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 10px;
  letter-spacing: 0.08em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* ブックマーク件数バッジ（クライアント JS で localStorage から populate）*/
.qt-menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  background: #1d4ed8;
  color: #fafbfd;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-right: 4px;
  flex-shrink: 0;
}
.qt-menu-badge[hidden] { display: none; }

/* ===== フッター（言語切替・privacy）── home の home-footer と同一意匠 ===== */
.qt-footer {
  margin-top: 48px;
  padding: 20px 20px 0;
  border-top: 1px solid #eef1f6;
  text-align: center;
  font-size: 12px;
  color: #9aa1b3;
  line-height: 2.0;
}
.qt-footer a {
  color: #1d4ed8;
  text-decoration: none;
  margin: 0 4px;
}
.qt-footer a:hover { text-decoration: underline; }
.qt-footer .sep { color: #c5cbdc; margin: 0 4px; }
.qt-footer a.recommended { color: #1d4ed8; font-weight: bold; }
.qt-footer .copyright { display: block; margin-top: 8px; color: #9aa1b3; }

/* ===== スタブページ（準備中表示）===== */
.qt-stub {
  padding: 60px 20px 40px;
  text-align: center;
}
.qt-stub-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.qt-stub-title {
  font-size: 20px;
  font-weight: 800;
  color: #1d4ed8;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}
.qt-stub-message {
  font-size: 14px;
  color: #5a6275;
  line-height: 1.8;
  margin-bottom: 32px;
}
.qt-stub-back {
  display: inline-block;
  padding: 12px 28px;
  background: #ffffff;
  border: 1px solid #1d4ed8;
  border-radius: 10px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.05em;
}
.qt-stub-back:hover {
  background: #1d4ed8;
  color: #fafbfd;
}

/* ===== Phase J2.2: 基本ルールを学ぶページ（/quiz/learn 本実装）===== */
.qt-learn {
  padding: 16px 14px 24px;
}

/* 目次（カテゴリへのジャンプリンク）*/
.qt-learn-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  margin-bottom: 24px;
}
.qt-learn-toc-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #c5cbdc;
  border-radius: 8px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.qt-learn-toc-item:hover {
  border-color: #1d4ed8;
  background: #dbeafe;
}
.qt-learn-toc-item .cnt {
  color: #7a829a;
  font-size: 10px;
  font-weight: 600;
}

/* カテゴリセクション */
.qt-learn-section {
  margin-bottom: 28px;
  scroll-margin-top: 70px; /* sticky ヘッダーぶん上に余白 */
}
.qt-learn-cat-title {
  font-size: 16px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  background: #dbeafe;
  border-left: 4px solid #1d4ed8;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.qt-learn-cat-title .cnt {
  font-size: 11px;
  color: #5a6275;
  font-weight: 600;
}

/* 各 Q&A（details）*/
.qt-learn-qa {
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  scroll-margin-top: 70px;
}
.qt-learn-qa[open] {
  border-color: #1d4ed866;
  background: #f0fafe;
}
.qt-learn-qa > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.1s;
}
.qt-learn-qa > summary::-webkit-details-marker { display: none; }
.qt-learn-qa > summary::before {
  content: '▶';
  color: #1d4ed8;
  font-size: 9px;
  margin-right: 6px;
  display: inline-block;
  transition: transform 0.15s;
}
.qt-learn-qa[open] > summary::before { transform: rotate(90deg); }
.qt-learn-qa > summary:hover { background: #ffffff; }
.qa-card {
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.qa-q {
  font-size: 14px;
  color: #171f55;
  line-height: 1.5;
  font-weight: 500;
  word-break: break-word;
}
.qa-answer {
  padding: 12px 14px 14px 28px;
  font-size: 13px;
  line-height: 1.7;
  color: #171f55;
  border-top: 1px dashed #c5cbdc;
  background: #f4f6fa;
  word-break: break-word;
}

/* ===== Phase J2.3: 総合ルール（/quiz/general-rule）===== */
.qt-gr {
  padding: 16px 14px 24px;
}

/* インデックス（章カードグリッド）*/
.qt-gr-intro {
  font-size: 12px;
  color: #5a6275;
  line-height: 1.7;
  padding: 12px 14px;
  background: #f4f6fa;
  border-left: 3px solid #1d4ed8;
  border-radius: 4px;
  margin-bottom: 18px;
}
.qt-gr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.qt-gr-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  min-height: 64px;
  transition: border-color 0.15s, background 0.15s;
}
.qt-gr-card:hover { border-color: #1d4ed8; background: #eef1f6; }
.qt-gr-card-num {
  font-size: 10px;
  color: #7a829a;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.qt-gr-card-title {
  font-size: 13px;
  color: #1d4ed8;
  font-weight: 800;
  line-height: 1.35;
}
.qt-gr-card-cnt {
  font-size: 10px;
  color: #5a6275;
  margin-top: auto;
}

/* 章ページ（コンテンツ）*/
.qt-gr-chapter-head {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #dbeafe;
  border-left: 4px solid #1d4ed8;
}
.qt-gr-chapter-head .num {
  font-size: 11px;
  color: #5a6275;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.qt-gr-chapter-head .title {
  font-size: 18px;
  font-weight: 800;
  color: #1d4ed8;
  margin-top: 2px;
}

/* 項目（id 付き）*/
.qt-gr-item {
  padding: 8px 0;
  border-bottom: 1px dashed #e3e7ee;
  scroll-margin-top: 70px;
}
.qt-gr-item .id {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #7a829a;
  padding: 2px 6px;
  background: #ffffff;
  border: 1px solid #eef1f6;
  border-radius: 4px;
  margin-right: 8px;
  letter-spacing: 0.04em;
}
.qt-gr-item .body {
  display: inline;
  font-size: 13px;
  line-height: 1.75;
  color: #171f55;
  word-break: break-word;
}
.qt-gr-item.d1 { padding-left: 0; }
.qt-gr-item.d1 .body { color: #171f55; font-weight: 600; }
.qt-gr-item.d2 { padding-left: 14px; }
.qt-gr-item.d3 { padding-left: 28px; }
.qt-gr-item.d4 { padding-left: 42px; }
.qt-gr-item.d5 { padding-left: 56px; }
.qt-gr-item.d6 { padding-left: 70px; }
.qt-gr-item.d7 { padding-left: 84px; }
.qt-gr-item:target {
  background: #dbeafe;
  border-left: 3px solid #1d4ed8;
  padding-left: 8px;
}

/* 前後章ナビ */
.qt-gr-pn {
  display: flex;
  gap: 8px;
  margin: 24px 0 16px;
}
.qt-gr-pn a, .qt-gr-pn span.disabled {
  flex: 1;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  color: #1d4ed8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.qt-gr-pn span.disabled { color: #b5bbcb; border-color: #ffffff; }
.qt-gr-pn a:hover { border-color: #1d4ed8; background: #dbeafe; }

/* ===== ブックマーク一覧（/quiz/bookmarks）===== */
.qt-bm {
  padding: 16px 14px 24px;
}
.qt-bm-stat {
  text-align: center;
  font-size: 12px;
  color: #5a6275;
  margin-bottom: 12px;
}
.qt-bm-stat .num {
  color: #1d4ed8;
  font-weight: 800;
  font-size: 14px;
}
.qt-bm-search {
  margin-bottom: 16px;
}
.qt-bm-search input {
  width: 100%;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  color: #171f55;
  font-size: 16px; /* iOS Safari でフォーカス時の自動拡大を防ぐため 16px 必須 */
  box-sizing: border-box;
  -webkit-appearance: none;
}
.qt-bm-search input:focus {
  outline: none;
  border-color: #1d4ed8;
}
.qt-bm-search input::placeholder { color: #9aa1b3; }

.qt-bm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 600px) {
  .qt-bm-grid { grid-template-columns: repeat(2, 1fr); }
}

.qt-bm-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.15s, background 0.15s;
}
.qt-bm-card:hover {
  border-color: #1d4ed8;
  background: #eef1f6;
}
.qt-bm-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.qt-bm-card-no {
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.qt-bm-card-qnum {
  font-size: 10px;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #a8e0f5;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}
.qt-bm-card-name {
  font-size: 12px;
  color: #5a6275;
  margin-bottom: 4px;
}
.qt-bm-card-q {
  font-size: 13px;
  color: #171f55;
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.qt-bm-empty {
  text-align: center;
  padding: 48px 16px;
  color: #7a829a;
  font-size: 13px;
  line-height: 1.8;
}
.qt-bm-empty a { color: #1d4ed8; text-decoration: none; }
.qt-bm-empty a:hover { text-decoration: underline; }

.qt-bm-loading {
  text-align: center;
  padding: 24px 16px;
  color: #9aa1b3;
  font-size: 12px;
}

/* ===== Phase J4: 検索ページ（/quiz/search）===== */
.qt-sr {
  padding: 16px 14px 24px;
}
.qt-sr-form {
  margin-bottom: 16px;
}
.qt-sr-input-wrap {
  position: relative;
}
.qt-sr-input {
  width: 100%;
  padding: 12px 44px 12px 14px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  color: #171f55;
  font-size: 16px; /* iOS Safari でフォーカス時の自動拡大を防ぐため 16px 必須 */
  box-sizing: border-box;
  -webkit-appearance: none;
}
.qt-sr-input:focus { outline: none; border-color: #1d4ed8; }
.qt-sr-input::placeholder { color: #9aa1b3; }
.qt-sr-submit {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: #1d4ed8;
  font-size: 18px;
  padding: 8px 10px;
  cursor: pointer;
}
.qt-sr-submit:hover { color: #171f55; }

.qt-sr-stat {
  font-size: 12px;
  color: #5a6275;
  text-align: center;
  margin-bottom: 14px;
}
.qt-sr-stat strong { color: #1d4ed8; font-weight: 800; }
.qt-sr-stat .breakdown { color: #1d4ed8; margin-left: 6px; }

.qt-sr-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  background: #dbeafe;
  border-left: 3px solid #1d4ed8;
  margin: 18px 0 10px;
}
.qt-sr-section-title .badge {
  display: inline-block;
  background: #1d4ed8;
  color: #fafbfd;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: 1px;
}

.qt-sr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.qt-sr-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color 0.15s, background 0.15s;
}
.qt-sr-card:hover {
  border-color: #1d4ed8;
  background: #dbeafe;
}
.qt-sr-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.qt-sr-card-typebadge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 0.04em;
}
.qt-sr-card-typebadge.rule { background: #e3f3fb; color: #1d4ed8; border: 1px solid #a8e0f5; }
.qt-sr-card-typebadge.quiz { background: #e3f3fb; color: #1d4ed8; border: 1px solid #4a3010; }
.qt-sr-card-no {
  font-size: 11px;
  color: #1d4ed8;
  font-weight: 700;
}
.qt-sr-card-cat {
  font-size: 10px;
  color: #5a6275;
  background: #ffffff;
  padding: 1px 6px;
  border-radius: 6px;
}
.qt-sr-card-qnum {
  font-size: 10px;
  color: #7a829a;
  font-weight: 600;
  background: #f4f6fa;
  border: 1px solid #eef1f6;
  padding: 1px 6px;
  border-radius: 6px;
}
.qt-sr-card-q {
  font-size: 13px;
  color: #171f55;
  line-height: 1.55;
  margin-bottom: 4px;
  word-break: break-word;
}
.qt-sr-card-a {
  font-size: 12px;
  color: #5a6275;
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.qt-sr-empty {
  text-align: center;
  padding: 36px 16px;
  color: #7a829a;
  font-size: 13px;
  line-height: 1.8;
}
.qt-sr-empty .hint {
  font-size: 11px;
  color: #9aa1b3;
  margin-top: 12px;
}
.qt-sr-empty a { color: #1d4ed8; text-decoration: none; }
.qt-sr-empty a:hover { text-decoration: underline; }

.qt-sr-truncated {
  text-align: center;
  font-size: 11px;
  color: #7a829a;
  margin-top: 14px;
  padding: 10px;
  background: #f4f6fa;
  border-radius: 6px;
}

/* ===== Phase J5: キーワード辞書（/quiz/keywords）===== */
.qt-kw {
  padding: 16px 14px 24px;
}
.qt-kw-stat {
  text-align: center;
  font-size: 12px;
  color: #5a6275;
  margin-bottom: 14px;
}
.qt-kw-stat strong { color: #1d4ed8; font-weight: 800; }

/* 種別フィルタチップ */
.qt-kw-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 10px;
  margin-bottom: 18px;
}
.qt-kw-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #c5cbdc;
  border-radius: 18px;
  color: #171f55;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s;
}
.qt-kw-type:hover { border-color: #1d4ed8; color: #1d4ed8; }
.qt-kw-type.active {
  background: #1d4ed8;
  color: #fafbfd;
  border-color: #1d4ed8;
}
.qt-kw-type .cnt {
  background: rgba(0,0,0,0.25);
  color: inherit;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
}
.qt-kw-type:not(.active) .cnt {
  background: #f4f6fa;
  color: #7a829a;
}

/* キーワード項目（details）*/
.qt-kw-item {
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  scroll-margin-top: 70px;
}
.qt-kw-item[open] {
  border-color: #1d4ed866;
  background: #f0fafe;
}
.qt-kw-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  transition: background 0.1s;
}
.qt-kw-item > summary::-webkit-details-marker { display: none; }
.qt-kw-item > summary::before {
  content: '▶';
  color: #1d4ed8;
  font-size: 9px;
  display: inline-block;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.qt-kw-item[open] > summary::before { transform: rotate(90deg); }
.qt-kw-item > summary:hover { background: #ffffff; }

.qt-kw-name {
  font-size: 15px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.02em;
}
.qt-kw-typebadge {
  display: inline-block;
  padding: 2px 8px;
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #a8e0f5;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: inherit;
  cursor: default;
}

/* Phase J10: シチュエーション逆引きページ用スタイル */
.qt-sit-item {
  display: block;
  padding: 12px 16px;
  margin: 0 16px 8px;
  background: #ffffff;
  border: 1px solid #d5dae5;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.qt-sit-item:hover { border-color: #1d4ed8; background: #eff6ff; }
.qt-sit-card {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.qt-sit-q {
  font-size: 13px;
  line-height: 1.7;
  color: #171f55;
  word-break: break-word;
  margin-bottom: 6px;
}
.qt-sit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 4px;
}
.qt-sit-tag {
  display: inline-block;
  font-size: 10px;
  color: #5a6275;
  background: #f4f6fa;
  border: 1px solid #d5dae5;
  padding: 1px 6px;
  border-radius: 8px;
}
.qt-sit-tag.muted { color: #9aa1b3; }
button.qt-kw-typebadge {
  /* button タグ既定スタイルの除去 */
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.qt-kw-typebadge.clickable {
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.qt-kw-typebadge.clickable::after {
  content: ' ▼';
  font-size: 8px;
  opacity: 0.7;
}
.qt-kw-typebadge.clickable.open::after {
  content: ' ▲';
}
.qt-kw-typebadge.clickable:hover {
  background: #bfdbfe;
}

/* type バッジクリックで開く 総合ルール条文ボックス */
.qt-kw-typerule {
  margin: 8px 14px 0;
  padding: 12px 14px;
  background: #eff6ff;
  border: 1px solid #1d4ed8;
  border-left-width: 3px;
  border-radius: 6px;
}
.qt-kw-typerule-section {
  font-size: 11px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.qt-kw-typerule-text {
  margin: 0;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.75;
  color: #171f55;
  white-space: pre-wrap;
  word-break: break-word;
}
.qt-kw-short {
  flex: 1 0 100%;
  font-size: 12px;
  color: #5a6275;
  line-height: 1.55;
  margin-top: 4px;
  word-break: break-word;
}

.qt-kw-detail {
  padding: 12px 14px 14px;
  border-top: 1px dashed #c5cbdc;
  background: #f4f6fa;
}
.qt-kw-detail-text {
  font-size: 12.5px;
  line-height: 1.75;
  color: #171f55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: inherit;
}
.qt-kw-caution {
  margin-top: 10px;
  padding: 10px 12px;
  background: #2a1500;
  border-left: 3px solid #1d4ed8;
  border-radius: 4px;
  font-size: 12px;
  color: #1a3340;
  line-height: 1.6;
}
.qt-kw-caution::before {
  content: '⚠️ ';
  margin-right: 4px;
}

/* ===== Phase J8: キーワードポップアップ（≪Name≫ 即時参照）===== */
.kw-pop {
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  transition: background 0.15s;
  border-radius: 2px;
  padding: 0 1px;
}
.kw-pop:hover, .kw-pop:focus {
  background: rgba(245, 158, 11, 0.18);
  color: #1e3a8a;
  outline: none;
}

.kw-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
  animation: kwFadeIn 0.15s ease-out;
}
.kw-popup-overlay[hidden] { display: none; }
@keyframes kwFadeIn { from { opacity: 0; } to { opacity: 1; } }

.kw-popup {
  position: relative;
  background: #ffffff;
  border: 2px solid #1d4ed8;
  border-radius: 12px;
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: kwSlideIn 0.2s ease-out;
}
@keyframes kwSlideIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.kw-popup-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  color: #7a829a;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
}
.kw-popup-close:hover { color: #171f55; background: #d5dae5; }

.kw-popup-name {
  font-size: 18px;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  word-break: break-word;
  padding-right: 30px;
}
.kw-popup-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #a8e0f5;
  border-radius: 6px;
  padding: 2px 8px;
  margin-bottom: 10px;
}
.kw-popup-short {
  font-size: 13px;
  color: #171f55;
  line-height: 1.7;
  margin-bottom: 14px;
  word-break: break-word;
}
.kw-popup-link {
  display: inline-block;
  padding: 8px 14px;
  background: #dbeafe;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s;
}
.kw-popup-link:hover {
  background: #1d4ed8;
  color: #fafbfd;
}
