/* Bootstrap reboot.css の最小サブセット。
   トップページなど Bootstrap CSS を読み込まないページでも、box-sizing と
   見出し・段落・ボタンのデフォルトを Bootstrap と揃えてレイアウト崩れを防ぐ。
   Bootstrap 読み込みページでは同名ルールが Bootstrap 側で上書きされるため副作用なし。 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.2;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

ul, ol {
  padding-left: 2rem;
}

button {
  border: 0;
  background-color: transparent;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

img, svg {
  vertical-align: middle;
}

/* 共通レイアウト / ブランド / カラー */
:root {
  --app-bg: #F0F2F7;
  --app-max-width: 1200px;
  --app-side-pad: 16px;
  --app-scrollbar-w: 6px;
  --app-panel-bg: #FFFFFF;
  --app-panel-border: #E0E0E0;
  --app-panel-shadow: 0 8px 22px rgba(139, 116, 73, 0.07);
  --app-radius: 12px;
  --app-panel-radius: 0px;
  --app-text: #2D3436;
  --app-subtle: #6B7280;
  --app-accent: #C4A35A;
  --app-accent-dark: #152E4A;
  --app-accent-dark-2: #1E3B5E;
  --app-accent-teal: #1A6B5A;
  /* トップバー高さ (デザインシステム仕様)。 */
  --topbar-h: 64px;
  --topbar-h-mobile: 50px;
  /* V26 セリフフォント (= ヘッダーナビ + section title + eyebrow で使用)。 */
  --v26-serif: "Noto Serif JP", "Times New Roman", serif;
}

a {
  color: var(--app-accent-dark);
}
a:hover {
  color: #1E3B5E;
}

html {
  overflow-x: clip;
  scrollbar-gutter: stable;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Bootstrap CSS 非同期ロード中の FOUC 防止フォールバック。
   Bootstrap が読み込まれた後は同名ルールが上書きされるため副作用なし。
   非アクティブな tab-pane / モーダルが一瞬表示されるのを防ぐ。 */
.tab-pane:not(.active):not(.show) {
  display: none;
}
.modal:not(.show) {
  display: none;
}

/* Bootstrap utility class の最小サブセット（Bootstrap CSS 非読み込みページ用）。
   トップページなど Bootstrap CSS を完全に外したページでもレイアウトが崩れないよう、
   実際に使っている軽量 utility だけ自前で定義する。Bootstrap が読み込まれている
   ページでは同名ルールが Bootstrap 側で上書きされるため副作用なし。 */
.text-muted { color: #6c757d; }
.text-end { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }

/* <picture> はラッパーとしてのみ機能させ、レイアウト上は中の <img> を直接親の子として扱う。
   これにより既存の flexbox / block コンテナの CSS（.tw-ds-img img 等）が
   <picture> ラップ後も完全に同じ挙動になる。 */
picture {
  display: contents;
}

body.with-app-fixed-title {
  margin: 0;
  padding-top: 0;
  color: var(--app-text);
  font-family: "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(1200px 360px at 94% -10%, rgba(196, 163, 90, 0.06), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #F4F5F9 0%, var(--app-bg) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== ワイドページ幅 (= TOP の .v26m-section と同じ体系) =====
   --app-max-width(1720) + --app-side-pad(100) で shell 最大幅 = 1720+2*100 = 1920px、
   左右パディング 100/56/16px。 ヘッダー / 固定ヘッダー / 本文 / フッターが一斉に広がる。
   body にこのクラスを付けたページ (= コラム一覧 / 用語集 等) だけが対象。 */
body.wide-page {
  --app-max-width: 1720px;
  --app-side-pad: 100px;
}
@media (max-width: 1280px) {
  body.wide-page { --app-side-pad: 56px; }
}
@media (max-width: 960px) {
  body.wide-page { --app-side-pad: 16px; }
}


/* ===== トップバー ===== */
.app-topbar {
  /* フッター (.app-footer) と同色に統一: 単色 #1E3B5E。 */
  background: var(--app-accent-dark-2);
  border-bottom: 1px solid rgba(196, 163, 90, 0.18);
  box-shadow: 0 2px 20px rgba(11, 25, 48, 0.4);
}

.app-topbar-inner {
  /* バー全幅活用 + ロゴ / nav を左端ギリギリに寄せる。 */
  max-width: none;
  margin: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
}

.app-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 24px;
  color: #FFFFFF;
  letter-spacing: 0.08em;
}

.app-topbar-brand-sub {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.app-topbar-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.app-topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.app-topbar-nav-item {
  display: inline-flex;
  align-items: center;
  padding: 22px 16px;
  /* 非アクティブ: 白 85%、 weight 500。 */
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.86rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
  position: relative;
}

.app-topbar-nav-item:hover {
  color: #fff;
}

.app-topbar-nav-item.active {
  /* アクティブ: ゴールド (#C4A35A) + weight 700。 */
  color: var(--app-accent);
  font-weight: 700;
}

.app-topbar-nav-item.active::after {
  /* アクティブ下線: ゴールド 2px。 */
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--app-accent);
}

/* モバイル展開メニュー (= ハンバーガークリックで開閉) */
.app-topbar-mobile-menu {
  display: none;
  flex-direction: column;
  background: #1E3B5E;
  border-top: 1px solid rgba(196, 163, 90, 0.18);
  padding: 4px 0 12px;
}

.app-topbar-mobile-menu:not([hidden]) { display: flex; }

.app-topbar-mobile-item {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 20px;
  border-left: 3px solid transparent;
}

.app-topbar-mobile-item.active {
  color: var(--app-accent);
  border-left-color: var(--app-accent);
  background: rgba(196, 163, 90, 0.06);
}

.app-topbar-nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.app-topbar-nav-item.active .app-topbar-nav-icon {
  opacity: 1;
}

/* モバイル用ハンバーガー */
.app-topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
  /* デスクトップでは hidden だが、 モバイル時に右端に押し出すための保険。 */
  margin-left: auto;
}

.app-topbar-hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-topbar-hamburger svg {
  width: 24px;
  height: 24px;
}

/* DB 切り替え（Admin 用） */
.app-topbar-db-switcher {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 8px;
  flex-shrink: 0;
}

.db-toggle-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.db-toggle-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: none;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.db-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.db-toggle-btn--active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  pointer-events: none;
}

