
:root{
  /* ── ブランドカラー ── */
  --primary:#0f1d3a;          /* 濃紺 — ヘッダー・見出し */
  --primary-dark:#0a142a;
  --primary-light:#3e5a8f;
  --accent:#b91c1c;           /* 赤 — 重要・本日 */
  --accent-warm:#d97706;      /* 橙 — 注意・G1 */

  /* ── 背景・面 ── */
  --bg:#f4f6fa;
  --bg-soft:#fafbfd;
  --surface:#ffffff;
  --border:#e2e8f0;

  /* ── テキスト ── */
  --text:#0f172a;
  --text-2:#475569;
  --text-3:#94a3b8;

  /* ── セマンティック (状態色) ── */
  --success:#15803d;
  --success-bg:#dcfce7;
  --warn:#ea580c;
  --warn-bg:#ffedd5;
  --danger:#dc2626;
  --danger-bg:#fee2e2;
  --info:#0ea5e9;
  --info-bg:#e0f2fe;

  /* ── 評価記号パレット (◎○−▲✕) ── */
  --v-best:#15803d;           /* ◎ */
  --v-good:#65a30d;           /* ○ */
  --v-mid:#94a3b8;            /* − */
  --v-bad:#ea580c;            /* ▲ */
  --v-worst:#dc2626;          /* ✕ */

  /* ── チャート/アクセント 6色パレット ── */
  --c-indigo:#6366f1;
  --c-sky:#0ea5e9;
  --c-rose:#f43f5e;
  --c-amber:#f59e0b;
  --c-emerald:#10b981;
  --c-violet:#8b5cf6;

  /* ── 枠色 (JRA 標準) ── */
  --lane-1:#ffffff;  --lane-2:#1f2937;  --lane-3:#ef4444;  --lane-4:#2563eb;
  --lane-5:#facc15;  --lane-6:#15803d;  --lane-7:#ea580c;  --lane-8:#db2777;

  /* ── 暖色ハイライト (強調・注意・フィルタ・1着カード) ── */
  --hl-bg:#fef9c3;            /* 淡い黄の強調背景 */
  --hl-bg-soft:#fffbeb;       /* 最も淡い (グラデ開始用) */
  --hl-fill:#fef3c7;          /* 中間の黄 (hover・グラデ終点) */
  --hl-border:#facc15;        /* 黄の枠線・アクセント */
  --hl-strong:#f59e0b;        /* 強い琥珀 (★・矢印・アイコン) */
  --hl-text:#854d0e;          /* 暖色背景上の濃い文字 */
  --hl-text-deep:#422006;     /* 黄背景での最大コントラスト文字 */

  /* ── ゴールド (レース結果セクション) ── */
  --gold-bg:#fff8e1;          /* ゴールド淡背景 */
  --gold-fill:#fff5d6;        /* ゴールド背景グラデ終点 */
  --gold-border:#f3d77a;      /* ゴールド枠線 */
  --gold-text:#7a5c00;        /* ゴールド濃文字 */

  /* ── 着順メダル (1=金 2=銀 3=銅) ── */
  --medal-gold:#facc15;    --medal-gold-bg:#fde68a;
  --medal-silver:#94a3b8;  --medal-silver-bg:#cbd5e1;
  --medal-bronze:#fb923c;  --medal-bronze-bg:#fed7aa;

  /* ── 微細グレー (テーブル罫線) ── */
  --border-hair:#f0f3f8;      /* 最も淡い罫線 */

  /* ── タイポグラフィ ── */
  --font-sans:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,
              "Hiragino Sans","Noto Sans JP","Meiryo",sans-serif;
  --fs-xs:10.5px; --fs-sm:12px; --fs-base:14px;
  --fs-lg:16px;   --fs-xl:20px; --fs-2xl:26px; --fs-3xl:32px;
  --fw-normal:500; --fw-bold:700; --fw-black:900;

  /* ── 間隔スケール (4px 基準) ── */
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px;

  /* ── 角丸 ── */
  --radius-sm:8px; --radius:12px; --radius-lg:16px; --radius-pill:999px;

  /* ── 影 ── */
  --shadow-sm:0 1px 2px rgba(15,23,42,.05);
  --shadow-md:0 4px 12px rgba(15,23,42,.10);
  --shadow-lg:0 10px 30px rgba(15,23,42,.14);

  /* ── モーション ── */
  --transition:160ms ease;

  /* ヘッダー高 (sticky thead 用、JS が実測値で上書き) */
  --keiba-header-h:56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
ul, ol { padding-left: 1.4em; }
img, svg { max-width: 100%; }

/* ─── ヘッダー ─── */
.header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-size: 17px; font-weight: 800; letter-spacing: .02em;
         display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 22px; }
.back-btn {
  font-size: 12.5px; padding: 6px 12px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
}
@media (min-width: 720px) {
  .header { padding: 18px 24px; }
  .brand { font-size: 19px; }
}

