/* ============================================================
   競馬用語集（/glossary, /glossary/{slug}）専用スタイル
   ============================================================ */

/* ---------- Hero ----------
   他ページ（col-hero / ct-hero / rl-hero）と同じく app-fixed-header 直下に
   配置し、`app-scroll-area` の top padding (16px) を行間に使う。
   `margin-bottom` は持たない。下にアクセント線を入れて他ページと統一する。 */
.gl-hero {
  background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 60%, #2A4D75 100%);
  color: #fff;
  padding: 22px 20px 20px;
  border-bottom: 2px solid var(--app-accent);
  position: relative;
  overflow: hidden;
}
.gl-hero::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(196, 163, 90, 0.18), transparent 70%);
  pointer-events: none;
}
.gl-hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  background: rgba(196, 163, 90, 0.22);
  color: #F1D89A;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  font-weight: 600;
}
.gl-hero-title {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
.gl-hero-br {
  display: none;
}
.gl-hero-sub {
  font-size: 1.05rem;
  color: #F1D89A;
  margin: 0 0 16px;
  font-weight: 600;
}
.gl-hero-sub strong {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 4px;
}
.gl-hero-lead {
  font-size: 0.95rem;
  line-height: 1.85;
  color: #DCE3EE;
  margin: 0 0 18px;
  max-width: 780px;
}
.gl-hero-lead strong {
  color: #fff;
  font-weight: 700;
}
.gl-hero-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #C9D2E0;
}
.gl-hero-meta-dot {
  color: #6E8AB0;
}
.gl-hero-meta-item {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .gl-hero {
    padding: 18px 16px 16px;
  }
  .gl-hero-title {
    font-size: 1.4rem;
  }
  .gl-hero-br {
    display: inline;
  }
  .gl-hero-sub strong {
    font-size: 1.3rem;
  }
  .gl-hero-lead {
    font-size: 0.9rem;
    line-height: 1.75;
  }
}

/* ---------- TOC（目次） ---------- */
.gl-toc {
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  box-shadow: var(--app-panel-shadow);
  padding: 18px 20px 16px;
  margin-bottom: 22px;
}
.gl-toc-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-accent-dark);
  margin: 0 0 12px;
  letter-spacing: 0.04em;
}
.gl-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}
.gl-toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #F7F8FB;
  border: 1px solid #E5E9F0;
  text-decoration: none;
  color: var(--app-text);
  transition: background 0.15s, border-color 0.15s;
}
.gl-toc-item:hover {
  background: #EEF2F8;
  border-color: var(--app-accent-dark);
  color: var(--app-accent-dark);
}
.gl-toc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--app-accent-dark);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.gl-toc-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.gl-toc-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--app-accent-dark);
}
.gl-toc-count {
  font-size: 0.7rem;
  color: var(--app-subtle);
  margin-top: 2px;
}

/* ---------- カテゴリセクション ---------- */
/* カテゴリ別セクションを 2 列で配置 (= 1 行に 2 セクション)。 高さ差は許容 (align-items:start)。 */
.gl-sections {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  align-items: start;
}
.gl-section {
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  box-shadow: var(--app-panel-shadow);
  padding: 22px 22px 20px;
  scroll-margin-top: 88px;
}
.gl-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--app-accent);
}
.gl-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--app-accent-dark), #2A4D75);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  flex-shrink: 0;
}
.gl-section-titles {
  flex: 1;
  min-width: 0;
}
.gl-section-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 0 0 3px;
  letter-spacing: 0.01em;
}
.gl-section-desc {
  font-size: 0.83rem;
  color: var(--app-subtle);
  margin: 0;
  line-height: 1.5;
}
.gl-section-count-badge {
  background: #F0E5C8;
  color: #6B5223;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  flex-shrink: 0;
}

/* ---------- 用語カードグリッド ---------- */
.gl-term-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
/* 各 <li> セルを flex コンテナにし、内部の <a> を flex: 1 で
   セルいっぱいに広げる。これにより同行のカードが
   最も背の高いカードに揃う（短いカードに余白が生まれる）。 */