.db-toggle-btn--prod.db-toggle-btn--active {
  background: #dc3545;
  color: #fff;
}

.db-label-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}

.db-label-badge--local {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

/* ===== サブナビ (V26 統合型ヘッダーに移行済み、 旧テンプレ残置時のみ描画されないようガード) ===== */
.app-subnav { display: none; }
.app-subnav {
  background: var(--app-bg);
  border-bottom: 1px solid var(--app-panel-border);
}

.app-subnav-inner {
  max-width: calc(var(--app-max-width) + 2 * var(--app-side-pad));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 var(--app-side-pad);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.app-subnav-inner::-webkit-scrollbar { display: none; }

.app-subnav-item {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--app-subtle);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  position: relative;
  transition: color 0.15s, border-color 0.15s;
}

.app-subnav-item:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(0,0,0,0.10);
}

.app-subnav-item:hover {
  color: var(--app-accent-dark);
}

.app-subnav-item.active {
  color: var(--app-accent-dark);
  border-bottom: 2px solid var(--app-accent-dark);
  font-weight: 700;
}

.app-topbar--prod {
  background: linear-gradient(135deg, #5a1a1a 0%, #7c2020 100%);
}

.prod-warning-banner {
  background: #dc3545;
  color: #fff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 0;
  letter-spacing: 0.04em;
}

/* DB同期ボタン */
.db-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-left: 6px;
  white-space: nowrap;
}

.db-sync-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* DB同期ダイアログ */
.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-dialog {
  background: var(--app-panel-bg);
  border-radius: 12px;
  padding: 28px 32px;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.sync-dialog-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.sync-dialog-warn {
  font-size: 0.88rem;
  color: #dc3545;
  line-height: 1.6;
  margin: 0 0 20px;
}

.sync-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sync-progress-bar-wrap {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.sync-progress-bar {
  height: 100%;
  background: #0d6efd;
  border-radius: 4px;
  transition: width 0.3s;
}

.sync-status-msg {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 10px;
}

.sync-table-log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: #666;
  border-top: 1px solid #eee;
  padding-top: 8px;
}

.sync-log-entry {
  padding: 2px 0;
}

/* モバイルドロワー */
.app-mobile-drawer {
  display: none;
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #152E4A, #1E3B5E);
  z-index: 1199;
  padding: 8px 16px 16px;
  box-shadow: 0 8px 24px rgba(11, 25, 48, 0.5);
  flex-direction: column;
  gap: 2px;
}

.app-mobile-drawer.open {
  display: flex;
}

.app-mobile-drawer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.app-mobile-drawer a:hover,
.app-mobile-drawer a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-mobile-drawer a.active {
  border-left: 3px solid var(--app-accent);
}

/* ===== パンくずリスト ===== */
.breadcrumb-nav {
  padding: 8px 0 0;
}
.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: #5a6a7a;
}
.breadcrumb-list li + li::before {
  content: "›";
  margin: 0 6px;
  color: #8a95a0;
}
.breadcrumb-list a {
  color: #4a7ab5;
  text-decoration: none;
}
.breadcrumb-list a:hover {
  color: #2c5a8f;
  text-decoration: underline;
}
.breadcrumb-list li[aria-current="page"] {
  color: #3a4a5a;
}

