/* Abumi ~ 鐙 ~ design v2
   Adapted from KAGE-UMA prototype, rebranded for static site usage.
   ─────────────────────────────────────────────────────────────────── */

:root {
  --bg: #ffffff;
  --bg-1: #f6f8fb;
  --bg-2: #eef2f7;
  --bg-3: #e3e9f1;
  --line: rgba(15,32,64,.10);
  --line-2: rgba(15,32,64,.18);
  --fg: #0f1f3d;
  --fg-dim: #4a5b7a;
  --fg-mute: #8896ad;
  --accent: #1d5ad8;
  --accent-fg: #ffffff;
  --accent-soft: #e7efff;
  --good: #1aa06b;
  --warn: #c98a00;
  --bad: #d23a4a;
  --gold: #b8860b;
  --navy: #0a2452;

  --f-display: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --f-sans: "Noto Sans JP", system-ui, sans-serif;
  --f-body: "Noto Sans JP", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 14.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt";
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* ─ Layout primitives ─ */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.container-wide { max-width: 1440px; }

/* ─ Header ─ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-display); font-weight: 900;
}
.brand-link { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-link:hover { color: var(--fg); }
.brand .glyph {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 4px;
  background: var(--accent); color: var(--accent-fg);
  font-family: var(--f-display); font-size: 18px; font-weight: 900;
  flex-shrink: 0;
}
.brand .glyph-img {
  width: 36px; height: 36px; border-radius: 4px;
  object-fit: contain; background: var(--navy);
  flex-shrink: 0; display: block;
}
.brand > div {
  display: flex; flex-direction: column; justify-content: center;
  gap: 3px; line-height: 1;
}
.brand .name { font-size: 19px; letter-spacing: .04em; line-height: 1; }
.brand .roman {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-mute); letter-spacing: .18em; font-weight: 500;
  text-transform: uppercase; line-height: 1;
}
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--fg-dim); cursor: pointer;
  font-family: var(--f-sans); font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: 6px;
  letter-spacing: .02em;
  transition: color .12s, background .12s;
}
.nav a:hover { color: var(--fg); background: var(--bg-1); }
.nav a.active { color: var(--fg); }
.nav a.active::after {
  content: ""; display: block; height: 2px; margin-top: 4px;
  background: var(--accent); border-radius: 1px;
}

/* ─ 検索ボックス ─ */
.search-wrap { position: relative; margin-left: auto; }
.search-wrap input {
  appearance: none; width: 180px; padding: 6px 10px;
  border: 1px solid var(--line-2); border-radius: 3px;
  background: var(--bg);
  font-family: var(--f-mono); font-size: 12px;
  color: var(--fg); outline: none;
  transition: width .15s, border-color .15s;
}
.search-wrap input:focus { width: 240px; border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--fg-mute); }
.search-results {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  min-width: 320px; max-height: 60vh; overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(15,32,64,.12);
  z-index: 100;
}
.search-results .sr-item {
  display: block; padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--fg); text-decoration: none;
  font-size: 13px; line-height: 1.4;
}
.search-results .sr-item:hover { background: var(--accent-soft); }
.search-results .sr-item .sub {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-mute);
  margin-top: 2px; letter-spacing: .04em;
}
.search-results .sr-empty {
  padding: 14px; text-align: center; color: var(--fg-mute); font-size: 12px;
}
@media (max-width: 880px) { .search-wrap { display: none; } }

/* ─ シェアボタン (ブランドカラー) ─ */
.share-row { display: flex; align-items: center; gap: 10px; margin: 12px 0 20px; flex-wrap: wrap; }
.share-row .share-label {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .18em;
  color: var(--fg-mute); margin-right: 2px;
}
.share-row .share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border: 0; border-radius: 4px;
  font-family: var(--f-sans); font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  letter-spacing: .04em;
  transition: transform .12s, opacity .12s, box-shadow .12s;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.share-row .share-btn:hover { transform: translateY(-1px); opacity: .92; box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.share-row .share-btn.x    { background: #000000; color: #ffffff; }
.share-row .share-btn.line { background: #06C755; color: #ffffff; }
.share-row .share-btn.copy { background: var(--bg-2); color: var(--fg); border: 1px solid var(--line-2); }
.share-row .share-btn.copy:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
@media (max-width: 560px) {
  .share-row .share-btn { padding: 8px 12px; font-size: 12px; }
  .share-row .share-btn span { display: none; }
  .share-row .share-btn svg { width: 18px; height: 18px; }
  .share-row .share-btn { padding: 9px 12px; }
}

.topbar-meta {
  margin-left: auto; display: flex; gap: 14px; align-items: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: .08em;
}
.topbar-meta .live {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
}
.topbar-meta .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 50%, transparent); }
  100% { box-shadow: 0 0 0 8px color-mix(in oklab, var(--accent) 0%, transparent); }
}

/* mobile hamburger (simple drawer) */
.m-toggle { display: none; appearance: none; border: 0; background: transparent;
  font-size: 22px; color: var(--fg); cursor: pointer; padding: 8px; margin-left: auto; }
.m-drawer { display: none; background: var(--bg-1); border-bottom: 1px solid var(--line); }
.m-drawer.open { display: block; }
.m-drawer a { display: block; padding: 12px 20px; border-bottom: 1px solid var(--line);
  color: var(--fg); font-weight: 500; }
.m-drawer a.active { color: var(--accent); background: var(--accent-soft); }

/* ─ Cards / panels ─ */
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: 4px; }
.panel-pad { padding: 24px; }

/* ─ Eyebrow / labels ─ */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 500;
  display: inline-block;
}
.eyebrow .bar {
  display: inline-block; width: 24px; height: 1px;
  background: currentColor;
  transform: translateY(-3px);
  margin-right: 10px;
}