.gl-term-grid > li {
  display: flex;
}
.gl-term-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  /* セクション内の全カードを同じ高さに揃える。値は短い説明文を持つ
     カードと、3行に折り返す最長カードの両方を収められるサイズで決定。 */
  min-height: 132px;
  background: #FAFBFD;
  border: 1px solid #E5E9F0;
  padding: 14px 36px 14px 16px;
  text-decoration: none;
  color: var(--app-text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.gl-term-card:hover {
  background: #fff;
  border-color: var(--app-accent-dark);
  color: var(--app-text);
}
.gl-term-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.gl-term-card-name {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  letter-spacing: 0.01em;
}
.gl-term-card-reading {
  font-size: 0.75rem;
  color: var(--app-subtle);
  font-weight: 500;
}
.gl-term-card-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #4A5568;
  margin: 0;
}
.gl-term-card-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  color: var(--app-accent);
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 768px) {
  /* モバイルはセクションを 1 列に縦積み */
  .gl-sections {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .gl-section {
    padding: 18px 16px 16px;
  }
  .gl-section-header {
    gap: 10px;
  }
  .gl-section-num {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
  .gl-section-title {
    font-size: 1.05rem;
  }
  .gl-section-desc {
    font-size: 0.78rem;
  }
  .gl-term-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .gl-term-card {
    padding: 12px 30px 12px 14px;
  }
}

/* ---------- 完読 CTA カード ---------- */
.gl-finish-card {
  background: linear-gradient(135deg, #1A6B5A 0%, #258073 50%, #2E9784 100%);
  color: #fff;
  padding: 30px 24px 28px;
  margin-bottom: 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.gl-finish-card::before {
  content: "";
  position: absolute;
  bottom: -50px;
  left: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent 70%);
  pointer-events: none;
}
.gl-finish-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
  line-height: 1;
}
.gl-finish-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}
.gl-finish-text {
  font-size: 0.92rem;
  line-height: 1.8;
  color: #DBF1EC;
  max-width: 640px;
  margin: 0 auto 20px;
}
.gl-finish-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.gl-finish-btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.gl-finish-btn-primary {
  background: #fff;
  color: #1A6B5A;
}
.gl-finish-btn-primary:hover {
  background: #F1D89A;
  color: #6B5223;
}
.gl-finish-btn-primary:focus-visible {
  outline: 2px solid #F1D89A;
  outline-offset: 3px;
}
.gl-finish-btn-secondary {
  background: transparent;
  color: #fff;
  border-color: #fff;
}
.gl-finish-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: #fff;
}
.gl-finish-btn-secondary:focus-visible {
  outline: 2px solid #F1D89A;
  outline-offset: 3px;
  background: rgba(255, 255, 255, 0.16);
}

@media (max-width: 768px) {
  .gl-finish-card {
    padding: 26px 18px 22px;
  }
  .gl-finish-title {
    font-size: 1.15rem;
  }
  .gl-finish-text {
    font-size: 0.86rem;
  }
  .gl-finish-btn {
    padding: 10px 20px;
    font-size: 0.88rem;
    flex: 1 1 auto;
    min-width: 130px;
    text-align: center;
  }
}

/* ============================================================
   詳細ページ /glossary/{slug}
   ============================================================ */

.gl-detail {
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  box-shadow: var(--app-panel-shadow);
  margin-bottom: 16px;
}

.gl-detail-header {
  background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 100%);
  color: #fff;
  padding: 28px 24px 24px;
  position: relative;
  overflow: hidden;
}
.gl-detail-header::before {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(196, 163, 90, 0.18), transparent 70%);
  pointer-events: none;
}
.gl-detail-cat-badge {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: rgba(196, 163, 90, 0.22);
  color: #F1D89A;
  padding: 4px 14px;
  border-radius: 999px;
  text-decoration: none;
  margin-bottom: 12px;
  font-weight: 600;
  transition: background 0.15s;
}
.gl-detail-cat-badge:hover {
  background: rgba(196, 163, 90, 0.35);
  color: #F1D89A;
}
.gl-detail-term {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.gl-detail-reading {
  font-size: 0.92rem;
  color: #C9D2E0;
  margin: 0 0 16px;
  font-weight: 500;
}
.gl-detail-summary {
  font-size: 1rem;
  line-height: 1.7;
  color: #DCE3EE;
  margin: 0;
  font-weight: 500;
  max-width: 700px;
}

.gl-detail-section {
  padding: 22px 24px 20px;
  border-bottom: 1px solid #EDEFF3;
}
.gl-detail-h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}
.gl-detail-h2-mark {
  font-size: 1.1rem;
  line-height: 1;
}
.gl-detail-body {
  font-size: 0.96rem;
  line-height: 1.95;
  color: #2D3436;
  margin: 0;
}