.app-page-shell {
  max-width: calc(var(--app-max-width) + 2 * var(--app-side-pad));
  margin: 0 auto;
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.app-fixed-header {
  padding: 16px var(--app-side-pad) 0;
}

.app-scroll-area {
  padding: 16px var(--app-side-pad) 16px;
  flex: 1 0 auto;
}

.app-content-wrap {
  width: 100%;
}

.app-panel,
.page-title-card,
.race-header,
.detail-menu,
.section-card,
.stats-card,
.page-card {
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  border-radius: var(--app-panel-radius);
  box-shadow: var(--app-panel-shadow);
}

.section-card,
.page-card {
  overflow: hidden;
  margin-bottom: 16px;
}

/* ===== 曜日バッジ（全ページ共通） ===== */
.weekday {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 1.6em;
  height: 1.45em;
  padding: 0 4px;
  border-radius: 4px;
  color: #fff !important;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: text-bottom;
}
.weekday-sat     { background-color: #007bff; }
.weekday-sun     { background-color: #dc3545; }
.weekday-week    { background-color: #6c757d; }
.weekday-holiday { background-color: #dc3545; }

.page-title-card {
  padding: 12px 14px 12px 18px;
  height: 80px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  box-sizing: border-box;
  margin-bottom: 10px;
  border-left: 3px solid var(--app-accent);
}

.page-title-heading {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--app-accent-dark);
  margin: 0;
}

.page-title-sub {
  font-size: 0.78rem;
  color: var(--app-subtle);
  line-height: 1.4;
}



.stats-section {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.88),
    rgba(247, 250, 252, 0.9)
  );
  border: 1px solid var(--app-panel-border);
}


.x-follow-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #000;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ===== グレードバッジ ===== */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.25rem;
  padding: 0.24rem 0.58rem;
  margin-right: 0.35rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  color: #fff;
  /* italic eyebrow 内に入っても badge 文字は常に立て (= 親の font-style を無視)。 */
  font-style: normal;
}

.grade-G1,
.grade-GI,
.grade-JG1 {
  background: #1161c7;
}

.grade-G2,
.grade-GII,
.grade-JG2 {
  background: #cc2f42;
}

.grade-G3,
.grade-GIII,
.grade-JG3 {
  background: #1A6B5A;
}

.grade-L,
.grade-Listed,
.grade-OP,
.grade-OPEN {
  background: #6B7280;
}

/* ===== レース番号・発走時刻チップ（全ページ共通） ===== */
.race-meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a3e5c;
  background: rgba(31, 52, 72, 0.08);
  border: 1px solid rgba(31, 52, 72, 0.15);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ===== 共通テーブル ===== */
.table.table-results {
  table-layout: auto;
  width: 100%;
  min-width: max-content;
}

.section-card .table-responsive {
  overflow-x: auto;
  overflow-y: visible;
}


.table-results th {
  background: var(--app-accent-dark);
  color: #fff;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  word-break: keep-all;
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(21, 46, 74, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.table-results th,
.table-results td {
  text-align: center;
  vertical-align: middle;
  font-size: 0.88rem;
  padding: 0.4rem 0.5rem;
  line-height: 1.25;
  white-space: nowrap;
  word-break: keep-all;
  border-left: none;
  border-right: none;
  border-bottom: 1px solid var(--app-panel-border);
}

.table-results tbody tr:nth-child(even) {
  background: rgba(21, 46, 74, 0.03);
}

.table-results tbody tr:hover {
  background: rgba(196, 163, 90, 0.06);
}

.btn.btn-secondary {
  border-radius: 4px;
  border-color: #607080;
  background: #607080;
  font-weight: 700;
}

.btn.btn-secondary:hover {
  border-color: #4d5b69;
  background: #4d5b69;
}

/* 枠色 / 上がり / 人気カラー */
.waku-1 {
  --bs-table-bg: #ffffff;
  background-color: #ffffff !important;
  color: #111 !important;
}
.waku-2 {
  --bs-table-bg: #222222;
  background-color: #222222 !important;
  color: #fff !important;
}
.waku-3 {
  --bs-table-bg: #d32f2f;
  background-color: #d32f2f !important;
  color: #fff !important;
}
.waku-4 {
  --bs-table-bg: #1976d2;
  background-color: #1976d2 !important;
  color: #fff !important;
}
.waku-5 {
  --bs-table-bg: #ffd600;
  background-color: #ffd600 !important;
  color: #111 !important;
}
.waku-6 {
  --bs-table-bg: #2e7d32;
  background-color: #2e7d32 !important;
  color: #fff !important;
}
.waku-7 {
  --bs-table-bg: #f57c00;
  background-color: #f57c00 !important;
  color: #fff !important;
}
.waku-8 {
  --bs-table-bg: #f8bbd0;
  background-color: #f8bbd0 !important;
  color: #111 !important;
}

.agari-rank-1 {
  --bs-table-bg: #fff2a8;
  background-color: #fff2a8 !important;
  color: #5c4800 !important;
  font-weight: 700;
}
.agari-rank-2 {
  --bs-table-bg: #bfe1ff;
  background-color: #bfe1ff !important;
  color: #003b73 !important;
  font-weight: 700;
}
.agari-rank-3 {
  --bs-table-bg: #ffd6ad;
  background-color: #ffd6ad !important;
  color: #7a3b00 !important;
  font-weight: 700;
}
.agari-rank-other {
  --bs-table-bg: #f7f7f7;
  background-color: #f7f7f7 !important;
  color: #444 !important;
}

.ninki-1 {
  --bs-table-bg: #fff2a8;
  background-color: #fff2a8 !important;
  color: #5c4800 !important;
  font-weight: 700;
}
.ninki-2 {
  --bs-table-bg: #bfe1ff;
  background-color: #bfe1ff !important;
  color: #003b73 !important;
  font-weight: 700;
}
.ninki-3 {
  --bs-table-bg: #ffd6ad;
  background-color: #ffd6ad !important;
  color: #7a3b00 !important;
  font-weight: 700;
}
.ninki-other {
  --bs-table-bg: #f6f6f6;
  background-color: #f6f6f6 !important;
  color: #555 !important;
}

.chaku-1 {
  --bs-table-bg: #fff2a8;
  background-color: #fff2a8 !important;
  color: #5c4800 !important;
  font-weight: 700;
}
.chaku-2 {
  --bs-table-bg: #bfe1ff;
  background-color: #bfe1ff !important;
  color: #003b73 !important;
  font-weight: 700;
}
.chaku-3 {
  --bs-table-bg: #ffd6ad;
  background-color: #ffd6ad !important;
  color: #7a3b00 !important;
  font-weight: 700;
}

@media (max-width: 768px) {
  :root {
    --app-side-pad: 10px;
  }

  .app-subnav-item {
    padding: 7px 10px;
    font-size: 0.76rem;
  }

  /* ハンバーガーメニューを overlay 化 (= page flow を変えず、 下のコンテンツを押し下げない)。
     header 自体を relative にして、 開いた mobile-menu を absolute で topbar 直下に貼り付ける。 */
  .app-topbar {
    position: relative;
  }
  .app-topbar-inner {
    height: var(--topbar-h-mobile);
  }

  .app-topbar-nav {
    display: none;
  }

  .app-topbar-hamburger {
    display: block;
  }

  .app-topbar-mobile-menu:not([hidden]) {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    /* スマホ画面高超え時はスクロール可能に (= リスト長くなっても overlay 内で完結) */
    max-height: calc(100vh - var(--topbar-h-mobile));
    overflow-y: auto;
  }

  .app-topbar-logo-img {
    height: 32px;
  }

  .page-title-card {
    height: auto;
    min-height: 70px;
    flex-wrap: wrap;
  }

  /* フッター: PC 4 列をそのまま縦に並べると縦長すぎ。 リンク自体を 2 列 grid で詰めて、
     ブロック間隔・パディングも圧縮。 全体の縦サイズを半分程度に。 */
  .app-footer {
    padding: 28px 0 16px;
  }
  .app-footer-head {
    margin-bottom: 12px;
  }
  .app-footer-grid {
    display: block;
  }
  .app-footer-col {
    margin-top: 16px;
  }
  .app-footer-col:first-child {
    margin-top: 0;
  }
  .app-footer-col-eyebrow {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }
  /* NAV / INFO / SOCIAL のリンクを 2 列に並べる (= 各 6/4/1 リンクを縦に積まない) */
  .app-footer-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
  }
  .app-footer-list-link {
    padding: 4px 0;
    font-size: 0.86rem;
  }
  /* ブランドコピーは全幅 1 ブロックのまま (= grid 子じゃないので block 化のみで OK) */
  .app-footer-brand-title {
    font-size: 1.4rem;
    margin-bottom: 4px;
  }
  .app-footer-brand-prose {
    font-size: 0.85rem;
    line-height: 1.5;
  }
  .app-footer-rule {
    margin: 18px 0 10px;
  }
  .app-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 0.78rem;
  }
}

/* ===== 年切り替えプルダウン（共通） ===== */
.year-selector-dropdown {
  padding: 5px 12px;
  border: 1px solid var(--app-panel-border);
  border-radius: 4px;
  background: var(--app-panel-bg);
  color: var(--app-subtle);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.year-selector-dropdown:hover,
.year-selector-dropdown:focus {
  border-color: var(--app-accent);
  color: var(--app-accent);
}

/* ===== レスポンシブ列表示制御（グローバル） ===== */
@media (max-width: 992px) {
  .hide-lg { display: none !important; }
}
@media (max-width: 768px) {
  .hide-md { display: none !important; }
}

/* ===== フッター (V26 編集型) ===== */
.app-footer {
  padding: 56px 0 28px;
  color: rgba(255, 255, 255, 0.7);
  background: #1E3B5E;
  border-top: 1px solid rgba(196, 163, 90, 0.18);
  margin-top: 0;
  margin-left: calc(-50vw + 50%);
  width: 100vw;
  flex-shrink: 0;
}

.app-footer-inner {
  /* サイト最大幅 (= ヒーロー / v26m-section と同じ 1920px) に揃える。 */
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 max(16px, calc((100% - 1720px) / 2));
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* V26 section-head と同じ「— eyebrow + gold rule」 パターン。 */
.app-footer-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.app-footer-head-eyebrow {
  font-family: var(--v26-serif);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--app-accent);
  letter-spacing: 0.3em;
  font-weight: 700;
  white-space: nowrap;
}

.app-footer-head-rule {
  flex: 1;
  height: 1px;
  background: var(--app-accent);
  opacity: 0.45;
}

/* 編集型 3 カラム (ブランド / NAVIGATION / INFO) */
.app-footer-grid {
  display: grid;
  /* ブランド + NAVIGATION + INFO + SOCIAL の 4 列構成。 */
  grid-template-columns: 4fr 1fr 1fr 1fr;
  column-gap: 8px;
  row-gap: 36px;
}

.app-footer-col--brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-footer-brand-title {
  font-family: var(--v26-serif);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
}

.app-footer-brand-accent {
  color: var(--app-accent);
}

.app-footer-brand-prose {
  font-size: 0.82rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.62);
  margin: 0;
  max-width: 360px;
}

/* SOCIAL カラムの X リンク (= app-footer-list-link を継承しつつアイコン inline 配置)。 */
.app-footer-list-link--x {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-footer-x-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.app-footer-col-eyebrow {
  font-family: var(--v26-serif);
  font-style: italic;
  font-size: 0.68rem;
  color: var(--app-accent);
  letter-spacing: 0.25em;
  font-weight: 700;
  margin-bottom: 16px;
}

.app-footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-footer-list-link {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 0.15s;
}

.app-footer-list-link:hover {
  color: var(--app-accent);
}

.app-footer-rule {
  height: 1px;
  background: rgba(196, 163, 90, 0.18);
}

.app-footer-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.app-footer-copy {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.app-footer-bottom-eyebrow {
  font-family: var(--v26-serif);
  font-style: italic;
  font-size: 0.7rem;
  color: rgba(196, 163, 90, 0.7);
  letter-spacing: 0.25em;
  font-weight: 700;
}

@media (max-width: 768px) {
  .app-footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .app-footer-brand-title {
    font-size: 1.6rem;
  }
}

.btn-back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--app-subtle);
  background: var(--app-panel-bg);
  border: 1px solid var(--app-panel-border);
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-back-to-top:hover {
  border-color: var(--app-accent);
  color: var(--app-accent);
}

.back-to-top-wrap {
  text-align: center;
  margin: 16px 0 8px;
}

@media (max-width: 600px) {
  .app-footer-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 0;
  }

  .app-footer-sep {
    display: none;
  }

  .app-footer-link {
    display: block;
    text-align: center;
  }
}

/* ===== Bootstrap ボタン テーマ統一 ===== */
.btn-primary {
  background: var(--app-accent-dark);
  border-color: var(--app-accent-dark);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background: #1E3B5E;
  border-color: #1E3B5E;
  color: #fff;
}
.btn-outline-primary {
  color: var(--app-accent-dark);
  border-color: var(--app-accent-dark);
}
.btn-outline-primary:hover {
  background: var(--app-accent-dark);
  border-color: var(--app-accent-dark);
  color: #fff;
}
.btn-secondary {
  background: var(--app-panel-bg);
  border-color: var(--app-panel-border);
  color: var(--app-subtle);
}
.btn-secondary:hover {
  border-color: var(--app-accent);
  color: var(--app-accent);
  background: rgba(196, 163, 90, 0.06);
}
.btn-outline-secondary {
  color: var(--app-subtle);
  border-color: var(--app-panel-border);
}
.btn-outline-secondary:hover {
  border-color: var(--app-accent);
  color: var(--app-accent);
  background: rgba(196, 163, 90, 0.06);
}

/* ===== フォーム テーマ統一 ===== */
.form-control:focus {
  border-color: var(--app-accent);
  box-shadow: 0 0 0 0.2rem rgba(196, 163, 90, 0.2);
}

/* ===== AdSense スクロール干渉防止 ===== */
.adsbygoogle {
  overflow: visible !important;
}

/* ===== 説明文共通 ===== */
.analysis-page-desc {
  font-size: 0.88rem;
  color: var(--app-subtle);
  line-height: 1.8;
  padding: 0 0.2rem;
}

/* ===== 共通バッジ ===== */
.hit-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 400;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--app-accent-teal), #1a8b65);
  box-shadow: 0 1px 4px rgba(26, 107, 90, 0.35);
}