/* ─── 本体 ─── */
.body { max-width: 980px; margin: 0 auto; padding: 14px 16px 24px; min-height: calc(100vh - 160px); }
@media (min-width: 720px) { .body { padding: 20px 24px 32px; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
@media (min-width: 720px) { .card { padding: 18px 22px; } }

/* ─── LP hero ─── */
.lp-hero {
  text-align: center;
  padding: 28px 14px 24px;
  background: linear-gradient(135deg, #0a142a 0%, #0f1d3a 60%, #1d2d52 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  margin: 8px 0 22px;
  position: relative; overflow: hidden;
}
.lp-hero::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(217,119,6,.25) 0%, transparent 70%);
}
.lp-hero-title { font-size: 28px; font-weight: 800; line-height: 1.25;
                 margin: 0 0 12px; letter-spacing: .02em; }
.lp-hero-accent { color: #f9c557; }
.lp-hero-sub {
  font-size: 14px; line-height: 1.7;
  color: rgba(255,255,255,.92);
  margin: 0 auto 18px; max-width: 540px;
  text-align: left;
}
@media (min-width: 720px) {
  .lp-hero { padding: 48px 24px 40px; margin: 16px 0 32px; }
  .lp-hero-title { font-size: 38px; }
  .lp-hero-sub { font-size: 16px; text-align: center; }
}
.lp-hero-sub b { color: #f9c557; font-weight: 700; }
.lp-hero-cta-row {
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  max-width: 360px; margin: 0 auto;
}
.lp-cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px; min-height: 48px;
  border-radius: 10px; font-weight: 700; font-size: 15px;
  text-decoration: none; transition: transform var(--transition), box-shadow var(--transition);
}
.lp-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.lp-cta-primary {
  background: #f9c557; color: #0f1d3a;
  box-shadow: 0 4px 14px rgba(249,197,87,.40);
}
.lp-cta-secondary {
  background: transparent; color: #fff;
  border: 1.5px solid rgba(255,255,255,.6);
}
@media (min-width: 720px) {
  .lp-hero-cta-row { flex-direction: row; max-width: 600px; }
  .lp-cta { flex: 1; }
}

.lp-section-title {
  font-size: 20px; font-weight: 700; color: var(--primary);
  margin: 28px 0 14px; padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}
@media (min-width: 720px) {
  .lp-section-title { font-size: 24px; margin: 36px 0 18px; }
}

.lp-strength-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .lp-strength-grid { grid-template-columns: 1fr 1fr; gap: 16px; } }
.lp-strength-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}
.lp-strength-icon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.lp-strength-name {
  font-size: 16px; font-weight: 700; color: var(--primary); margin: 0 0 8px;
}
.lp-strength-desc {
  font-size: 13.5px; line-height: 1.7; color: var(--text-2); margin: 0;
}
@media (min-width: 720px) {
  .lp-strength-card { padding: 22px 20px; }
  .lp-strength-name { font-size: 18px; }
  .lp-strength-desc { font-size: 14.5px; }
}

/* ─── 開催日リスト ─── */
.race-list { display: grid; gap: 10px; }
@media (min-width: 720px) { .race-list { grid-template-columns: 1fr 1fr; gap: 12px; } }
@media (min-width: 1100px) { .race-list { grid-template-columns: repeat(3,1fr); } }
.race-row {
  display: flex; align-items: center; padding: 16px 18px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: all var(--transition); font-size: 16px;
}
.race-row:hover {
  transform: translateY(-1px); box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}