.gl-detail-tips {
  margin: 20px 24px 0;
  padding: 18px 20px 16px;
  background: linear-gradient(135deg, #FFFAEC, #FFF6E0);
  border-left: 4px solid var(--app-accent);
}
.gl-detail-tips-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #6B5223;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gl-detail-tips-mark {
  font-size: 1rem;
  line-height: 1;
}
.gl-detail-tips-body {
  font-size: 0.9rem;
  line-height: 1.8;
  color: #4D3E1F;
  margin: 0;
}

.gl-detail-example {
  margin: 16px 24px 20px;
  padding: 16px 18px 14px;
  background: #F0F6F4;
  border-left: 4px solid var(--app-accent-teal);
}
.gl-detail-example-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #14564A;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gl-detail-example-mark {
  font-size: 0.8rem;
  color: var(--app-accent-teal);
  line-height: 1;
}
.gl-detail-example-body {
  font-size: 0.88rem;
  line-height: 1.75;
  color: #1F4D43;
  margin: 0;
  font-family: "SFMono-Regular", "Consolas", "Menlo", monospace, "Noto Sans JP";
}

.gl-detail-related {
  padding: 22px 24px 22px;
  background: #F7F9FC;
}
/* <article> 外に置いた関連用語に独立したカードスタイルを与える */
.gl-detail-related-card {
  border: 1px solid var(--app-panel-border);
  box-shadow: var(--app-panel-shadow);
}

/* 関連用語 + 右サイド広告のグリッド。モバイルは縦並び、PCは横並び */
.gl-detail-bottom-grid {
  margin-bottom: 16px;
}
.gl-detail-bottom-grid > .gl-detail-related-card {
  margin-bottom: 16px;
}
.gl-detail-ad-aside {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
/* aside 配置時は affiliate-slot 既定の上下マージン (base.css: margin:16px auto) を打ち消し、
   関連用語ボックスの上端と広告の上端を揃える */
.gl-detail-ad-aside .affiliate-slot {
  margin: 0 auto;
}
.gl-detail-ad-only {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

/* モバイル幅では用語集の 300x250 広告を非表示にする
   （モバイル下部固定バナー _affiliate_sticky_bottom.html に集約するため）。
   PC では従来通り表示。 */
@media (max-width: 768px) {
  .gl-detail-ad-aside,
  .gl-detail-ad-only { display: none; }
}

@media (min-width: 769px) {
  .gl-detail-bottom-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
  }
  /* 広告非表示モード時は1列レイアウト（関連用語が幅いっぱいに広がる） */
  .gl-detail-bottom-grid--no-ad {
    grid-template-columns: minmax(0, 1fr);
  }
  .gl-detail-bottom-grid > .gl-detail-related-card {
    margin-bottom: 0;
  }
  .gl-detail-ad-aside {
    justify-content: flex-end;
  }
}
.gl-detail-related-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 0 0 12px;
  letter-spacing: 0.01em;
}
.gl-detail-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}
/* 用語カードと同様に、関連用語のカードも同行で高さを揃える。 */
.gl-detail-related-list > li {
  display: flex;
}
.gl-detail-related-item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  /* 関連用語のカードも全項目同じ高さに揃える。 */
  min-height: 92px;
  background: #fff;
  border: 1px solid #E5E9F0;
  padding: 12px 30px 12px 14px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.gl-detail-related-item:hover {
  background: #FAFBFD;
  border-color: var(--app-accent-dark);
}
.gl-detail-related-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin-bottom: 2px;
}
.gl-detail-related-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--app-subtle);
  line-height: 1.5;
}
.gl-detail-related-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--app-accent);
}