.hit-badge-double {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  box-shadow: 0 1px 4px rgba(184, 134, 11, 0.45);
}

.recovery-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.02em;
  margin-left: 4px;
  background: linear-gradient(135deg, var(--app-accent-dark), #1E3B5E);
  box-shadow: 0 1px 4px rgba(21, 46, 74, 0.35);
}

.final-verdict-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, var(--app-accent-dark), #1E3B5E);
  box-shadow: 0 1px 4px rgba(21, 46, 74, 0.35);
  border-radius: 4px;
  white-space: nowrap;
}

.provisional-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, #6B7280, #9CA3AF);
  box-shadow: 0 1px 4px rgba(107, 114, 128, 0.35);
  border-radius: 4px;
  white-space: nowrap;
}

.result-confirmed-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #9CA3AF;
  background: transparent;
  border: 1px solid #9CA3AF;
  border-radius: 4px;
  white-space: nowrap;
}

/* ===== 共通ボックスタイトル ===== */
.section-h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--app-accent);
}

/* ===== 今週の重賞 共通ハイライトセクション ===== */
.tw-highlight {
  background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 60%, #2A4D75 100%);
  border-radius: var(--app-panel-radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.tw-highlight-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--app-accent);
}

/* ===== モバイル限定: レース名タブ（カルーセル連動・TOP用） ===== */
.tw-mobile-tabs {
  display: none;
}

