/* KEIRIN HEX のレースのページ（/races/）。site.css の上に重ねる。色は site.css の変数（明るい配色 10/16）。外部読み込みなし・インラインの style は使わない（CSP）。 */
.top { display: flex; align-items: center; justify-content: space-between; }
.topnav { color: var(--text); text-decoration: none; font-size: .9rem; border: 1px solid var(--ui); border-radius: 999px; padding: 2px 14px; }
main.race { max-width: 880px; }
.crumb { font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.crumb a { color: var(--muted); }
.crumb span { margin: 0 6px; }
.crumb .here { margin: 0; }
.race h1 { font-size: 1.45rem; margin: 4px 0 8px; }
.race h1 .h1d { display: block; margin-top: 2px; font-size: .62em; font-weight: 400; line-height: 1.5; color: var(--muted); }
.race h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.cupline { margin: 0; color: var(--muted); font-size: .9rem; }
.cupname { margin-left: 8px; }
p.cupname { margin: 2px 0 6px; color: var(--muted); font-size: .85rem; }
.grade {
  display: inline-block;
  min-width: 2.2em;
  text-align: center;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.6;
  border: 1px solid var(--amber);
  color: var(--amber);
  border-radius: 6px;
  padding: 0 6px;
  vertical-align: middle;
}
.g-g3 { background: var(--red); border-color: var(--red); color: #fff; }

/* レースの数字（場・級・種別・発走など） */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0 14px; }
.facts div { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(31, 26, 28, .06); padding: 4px 8px; min-width: 0; }
.facts dt { font-size: .72rem; color: var(--muted); line-height: 1.5; }
.facts dd { margin: 0; font-weight: 700; font-size: .95rem; line-height: 1.4; font-variant-numeric: tabular-nums; }

/* 前後のレースへ */
.racenav { margin: 12px 0; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.prevnext a { color: var(--amber); font-weight: 700; text-decoration: none; padding: 6px 0; }
.rnos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rnos a, .rnos .off {
  display: block;
  min-width: 2.9em;
  text-align: center;
  border: 1px solid var(--ui);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  color: var(--text);
}
.rnos .off { color: var(--muted); opacity: .5; }
.rnos a.now { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }

/* ページ内の移動の帯（狭い画面だけ. 1280px 以上は wide.css が隠す）: JS なしの #アンカーで 印・並び・展開・出走表 へ. 中身は全部ページにある */
.jump { display: flex; margin: 6px 0 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); overflow: hidden; }
.jump a { flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 3px; border-left: 1px solid var(--line); color: var(--text); font-size: .88rem; font-weight: 700; text-decoration: none; }
.jump a:first-child { border-left: 0; }
.jump a::after { content: "↓"; color: var(--amber); font-size: .8em; }
:target { scroll-margin-top: 8px; }

/* 見どころ */
.points { margin: 6px 0; padding-left: 1.2em; }
.points li { margin: 4px 0; }

/* 車番の色札: 1 白・2 黒・3 赤・4 青・5 黄・6 緑・7 橙・8 桃・9 紫 */
.car {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 7px;
  font-weight: 800;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(31, 26, 28, .35);
}
.c0 { background: var(--bg2); color: var(--text); border-color: var(--line); }
.c1 { background: #fff; color: #111; }
.c2 { background: #111; color: #fff; border-color: #8a8a8a; }
.c3 { background: #e53935; color: #fff; }
.c4 { background: #1e6fe0; color: #fff; }
.c5 { background: #f6d60a; color: #111; }
.c6 { background: #1fa04b; color: #fff; }
.c7 { background: #f28c1e; color: #111; }
.c8 { background: #f49ac2; color: #111; }
.c9 { background: #7b4bc4; color: #fff; }

/* 並び */
.label { margin: 0 0 8px; color: var(--muted); font-size: .85rem; }
.lines, .inits, .marklist, .finlist { list-style: none; margin: 0; padding: 0; }
/* 結果（1 着の行があるレースだけ）: 節の頭の 1 文・着・車番・名前・前の晩の印 */
.rsum { margin: 0 0 10px; line-height: 1.7; }
.fin { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fin .pos { flex: 0 0 2.8em; font-weight: 700; }
.fin .mk { margin-left: auto; font-size: 1.1rem; font-weight: 700; }
/* 展開シミュレーションの動画（前の晩に作った 1 レース 1 本. 正方形 720×720. 幅いっぱい・最大 560px. 表紙の jpg が読み込まれるまでは薄い面） */
.simvid-v { display: block; width: 100%; max-width: 560px; height: auto; aspect-ratio: 1 / 1; margin: 0 0 8px; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; }
/* 前夜に凍結した印（10/31 まで発走の前から出す） */
.mark { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mk { flex: 0 0 1.6em; font-size: 1.15rem; font-weight: 700; text-align: center; }
.mname { font-weight: 600; }
.init { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line-tag { flex: 0 0 3.4em; font-size: .8rem; color: var(--muted); }
/* 並び: ラインを横に 1 本の帯で（ラインの間は縦の細線・各ラインの下に 3車・単騎 の小さな札）. HTML は 札 → 色札 の順のまま, 見た目だけ色札を上にする（column-reverse） */
.lines { display: flex; flex-wrap: wrap; align-items: flex-start; row-gap: 10px; padding: 10px 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.lines .line { display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; padding: 0 14px; border-left: 1px solid var(--line); }
.lines .line:first-child { padding-left: 2px; border-left: 0; }
.lines .line-tag { flex: 0 0 auto; font-size: .72rem; line-height: 1.4; }
.chain { display: inline-flex; align-items: center; flex-wrap: nowrap; }
.join { display: inline-block; width: 8px; height: 2px; background: var(--muted); opacity: .6; }
.duel { display: inline-flex; align-items: center; gap: 2px; border: 1px dashed var(--amber); border-radius: 9px; padding: 2px; }
.duel-x { font-size: .7rem; color: var(--amber); font-weight: 700; padding: 0 1px; }

/* 想定の位置取り（ガールズ）: 強い選手の札 → 後ろを取る見込みの最も高い選手の札と割合, 2 番目に高い選手は小さい札で */
.follow-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0; }
.follow-main, .follow-sub { display: inline-flex; align-items: center; gap: 6px; }
.follow-main .pv { min-width: 0; font-size: 1.15rem; }
.follow-sub { margin-left: 8px; color: var(--muted); }
.follow-sub .pv { min-width: 0; font-size: .9rem; font-weight: 600; }
.car.sm { width: 1.6rem; height: 1.6rem; font-size: .85rem; border-radius: 5px; }

/* 主導権・見込みの棒 */
.init .chain { flex: 0 0 auto; }
.bar { flex: 1 1 auto; min-width: 40px; height: 8px; display: block; }
.bar-bg { fill: var(--track); }
.bar-fg { fill: var(--red); }
.pv { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.6em; text-align: right; }
.init .pv { flex: 0 0 3.6em; }
.probs td.pc { min-width: 58px; }
.probs td.pc .bar { width: 52px; min-width: 0; height: 5px; margin-bottom: 2px; }
.probs td.pc .pv { display: block; text-align: left; min-width: 0; }

/* 出走表（運営者 10/20 夜）: 白い面の箱（.tbl）に入れ, 箱の中だけ横に動く（ページ全体ははみ出さない）. 車と選手は左に固定. 今節の列は 1 走 1 枚のタイル（下）.
   見出しは 2 段（今節・直近4か月・決まり手 のまとまり）. まとまりの頭の列（.cg）に縦の細線. いちばん大きい数字（.mx）は薄いだいだいの地 */
.tbl { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(31, 26, 28, .06); overflow-x: auto; margin: 8px 0; }   /* position: relative = 読み上げ用の .sr（絶対配置）も箱の中で切る */
.riders { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 0; margin: 0; font-size: .82rem; }
.riders th, .riders td { padding: 6px 4px; white-space: nowrap; border-bottom: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
.riders tbody tr:last-child > * { border-bottom: 0; }
.riders thead th { background: var(--sunk); color: var(--muted); font-weight: 700; font-size: .74rem; line-height: 1.35; vertical-align: bottom; }
.riders thead tr:first-child th[colspan] { border-bottom: 1px solid var(--line); }
.riders .cg { border-left: 1px solid var(--line); }
.riders td.num { text-align: right; }
.riders .c-car, .riders .c-name { position: sticky; z-index: 1; background: var(--bg2); }
.riders thead .c-car, .riders thead .c-name { background: var(--sunk); z-index: 2; }
.riders .c-car { left: 0; width: 2.6rem; min-width: 2.6rem; padding-left: 6px; padding-right: 2px; }
.riders .c-name { left: 2.6rem; text-align: left; font-weight: 400; box-shadow: 1px 0 0 var(--line); padding-right: 6px; }
.riders thead .c-name { font-weight: 700; }
.mkcol .riders thead .c-name { text-indent: 1.125rem; }                     /* 印の字の列があるときだけ, 見出しの「選手」も名前の頭にそろえる（名前 .9rem × 字の幅 1.25em） */
.riders .rnm { display: flex; align-items: center; font-weight: 700; font-size: .9rem; line-height: 1.3; }
.riders .rmk { display: inline-block; width: 1.25em; flex: 0 0 auto; font-weight: 700; color: var(--text); }
.riders .rsub { display: block; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.mkcol .rsub { padding-left: 1.25em; }
/* 地元の札（場と同じ府県の選手. 名前の後ろの小さな札. 色だけで見分けず「地元」と字で書く） */
.riders .home { flex: 0 0 auto; margin-left: 6px; padding: 0 5px; border: 1px solid var(--amber); border-radius: 4px; font-size: .62rem; font-weight: 700; line-height: 1.5; color: var(--amber); white-space: nowrap; }
.riders .rpt { font-weight: 800; font-size: .98rem; color: var(--text); }
.riders .rsty { font-weight: 700; }
.riders td.mx { background: rgba(255, 178, 56, .16); font-weight: 800; color: var(--text); }
.riders td.mt { padding: 4px 3px; }
.riders td.mt.cg { padding-left: 6px; }
.riders td.mt .mt-t + .mt-t { margin-left: 3px; }
.rhint { margin: 4px 0 0; }

/* 今節の 1 走のタイル（着順が主役）: 1着 = だいだいの塗り・2〜3着 = 赤の枠と字・4着から下 = くぼんだ地・落車など = だいだいの点線. 右上は 1・2 着だけの決まり手 1 字, 左下はレース番号 */
.mt-t { display: inline-grid; grid-template-columns: 1fr auto; grid-template-areas: "pos kim" "rno rno"; align-items: start; width: 42px; height: 38px; padding: 3px 5px 2px 6px; border: 1.5px solid transparent; border-radius: 8px; line-height: 1; vertical-align: middle; text-align: left; }
.mt-t .mt-pos { grid-area: pos; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.mt-t .mt-kim { grid-area: kim; font-size: .7rem; font-weight: 800; text-decoration: none; padding-top: 1px; }
.mt-t .mt-rno { grid-area: rno; align-self: end; font-size: .62rem; font-weight: 600; color: var(--muted); }
.mt-t.f1 { background: var(--amber-fill); color: var(--on-amber); border-color: var(--amber-fill); }
.mt-t.f1 .mt-rno { color: var(--on-amber); }
.mt-t.f2, .mt-t.f3 { background: var(--bg2); color: var(--red-ink); border-color: var(--red-ink); }
.mt-t.f2 .mt-kim { color: var(--text); }
.mt-t.fx { background: var(--sunk); color: var(--muted); }
.mt-t.acc { background: var(--bg2); color: var(--amber); border: 1.5px dashed var(--amber); }
.mt-t.acc .mt-pos { font-size: .74rem; padding-top: 2px; }
.mt-none { color: var(--muted); }
/* 色の凡例（表の上. 今節の列があるときだけ） */
.mt-legend { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 2px 0 6px; padding: 0; font-size: .8rem; color: var(--muted); }
.mt-legend li { display: inline-flex; align-items: center; gap: 6px; }
.mt-t.mini { width: 24px; height: 22px; grid-template-columns: 1fr; grid-template-areas: "pos"; padding: 0; place-items: center; }
.mt-t.mini .mt-pos { font-size: .82rem; padding-top: 0; }
/* 近況（前場所・前々場所）: 走った順の小さなチップ + 下に «場所 月/日». チップの色は今節のタイル（.mt-t）と同じ（1着 = だいだいの塗り・2〜3着 = 赤の枠と字・4着から下 = くぼんだ地・落車など = だいだいの点線）.
   直近1年（.yr）は数字だけ. 幅は詰めてある（1280px の画面で, 4 走の開催が並んでも表の箱いっぱいに収まる. 収まらないときは箱の中だけ横に動く） */
.riders td.rc { padding: 4px 4px; }
.riders td.rc.cg { padding-left: 6px; }
.riders td.yr, .riders th.rc, .riders th.yr { padding-left: 4px; padding-right: 4px; }
.rc-runs { display: inline-flex; align-items: center; gap: 2px; }
.rc-r { display: inline-flex; align-items: baseline; justify-content: center; box-sizing: border-box; min-width: 20px; height: 22px; padding: 0 3px; border: 1px solid transparent; border-radius: 6px; line-height: 20px; }
.rc-r .rc-pos { font-size: .86rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rc-r .rc-kim { font-size: .56rem; font-weight: 800; text-decoration: none; }
.rc-r.f1 { background: var(--amber-fill); color: var(--on-amber); border-color: var(--amber-fill); }
.rc-r.f2, .rc-r.f3 { background: var(--bg2); color: var(--red-ink); border-color: var(--red-ink); }
.rc-r.f2 .rc-kim { color: var(--text); }
.rc-r.fx { background: var(--sunk); color: var(--muted); }
.rc-r.acc { background: var(--bg2); color: var(--amber); border: 1px dashed var(--amber); }
.rc-r.acc .rc-pos { font-size: .7rem; }
.rc-sub { display: block; margin-top: 2px; color: var(--muted); font-size: .66rem; line-height: 1.3; }
.probs th, .probs td { white-space: nowrap; }
.probs { min-width: 0; font-size: .9rem; }
.probs th, .probs td { padding: 6px 6px; }
.probs .c-car { width: 2.7rem; }
.probs .c-name { white-space: normal; font-size: .85rem; line-height: 1.3; }
.gone { opacity: .5; }
.absent { margin-left: 6px; font-size: .75rem; color: var(--amber); }

/* 時間帯パック */
.pack { margin: 28px 0 6px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: .9rem; }

/* 1 日のレース一覧 */
.slot h2 { margin-top: 30px; }
.cupbox { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px rgba(31, 26, 28, .06); padding: 10px 12px; margin: 10px 0; }
.cupbox h3 { font-size: 1.05rem; margin: 0 0 2px; }
.cupbox h3 .grade { margin-right: 8px; }
.dayno { margin-left: 8px; font-size: .8rem; color: var(--muted); font-weight: 400; }
.rlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rlink {
  display: grid;
  grid-template-columns: 2.6em 1fr;
  grid-template-areas: "no time" "type type";
  column-gap: 6px;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  text-decoration: none;
  color: var(--text);
  font-size: .9rem;
  height: 100%;
}
a.rlink:hover { border-color: var(--red); }
.rlink.off { opacity: .45; }
.rno { grid-area: no; font-weight: 700; font-variant-numeric: tabular-nums; }
.rtime { grid-area: time; color: var(--amber); font-variant-numeric: tabular-nums; }
.rtype { grid-area: type; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.rlist.days { grid-template-columns: 1fr; }
.rlist.days .rlink { display: block; }
.rlist.days .rno { font-size: 1rem; }
.rlist.days .rtype { display: block; margin-top: 2px; }

@media (min-width: 640px) {
  .facts { grid-template-columns: repeat(4, 1fr); }
  .facts dd { font-size: 1rem; }
  .rlist { grid-template-columns: repeat(3, 1fr); }
  .rlist.days { grid-template-columns: repeat(2, 1fr); }
  .race h1 { font-size: 1.7rem; }
  /* 出走表: 640px 以上は少しゆったり（横にずらせる案内は要らない） */
  .riders { font-size: .85rem; }
  .riders th, .riders td { padding: 6px 5px; }
  .riders .c-car { width: 2.9rem; min-width: 2.9rem; padding-left: 8px; padding-right: 4px; }
  .riders .c-name { left: 2.9rem; padding-right: 10px; }
  .riders .rnm { font-size: .95rem; }
  .mkcol .riders thead .c-name { text-indent: 1.19rem; }
  .riders td.mt { padding: 4px 3px; }
  .riders td.mt.cg { padding-left: 8px; }
  .mt-t { width: 46px; height: 40px; padding-left: 7px; }
  .rhint { display: none; }
  .rstage-main .k3-stage, .rstage-main .simvid-v { max-width: 620px; }
}
@media (max-width: 480px) {
  .car { width: 1.9rem; height: 1.9rem; font-size: 1rem; }
  .init { gap: 8px; }
  .line-tag { flex-basis: 2.8em; }
  .lines .line { padding: 0 10px; }
  .jump a { font-size: .8rem; line-height: 1.3; text-align: center; }               /* 320px でも 5 項目（結果・印・位置取り・展開・出走表）が収まる */
}

/* 印の成績（/marks-record/）と日のページからのリンク */
.recordlink { margin: 28px 0 6px; }
.rec { min-width: 520px; font-size: .9rem; }
.rec th, .rec td { padding: 6px 8px; white-space: nowrap; }
.rec thead th { text-align: center; vertical-align: bottom; }
.rec tbody th { text-align: left; font-weight: 500; }
.rec td.num { text-align: right; }
.rec th.mk { font-size: 1.15rem; font-weight: 700; text-align: center; }
.rec .base { color: var(--muted); }
.rec .grp { border-left: 1px solid var(--line); }

/* 場×日のページ（/races/<日>/<場>/）・場のページ（/venues/<場>/）・頭と足もとの場へのリンク・並びの 1 文（SEO 計画 P1） */
.navs { display: inline-flex; align-items: center; gap: 8px; }
.vrows { list-style: none; margin: 10px 0; padding: 0; }
.vrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.vrow .rlink { flex: 1 1 15em; height: auto; grid-template-columns: auto auto 1fr; grid-template-areas: "no time type"; column-gap: 10px; }
.vlines { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.vwin { flex: 1 1 100%; font-size: .9rem; }
.vdlink { margin: 2px 0 6px; font-size: .9rem; }
.lines-sum { margin: 0 0 10px; line-height: 1.7; }
.meets { list-style: none; margin: 0; padding: 0; }
.meet { margin: 0 0 14px; }
.meet-head { margin: 0 0 6px; }
.meet-name { font-weight: 700; margin-right: 8px; }
.meet-span { color: var(--muted); font-size: .9rem; }
.meet .grade { margin-right: 8px; }
.vtext { margin: 6px 0; line-height: 1.7; }
.kim { min-width: 0; }
.kim th[scope="row"] { text-align: left; font-weight: 500; white-space: nowrap; }
.kim td.pc { min-width: 120px; }
.kim td.num { white-space: nowrap; }
.vfoot { margin: 12px 0 8px; }
.vfoot-row { margin: 3px 0; line-height: 1.9; }
.vfoot-row a { margin: 0 6px; display: inline-block; }
.vfoot .vreg { color: var(--muted); margin-right: 6px; font-size: .8rem; }
.navs .topnav { white-space: nowrap; }
.navs-on .brand { white-space: nowrap; }
@media (max-width: 480px) {
  .navs-on { padding-left: 10px; padding-right: 10px; }
  .navs-on .brand { gap: 6px; letter-spacing: .02em; font-size: .9rem; }
  .navs-on .brand img { width: 30px; height: 30px; }
  .navs-on .beta { font-size: .62rem; padding: 1px 6px; }
  .navs { gap: 4px; }
  .navs .topnav { padding: 2px 9px; font-size: .8rem; }
}
.kim thead th { white-space: normal; }

/* 開催のページ（/cups/<開催の ID>/. SEO 計画 P2）の出場選手 */
.crd { list-style: none; margin: 4px 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; line-height: 1.7; }
.crd li { white-space: nowrap; }
.crd .pref { color: var(--muted); font-size: .85em; margin-left: 2px; }