/* 詳細ページ下のナビゲーション */
.gl-detail-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.gl-detail-nav-back,
.gl-detail-nav-next {
  flex: 1 1 auto;
  text-align: center;
  padding: 12px 18px;
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--app-accent-dark);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-width: 160px;
}
.gl-detail-nav-back:hover,
.gl-detail-nav-next:hover {
  background: #F7F9FC;
  border-color: var(--app-accent-dark);
  color: var(--app-accent-dark);
}
.gl-detail-nav-next {
  background: var(--app-accent-dark);
  color: #fff;
  border-color: var(--app-accent-dark);
}
.gl-detail-nav-next:hover {
  background: #1E3B5E;
  color: #fff;
  border-color: #1E3B5E;
}

@media (max-width: 768px) {
  .gl-detail-header {
    padding: 24px 18px 20px;
  }
  .gl-detail-term {
    font-size: 1.6rem;
  }
  .gl-detail-summary {
    font-size: 0.92rem;
  }
  .gl-detail-section {
    padding: 18px 18px 16px;
  }
  .gl-detail-body {
    font-size: 0.92rem;
    line-height: 1.85;
  }
  .gl-detail-tips,
  .gl-detail-example {
    margin-left: 18px;
    margin-right: 18px;
  }
  .gl-detail-related {
    padding: 18px;
  }
  .gl-detail-related-list {
    grid-template-columns: 1fr;
  }
  .gl-detail-nav-back,
  .gl-detail-nav-next {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* ============================================================================
   用語集一覧 リデザイン: フラッシュカード + 検索 + カテゴリタブ (g3x)
   .gl-rd 配下にスコープ。 詳細ページの .gl-detail-* とは独立。
   ============================================================================ */
.gl-rd {
  --navy: #152E4A;
  --gold: #C4A35A;
  --gold-d: #A9854A;
  --panel: var(--app-panel-bg);
  --border: var(--app-panel-border);
  --subtle: var(--app-subtle);
  --display: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  --shadow: 0 8px 22px rgba(139, 116, 73, 0.07);
  --shadow-h: 0 16px 38px rgba(21, 46, 74, 0.15);
  color: var(--app-text);
}
.gl-rd a { color: inherit; text-decoration: none; }

/* ----- Hero + 検索 ----- */
.gl-rd .g3x-hero { text-align: center; padding: 26px 0; }
.gl-rd .g3x-eyebrow { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.14em; color: var(--gold-d); margin-bottom: 14px; }
.gl-rd .g3x-title { font-family: var(--display); font-size: 2.6rem; font-weight: 900; color: var(--navy); line-height: 1.3; margin: 0 0 16px; }
.gl-rd .g3x-sub { font-size: 1.02rem; color: var(--subtle); margin: 0; }
.gl-rd .g3x-sub b { color: var(--gold-d); font-family: var(--display); font-size: 1.4rem; }

.gl-rd .g3x-searchwrap { display: flex; align-items: center; gap: 14px; max-width: 680px; margin: 24px auto 0; }
.gl-rd .g3x-search { flex: 1; position: relative; }
.gl-rd .g3x-search input {
  width: 100%; padding: 14px 44px 14px 46px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 1rem; font-family: inherit; background: var(--panel); color: var(--app-text);
  box-shadow: var(--shadow); transition: .15s;
}
.gl-rd .g3x-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(196, 163, 90, 0.12); }
.gl-rd .g3x-search .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 1.05rem; color: var(--subtle); pointer-events: none; }
.gl-rd .g3x-search .clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: none; border-radius: 50%; background: #e8ebf0; color: var(--subtle); font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s; }
.gl-rd .g3x-search .clear:hover { background: var(--navy); color: #fff; }
.gl-rd .g3x-count { font-size: 0.9rem; color: var(--subtle); white-space: nowrap; }
.gl-rd .g3x-count b { color: var(--navy); font-family: var(--display); font-size: 1.2rem; }

/* ----- カテゴリタブ ----- */
.gl-rd .g3x-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 22px 0 38px; }
.gl-rd .g3x-tab { display: inline-flex; align-items: center; gap: 9px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--panel); font-size: 0.9rem; font-weight: 700; color: var(--subtle); cursor: pointer; font-family: inherit; transition: .15s; }
.gl-rd .g3x-tab:hover { border-color: var(--cat-h, var(--navy)); color: var(--navy); }
.gl-rd .g3x-tab.on { color: #fff; }
.gl-rd .g3x-tab .em { font-size: 0.98rem; }
.gl-rd .g3x-tab .cnt { font-size: 0.74rem; font-weight: 800; opacity: 0.85; }

/* ----- セクション + カード ----- */
.gl-rd .g3x-section { margin-bottom: 40px; scroll-margin-top: 80px; }
.gl-rd .g3x-shead { text-align: center; margin-bottom: 22px; }
.gl-rd .g3x-semoji { font-size: 2.1rem; }
.gl-rd .g3x-stitle { font-family: var(--display); font-size: 1.6rem; font-weight: 900; color: var(--navy); margin: 6px 0; }
.gl-rd .g3x-sdesc { font-size: 0.9rem; color: var(--subtle); max-width: 620px; margin: 0 auto; }
.gl-rd .g3x-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.gl-rd .g3x-card { position: relative; display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 24px 20px; text-align: center; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; overflow: hidden; }
.gl-rd .g3x-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--cat); }
.gl-rd .g3x-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-h); }
.gl-rd .g3x-card-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 10px; border-radius: 999px; background: color-mix(in srgb, var(--cat) 12%, #fff); color: var(--cat); font-size: 0.72rem; font-weight: 800; margin-bottom: 12px; }
.gl-rd .g3x-card-name { font-family: var(--display); font-size: 1.4rem; font-weight: 900; color: var(--navy); line-height: 1.25; }
.gl-rd .g3x-card-reading { font-size: 0.78rem; color: var(--subtle); margin-top: 6px; }
.gl-rd .g3x-card-divider { width: 30px; height: 2px; background: var(--cat); margin: 13px auto; opacity: 0.5; }
.gl-rd .g3x-card-desc { font-size: 0.84rem; line-height: 1.7; color: var(--subtle); margin: 0; }
.gl-rd .g3x-card mark { background: rgba(196, 163, 90, 0.32); color: inherit; border-radius: 2px; padding: 0 1px; }
.gl-rd .g3x-card[hidden], .gl-rd .g3x-section[hidden] { display: none !important; }

/* ----- 0 件 ----- */
.gl-rd .g3x-empty { text-align: center; padding: 56px 20px; color: var(--subtle); }
.gl-rd .g3x-empty .em { font-size: 2.6rem; }
.gl-rd .g3x-empty p { margin-top: 12px; font-size: 1.05rem; }
.gl-rd .g3x-empty .reset { margin-top: 18px; display: inline-flex; padding: 11px 24px; border-radius: 6px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy); font-weight: 800; font-size: 0.9rem; cursor: pointer; font-family: inherit; transition: .15s; }
.gl-rd .g3x-empty .reset:hover { background: var(--navy); color: #fff; }

/* ----- 読了 CTA ----- */
.gl-rd .gl-finish { margin-top: 50px; border-radius: 8px; overflow: hidden; position: relative; background: linear-gradient(135deg, #152E4A, #1E3B5E); padding: 46px 40px; text-align: center; }
.gl-rd .gl-finish::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-d)); }
.gl-rd .gl-finish-emoji { font-size: 2.4rem; position: relative; }
.gl-rd .gl-finish-title { font-family: var(--display); font-size: 1.7rem; font-weight: 900; color: #fff; margin: 8px 0 12px; position: relative; }
.gl-rd .gl-finish-text { font-size: 0.96rem; line-height: 1.9; color: rgba(255, 255, 255, 0.82); max-width: 760px; margin: 0 auto 24px; position: relative; }
.gl-rd .gl-finish-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; position: relative; }
.gl-rd .gl-fbtn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 26px; border-radius: 5px; font-size: 0.94rem; font-weight: 800; transition: .18s; }
.gl-rd .gl-fbtn.primary { background: var(--gold); color: var(--navy); border: 1.5px solid var(--gold); }
.gl-rd .gl-fbtn.primary:hover { background: #d4b56e; }
.gl-rd .gl-fbtn.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.4); }
.gl-rd .gl-fbtn.ghost:hover { border-color: var(--gold); color: var(--gold); }