@media (max-width: 768px) {
  .tw-mobile-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    position: relative;
    margin: 0 -14px 10px;
    padding: 0 14px 4px;
  }
  .tw-mobile-tabs::-webkit-scrollbar {
    display: none;
  }
  .tw-mobile-tab {
    flex: 0 0 auto;
    padding: 6px 14px;
    border: 1px solid rgba(196, 163, 90, 0.35);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .tw-mobile-tab:focus { outline: none; }
  .tw-mobile-tab-active {
    background: var(--app-accent);
    color: #152E4A;
    border-color: var(--app-accent);
  }
}

/* ===== ハイライトカルーセル: レース名タブ（PC・モバイル両方表示） ===== */
.tw-hl-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  cursor: grab;
  user-select: none;
  /* JS の setTabActive() が offsetLeft で中央配置するため、
     offsetParent をこのコンテナ自身に固定する必要がある */
  position: relative;
  margin: 0 -14px 10px;
  padding: 0 14px 4px;
}
.tw-hl-tabs.is-dragging {
  cursor: grabbing;
}
.tw-hl-tabs::-webkit-scrollbar {
  display: none;
}
.tw-hl-tab {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid rgba(196, 163, 90, 0.35);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tw-hl-tab:focus { outline: none; }
.tw-hl-tab-active {
  background: var(--app-accent);
  color: #152E4A;
  border-color: var(--app-accent);
}

.tw-highlight-header .section-h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.tw-highlight-title {
  color: var(--app-accent);
}

.tw-highlight-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
}