/* ─ Hero ─ */
.hero {
  position: relative;
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
/* 背景: 青グラデ */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(70% 90% at 90% 10%, color-mix(in oklab, var(--accent) 14%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg) 100%);
  pointer-events: none;
}
/* 馬画像: 右側に配置、左→右フェード */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: url("../../hero-horse.jpg");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: cover;
  opacity: 0.32;
  filter: grayscale(70%) contrast(.95);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 28%, rgba(0,0,0,.6) 60%, #000 100%);
          mask-image: linear-gradient(90deg, transparent 0%, transparent 28%, rgba(0,0,0,.6) 60%, #000 100%);
  pointer-events: none;
}
@media (max-width: 880px) {
  .hero::after {
    background-position: center;
    opacity: 0.15;
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.7) 30%, transparent 75%);
            mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.7) 30%, transparent 75%);
  }
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px; align-items: end;
}
.hero h1 {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(48px, 6vw, 84px);
  line-height: 1.02;
  letter-spacing: -.01em;
  margin: 14px 0 16px;
  text-wrap: balance;
}
.hero h1 .accent { color: var(--accent); }
.hero h1 .stroke { -webkit-text-stroke: 1px var(--fg); color: transparent; }
.hero-sub { font-size: 15px; color: var(--fg-dim); max-width: 520px; line-height: 1.85; }
.hero-meta {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 36px;
}
.hero-meta > div { background: var(--bg); padding: 14px 16px; }
.hero-meta .k {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-mute); letter-spacing: .16em; text-transform: uppercase;
}
.hero-meta .v {
  font-family: var(--f-display); font-weight: 700;
  font-size: 22px; color: var(--fg); margin-top: 4px;
  font-feature-settings: "tnum";
}
.hero-meta .v .unit { font-size: 12px; color: var(--fg-mute); margin-left: 4px; font-family: var(--f-mono); font-weight: 500; }

/* hero-side: vertical strip */
.hero-side { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.stamp {
  border: 1px solid var(--line-2);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-1);
}
.stamp .num {
  font-family: var(--f-display); font-weight: 900;
  font-size: 28px; line-height: 1.15;
  color: var(--accent);
  font-feature-settings: "tnum";
}
.stamp .label {
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--fg-mute);
}
.stamp .desc { color: var(--fg-dim); font-size: 13px; }

/* ─ Section ─ */
.section { padding: 48px 0; border-bottom: 1px solid var(--line); }
.section:last-of-type { border-bottom: 0; }
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  margin-bottom: 22px; gap: 20px;
}
.section-head h2 {
  font-family: var(--f-display); font-weight: 900;
  font-size: 28px; line-height: 1.2; margin: 6px 0 0;
  letter-spacing: -.005em;
}
.section-head .h-meta {
  font-family: var(--f-mono); font-size: 11px;
  color: var(--fg-mute); letter-spacing: .14em;
}
.section-head a.h-meta { cursor: pointer; }
.section-head a.h-meta:hover { color: var(--accent); }