/* ----- レスポンシブ ----- */
@media (max-width: 1280px) { .gl-rd .g3x-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px) {
  .gl-rd .g3x-grid { grid-template-columns: repeat(2, 1fr); }
  .gl-rd .g3x-title { font-size: 2.1rem; }
}
@media (max-width: 560px) {
  .gl-rd .g3x-grid { grid-template-columns: 1fr; }
  .gl-rd .g3x-title { font-size: 1.7rem; }
  .gl-rd .g3x-searchwrap { flex-direction: column; align-items: stretch; gap: 10px; }
  .gl-rd .g3x-count { text-align: right; }
  .gl-rd .gl-finish { padding: 34px 20px; }
  /* タブは横スクロールの帯に (= 見切れ防止) */
  .gl-rd .g3x-tabs {
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    padding-bottom: 4px; margin: 18px -16px 30px; padding-left: 16px; padding-right: 16px;
    -webkit-overflow-scrolling: touch;
  }
  .gl-rd .g3x-tab { flex: 0 0 auto; }
}

/* ============================================================================
   用語集 詳細 リデザイン (/glossary/<slug>) — gd
   .gl-dt 配下にスコープ。 --cat はテンプレ側で各語のカテゴリ色を注入。
   ============================================================================ */
.gl-dt {
  --navy: #152E4A;
  --navy-3: #2A4D75;
  --gold: #C4A35A;
  --gold-d: #A9854A;
  --panel: var(--app-panel-bg);
  --border: var(--app-panel-border);
  --subtle: var(--app-subtle);
  --display: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  --shadow: 0 8px 22px rgba(139, 116, 73, 0.07);
  --shadow-h: 0 16px 38px rgba(21, 46, 74, 0.15);
  color: var(--app-text);
}
.gl-dt a { color: inherit; text-decoration: none; }