.tw-highlight-grid {
  display: flex;
  gap: 10px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.tw-highlight-grid > .tw-card {
  flex: 1 1 0;
  min-width: 0;
}

.tw-highlight-empty {
  color: rgba(255,255,255,0.4);
  font-size: 0.88rem;
  margin: 0;
}

.tw-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  min-height: 88px;
  border-radius: var(--app-radius);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
  color: #fff;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  overflow: hidden;
}

.tw-card:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(196, 163, 90, 0.4);
  transform: translateY(-2px);
  color: #fff;
}

.tw-card-hit {
  border-color: rgba(25, 135, 84, 0.6);
  background: linear-gradient(135deg, rgba(25, 135, 84, 0.1), rgba(255,255,255,0.06));
}

.tw-card-hit-double {
  border-color: rgba(212, 160, 23, 0.7);
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.12), rgba(255,255,255,0.06));
}

.tw-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tw-card-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tw-card-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
  min-width: 0;
}

.tw-card-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.tw-card-date {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tw-card-meta {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.tw-card-badge {
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-left: auto;
}
.countdown-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--app-muted-bg, #e9ecef);
  color: var(--app-text-muted, #6c757d);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  min-width: 4.4rem;
  text-align: center;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .tw-highlight {
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .tw-highlight-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tw-highlight-grid::-webkit-scrollbar {
    display: none;
  }
  .tw-highlight-grid > .tw-card {
    flex: 0 0 280px;
  }
}

/* ===== サイドバー用レースカード（共通） ===== */
.sidebar-race-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-race-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--app-radius);
  background: var(--app-bg);
  border: 1px solid var(--app-panel-border);
  border-left: 3px solid var(--app-accent-dark);
  text-decoration: none;
  color: var(--app-text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  overflow: hidden;
}

.sidebar-race-item:hover {
  border-left-color: var(--app-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  color: var(--app-text);
}

.sidebar-race-item-hit {
  border-left-color: var(--app-accent-teal);
  border-color: var(--app-accent-teal);
  background: rgba(0, 166, 153, 0.04);
}

.sidebar-race-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-race-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--app-accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sidebar-race-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sidebar-race-date {
  font-size: 0.72rem;
  color: var(--app-subtle);
  white-space: nowrap;
}

.sidebar-race-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
}

/* ===== 情報ページ共通（運営者情報・利用規約・プライバシーポリシー・お問い合わせ） ===== */
.info-page {
  max-width: var(--app-max-width);
  margin: 0 auto;
}

.info-hero {
  background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 60%, #2A4D75 100%);
  border-radius: var(--app-panel-radius);
  padding: 28px 28px 22px;
  margin-bottom: 18px;
}

.info-hero-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
}

.info-hero-desc {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  margin: 0;
  font-weight: 500;
}

.info-page-body {
  padding: 28px;
  line-height: 1.85;
  font-size: 0.92rem;
  color: var(--app-text);
}

.info-page-body h2 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 2.2rem 0 0.7rem;
  padding: 0 0 8px 12px;
  border-left: 3px solid var(--app-accent);
  border-bottom: 1px solid rgba(196, 163, 90, 0.15);
}

.info-page-body h2:first-child {
  margin-top: 0;
}

.info-page-body p {
  margin-bottom: 0.85rem;
}

.info-page-body ul {
  padding-left: 1.3rem;
  margin-bottom: 1rem;
}

.info-page-body li {
  margin-bottom: 0.35rem;
  line-height: 1.75;
}

.info-page-body li::marker {
  color: var(--app-accent);
}

.info-page-body a {
  color: var(--app-accent-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(196, 163, 90, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.info-page-body a:hover {
  text-decoration-color: var(--app-accent);
}

/* ===== レース分析の傾向分析ブロック ===== */
.analysis-summary-body {
  font-size: 0.92rem;
  line-height: 1.85;
  color: var(--app-text);
}

.analysis-summary-body > *:first-child {
  margin-top: 0;
}

.analysis-summary-body h2 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--app-accent-dark);
  margin: 1.4rem 0 0.6rem;
  padding: 0 0 6px 10px;
  border-left: 3px solid var(--app-accent);
  border-bottom: 1px solid rgba(196, 163, 90, 0.15);
}

.analysis-summary-body h3 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--app-accent-dark);
  margin: 1.2rem 0 0.5rem;
}

.analysis-summary-body p {
  margin-bottom: 0.85rem;
}

.analysis-summary-body ul,
.analysis-summary-body ol {
  padding-left: 1.3rem;
  margin-bottom: 1rem;
}

.analysis-summary-body li {
  margin-bottom: 0.35rem;
  line-height: 1.75;
}