.race-row.race-row-today {
  border-color: var(--accent); border-width: 2px;
  background: linear-gradient(135deg, #fff5f6 0%, #fff 60%);
  box-shadow: 0 4px 14px rgba(185,28,28,.18), var(--shadow-sm);
  position: relative; padding-top: 22px;
}
.race-row.race-row-today::before {
  content: "🔴 本日"; position: absolute; top: -10px; left: 14px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px;
}
.race-row.race-row-future {
  border-color: var(--primary-light);
  background: linear-gradient(135deg, #f5faff 0%, #fff 70%);
}
.race-row.race-row-done { opacity: 0.62; background: var(--bg-soft); }
.race-row.race-row-done:hover { opacity: 0.92; }

/* ─── 会場グリッド ─── */
.venue-grid {
  display: grid; grid-template-columns: repeat(2,1fr); gap: 10px;
}
@media (min-width: 520px) { .venue-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 720px) { .venue-grid { grid-template-columns: repeat(5,1fr); gap: 12px; } }
.venue-tile {
  background: linear-gradient(180deg, #fff 0%, #eef4fc 100%);
  border: 1px solid rgba(15,29,58,.08); border-radius: var(--radius);
  padding: 18px 6px; text-align: center;
  text-decoration: none; color: inherit;
  min-height: 88px;
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.venue-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.venue-tile-name { font-size: 18px; font-weight: 800; color: var(--primary); }
.venue-tile-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.venue-tile.no-data { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Open venues are highlighted; closed venues collapse into one small note. */
.venue-tile-open {
  background: linear-gradient(180deg, #fff 0%, #e0eaf9 100%);
  border-color: var(--primary-light);
}
.venue-tile-open .venue-tile-sub {
  color: var(--accent); font-weight: 700; font-size: 12px;
}
.venue-closed-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--text-2);
}
.venue-closed-icon { font-size: 18px; flex-shrink: 0; }
.venue-closed-text { line-height: 1.5; }
.venue-closed-text b { color: var(--text); font-weight: 700; }
.venue-tile.featured {
  border-color: var(--accent-warm); border-width: 2px;
  background: linear-gradient(180deg, var(--hl-bg) 0%, var(--hl-fill) 100%);
  position: relative;
}
.venue-tile.featured::before {
  content: "G1"; position: absolute; top: 6px; right: 6px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
}

/* ─── レース番号タブ ─── */
.race-num-grid {
  display: grid; grid-template-columns: repeat(6,1fr); gap: 8px;
  margin-bottom: 16px;
}
@media (min-width: 520px) { .race-num-grid { grid-template-columns: repeat(12,1fr); } }
.race-num-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 6px; text-align: center;
  text-decoration: none; color: var(--primary); font-weight: 700;
  font-size: 14px;
  transition: all var(--transition);
}
.race-num-tile:hover { background: var(--primary); color: #fff; }
.race-num-tile.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }

/* ─── 出走表（比較テーブル） ─── */
.compare-table-wrap {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  padding: 12px;
  margin-bottom: 14px;
}
.compare-table-head {
  display: flex; justify-content: space-between; align-items: baseline;
  flex-wrap: wrap; gap: 6px 12px; margin-bottom: 8px;
}
.compare-table-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.compare-table-sub { font-size: 11px; color: var(--text-3); }
.compare-table-scroll { overflow-x: auto; }
.ct-tab-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 6px 0 10px;
}
.ct-tab {
  flex: 0 0 auto;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  min-height: 32px;
}
.ct-tab:hover { background: var(--bg-soft); color: var(--primary); }
.ct-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(15,29,58,.25);
}
/* When tab filter is active, show an explicit banner so users know WHY
   some rows are missing. Tap the reset button to restore "両方".
   NOTE: explicit [hidden] rule needed because UA stylesheet's
   `[hidden]{display:none}` has lower specificity than our class rule. */
.ct-filter-banner {
  display: flex; align-items: center; gap: 8px;
  margin: -4px 0 10px;
  padding: 8px 12px;
  background: var(--hl-bg); border: 1px solid var(--hl-border);
  border-radius: 8px;
  font-size: 12px; color: var(--hl-text);
}
.ct-filter-banner[hidden] { display: none; }
.ct-tab-row[hidden] { display: none; }
.bottom-nav button[hidden],
.bottom-nav a[hidden] { display: none; }
.ct-filter-icon { font-size: 14px; flex-shrink: 0; }
.ct-filter-msg { flex: 1; font-weight: 600; }
.ct-filter-reset {
  flex-shrink: 0;
  padding: 4px 10px; min-height: 28px;
  background: var(--surface); border: 1px solid var(--hl-border);
  border-radius: 6px; font-size: 11px; font-weight: 700;
  color: var(--hl-text); cursor: pointer; font-family: inherit;
}
.ct-filter-reset:hover { background: var(--hl-fill); }
@media (min-width: 720px) {
  .ct-tab { font-size: 13px; padding: 8px 18px; }
}
/* table-layout:auto lets each column size to its min-width — important on
   mobile because 'fixed' was forcing all 15-18 horse columns to share the
   viewport width equally, squeezing text to overlap. With auto, content
   pushes the table wider and the wrapper scrolls horizontally. */
.compare-table {
  width: auto; min-width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-size: 11px; font-variant-numeric: tabular-nums;
  table-layout: auto;
}
.compare-table th, .compare-table td {
  text-align: center; padding: 4px 1px;
  border-bottom: 1px solid var(--border-hair);
  border-right: 1px solid var(--border-hair);
}
.compare-table th:last-child, .compare-table td:last-child { border-right: 0; }
.compare-table .ct-rowlabel {
  text-align: left; padding: 4px 6px; background: var(--bg-soft);
  color: var(--text-2); font-weight: 600; font-size: 10px;
  border-right: 1px solid var(--border);
  white-space: nowrap; width: 76px; min-width: 76px;
}
.compare-table thead .ct-rowlabel { background: var(--surface); }
/* Single combined thead row: souban badge + vertical name in one cell,
   fixed height to prevent wobble. Sticky so it stays at top while
   scrolling deep into the metric rows. */
.compare-table thead th {
  position: -webkit-sticky; position: sticky;
  top: var(--keiba-header-h, 56px);
  background: var(--surface); padding: 4px 2px; font-weight: 600;
  border-bottom: 2px solid var(--border); z-index: 6;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .10);
  vertical-align: top;
}
/* Combined horse-header cell: badge on top + vertical name below.
   Fixed height keeps all cells uniform — no wobble even when some
   names are missing (placeholder shows just "新馬" label). */
.compare-table .ct-th-horse {
  padding: 6px 4px 8px;
  width: 44px; min-width: 44px;
  height: 152px;
  background: var(--surface);
  overflow: hidden;
}
.compare-table .ct-th-stack {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px;
  height: 100%;
}
.compare-table .ct-souban-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-weight: 700; font-size: 13px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15) inset;
  flex-shrink: 0;
}
/* 馬名は JRA 公式紙面に倣い縦書き表示。text-orientation: mixed で
   日本語は正立、英数字のみ横倒し。 */