/* ----- ヒーロー ----- */
.gl-dt .gd-hero { position: relative; overflow: hidden; border-radius: 10px; background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 100%); padding: 42px 44px; margin-bottom: 24px; }
.gl-dt .gd-hero::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-d)); }
.gl-dt .gd-hero-glow { position: absolute; top: -90px; right: -70px; width: 320px; height: 320px; background: radial-gradient(circle, color-mix(in srgb, var(--cat) 42%, rgba(196, 163, 90, 0.5)), rgba(20, 40, 66, 0) 70%); opacity: 0.5; pointer-events: none; }
.gl-dt .gd-badge { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 6px 15px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; color: #fff; background: var(--cat); box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25); }
.gl-dt .gd-term { position: relative; font-family: var(--display); font-size: 3rem; font-weight: 900; color: #fff; line-height: 1.14; margin: 18px 0 0; letter-spacing: 0.02em; }
.gl-dt .gd-reading { position: relative; font-size: 1rem; color: rgba(255, 255, 255, 0.62); margin-top: 8px; font-weight: 500; }
.gl-dt .gd-summary { position: relative; font-size: 1.16rem; line-height: 1.7; color: rgba(255, 255, 255, 0.92); margin: 18px 0 0; font-weight: 500; max-width: 880px; }

/* ----- 本文パネル ----- */
.gl-dt .gd-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 32px 38px; margin-bottom: 22px; }
.gl-dt .gd-h { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.3rem; font-weight: 900; color: var(--navy); margin: 0 0 18px; }
.gl-dt .gd-h .ic { font-size: 1.2rem; }
.gl-dt .gd-body { font-size: 1.05rem; line-height: 2.0; color: #3a4753; margin: 0; text-wrap: pretty; }
.gl-dt .gd-point { margin-top: 24px; border: 1px solid rgba(196, 163, 90, 0.3); border-left: 4px solid var(--gold); border-radius: 8px; background: linear-gradient(180deg, rgba(196, 163, 90, 0.10), rgba(196, 163, 90, 0.05)); padding: 18px 22px; }
.gl-dt .gd-point-h { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.0rem; color: var(--gold-d); margin-bottom: 8px; }
.gl-dt .gd-point p { margin: 0; font-size: 0.98rem; line-height: 1.85; color: #4a5560; }
.gl-dt .gd-ex { margin-top: 16px; border-radius: 8px; background: #f4f6f9; border-left: 3px solid var(--navy-3); padding: 16px 22px; }
.gl-dt .gd-ex-h { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 0.98rem; color: var(--navy); margin-bottom: 7px; }
.gl-dt .gd-ex p { margin: 0; font-size: 0.98rem; line-height: 1.7; color: #3a4753; }

/* ----- 関連用語 ----- */
.gl-dt .gd-rel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 26px 32px; margin-bottom: 24px; }
.gl-dt .gd-rel-h { font-family: var(--display); font-size: 1.16rem; font-weight: 900; color: var(--navy); margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
.gl-dt .gd-rel-h::before { content: ""; width: 4px; height: 18px; background: var(--gold); border-radius: 2px; }
.gl-dt .gd-rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gl-dt .gd-rel-card { position: relative; display: block; background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--rcat); border-radius: 7px; padding: 16px 38px 16px 18px; transition: transform .16s, box-shadow .16s, border-color .16s; }
.gl-dt .gd-rel-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); }
.gl-dt .gd-rel-name { font-family: var(--display); font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.gl-dt .gd-rel-reading { font-size: 0.74rem; color: var(--subtle); margin-left: 7px; font-weight: 500; }
.gl-dt .gd-rel-desc { font-size: 0.84rem; line-height: 1.65; color: var(--subtle); margin-top: 7px; }
.gl-dt .gd-rel-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--rcat); font-weight: 800; }

/* ----- 広告 ----- */
.gl-dt .gd-ad { display: flex; justify-content: center; margin: 0 0 24px; }

/* ----- 下部ナビ ----- */
.gl-dt .gd-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
.gl-dt .gd-nav-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 16px 24px; border-radius: 7px; font-size: 1rem; font-weight: 800; transition: .18s; }
.gl-dt .gd-nav-btn.back { background: var(--panel); color: var(--navy); border: 1.5px solid var(--navy); }
.gl-dt .gd-nav-btn.back:hover { background: rgba(21, 46, 74, 0.05); }
.gl-dt .gd-nav-btn.cta { background: linear-gradient(135deg, #152E4A, #1E3B5E); color: #fff; border: 1.5px solid var(--navy); }
.gl-dt .gd-nav-btn.cta:hover { filter: brightness(1.12); }
.gl-dt .gd-nav-btn.cta .ar { color: var(--gold); }
.gl-dt .gd-top { text-align: center; }
.gl-dt .gd-top a { display: inline-flex; padding: 10px 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--subtle); font-size: 0.88rem; font-weight: 700; transition: .15s; }
.gl-dt .gd-top a:hover { border-color: var(--gold); color: var(--gold-d); }

/* ----- レスポンシブ ----- */
@media (max-width: 900px) {
  .gl-dt .gd-rel-grid { grid-template-columns: repeat(2, 1fr); }
  .gl-dt .gd-term { font-size: 2.4rem; }
  .gl-dt .gd-hero { padding: 32px 26px; }
  .gl-dt .gd-panel { padding: 26px 22px; }
}
@media (max-width: 560px) {
  .gl-dt .gd-rel-grid { grid-template-columns: 1fr; }
  .gl-dt .gd-term { font-size: 2rem; }
  .gl-dt .gd-summary { font-size: 1.05rem; }
  .gl-dt .gd-nav { grid-template-columns: 1fr; }
}