.analysis-summary-body li::marker {
  color: var(--app-accent);
}

.analysis-summary-body strong {
  color: var(--app-accent-dark);
  font-weight: 700;
}

.analysis-summary-body p:last-child,
.analysis-summary-body ul:last-child,
.analysis-summary-body ol:last-child {
  margin-bottom: 0;
}

.info-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--app-panel-border);
  margin-bottom: 1.5rem;
}

.info-table th,
.info-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--app-panel-border);
  vertical-align: middle;
}

.info-table th {
  width: 140px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--app-accent-dark);
  background: rgba(196, 163, 90, 0.06);
  font-size: 0.85rem;
}

.info-table tr:last-child th,
.info-table tr:last-child td {
  border-bottom: none;
}

.info-page-note {
  font-size: 0.8rem;
  color: var(--app-subtle);
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-panel-border);
}

@media (max-width: 640px) {
  .info-hero {
    padding: 20px 18px 16px;
    margin-bottom: 12px;
  }

  .info-hero-title {
    font-size: 1.25rem;
  }

  .info-page-body {
    padding: 18px 16px;
  }

  .info-page-body h2 {
    font-size: 0.9rem;
  }

  .info-table th {
    width: 100px;
    font-size: 0.8rem;
    padding: 10px 12px;
  }

  .info-table td {
    font-size: 0.85rem;
    padding: 10px 12px;
  }
}

/* ===== 今週の重賞 コンパクト横スクロール・チップ形式 ===== */
.tw-compact {
  background: linear-gradient(135deg, #152E4A 0%, #1E3A55 100%);
  border-radius: var(--app-panel-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.tw-compact-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.tw-compact-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--app-accent);
}

.tw-compact-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
}

.tw-compact-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.tw-compact-scroll::-webkit-scrollbar {
  display: none;
}

.tw-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
  min-width: 130px;
  border-radius: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  text-decoration: none;
  color: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.tw-chip:hover {
  background: rgba(255,255,255,0.13);
  border-color: rgba(196,163,90,0.4);
  color: #fff;
}

.tw-chip-hit {
  border-color: rgba(25,135,84,0.5);
}

.tw-chip-hit-double {
  border-color: rgba(196,163,90,0.5);
}

.tw-chip-top {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tw-chip-name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tw-chip-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tw-chip-date {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

.tw-chip-badge {
  font-size: 0.6rem !important;
  padding: 1px 5px !important;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .tw-compact {
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  .tw-chip {
    min-width: 120px;
    padding: 7px 10px;
  }
}

/* ===== 今週の重賞 スライドバナー ===== */
/* ===== 今週の重賞 スライドバナー（前後見切れ型・無限ループ） ===== */
.tw-banner-card {
  background: linear-gradient(135deg, #152E4A 0%, #1E3B5E 60%, #2A4D75 100%) !important;
  border: none !important;
}

.tw-banner-card-title {
  color: #fff !important;
  border-bottom-color: var(--app-accent) !important;
}

.tw-banner-card .tw-banner-label-inline {
  color: rgba(255,255,255,0.5);
}

.tw-banner {
  position: relative;
  margin-bottom: 0;
}

.tw-banner-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 0 8px;
}

.tw-banner-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--app-accent);
}

.tw-banner-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
}

.tw-banner-label-inline {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--app-subtle);
  margin-left: 8px;
}

.tw-banner-viewport {
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
}

.tw-banner-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.tw-banner-slide {
  flex: 0 0 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.tw-banner-slide > .tw-sub-card {
  flex: 1 1 auto;
  width: 100%;
}

.tw-banner-slide-active {
  /* 視覚効果は付与しない（JS 状態管理用のみ） */
}

.tw-banner-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(3px) brightness(0.38);
  transform: scale(1.15);
}

.tw-banner-bg-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a3a5c 0%, #0d2240 100%);
}

.tw-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13,31,51,0.25) 0%, rgba(13,31,51,0.65) 100%);
}

.tw-banner-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tw-banner-race-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tw-banner-race-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.tw-banner-race-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 8px;
  min-width: 0;
}

.tw-banner-race-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.tw-banner-date {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.tw-banner-course {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.tw-banner-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.tw-banner-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 2px;
}

.tw-banner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: background 0.2s;
}

.tw-banner-dot-active {
  background: var(--app-accent);
}

/* ===== バナー: モバイル限定 レース名タブ（カルーセル連動） ===== */
.tw-banner-mobile-tabs {
  display: none;
}

@media (max-width: 959px) {
  .tw-banner-mobile-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    position: relative;
    margin: 0 0 10px;
    padding: 0 0 4px;
  }
  .tw-banner-mobile-tabs::-webkit-scrollbar {
    display: none;
  }
  .tw-banner-mobile-tab {
    flex: 0 0 auto;
    padding: 6px 14px;
    border: 1px solid rgba(196, 163, 90, 0.35);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .tw-banner-mobile-tab:focus { outline: none; }
  .tw-banner-mobile-tab-active {
    background: var(--app-accent);
    color: #152E4A;
    border-color: var(--app-accent);
  }
}

@media (max-width: 768px) {
  .tw-banner-race-name {
    font-size: 1rem;
  }
}

/* ====== アフィリエイトスロット共通 ====== */
.affiliate-slot {
  display: block;
  margin: 16px auto;
  position: relative;
  max-width: 100%;
}