/* ─ Race cards (Top) ─ */
.race-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.race-card {
  background: var(--bg);
  padding: 24px 26px;
  cursor: pointer;
  position: relative;
  transition: background .15s;
  display: flex; flex-direction: column; gap: 14px;
  color: inherit;
}
.race-card:hover { background: var(--bg-1); color: inherit; }
.race-card .top-row { display: flex; align-items: center; gap: 10px; }
.grade-pill {
  font-family: var(--f-mono); font-weight: 700; font-size: 11px;
  letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--accent); color: var(--accent-fg);
}
.grade-pill.g2 { background: var(--gold); color: #1a1a1a; }
.grade-pill.g3 { background: var(--gold); color: #1a1a1a; }
.grade-pill.l, .grade-pill.op {
  background: transparent; color: var(--fg-dim);
  border: 1px solid var(--line-2);
}
.grade-pill.s3, .grade-pill.s2, .grade-pill.s1 {
  background: var(--bg-2); color: var(--fg);
}
.race-card .time {
  font-family: var(--f-mono); font-size: 12px; color: var(--fg-mute);
  letter-spacing: .04em; margin-left: auto;
}
.race-card h3 {
  font-family: var(--f-display); font-weight: 900;
  font-size: 30px; line-height: 1.1; margin: 0;
  letter-spacing: -.005em;
}
.race-card .course {
  font-family: var(--f-mono); font-size: 11.5px;
  color: var(--fg-dim); letter-spacing: .04em;
}
.race-card .tagline {
  color: var(--fg); font-size: 13.5px; line-height: 1.7;
  border-left: 3px solid var(--accent); padding-left: 12px;
  margin: 4px 0 8px;
}
.race-card .honmei {
  display: flex; align-items: center; gap: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.honmei-mark {
  font-family: var(--f-display);
  font-size: 28px; font-weight: 700; color: var(--accent);
  line-height: 1; width: 32px; text-align: center;
}
.honmei-num {
  font-family: var(--f-mono); font-size: 11px;
  color: var(--fg-mute); letter-spacing: .1em;
}
.honmei-name {
  font-family: var(--f-sans); font-weight: 700; font-size: 16px;
  color: var(--fg);
}
.honmei-arrow {
  margin-left: auto;
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: .1em;
  transition: transform .15s, color .15s;
}
.race-card:hover .honmei-arrow { color: var(--accent); transform: translateX(4px); }

.confidence { display: inline-flex; gap: 3px; align-items: center; }
.confidence span { width: 14px; height: 4px; background: var(--line-2); border-radius: 1px; }
.confidence span.on { background: var(--accent); }

/* ─ Race detail ─ */
.detail-hero { padding: 48px 0 36px; border-bottom: 1px solid var(--line); }
.breadcrumb {
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: .1em; margin-bottom: 24px;
  display: flex; gap: 8px; align-items: center;
}
.breadcrumb a { color: var(--fg-mute); cursor: pointer; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .4; }
.detail-hero h1 {
  font-family: var(--f-display); font-weight: 900;
  font-size: 64px; line-height: 1;
  margin: 8px 0 16px; letter-spacing: -.01em;
}
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 20px;
  font-family: var(--f-mono); font-size: 12px; color: var(--fg-dim);
  letter-spacing: .04em;
}
.detail-meta span strong { color: var(--fg); margin-left: 8px; font-weight: 500; }

/* ─ Marks table ─ */
.marks-wrap { overflow-x: auto; }
table.marks { width: 100%; border-collapse: collapse; font-family: var(--f-sans); }
table.marks th, table.marks td {
  padding: 10px 10px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; vertical-align: middle; line-height: 1.5;
}
table.marks th {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--fg-mute); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}
table.marks tr.row-honmei { background: var(--accent-soft); }
table.marks tr.row-honmei td:first-child { border-left: 2px solid var(--accent); }
table.marks .mark-cell {
  font-family: var(--f-display); font-weight: 700;
  font-size: 22px; line-height: 1; width: 36px;
  color: var(--fg);
}
table.marks tr.row-honmei .mark-cell { color: var(--accent); }
table.marks .num {
  font-family: var(--f-mono); font-weight: 700; font-size: 14px;
  width: 36px; text-align: center;
  background: var(--navy); color: #fff; border-radius: 2px; padding: 4px 0;
  display: inline-block; min-width: 30px;
}

/* ─ JRA 枠色 (馬番バッジ) ─ */
.uma {
  font-family: var(--f-mono); font-weight: 700; font-size: 13px;
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 3px;
  border: 1px solid transparent;
  font-feature-settings: "tnum";
}
.uma.lg { width: 34px; height: 34px; font-size: 15px; }
.uma.sm { width: 22px; height: 22px; font-size: 11px; }
.uma.waku-1 { background: #ffffff; color: #000; border-color: #111; }
.uma.waku-2 { background: #111111; color: #fff; }
.uma.waku-3 { background: #E60012; color: #fff; }
.uma.waku-4 { background: #0067C0; color: #fff; }
.uma.waku-5 { background: #FFE100; color: #000; border-color: #cfa800; }
.uma.waku-6 { background: #009A44; color: #fff; }
.uma.waku-7 { background: #F39800; color: #000; border-color: #c87400; }
.uma.waku-8 { background: #F4ACBE; color: #000; border-color: #c47a8b; }

/* ─ 想定脚質ドット (5走の脚質履歴) ─ */
.style-strip { display: inline-flex; gap: 2px; align-items: center; vertical-align: middle; }
.style-strip .sd {
  width: 14px; height: 14px; border-radius: 50%;
  font-family: var(--f-display); font-size: 9px; font-weight: 700;
  color: #fff; display: inline-grid; place-items: center; line-height: 1;
}
.style-strip .sd.nige  { background: #C62828; }
.style-strip .sd.sen   { background: #EF6C00; }
.style-strip .sd.sashi { background: #1565C0; }
.style-strip .sd.oi    { background: #7B1FA2; }
.style-strip .sd.empty { background: var(--line-2); }

.style-main {
  font-family: var(--f-display); font-weight: 700; font-size: 13px;
  letter-spacing: .04em;
}
.style-main.nige  { color: #C62828; }
.style-main.sen   { color: #EF6C00; }
.style-main.sashi { color: #1565C0; }
.style-main.oi    { color: #7B1FA2; }

/* ─ 想定位置取り図 ─ */
.position-map {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.position-map .lbl {
  font-family: var(--f-display); font-weight: 900; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.position-map > div:nth-last-child(2),
.position-map > div:last-child { border-bottom: 0; }
.position-map .lbl.nige  { color: #C62828; }
.position-map .lbl.sen   { color: #EF6C00; }
.position-map .lbl.sashi { color: #1565C0; }
.position-map .lbl.oi    { color: #7B1FA2; }
.position-map .row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  align-items: center;
}
.position-map .row .empty { color: var(--fg-mute); font-family: var(--f-mono); font-size: 12px; }
.position-map .row a { display: inline-flex; }

/* ─ 全馬比較テーブル v2 (otherhorses) ─ */
.fullgrid-wrap { overflow-x: auto; border: 1px solid var(--line); }
table.fullgrid {
  width: 100%; min-width: 880px; border-collapse: collapse;
  font-family: var(--f-sans);
}
table.fullgrid th, table.fullgrid td {
  padding: 8px 7px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; vertical-align: middle;
  white-space: nowrap; line-height: 1.4;
}
table.fullgrid th {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-mute); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
  border-bottom: 1px solid var(--line-2);
  background: var(--bg-1);
  position: sticky; top: 0; z-index: 1;
}
/* ソートUIの矢印 + ホバー */
table.sortable th[data-col] { cursor: pointer; user-select: none; }
table.sortable th[data-col]:hover { background: var(--bg-2); color: var(--fg); }
table.sortable th[data-col]::after {
  content: ""; display: inline-block;
  width: 0; height: 0; margin-left: 5px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  vertical-align: middle; opacity: .25;
  border-top: 5px solid currentColor;
}
table.sortable th.sorted { color: var(--accent); background: var(--accent-soft); }
table.sortable th.sorted::after { opacity: 1; }
table.sortable th[data-dir="asc"]::after {
  border-top: 0;
  border-bottom: 5px solid currentColor;
}
/* tbody zebra + hover */
table.fullgrid tbody tr:nth-child(even):not(.has-mark) { background: rgba(15,32,64,.02); }
table.fullgrid tbody tr:hover { background: var(--bg-2); }
table.fullgrid tbody tr.has-mark:hover { background: color-mix(in oklab, var(--accent-soft) 70%, var(--bg-2)); }
table.fullgrid tr.has-mark { background: var(--accent-soft); }
table.fullgrid tr.has-mark td:first-child { border-left: 2px solid var(--accent); }
table.fullgrid .mk { font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--fg); }
table.fullgrid tr.has-mark .mk { color: var(--accent); }
table.fullgrid .nm-cell { white-space: nowrap; max-width: 11em; overflow: hidden; text-overflow: ellipsis; }
table.fullgrid .nm { font-weight: 700; }
table.fullgrid .meta-cell { font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute); }
table.fullgrid .num-cell { font-family: var(--f-mono); font-feature-settings: "tnum"; text-align: right; }
table.fullgrid .grade-cell {
  display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1;
  min-width: 38px;
}
table.fullgrid .grade-cell .g {
  font-family: var(--f-display); font-weight: 900; font-size: 15px;
}
table.fullgrid .grade-cell .v {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-dim);
  font-feature-settings: "tnum"; font-weight: 500;
}
table.fullgrid .grade-cell.g-tokuyo .g, table.fullgrid .grade-cell.g-honmei .g { color: var(--bad); }
table.fullgrid .grade-cell.g-good .g { color: var(--warn); }
table.fullgrid .grade-cell.g-mid .g  { color: var(--fg-dim); }
table.fullgrid .grade-cell.g-bad .g  { color: var(--fg-mute); }

/* バッジ (穴 / 短1 / 短2 / ❓ 評価困難) */
.tag {
  display: inline-block; padding: 1px 5px; border-radius: 2px;
  font-family: var(--f-mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .04em; margin-left: 4px;
  vertical-align: middle;
}
.tag.anaba { background: var(--gold); color: #1a1a1a; }
.tag.short1 { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.tag.short2 { background: var(--accent); color: var(--accent-fg); }
.tag.unknown { background: var(--warn); color: #fff; }

/* ─ AXIS LEADERS (評価軸別 Top5) ─ */
.axis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.axis-card { background: var(--bg); padding: 18px 18px 14px; }
.axis-card .head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.axis-card .head .name {
  font-family: var(--f-display); font-weight: 900; font-size: 18px;
}
.axis-card .head .name.ability { color: var(--accent); }
.axis-card .head .name.kick    { color: var(--good); }
.axis-card .head .name.train   { color: var(--warn); }
.axis-card .head .name.sire    { color: var(--bad); }
.axis-card .head .desc {
  font-family: var(--f-mono); font-size: 10px; color: var(--fg-mute);
  letter-spacing: .06em;
}
.axis-card ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.axis-card ol li {
  display: grid;
  grid-template-columns: 18px 30px 1fr auto;
  gap: 8px; align-items: center;
  font-size: 12.5px;
}
.axis-card ol li .rk {
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  font-weight: 700; text-align: right;
}
.axis-card ol li .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.axis-card ol li .val {
  font-family: var(--f-mono); font-feature-settings: "tnum";
  font-weight: 700; font-size: 12px;
}
@media (max-width: 880px) {
  .axis-grid { grid-template-columns: repeat(2, 1fr); }
  .position-map { grid-template-columns: 50px 1fr; }
  .position-map .lbl { font-size: 18px; }
}

/* ─ Race: 観察セクション (信頼度 + 戦術 + 観察文章) ─ */
.reading-cards {
  display: grid; grid-template-columns: 1fr 1.6fr;
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.reading-card { background: var(--bg); padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.reading-card .rc-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.reading-card .rc-eyebrow {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--fg-mute); text-transform: uppercase; font-weight: 500;
}
.reading-card .rc-num {
  font-family: var(--f-display); font-weight: 900; font-size: 32px;
  color: var(--accent); line-height: 1;
}
.reading-card .rc-num .rc-den { font-size: 14px; color: var(--fg-mute); margin-left: 2px; }
.reading-card .rc-spread {
  font-family: var(--f-display); font-weight: 900; font-size: 20px;
  color: var(--accent); letter-spacing: .02em;
}
.reading-card .rc-body {
  display: flex; align-items: center; gap: 12px;
}
.reading-card .rc-tag {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-dim);
  letter-spacing: .12em; font-weight: 700;
}
.reading-card .rc-desc {
  font-size: 13px; color: var(--fg-dim); line-height: 1.75; margin: 0;
}
.reading-text {
  padding: 16px 20px;
  border-left: 2px solid var(--accent); background: var(--bg-1);
}
.reading-text .rt-eyebrow {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: .18em;
  color: var(--fg-mute); text-transform: uppercase; font-weight: 500;
  display: block; margin-bottom: 8px;
}
.reading-text p {
  font-size: 14.5px; line-height: 1.95; color: var(--fg);
  margin: 0;
}
@media (max-width: 880px) {
  .reading-cards { grid-template-columns: 1fr; }
}

/* ─ Top page: 的中レース テーブル (段ズレ抑制) ─ */
.archive-table.hits-table { table-layout: fixed; }
.archive-table.hits-table td, .archive-table.hits-table th {
  vertical-align: middle; line-height: 1.4;
}
.archive-table.hits-table .cell-vr { white-space: nowrap; }
.archive-table.hits-table .vr-text {
  font-family: var(--f-mono); font-weight: 700; color: var(--fg);
  font-feature-settings: "tnum"; font-size: 12px; letter-spacing: .02em;
}
.archive-table.hits-table .cell-grade { padding-right: 0; }
.archive-table.hits-table .cell-grade .grade-mini { margin-right: 0; }
.archive-table.hits-table .cell-race { overflow: hidden; }
.archive-table.hits-table .cell-race .race-name {
  font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.archive-table.hits-table .cell-honmei { overflow: hidden; }
.archive-table.hits-table .cell-honmei a {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
@media (max-width: 880px) {
  .archive-table.hits-table { table-layout: auto; min-width: 720px; }
}

/* ─ Top page: 開催日別の的中実績 ─ */
.recent-days { display: flex; flex-direction: column; gap: 32px; }
.recent-day {
  border: 1px solid var(--line);
  background: var(--bg);
}
.recent-day .day-head {
  display: flex; align-items: center; gap: 24px;
  padding: 16px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.recent-day .day-date {
  display: flex; flex-direction: column; gap: 3px;
}
.recent-day .day-date .date {
  font-family: var(--f-display); font-weight: 900; font-size: 20px;
  color: var(--fg); letter-spacing: .02em; line-height: 1;
}
.recent-day .day-date .meta {
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: .04em;
}
.recent-day .day-kpis {
  display: flex; gap: 24px; margin-left: auto;
}
.recent-day .day-kpis .kpi {
  display: flex; flex-direction: column; gap: 2px;
  align-items: flex-end; min-width: 64px;
}
.recent-day .day-kpis .lbl {
  font-family: var(--f-mono); font-size: 9.5px;
  color: var(--fg-mute); letter-spacing: .12em; text-transform: uppercase;
}
.recent-day .day-kpis .val {
  font-family: var(--f-display); font-weight: 900; font-size: 18px;
  color: var(--fg); font-feature-settings: "tnum"; line-height: 1.1;
}
@media (max-width: 560px) {
  .recent-day .day-head { gap: 12px; padding: 12px 14px; }
  .recent-day .day-kpis { gap: 14px; margin-left: 0; width: 100%; justify-content: space-between; }
  .recent-day .day-kpis .kpi { min-width: 0; }
  .recent-day .day-date .date { font-size: 16px; }
}

/* ─ Race ページの 2 列レイアウト: 左 TOC + 右 main ─ */
.race-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 0;
}
.race-main { min-width: 0; }
/* race-main 配下の section は左右 padding を抑える (race-layout 側で確保済) */
.race-main .section { padding: 36px 0; }
.race-main .section:first-child { padding-top: 0; }
.race-main .section .container { max-width: none; padding: 0; }

/* ─ アンカージャンプ時に topbar + racenav に潜らないようオフセット ─ */
html { scroll-padding-top: 220px; scroll-behavior: smooth; }
.section[id], [id^="h"], [id^="sec-"] { scroll-margin-top: 220px; }

.race-toc {
  position: sticky; top: 210px;  /* topbar(60) + racenav(~140 2段) + 余白 */
  align-self: start; height: max-content; max-height: calc(100vh - 240px); overflow-y: auto;
  font-family: var(--f-mono);
  border-left: 2px solid var(--line);
  padding: 8px 0 8px 16px;
}
.race-toc .toc-head {
  font-size: 9.5px; letter-spacing: .22em; color: var(--fg-mute);
  margin-bottom: 14px; text-transform: uppercase; font-weight: 500;
}
.race-toc ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.race-toc a {
  display: flex; align-items: baseline; gap: 8px;
  color: var(--fg-dim); text-decoration: none;
  font-size: 11px; padding: 4px 6px;
  border-radius: 2px;
  transition: color .12s, background .12s;
}
.race-toc a:hover { color: var(--accent); background: var(--accent-soft); }
.race-toc a.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.race-toc .num {
  font-weight: 700; color: var(--fg-mute); font-size: 10px;
  letter-spacing: .04em; min-width: 1.6em;
}
.race-toc a.active .num { color: var(--accent); }
.race-toc .lbl { font-weight: 500; }

@media (max-width: 880px) {
  .race-layout { grid-template-columns: 1fr; padding: 24px 20px 0; gap: 0; }
  .race-toc { display: none; }
}

/* ─ RESULT 用 bet table ─ */
table.result-bets {
  width: 100%; border-collapse: collapse; font-family: var(--f-sans);
  table-layout: fixed;
}
table.result-bets th, table.result-bets td {
  padding: 12px 12px; font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.result-bets th {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--fg-mute); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
  background: var(--bg-1);
  text-align: left;
}
table.result-bets td.num-cell {
  font-family: var(--f-mono); font-feature-settings: "tnum"; text-align: right;
}
table.result-bets tr.total-row { background: var(--bg-2); }
table.result-bets .bet-combos { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
table.result-bets .bet-combos .sep { color: var(--fg-mute); font-family: var(--f-mono); margin: 0 4px; }
table.result-bets .bet-combos .lbl {
  font-family: var(--f-mono); font-size: 9.5px; color: var(--fg-mute);
  background: var(--bg-2); padding: 1px 5px; border-radius: 2px;
  margin-right: 2px;
}
table.result-bets .uma { width: 22px; height: 22px; font-size: 11px; }
@media (max-width: 880px) {
  table.result-bets { table-layout: auto; min-width: 720px; }
  table.result-bets th, table.result-bets td { white-space: nowrap; }
  table.result-bets td:nth-child(2) { white-space: normal; }
}

/* ─ RESULT 折りたたみ ─ */
.result-details {
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}
.result-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px;
  background: var(--accent-soft);
  color: var(--fg);
  user-select: none;
}
.result-details > summary::-webkit-details-marker { display: none; }
.result-details .result-title {
  font-family: var(--f-display); font-weight: 700; font-size: 16px;
  letter-spacing: .02em;
}
.result-details .result-arrow {
  margin-left: auto; font-family: var(--f-mono); font-size: 12px;
  color: var(--accent); transition: transform .2s;
}
.result-details[open] .result-arrow { transform: rotate(180deg); }
.result-details .result-body { padding: 16px 20px 20px; }

/* ─ RACENAV · スクロール追従ナビ帯 ─ */
.racenav {
  position: sticky; top: 60px; z-index: 40;
  background: color-mix(in oklab, var(--accent-soft) 92%, white);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-2);
  box-shadow: 0 2px 6px rgba(15,32,64,.04);
  font-family: var(--f-mono); font-size: 11px;
  color: var(--fg); letter-spacing: .04em;
}
.racenav-inner {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 32px; flex-wrap: wrap;
}
.racenav .rn-date {
  color: var(--accent); text-decoration: none; font-weight: 700;
  padding: 0 4px;
}
.racenav .rn-date.dis { color: var(--fg-mute); cursor: default; }
.racenav .rn-date-cur {
  background: var(--accent-soft); color: var(--accent);
  padding: 3px 9px; border-radius: 3px;
  font-weight: 700;
}
.racenav .rn-home {
  background: var(--bg-1); color: var(--fg);
  padding: 3px 9px; border-radius: 3px;
  font-weight: 600; text-decoration: none;
}
.racenav .rn-home:hover { background: var(--bg-2); color: var(--accent); }
.racenav .rn-spacer { flex: 1; }
.racenav .rn-btn {
  background: var(--accent); color: var(--accent-fg);
  padding: 3px 10px; border-radius: 3px;
  font-weight: 700; text-decoration: none;
  white-space: nowrap;
}
.racenav .rn-btn:hover { background: var(--navy); }
.racenav .rn-btn.dis { background: var(--bg-2); color: var(--fg-mute); cursor: default; }
.racenav-jumps {
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px 32px 6px;
}
.racenav .rn-venue { display: flex; align-items: center; gap: 6px; }
.racenav .rn-venue-lbl {
  font-weight: 700; color: var(--accent);
  min-width: 2.4em; font-size: 10.5px;
}
.racenav .rn-rs { display: flex; gap: 2px; flex-wrap: wrap; }
.racenav .rn-r {
  display: inline-block;
  min-width: 2em; text-align: center;
  padding: 2px 5px;
  background: var(--bg); border: 1px solid var(--line-2);
  color: var(--fg); border-radius: 2px;
  font-weight: 700; text-decoration: none;
}
.racenav .rn-r:hover { background: var(--bg-2); color: var(--accent); border-color: var(--accent); }
.racenav .rn-r.cur {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
@media (max-width: 560px) {
  .racenav-inner { padding: 5px 14px; gap: 5px; font-size: 10.5px; }
  .racenav-jumps { padding: 2px 14px 5px; max-height: 90px; overflow-y: auto; }
  .racenav .rn-r { min-width: 1.8em; padding: 1px 4px; font-size: 10px; }
  .racenav .rn-btn, .racenav .rn-home, .racenav .rn-date-cur { font-size: 10px; padding: 2px 7px; }
}

/* ─ TRAINING · 調教タイム詳細 (要ログイン) ─ */
.train-lock {
  border: 1px dashed var(--line-2);
  padding: 32px 24px; text-align: center;
  background: var(--bg-1);
}
.train-lock .icon {
  font-family: var(--f-display); font-size: 28px; color: var(--fg-mute);
  margin-bottom: 8px;
}
.train-lock .msg {
  font-size: 13px; color: var(--fg-dim); margin-bottom: 16px;
  line-height: 1.7;
}
.train-lock input {
  appearance: none; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: 3px;
  font-family: var(--f-mono); font-size: 13px;
  width: 200px; background: var(--bg);
  color: var(--fg);
}
.train-lock input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.train-lock button {
  appearance: none; margin-left: 8px; padding: 8px 18px;
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 3px;
  font-family: var(--f-mono); font-weight: 700; font-size: 12px;
  letter-spacing: .08em; cursor: pointer;
}
.train-lock button:hover { background: var(--navy); }
.train-lock .err {
  margin-top: 10px; font-size: 11px; color: var(--bad);
  display: none; font-family: var(--f-mono);
}
.train-detail-wrap {
  display: none;
  border: 1px solid var(--line);
  overflow-x: auto;
}
table.train {
  width: 100%; min-width: 880px; border-collapse: separate; border-spacing: 0;
  font-family: var(--f-sans);
}
table.train th, table.train td {
  padding: 9px 10px; font-size: 12.5px;
  border-bottom: 1px solid var(--line);
}
table.train th {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-mute); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
  background: var(--bg-1);
  text-align: left;
}
table.train th.num-th, table.train td.num-cell { text-align: right; }
table.train td.num-cell { font-family: var(--f-mono); font-feature-settings: "tnum"; }
table.train .horse-cell {
  vertical-align: middle;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
table.train .horse-cell .nm { font-weight: 700; margin-left: 6px; }
/* 優秀タイム色付け */
table.train td.tc-exc  { background: color-mix(in oklab, var(--bad) 16%, transparent); color: var(--bad); font-weight: 700; }
table.train td.tc-good { background: color-mix(in oklab, var(--warn) 14%, transparent); color: var(--warn); font-weight: 700; }
/* 時計更新バッジ */
.imp-badge {
  display: inline-block; padding: 3px 9px; border-radius: 2px;
  font-family: var(--f-mono); font-weight: 700; font-size: 11px;
}
.imp-badge.major { background: var(--bad); color: #fff; }
.imp-badge.minor { background: color-mix(in oklab, var(--warn) 80%, transparent); color: #fff; }
.imp-sub { font-size: 10px; color: var(--fg-mute); margin-top: 2px; font-family: var(--f-mono); }
table.marks .name { font-weight: 700; font-size: 15px; color: var(--fg); letter-spacing: .02em; }
table.marks .meta { color: var(--fg-dim); font-family: var(--f-mono); font-size: 11px; margin-top: 2px; }
table.marks .odds { font-family: var(--f-mono); font-feature-settings: "tnum"; color: var(--fg); }
table.marks .pop { font-family: var(--f-mono); color: var(--fg-dim); font-size: 11px; letter-spacing: .04em; }
table.marks .comment { color: var(--fg); font-size: 13px; line-height: 1.75; max-width: 540px; }
/* 馬名リンクのホバー */
table.marks a:hover .name { color: var(--accent); }
/* オッズの強調 */
table.marks tr.row-honmei .odds { color: var(--accent); font-size: 16px; }

/* ─ Bet table ─ */
.bet-table { width: 100%; border-collapse: collapse; }
.bet-table th, .bet-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.bet-table th {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--fg-mute); letter-spacing: .12em;
  text-transform: uppercase; font-weight: 500;
}
.bet-table .type {
  font-family: var(--f-display); font-weight: 700; font-size: 16px;
  color: var(--fg);
}
.bet-table .combos {
  font-family: var(--f-mono); font-size: 13px; color: var(--fg);
  letter-spacing: .04em;
}
.bet-table .units {
  font-family: var(--f-mono); font-weight: 700;
  color: var(--accent);
}

/* ─ Reasoning ─ */
.reasoning { display: flex; flex-direction: column; gap: 14px; }
.reasoning .item {
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--bg-1);
  color: var(--fg-dim); font-size: 13.5px; line-height: 1.85;
  border-radius: 0 4px 4px 0;
}
.reasoning .item strong { color: var(--fg); font-weight: 700; }

/* ─ Exclude list ─ */
.exclude-list { border: 1px solid var(--line); }
.exclude-list .item { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.exclude-list .item:last-child { border-bottom: 0; }
.exclude-list .head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.exclude-list .x { font-family: var(--f-mono); color: var(--fg-mute); font-weight: 700; font-size: 14px; }
.exclude-list .num { font-family: var(--f-mono); font-size: 12px; color: var(--fg-mute); }
.exclude-list .name { font-weight: 700; }
.exclude-list .reason { color: var(--fg-dim); font-size: 13px; line-height: 1.7; padding-left: 24px; }

/* ─ Stats ─ */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
}
.stat {
  background: var(--bg);
  padding: 18px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat .label {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--fg-mute); letter-spacing: .16em; text-transform: uppercase;
}
.stat .value {
  font-family: var(--f-display); font-weight: 900;
  font-size: 32px; line-height: 1.05;
  color: var(--fg); margin-top: 6px;
  font-feature-settings: "tnum";
}
.stat.accent .value { color: var(--accent); }
.stat .delta {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--fg-mute); margin-top: 4px;
}
.stat .delta.up { color: var(--good); }
.stat .delta.down { color: var(--bad); }

/* ─ Archive table ─ */
.archive-table { width: 100%; border-collapse: collapse; font-family: var(--f-sans); }
.archive-table th, .archive-table td {
  padding: 10px 10px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px; line-height: 1.5;
}
.archive-table th {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-mute);
  letter-spacing: .12em; text-transform: uppercase; font-weight: 500;
}
.archive-table tbody tr { transition: background .12s; cursor: pointer; }
.archive-table tbody tr:hover { background: var(--bg-1); }
.archive-table tbody a { display: contents; color: inherit; }
.archive-table .date { font-family: var(--f-mono); color: var(--fg-mute); font-size: 12px; }
.archive-table .race-name { font-weight: 700; }
.archive-table .grade-mini {
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 2px; margin-right: 8px;
  letter-spacing: .04em;
}
.archive-table .grade-mini.g1 { background: var(--accent); color: var(--accent-fg); }
.archive-table .grade-mini.g2 { background: var(--gold); color: #1a1a1a; }
.archive-table .grade-mini.g3 { background: var(--bg-2); color: var(--fg); }
.archive-table .grade-mini.op, .archive-table .grade-mini.l { background: var(--bg-2); color: var(--fg-dim); }
.archive-table .units {
  font-family: var(--f-mono); font-weight: 700; font-feature-settings: "tnum";
}
.archive-table .units.up { color: var(--good); }
.archive-table .units.down { color: var(--bad); }
.archive-table .units.flat { color: var(--fg-mute); }
.archive-table .result.hit { color: var(--accent); font-weight: 700; }
.archive-table .result.miss { color: var(--fg-mute); }

/* archive filter chip-bar */
.filter-bar {
  display: flex; gap: 1px; background: var(--line);
  border: 1px solid var(--line); margin-bottom: 24px;
}
.filter-bar a {
  flex: 1; padding: 14px 0; text-align: center;
  background: var(--bg); color: var(--fg-dim);
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .14em; font-weight: 600; cursor: pointer;
  border-top: 2px solid transparent;
}
.filter-bar a.active {
  background: var(--bg-2); color: var(--fg);
  border-top: 2px solid var(--accent);
}
.filter-bar a .cnt { color: var(--fg-mute); margin-left: 6px; font-weight: 400; }

.filter-secondary {
  display: flex; align-items: center; gap: 10px;
  margin: -16px 0 20px;
  flex-wrap: wrap;
}
.filter-secondary select {
  appearance: none; padding: 7px 24px 7px 10px;
  border: 1px solid var(--line-2); border-radius: 3px;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%238896ad' d='M0 0h10L5 6z'/></svg>") no-repeat right 8px center;
  font-family: var(--f-mono); font-size: 12px; color: var(--fg);
  cursor: pointer;
}
.filter-secondary select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.filter-count {
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute);
  letter-spacing: .08em; margin-left: auto;
}

/* ─ Profile ─ */
.profile-hero {
  display: grid; grid-template-columns: 280px 1fr;
  gap: 56px; align-items: start;
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 280px; height: 280px;
  background:
    repeating-linear-gradient(45deg,
      var(--bg-2) 0px, var(--bg-2) 8px,
      var(--bg-1) 8px, var(--bg-1) 16px);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  position: relative;
  border-radius: 4px;
}
.avatar::after {
  content: "PORTRAIT"; position: absolute; bottom: 12px; right: 14px;
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: .2em; color: var(--fg-mute);
}
.avatar-mark {
  font-family: var(--f-display); font-weight: 900;
  font-size: 120px; color: var(--accent);
  line-height: 1;
}
.profile-hero h1 {
  font-family: var(--f-display); font-weight: 900;
  font-size: 56px; margin: 8px 0 12px; line-height: 1.05;
}
.profile-hero .tagline {
  font-size: 16px; color: var(--fg-dim); margin-bottom: 24px;
  border-left: 2px solid var(--accent); padding-left: 14px;
}
.profile-bio { color: var(--fg-dim); font-size: 14px; line-height: 1.95; max-width: 600px; }
.profile-style { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chip {
  font-family: var(--f-mono); font-size: 11px;
  padding: 6px 11px; border: 1px solid var(--line-2);
  color: var(--fg-dim); letter-spacing: .04em;
}

/* ─ Footer ─ */
footer.site-footer {
  margin-top: auto;
  padding: 40px 0 60px;
  border-top: 1px solid var(--line);
  color: var(--fg-mute);
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .08em;
}
footer.site-footer .footer-inner {
  display: flex; justify-content: space-between; gap: 40px;
  flex-wrap: wrap;
}
footer.site-footer .disclaimer {
  color: var(--fg-mute); font-family: var(--f-body);
  font-size: 11px; line-height: 1.8; max-width: 540px;
  letter-spacing: 0;
}

/* ─ Misc ─ */
.row { display: flex; gap: 12px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stack > * + * { margin-top: 14px; }

/* bar chart */
.bar-chart {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  max-width: 560px;
}
.bar-chart .col {
  background: var(--bg);
  padding: 18px 8px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 160px; justify-content: flex-end;
  position: relative;
}
.bar-chart .col .bar {
  width: 100%; background: var(--accent);
  transition: height .4s cubic-bezier(.2,.7,.3,1);
  position: relative;
}
.bar-chart .col .bar.under { background: var(--line-2); }
.bar-chart .col .bar::after {
  content: attr(data-val);
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-family: var(--f-mono); font-size: 11px; color: var(--fg);
  font-weight: 700;
}
.bar-chart .col .month {
  font-family: var(--f-mono); font-size: 10px; color: var(--fg-mute);
  letter-spacing: .04em;
}

/* tactical / venue-grid (kept from old, simplified to fit v2) */
.venue-grid {
  display: grid; gap: 6px; margin-top: 16px;
}
.venue-grid .grid-cell {
  display: block; background: var(--bg); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 10px 12px; cursor: pointer; transition: background .12s;
  min-height: 84px;
}
.venue-grid .grid-cell:hover { background: var(--bg-1); }
.venue-grid .grid-cell .top { display: flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-dim); margin-bottom: 4px; }
.venue-grid .grid-cell .title {
  font-family: var(--f-display); font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.venue-grid .grid-cell .sub { font-size: 11px; color: var(--fg-mute); }
.venue-grid .grid-cell.empty { background: var(--bg-1); border-style: dashed; border-left: 1px dashed var(--line-2); cursor: default; }
.venue-grid .top-marks-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 6px; padding-top: 5px;
  border-top: 1px dashed var(--line);
}
.venue-grid .top-mark {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--f-mono); font-size: 10px;
}
.venue-grid .top-mark .mk {
  font-family: var(--f-display); font-weight: 700; font-size: 14px; color: var(--accent);
  margin-right: 1px;
}
.venue-grid .top-mark .pop { color: var(--fg-mute); font-size: 9.5px; margin-left: 1px; }
.venue-grid .top-mark .uma { width: 20px; height: 20px; font-size: 10px; }
.venue-grid .vh {
  background: var(--accent); color: var(--accent-fg);
  font-family: var(--f-mono); font-weight: 700; padding: 8px;
  text-align: center; font-size: 12px; letter-spacing: .06em;
}
.venue-grid .vr {
  background: var(--bg-2); color: var(--fg);
  font-family: var(--f-mono); font-weight: 700; padding: 8px;
  text-align: center; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* Result badges on race card */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 2px;
  font-family: var(--f-mono); font-size: 10px; font-weight: 700;
  letter-spacing: .06em;
}
.badge.hit { background: var(--good); color: #fff; }
.badge.miss { background: var(--bg-2); color: var(--fg-mute); }
.badge.skip { background: var(--warn); color: #fff; }

/* ─ responsive: tablet (880px↓) ─ */
@media (max-width: 880px) {
  .container { padding: 0 20px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .race-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  /* 月次バーチャートは inline で repeat(6,1fr) 指定されているが、モバイルでも6本維持 */
  .bar-chart { gap: 1px; }
  .bar-chart .col { padding: 14px 6px 10px; min-height: 180px; }
  .bar-chart .col .bar::after { font-size: 9px; top: -18px; }
  .bar-chart .col .month { font-size: 9px; }
  /* grid-2 強制 1 列 (inline 1fr 1fr override も含む) */
  .grid-2 { grid-template-columns: 1fr !important; gap: 24px !important; }
  .profile-hero { grid-template-columns: 1fr !important; gap: 24px; }
  .profile-hero .avatar { width: 100%; max-width: 200px; height: 200px; }
  .avatar-mark { font-size: 80px; }
  .nav { display: none; }
  .m-toggle { display: inline-block; }
  .detail-hero h1 { font-size: 36px; }
  .topbar-meta { display: none; }
  .hero h1 { font-size: clamp(38px, 9vw, 52px); }
  .hero-meta { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 40px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-head h2 { font-size: 24px; }
  .topbar-inner { gap: 12px; padding: 0; }
  /* テーブル系: 横スクロールが明確に分かるよう右端に陰影 */
  .marks-wrap, .fullgrid-wrap, .train-detail-wrap {
    background:
      linear-gradient(90deg, var(--bg) 30%, transparent),
      linear-gradient(90deg, transparent, var(--bg) 70%) right,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.08), transparent),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), transparent) right;
    background-repeat: no-repeat;
    background-size: 20px 100%, 20px 100%, 8px 100%, 8px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  /* fullgrid: stickyを切る（モバイルではかえって邪魔） */
  table.fullgrid th { position: static !important; }
  /* axis grid 2x2 */
  .axis-grid { grid-template-columns: repeat(2, 1fr); }
  /* position-map */
  .position-map { grid-template-columns: 50px 1fr; }
  .position-map .lbl { font-size: 18px; }
  /* hero-side stamps */
  .stamp .num { font-size: 22px; }
}

/* ─ テーブル横スクロール強制 (狭幅でも cell が折り返さないように) ─ */
@media (max-width: 880px) {
  /* fullgrid は明示的に min-width で横スクロール */
  table.fullgrid { min-width: 980px; }
  table.fullgrid th, table.fullgrid td { white-space: nowrap; }

  /* 調教 */
  table.train { min-width: 880px; }
  table.train th, table.train td { white-space: nowrap; }

  /* 馬連・買い目 */
  .bet-table { min-width: 540px; }
  .bet-table th, .bet-table td { white-space: nowrap; }
  /* combos と note のみ折り返し許可 */
  .bet-table .combos { white-space: normal !important; }
  .bet-table td:last-child { white-space: normal !important; }

  /* archive 系: stats 内の月次表・G1表・券種表も同様に横スクロール */
  .archive-table { min-width: 640px; }
  .archive-table th, .archive-table td { white-space: nowrap; }
  /* 親 div に overflow-x:auto 補強 */
  .archive-table-wrap, [data-table-wrap], div[style*="overflow-x:auto"] {
    -webkit-overflow-scrolling: touch;
  }
}

/* ─ MARKS: スマホではカード形式に変換 ─ */
@media (max-width: 560px) {
  table.marks, table.marks thead, table.marks tbody,
  table.marks tr, table.marks th, table.marks td { display: block; }
  table.marks { border-collapse: separate; }
  table.marks thead { display: none; }
  /* td 列順: 1=印 / 2=馬番 / 3=馬名 / 4=騎手 / 5=想定脚質 / 6=オッズ / 7=コメント */
  table.marks tbody tr {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 12px 14px 14px;
    margin-bottom: 10px;
    background: var(--bg);
    display: grid;
    grid-template-columns: 40px 44px 1fr auto;
    grid-template-areas:
      "mark num  name odds"
      "jock jock spec spec"
      "comm comm comm comm";
    gap: 8px 10px;
    align-items: center;
  }
  table.marks tbody tr.row-honmei {
    background: var(--accent-soft);
    border-color: var(--accent); border-left-width: 3px;
  }
  table.marks tbody tr > td { border: 0; padding: 0; }
  table.marks tbody tr > td:nth-child(1) { grid-area: mark; font-size: 26px; text-align: center; }
  table.marks tbody tr > td:nth-child(2) { grid-area: num; }
  table.marks tbody tr > td:nth-child(3) { grid-area: name; }
  table.marks tbody tr > td:nth-child(4) { grid-area: jock; padding-top: 8px; border-top: 1px dashed var(--line); }
  table.marks tbody tr > td:nth-child(5) { grid-area: spec; padding-top: 8px; border-top: 1px dashed var(--line); text-align: right; }
  table.marks tbody tr > td:nth-child(6) { grid-area: odds; text-align: right; align-self: start; }
  table.marks tbody tr > td:nth-child(7) { grid-area: comm; padding-top: 10px; border-top: 1px solid var(--line); }
  table.marks .name { font-size: 15px; font-weight: 700; }
  table.marks .meta { font-size: 11px; color: var(--fg-dim); margin-top: 1px; }
  table.marks .comment { font-size: 12.5px; line-height: 1.7; max-width: none; }
  table.marks .odds { font-size: 18px !important; font-weight: 800; color: var(--accent); line-height: 1; }
  table.marks .pop { font-size: 10.5px; margin-top: 2px; }
}

/* ─ small phone (560px↓) ─ */
@media (max-width: 560px) {
  .container { padding: 0 14px; }
  .section { padding: 30px 0; }
  .section-head h2 { font-size: 20px; }
  .hero { padding: 36px 0 30px; }
  .hero h1 { font-size: clamp(32px, 10vw, 44px); }
  .hero-meta { grid-template-columns: repeat(2, 1fr); }
  .hero-meta .v { font-size: 18px; }
  .detail-hero { padding: 30px 0 24px; }
  .detail-hero h1 { font-size: 28px; }
  .detail-meta { gap: 10px; font-size: 11px; }
  /* stats-grid: 2x2 維持 */
  .stat { padding: 16px 14px; }
  .stat .value { font-size: 28px; }
  /* race-card */
  .race-card { padding: 18px 18px; }
  .race-card h3 { font-size: 24px; }
  /* venue grid: ヘッダ縮小 */
  .venue-grid .vh, .venue-grid .vr { font-size: 10px; padding: 6px 2px; }
  .venue-grid .grid-cell { padding: 6px 8px; min-height: 68px; }
  .venue-grid .grid-cell .title { font-size: 12px; }
  .venue-grid .grid-cell .sub { font-size: 10px; }
  .venue-grid .grid-cell .top { font-size: 10px; }
  /* archive table 列を一部隠す */
  .archive-table th:nth-child(5), .archive-table td:nth-child(5) { display: none; } /* 信頼度 */
  /* axis-grid 1列 */
  .axis-grid { grid-template-columns: 1fr; }
  /* MARKS table: コメント幅縮小・行内余白詰める */
  table.marks th, table.marks td { padding: 8px 6px; font-size: 12.5px; }
  table.marks .comment { font-size: 12px; max-width: none; }
  /* 月次バー: 6カラム狭すぎ → 3カラム×2行に */
  .bar-chart { grid-template-columns: repeat(3, 1fr) !important; }
  /* footer */
  footer.site-footer .footer-inner { flex-direction: column; gap: 16px; }
}

/* fade-in */
.fade-in { animation: fadeIn .35s ease-out both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