.compare-table .ct-thead-name {
  display: inline-block;
  font-size: 12px; font-weight: 700;
  color: var(--primary); text-decoration: none;
  padding: 4px 3px;
  background: rgba(15,29,58,.06); border-radius: 6px;
  line-height: 1.25;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-height: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: .04em;
}
.compare-table .ct-thead-name-empty {
  color: var(--text-3);
  background: transparent;
  font-weight: 500;
  font-size: 11px;
}
/* Data cells: fixed width matching header, so columns align nicely */
.compare-table tbody td:not(.ct-rowlabel) {
  width: 44px; min-width: 44px;
  padding: 5px 2px;
  font-size: 11px;
}
@media (min-width: 720px) {
  .compare-table { font-size: 13px; }
  .compare-table .ct-th-horse { width: 56px; min-width: 56px; padding: 8px 6px 10px; height: 180px; }
  .compare-table .ct-souban-badge { width: 32px; height: 32px; font-size: 15px; }
  .compare-table .ct-thead-name { font-size: 14px; max-height: 138px; letter-spacing: .05em; }
  .compare-table .ct-thead-name-empty { font-size: 13px; }
  .compare-table tbody td:not(.ct-rowlabel) {
    width: 56px; min-width: 56px;
    padding: 7px 3px;
    font-size: 13px;
  }
  .compare-table .ct-rowlabel { font-size: 12px; width: 100px; min-width: 100px; }
}
.compare-table .ct-section {
  background: linear-gradient(180deg, #f0f4fa 0%, #e7eef8 100%);
  text-align: left; padding: 4px 8px 4px 12px;
  font-size: 10.5px; font-weight: 700; color: var(--primary);
  letter-spacing: .03em; border-left: 4px solid var(--primary-light);
}
.compare-table .ct-cell-empty { color: var(--text-3); }

/* 枠色（JRA 公式: 1=白 2=黒 3=赤 4=青 5=黄 6=緑 7=橙 8=桃） */
/* JRA 公式の枠色。白文字のレーン (3-4,6-8) は単独だと WCAG AA を満たさない
   ため、輪郭シャドウで可読性を底上げ。色覚多様性ユーザー向けにも数字は
   常に併記されているので色だけが情報を運ぶことはない。 */
.lane-1 { background: var(--lane-1); color: var(--text); border: 1px solid var(--medal-silver-bg); }
.lane-2 { background: var(--lane-2); color: #fff; }
.lane-3 { background: var(--lane-3); color: #fff;
          text-shadow: 0 0 2px rgba(0,0,0,.55); }
.lane-4 { background: var(--lane-4); color: #fff;
          text-shadow: 0 0 2px rgba(0,0,0,.45); }
.lane-5 { background: var(--lane-5); color: var(--hl-text-deep); }
.lane-6 { background: var(--lane-6); color: #fff;
          text-shadow: 0 0 2px rgba(0,0,0,.55); }
.lane-7 { background: var(--lane-7); color: #fff;
          text-shadow: 0 0 2px rgba(0,0,0,.55); }
.lane-8 { background: var(--lane-8); color: #fff;
          text-shadow: 0 0 2px rgba(0,0,0,.55); }

/* ─── 結果セクション ─── */
.race-result-section {
  margin-top: 6px; margin-bottom: 14px; padding: 14px 16px;
  background: linear-gradient(135deg, var(--gold-bg) 0%, var(--gold-fill) 100%);
  border: 1px solid var(--gold-border); border-radius: var(--radius);
}
.rr-head { display: flex; align-items: baseline; justify-content: space-between;
           flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.rr-title { font-size: 15px; font-weight: 800; color: var(--gold-text); }
.rr-update { font-size: 11px; color: var(--gold-text); opacity: .8; }
.rr-podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
@media (min-width: 520px) {
  .rr-podium { grid-template-columns: repeat(6, 1fr); }
}
.rr-slot {
  background: var(--surface); border: 1px solid var(--gold-border);
  border-radius: 10px; padding: 10px 6px 8px; text-align: center;
}
.rr-slot.rr-rank-1 {
  background: linear-gradient(180deg, var(--hl-bg) 0%, var(--medal-gold-bg) 100%);
  border-color: var(--medal-gold);
  box-shadow: 0 4px 12px rgba(250,204,21,.25);
  transform: translateY(-3px);
}
.rr-slot.rr-rank-2 {
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--medal-silver-bg) 100%);
  border-color: var(--medal-silver);
}
.rr-slot.rr-rank-3 {
  background: linear-gradient(180deg, var(--hl-bg-soft) 0%, var(--medal-bronze-bg) 100%);
  border-color: var(--medal-bronze);
}
.rr-medal { font-size: 18px; }
.rr-rank-num { font-size: 11px; font-weight: 800; color: var(--text-3); }
.rr-souban-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-weight: 700; font-size: 12px; margin: 4px 0;
}
.rr-name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.rr-foot { margin-top: 10px; font-size: 11px; color: var(--gold-text); text-align: center; }