/* 実広告の img が親要素より大きい場合はアスペクト比保持で縮小 */
.affiliate-slot-live img,
.affiliate-slot-live iframe {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.affiliate-slot-live .affiliate-label {
  font-size: 0.7rem;
  color: var(--app-subtle);
  text-align: right;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

/* プレースホルダ（開発環境専用表示） */
.affiliate-slot-placeholder {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 193, 7, 0.08),
      rgba(255, 193, 7, 0.08) 10px,
      rgba(255, 193, 7, 0.14) 10px,
      rgba(255, 193, 7, 0.14) 20px
    );
  border: 2px dashed #ffb300;
  color: #5a3a00;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(255, 179, 0, 0.15);
  position: relative;
}

.affiliate-slot-placeholder .affiliate-ph-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #b37700;
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.affiliate-slot-placeholder .affiliate-ph-body {
  text-align: center;
  padding: 8px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.affiliate-slot-placeholder .affiliate-ph-advertiser {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.affiliate-slot-placeholder .affiliate-ph-size {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: #d35400;
}

.affiliate-slot-placeholder .affiliate-ph-slot {
  font-size: 0.72rem;
  color: #7a5200;
  word-break: break-all;
}

.affiliate-slot-placeholder .affiliate-ph-note {
  font-size: 0.7rem;
  color: #8a6500;
  margin-top: 4px;
  max-width: 280px;
}

/* 狭いサイズ（300px 未満横幅）でのフォント縮小 */
.affiliate-slot-placeholder[data-slot-size*="120x"],
.affiliate-slot-placeholder[data-slot-size*="125x"],
.affiliate-slot-placeholder[data-slot-size*="160x"],
.affiliate-slot-placeholder[data-slot-size*="224x"],
.affiliate-slot-placeholder[data-slot-size*="234x"] {
  padding: 4px;
}
.affiliate-slot-placeholder[data-slot-size*="120x"] .affiliate-ph-size,
.affiliate-slot-placeholder[data-slot-size*="125x"] .affiliate-ph-size {
  font-size: 0.85rem;
}

/* 小さい高さ（60px 以下）での縦コンパクト化 */
.affiliate-slot-placeholder[data-slot-size$="x60"] .affiliate-ph-body,
.affiliate-slot-placeholder[data-slot-size$="x50"] .affiliate-ph-body,
.affiliate-slot-placeholder[data-slot-size$="x31"] .affiliate-ph-body,
.affiliate-slot-placeholder[data-slot-size$="x33"] .affiliate-ph-body {
  padding: 2px;
}
.affiliate-slot-placeholder[data-slot-size$="x60"] .affiliate-ph-size,
.affiliate-slot-placeholder[data-slot-size$="x50"] .affiliate-ph-size,
.affiliate-slot-placeholder[data-slot-size$="x31"] .affiliate-ph-size,
.affiliate-slot-placeholder[data-slot-size$="x33"] .affiliate-ph-size {
  font-size: 0.8rem;
  margin-bottom: 1px;
}
.affiliate-slot-placeholder[data-slot-size$="x60"] .affiliate-ph-slot,
.affiliate-slot-placeholder[data-slot-size$="x50"] .affiliate-ph-slot,
.affiliate-slot-placeholder[data-slot-size$="x31"] .affiliate-ph-slot,
.affiliate-slot-placeholder[data-slot-size$="x33"] .affiliate-ph-slot {
  font-size: 0.65rem;
}

/* ===== モバイル下部固定広告 (Sticky Bottom Ad) =====
   _affiliate_sticky_bottom.html から呼ばれる。モバイル幅でのみ表示し、
   画面下部中央に広告枠のみを浮かせて表示する（背景・枠・blur なし）。
   想定広告サイズ 310x60。 */
.aff-sticky-bottom {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 0;
  margin: 0;
  border: 0;
  max-width: calc(100vw - 16px);
}

@media (min-width: 769px) {
  .aff-sticky-bottom { display: none !important; }
}

.aff-sticky-bottom-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.aff-sticky-bottom-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

.aff-sticky-bottom-content {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* Sticky 内の広告枠は 310x60 固定。affiliate_slot のデフォルト
   margin (上下16px等) を打ち消して、ピッタリのサイズで配置する。 */
.aff-sticky-bottom-content .affiliate-slot,
.aff-sticky-bottom-content .affiliate-slot-placeholder {
  width: 310px !important;
  max-width: 100% !important;
  height: 60px !important;
  margin: 0 !important;
}

/* live モード時に <a><img></a> を置いた場合に画像も枠にフィットさせる */
.aff-sticky-bottom-content .affiliate-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Sticky の中ではバナー画像自体に広告主表記が含まれるため [PR] ラベルは
   省略する（60px 枠を画像でフルに使うため）。affiliate_macros 側の
   <div class="affiliate-label">[PR]</div> を非表示。 */
.aff-sticky-bottom-content .affiliate-label {
  display: none;
}

/* スティッキー広告がアクティブな間、フッターやコンテンツの下端が広告で
   隠れないよう body に padding-bottom を追加。閉じられたら JS 側で
   このクラスを外す。広告高さ 60 + bottom 8 + 余白 6 = 74px。 */
@media (max-width: 768px) {
  body.has-sticky-aff { padding-bottom: 74px; }
}