/* P1-1: 予想 vs 結果 透明性バッジ */
.rr-pred-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  margin-top: 12px; padding: 8px 10px;
  background: rgba(255,255,255,.7);
  border: 1px dashed var(--gold-border);
  border-radius: 8px;
  font-size: 11.5px;
}
.rr-pred-label { font-weight: 800; color: var(--gold-text); }
.rr-pred-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.rr-pred-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  border: 1px solid currentColor;
}
.rr-pred-mark { font-size: 12px; font-weight: 800; }
.rr-pred-hn { font-weight: 700; }
.rr-pred-result { opacity: .85; }
.rr-pred-hit  { background: var(--success-bg); color: #166534; border-color: #86efac; }
.rr-pred-near { background: var(--hl-fill); color: var(--hl-text); border-color: var(--hl-border); }
.rr-pred-miss { background: var(--danger-bg); color: #991b1b; border-color: #fca5a5; }
.rr-pred-summary {
  font-weight: 800; color: var(--gold-text); font-size: 11px;
  margin-left: auto;
  padding: 2px 8px; background: var(--hl-bg); border-radius: 4px;
}

/* ─── 払戻金 ─── */
.rr-payouts { margin-top: 14px; padding: 10px 12px;
              background: var(--surface); border: 1px solid var(--gold-border);
              border-radius: 10px; }
.rr-payouts-head { font-size: 13px; font-weight: 800; color: var(--gold-text);
                   margin-bottom: 8px; }
.po-row {
  display: grid; grid-template-columns: 60px 1fr auto auto;
  align-items: center; gap: 6px 10px; padding: 4px 0;
  font-size: 12.5px; border-bottom: 1px dashed rgba(122,92,0,.18);
}
.po-row-sub .po-type { visibility: hidden; }
.po-type { font-weight: 800; color: var(--gold-text); font-size: 11.5px; }
.po-combo { display: inline-flex; align-items: center; gap: 2px; }
.po-lane {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-weight: 700; font-size: 12px;
  border: 1px solid rgba(15,23,42,.12);
}
.po-sep { color: var(--text-3); font-weight: 700; font-size: 14px; }
.po-amt {
  font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: 13.5px; color: var(--text); text-align: right; min-width: 70px;
}
.po-amt.po-amt-high { color: var(--accent); }
.po-pop { font-size: 10.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; }

/* ─── スコアカード ─── */
.score-section { margin-top: 6px; margin-bottom: 14px; }
.score-section-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px 6px;
}
.score-section-title { font-size: 13px; font-weight: 700; color: var(--primary); }
.score-section-hint { font-size: 10.5px; color: var(--text-3); }
.score-cards-scroll {
  display: flex; gap: 10px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 0 12px;
}
.score-card {
  flex: 0 0 200px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  text-align: left; font-family: inherit; cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.score-card:hover, .score-card:focus-visible {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  outline: none;
}
.score-card:active { transform: translateY(0); }
/* Column flash highlight after score-card click. Both the souban TH and
   the name TH share the same data-hn so they pulse together. */
@keyframes ct-flash {
  0%   { background: var(--medal-gold-bg); }
  50%  { background: var(--hl-fill); }
  100% { background: var(--surface); }
}
.compare-table .ct-col-flash {
  animation: ct-flash 1.1s ease-out;
}
.score-card.sc-rank-1 {
  border-color: var(--medal-gold); border-width: 2px;
  background: linear-gradient(135deg, var(--hl-bg-soft) 0%, var(--hl-fill) 100%);
}
.score-card.sc-rank-2 { border-color: var(--medal-silver); }
.score-card.sc-rank-3 { border-color: var(--medal-bronze); }
.sc-rank-label {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; margin-bottom: 6px;
  background: var(--border); color: var(--text-2);
}
.sc-rank-1 .sc-rank-label { background: var(--medal-gold); color: var(--hl-text-deep); }
.sc-rank-2 .sc-rank-label { background: var(--medal-silver); color: #fff; }
.sc-rank-3 .sc-rank-label { background: var(--medal-bronze); color: #fff; }
.sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sc-lane {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-weight: 700; font-size: 13px;
}
.sc-name-block { line-height: 1.2; min-width: 0; }
.sc-name { font-size: 13px; font-weight: 700; }
.sc-meta { font-size: 10.5px; color: var(--text-3); }
.sc-scores { display: flex; align-items: baseline; gap: 6px; }
.sc-score-num { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
.sc-score-label { font-size: 10px; color: var(--text-3); font-weight: 700; }
.sc-score-gap {
  font-size: 10px; font-weight: 700;
  color: var(--text-3);
  margin-left: auto;
  padding: 1px 6px; border-radius: 4px;
  background: var(--bg-soft);
}
.sc-rank-1 .sc-score-gap { color: var(--hl-text); background: var(--hl-fill); }
.sc-bar-track {
  height: 6px; margin-top: 8px;
  background: var(--bg-soft); border-radius: 3px; overflow: hidden;
}
.sc-bar-fill {
  height: 100%; background: var(--primary-light);
  border-radius: 3px; transition: width 200ms ease;
}

/* ─── 想定ペースバッジ (race header) ─── */
.pace-badge {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px; padding: 8px 12px;
  border-radius: 10px; color: #fff;
}
.pace-badge-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,.20);
  font-weight: 800; font-size: 14px;
}
.pace-badge-label { font-weight: 800; font-size: 13px; }
.pace-badge-desc { font-size: 11px; opacity: .92; margin-left: auto; text-align: right; }

/* ─── 脚質バッジ (in compare table) ─── */
.ct-style {
  display: inline-block; padding: 1px 4px; border-radius: 4px;
  font-size: 10px; font-weight: 700; color: #fff;
}
.ct-style-逃げ  { background: #dc2626; }
.ct-style-先行  { background: #ea580c; }
.ct-style-差し  { background: #0d7034; }
.ct-style-追込  { background: #1d4ed8; }

/* ─── レース詳細ページ: ジャンプナビ + 読み方イントロ ─── */
.rd-jumpnav {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 14px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.rd-jumpnav a {
  display: inline-flex; align-items: center;
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.rd-jumpnav a:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
  transform: translateY(-1px);
}
@media (min-width: 720px) {
  .rd-jumpnav a { font-size: 13px; padding: 8px 14px; }
}
/* Section anchors offset so sticky header doesn't cover them on jump */
[id^="sec-"] { scroll-margin-top: 70px; }

.rd-intro {
  margin: 0 0 14px;
  padding: 0;
  background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.rd-intro summary {
  list-style: none; cursor: pointer;
  padding: 10px 14px;
  font-size: 13px; font-weight: 700;
  color: #0c4a6e;
}
.rd-intro summary::-webkit-details-marker { display: none; }
.rd-intro[open] summary { border-bottom: 1px solid #bae6fd; }
.rd-intro-body { padding: 10px 14px; font-size: 12.5px; color: var(--text); line-height: 1.7; }
.rd-intro-body p { margin: 4px 0; }
.rd-intro-body b { color: var(--primary); }

/* ─── 検索バー (Step2a) ─── */
.hdr-search-btn {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.30);
  color: #fff; font-size: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: auto;
}
.hdr-search-btn:hover { background: rgba(255,255,255,.30); }
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.65);
  z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 60px;
}
.search-overlay[hidden] { display: none; }
.search-modal {
  width: 100%; max-width: 600px; margin: 0 14px;
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15,23,42,.3);
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
}
.search-head {
  display: flex; gap: 6px; align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit;
  outline: none;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15,29,58,.1); }
.search-close {
  padding: 6px 12px; min-width: 36px; min-height: 36px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 700;
}
.search-results { padding: 8px; overflow-y: auto; flex: 1; }
.search-hint, .search-err {
  text-align: center; padding: 30px 10px;
  color: var(--text-3); font-size: 12.5px;
}
.search-hit {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px;
  text-decoration: none; color: var(--text);
  font-size: 13.5px;
}
.search-hit:hover, .search-hit.active { background: var(--bg-soft); }
.search-hit-type { font-size: 14px; flex-shrink: 0; }
.search-hit-name { font-weight: 700; color: var(--primary); }

/* ─── Twitter シェアボタン (Step2b) ─── */
.share-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 10px 0;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; min-height: 32px;
  background: #000; color: #fff;
  border: none; border-radius: 6px;
  font-size: 12px; font-weight: 700;
  text-decoration: none; font-family: inherit;
  transition: all 150ms;
}
.share-btn:hover { background: #1d2d52; transform: translateY(-1px); }
.share-btn-fav {
  background: var(--bg-soft); color: var(--text-2);
  border: 1px solid var(--border); cursor: pointer;
}
.share-btn-fav.faved {
  background: var(--hl-fill); color: var(--hl-text); border-color: var(--hl-strong);
}
.share-btn-fav:hover { background: var(--surface); box-shadow: var(--shadow-sm); }

/* ─── 本命3頭ヒーロー (Step1a) ─── */
.hero-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.hero-title { font-size: 14px; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.hero-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .hero-grid { grid-template-columns: repeat(3, 1fr); }
}
.hero-card {
  border-radius: 10px; padding: 12px 14px;
  position: relative; min-height: 130px;
  display: flex; flex-direction: column;
}
.hero-rank {
  position: absolute; top: -8px; left: 12px;
  padding: 2px 12px; border-radius: 4px;
  font-size: 11px; font-weight: 800;
}
.hero-head { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hero-fav {
  margin-left: auto; background: transparent; border: none;
  font-size: 22px; cursor: pointer; line-height: 1;
  color: var(--text-3); font-family: inherit; padding: 4px;
}
.hero-fav.faved { color: var(--hl-strong); }
.hero-fav:hover { transform: scale(1.15); }
.hero-name {
  font-size: 17px; font-weight: 800; color: var(--primary);
  text-decoration: none;
}
.hero-name:hover { text-decoration: underline; }
.hero-score-row {
  display: flex; align-items: baseline; gap: 6px;
  margin: 6px 0 4px;
}
.hero-score { font-size: 36px; font-weight: 800; line-height: 1; }
.hero-score-label { font-size: 11px; color: var(--text-3); font-weight: 700; }
.hero-reason {
  font-size: 11.5px; color: var(--text-2);
  margin: 4px 0 0; line-height: 1.5;
}
.hero-foot {
  font-size: 10px; color: var(--text-3); margin: 8px 0 0; text-align: center;
}
@media (min-width: 720px) {
  .hero-name { font-size: 19px; }
  .hero-score { font-size: 44px; }
  .hero-reason { font-size: 12.5px; }
}

/* ─── Smart View 属性バー (Step1b) ─── */
.sv-section { margin-top: 14px; }
.sv-scroll { overflow-x: auto; }
.sv-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px; min-width: 580px;
}
.sv-table th, .sv-table td {
  padding: 5px 6px; border-bottom: 1px solid var(--border-hair); text-align: center;
}
.sv-table th { background: #f8fafc; color: var(--text-2); font-size: 10.5px; font-weight: 700; }
.sv-table th:nth-child(2) { text-align: left; padding-left: 8px; }
.sv-table td:nth-child(2) { text-align: left; padding-left: 8px; }
.sv-name {
  font-weight: 700; color: var(--primary); white-space: nowrap;
  text-decoration: none;
}
.sv-name:hover { text-decoration: underline; }
.sv-composite {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 24px; border-radius: 4px;
  color: #fff; font-weight: 800; font-size: 12px;
  text-shadow: 0 0 2px rgba(0,0,0,.4);
}
.sv-bar-cell { width: 80px; }
.sv-bar-wrap {
  background: #f1f5f9; height: 18px; border-radius: 3px;
  overflow: hidden;
}
.sv-bar {
  height: 100%; transition: width 200ms;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 4px;
  color: #fff; font-size: 10px; font-weight: 800;
  text-shadow: 0 0 2px rgba(0,0,0,.4);
}
.sv-empty {
  color: var(--text-3); font-size: 10px; line-height: 18px;
  text-align: center;
}

/* ─── 出走表セル内ブレットグラフ (Step1c) ─── */
.bg-bullet {
  position: relative; display: block;
  height: 20px;
  background: linear-gradient(90deg, var(--danger-bg) 0%, var(--hl-bg) 50%, var(--success-bg) 100%);
  border-radius: 3px; overflow: hidden;
  min-width: 50px;
}
.bg-bullet-fill {
  position: absolute; left: 0; top: 3px; bottom: 3px;
  background: var(--primary);
  border-radius: 2px;
}
.bg-target {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #0f172a;
}
.bg-bullet-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800;
  color: #0f172a;
  text-shadow: 0 0 3px rgba(255,255,255,.9);
}

/* ─── 段階的開示 fold (Step1d) ─── */
.rd-fold {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.rd-fold summary {
  list-style: none; cursor: pointer;
  padding: 14px 16px;
  font-weight: 700; color: var(--primary);
  font-size: 14px;
  user-select: none;
}
.rd-fold summary::-webkit-details-marker { display: none; }
.rd-fold[open] summary { border-bottom: 1px solid var(--border); }
.rd-fold summary::after {
  content: " ▼"; font-size: 10px;
  float: right; color: var(--text-3);
}
.rd-fold[open] summary::after { content: " ▲"; }
.rd-fold-body { padding: 12px 16px; }
/* Override the .card margin within fold so inner sections collapse cleanly */
.rd-fold-body > .card,
.rd-fold-body > section.card { margin-bottom: 0; box-shadow: none; border: none; padding: 0; }

/* ─── メタ予想評価カード (Phase 3) ─── */
.meta-section { margin-top: 14px; }
.meta-list { display: flex; flex-direction: column; gap: 6px; }
.meta-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.meta-card[open] { background: #fff; box-shadow: var(--shadow-sm); }
.mc-summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  flex-wrap: wrap;
}
.mc-summary::-webkit-details-marker { display: none; }
.mc-name {
  font-weight: 700; color: var(--primary); font-size: 13px;
  flex: 1; min-width: 80px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-grade {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  color: #fff; font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.mc-strip {
  display: inline-flex; gap: 1px;
  flex-shrink: 0;
}
.mc-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; font-weight: 800; font-size: 12px;
}
.mc-body {
  padding: 4px 10px 10px;
  border-top: 1px dashed var(--border);
}
.mc-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-hair);
}
.mc-row:last-child { border-bottom: none; }
.mc-axis {
  width: 116px; flex-shrink: 0;
  font-weight: 600; color: var(--text-2);
}
.mc-verdict {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 5px;
  color: #fff; font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.mc-reason {
  flex: 1; color: var(--text); line-height: 1.4;
  font-size: 11.5px;
}
@media (min-width: 720px) {
  .mc-name { font-size: 14px; }
  .mc-mark { width: 20px; font-size: 14px; }
  .mc-row { font-size: 13px; }
  .mc-axis { width: 130px; }
}

/* ─── 条件フィルタ (J3) ─── */
.cond-filter-section { margin-top: 14px; }
.cond-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.cond-chip {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer; font-family: inherit;
  transition: all 150ms;
  white-space: nowrap;
}
.cond-chip:hover { border-color: var(--primary-light); }
.cond-chip.on {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(15,29,58,.25);
}
.cond-actions {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.cond-status {
  font-size: 12px; color: var(--text-2); flex: 1;
}
.cond-status b { color: var(--primary); font-size: 14px; }
.ctl-btn-light {
  padding: 4px 10px; min-height: 28px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; font-size: 11px; font-weight: 600;
  color: var(--text-2); cursor: pointer; font-family: inherit;
}
.ctl-btn-light:hover { background: var(--surface); }
.cond-list { display: flex; flex-direction: column; gap: 3px; }
.cond-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: all 200ms;
}
.cond-row.matched {
  background: linear-gradient(90deg, var(--hl-fill) 0%, transparent 100%);
  box-shadow: 0 0 0 1px var(--hl-strong) inset;
}
.cond-row.dimmed { opacity: 0.30; }
.cond-name {
  font-weight: 700; color: var(--primary);
  font-size: 13px; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cond-cells { display: inline-flex; gap: 3px; }
.cond-cell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 5px;
  font-weight: 800; font-size: 12px;
  text-shadow: 0 0 2px rgba(0,0,0,.4);
}

/* ─── フォームチャート (β設計, UX改善後) ─── */
.fc-section { margin-top: 14px; }
.fc-chart-wrap {
  background: var(--bg-soft); border-radius: 8px;
  padding: 4px;
  overflow-x: auto;
}
.fc-svg { width: 100%; height: auto; display: block; min-width: 360px; }
.fc-line { transition: stroke-width 160ms, opacity 160ms; cursor: pointer; }
.fc-line:hover { stroke-width: 4; }
.fc-line.faded, .fc-outline.faded { opacity: 0.15; }
.fc-line.active { stroke-width: 4.5; }
.fc-outline.faded { opacity: 0.10; }
.fc-outline.active { stroke-width: 6; }
.fc-dot { cursor: pointer; transition: opacity 160ms, r 160ms; }
.fc-dot.faded { opacity: 0.20; }
.fc-dot:hover { r: 7; }
.fc-legend {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.fc-leg {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--text); cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.fc-leg:hover { background: #fff; box-shadow: var(--shadow-sm); }
.fc-leg.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(15,29,58,.25);
}
.fc-leg.active .ct-souban-badge {
  box-shadow: 0 0 0 2px #fff inset;
}
.fc-leg.faded { opacity: 0.40; }
.fc-leg .ct-souban-badge { width: 20px; height: 20px; font-size: 11px; }
.fc-leg-name {
  max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 720px) {
  .fc-leg { font-size: 12px; padding: 5px 10px; }
  .fc-leg .ct-souban-badge { width: 22px; height: 22px; font-size: 12px; }
  .fc-leg-name { max-width: 140px; }
}

/* ─── ローテーションリボン (Design A) ─── */
.rr-rib-section { margin-top: 14px; }
.rr-rib-list { display: flex; flex-direction: column; gap: 14px; }
.rr-rib-row {
  display: flex; align-items: stretch; gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.rr-rib-row:first-child { border-top: none; padding-top: 0; }
.rr-rib-head {
  display: flex; align-items: center; gap: 8px;
  min-width: 130px; flex-shrink: 0;
}
@media (max-width: 720px) {
  .rr-rib-head { min-width: 100px; }
}
.rr-rib-name {
  font-weight: 700; font-size: 12.5px; color: var(--primary);
  line-height: 1.2;
}
.rr-rib-tiles {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.rr-rib-tile {
  display: flex; flex-direction: column; align-items: center;
  width: 74px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 3px 4px;
  font-size: 10.5px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.rr-rib-tile-current {
  background: linear-gradient(135deg, var(--hl-fill) 0%, var(--hl-bg-soft) 100%);
  border: 2px solid var(--hl-strong);
  box-shadow: 0 2px 8px rgba(245,158,11,.25);
}
.rr-rib-date {
  font-size: 9.5px; color: var(--text-3); line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.rr-rib-venue {
  font-size: 10px; color: var(--text-2); font-weight: 600;
  margin: 1px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.rr-rib-dist {
  font-size: 10.5px; font-weight: 700; color: var(--primary);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.rr-rib-goal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-weight: 800; font-size: 13px;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  padding: 0 2px;
}
.rr-rib-goal-q {
  background: var(--hl-border); color: var(--hl-text-deep); font-size: 11px;
}
.rr-rib-jockey {
  font-size: 10px; color: var(--text-2);
  font-family: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 68px;
  margin-top: 1px;
}
.rr-rib-jockey-label {
  display: inline-block;
  font-size: 8.5px; color: #fff; background: var(--text-3);
  padding: 0 3px; border-radius: 3px; margin-right: 2px;
  vertical-align: middle;
  font-weight: 700;
}
.rr-rib-sep {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; flex-shrink: 0; padding: 0 2px;
  gap: 2px;
}
.rr-rib-sep-cur { width: 56px; }
.rr-rib-arrow {
  font-size: 22px; font-weight: 800; color: var(--hl-strong); line-height: 1;
}
.rr-rib-change {
  font-size: 9.5px; color: #b91c1c; font-weight: 800;
  white-space: nowrap; line-height: 1.1;
}
.rr-rib-keep {
  font-size: 9px; color: var(--text-3); font-weight: 500;
  line-height: 1.1;
}
.rr-rib-distdiff {
  font-size: 9.5px; color: var(--text-2); font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── 過去5走セクション ─── */
.past-runs-section { margin-top: 14px; }
.past-runs-grid { display: grid; gap: 8px; }
@media (min-width: 720px) { .past-runs-grid { grid-template-columns: 1fr 1fr; } }
.past-runs-card {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.past-runs-card[open] { background: #fff; box-shadow: var(--shadow-sm); }
.prc-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  list-style: none;
}
.prc-summary::-webkit-details-marker { display: none; }
.prc-name { font-weight: 700; color: var(--primary); flex: 1; }
.prc-count { font-size: 11px; color: var(--text-3); }
.prc-table-wrap { padding: 0 8px 10px; overflow-x: auto; }
.prc-table {
  width: 100%; border-collapse: collapse; font-size: 11.5px;
  background: var(--surface);
}
.prc-table th, .prc-table td {
  padding: 4px 6px; text-align: center;
  border-bottom: 1px solid var(--border-hair);
}
.prc-table th { background: var(--bg-soft); color: var(--text-2); font-weight: 700; font-size: 10.5px; }
.prc-table td.pr-goal { font-weight: 700; }
.prc-table tr.pr-win { background: linear-gradient(90deg, var(--hl-bg-soft) 0%, var(--hl-bg) 100%); }
.prc-table tr.pr-win td.pr-goal::before { content: "🥇 "; }
.prc-table tr.pr-podium td.pr-goal::before { content: "🏅 "; }
.sc-rank-1 .sc-bar-fill { background: var(--hl-strong); }
.sc-rank-2 .sc-bar-fill { background: #64748b; }
.sc-rank-3 .sc-bar-fill { background: #f97316; }

/* ─── ボトムナビ ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a, .bottom-nav button {
  flex: 1; padding: 8px 4px 10px; text-align: center; font-size: 11px;
  color: var(--text-2); background: none; border: none; cursor: pointer;
  text-decoration: none; min-height: 56px;
  font-family: inherit;
}
.bottom-nav a:hover, .bottom-nav button:hover { color: var(--primary); }
.bottom-nav a.nav-on { color: var(--primary); position: relative; }
.bottom-nav a.nav-on::before { content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 3px; background: var(--primary); border-radius: 0 0 3px 3px; }
.bottom-nav .nav-icon { display: block; font-size: 22px; margin-bottom: 4px; }
.bottom-nav .nav-label { display: block; font-size: 11px; font-weight: 600; }

/* ─── フッター ─── */
.footer {
  background: var(--bg-soft); border-top: 1px solid var(--border);
  margin-top: 30px; padding: 22px 16px 90px;
  font-size: 12.5px; color: var(--text-2); line-height: 1.7;
}
.footer-title { font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.footer ul { margin: 0; padding-left: 1.4em; }
.footer li { margin: 4px 0; }
@media (min-width: 720px) { .footer { padding: 26px 22px 90px; } }

/* ─── ガイド記事 ─── */
.guide-intro { padding: 16px; margin-bottom: 18px; }
.guide-intro p { font-size: 14px; line-height: 1.8; color: var(--text-2); margin: 0; }
.guide-list { display: grid; gap: 12px; }
@media (min-width: 720px) { .guide-list { grid-template-columns: 1fr 1fr; gap: 16px; } }
.guide-card {
  display: block; padding: 18px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.guide-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.guide-card-title { font-size: 16px; font-weight: 700; color: var(--primary); margin: 0 0 8px; line-height: 1.45; }
.guide-card-desc { font-size: 13px; line-height: 1.7; color: var(--text-2); margin: 0 0 10px; }
.guide-card-cta { font-size: 13px; font-weight: 700; color: var(--accent); }

.guide-article { max-width: 720px; margin: 0 auto; }
.guide-lead {
  font-size: 15px; line-height: 1.85; color: var(--text);
  background: var(--bg-soft); border-left: 4px solid var(--accent);
  padding: 14px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 8px 0 24px;
}
.guide-h2 {
  font-size: 18px; font-weight: 700; color: var(--primary);
  margin: 28px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
}
.guide-h3 { font-size: 15px; font-weight: 700; color: var(--primary); margin: 18px 0 8px; }
.guide-p { font-size: 14.5px; line-height: 1.85; color: var(--text); margin: 0 0 12px; }

/* ─── 馬個別ページ ─── */
.horse-profile-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (min-width: 520px) { .horse-profile-grid { grid-template-columns: repeat(4, 1fr); } }
.horse-profile-cell {
  background: var(--bg-soft); padding: 10px; border-radius: var(--radius-sm);
  text-align: center;
}
.horse-profile-cell .num { font-size: 22px; font-weight: 800; color: var(--primary); }
.horse-profile-cell .lbl { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ─── 共通バッジ ─── */
.badge {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
}
.badge.badge-g1 { background: var(--accent); color: #fff; }
.badge.badge-g2 { background: #d97706; color: #fff; }
.badge.badge-g3 { background: #16a34a; color: #fff; }
.badge.badge-grade { background: var(--primary); color: #fff; }
