/* 日別一覧・表形式（info/new2.php） スマホ優先・横スクロールなし */
:root {
  --bg: #f3f5f8;
  --card: #fff;
  --text: #1d2330;
  --muted: #6b7380;
  --line: #e2e6ec;
  --brand: #1f5f8b;
  --brand-soft: #e6f0f7;
  --hit: #1a7f37;
  --hit-soft: #e5f4e8;
  --miss: #c62828;
  --miss-soft: #fdecec;
  --big: #b7791f;
  --big-soft: #fff1c2;
  --big-line: #f0d68a;
  --low: #d32f2f;
  --man: #1a56c4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1b2029;
    --text: #e6e9ef;
    --muted: #98a1ae;
    --line: #2c333f;
    --brand: #6fb0e0;
    --brand-soft: #1d3346;
    --hit: #5cc67a;
    --hit-soft: #18301f;
    --miss: #ff7a7a;
    --miss-soft: #3a1d1f;
    --big: #f0c060;
    --big-soft: #3d3215;
    --big-line: #5a4a1e;
    --low: #ff7a7a;
    --man: #7fb2ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--brand); }
button, select { font: inherit; color: inherit; }

/* ---- 上部の固定バー ---- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 8px 8px 6px;
}
.datenav {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto;
  padding-right: 66px;   /* 右上のメニューボタン（header.php）の分 */
}
.navbtn {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.navbtn.off { opacity: .35; }
.datepick {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.datepick small { font-size: 11px; color: #fff; background: var(--brand); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 2px; }
.datepick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.filters {
  display: flex;
  gap: 5px;
  max-width: 760px;
  margin: 8px auto 0;
  overflow-x: auto;
  padding-right: 66px;   /* 最後のボタンをメニューボタンの下から出せるように */
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip b { font-weight: 600; color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on b { color: #fff; opacity: .8; }
select.chip { padding-right: 6px; max-width: 8em; }

/* ---- 本文 ---- */
.wrap { max-width: 760px; margin: 0 auto; padding: 8px 6px 40px; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 2px 4px 4px;
  font-size: 12px;
  color: var(--muted);
}
.summary b { color: var(--text); font-size: 14px; }
.summary small { font-size: 11px; }
.summary .big b { color: var(--big); }
.updated { font-size: 11px; color: var(--muted); margin: 0 4px 6px; display: flex; align-items: center; gap: 6px; }
.linkbtn { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 2px 4px; cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.foot { font-size: 11px; color: var(--muted); margin-top: 20px; }
.muted { color: var(--muted); font-size: 12px; }

/* ---- 車番の色（旧ページと同じ配色） ---- */
.car {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
  font-family: Arial, sans-serif;
}
/*
.c1 { background: #e4e5ea; color: #2b2b2e; box-shadow: inset 0 0 0 1px #c3c5cc; }
.c2 { background: #2b2b2e; color: #fff; }
.c3 { background: #bf0015; color: #fff; }
.c4 { background: #003abf; color: #fff; }
.c5 { background: #ffce26; color: #2b2b2e; }
.c6 { background: #008a00; color: #fff; }
.c7 { background: #d45e00; color: #fff; }
.c8 { background: #d40565; color: #fff; }
.c9 { background: #9700bf; color: #fff; }
*/
.combo { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; }
.combo i { font-style: normal; color: var(--muted); font-size: 11px; }

/* ---- 一覧の表 ---- */
.races {
  width: 100%;
  table-layout: fixed;     /* 列幅を固定して横にはみ出さない */
  border-collapse: collapse;
  background: var(--card);
  font-variant-numeric: tabular-nums;
}
.c-venue { width: 21%; }
.c-no    { width: 9%; }
.c-time  { width: 16%; }
.c-wide  { width: auto; }
.c-votes { width: 19%; }
.races > thead th {
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  padding: 6px 5px;
  white-space: nowrap;
}
.races .r { text-align: right; }
.sortbtn { border: 0; background: none; color: inherit; font-weight: 600; padding: 0; cursor: pointer; font-size: 11px; }
.sortbtn::after { content: " ⇅"; opacity: .5; }
.sortbtn.on::after { content: " ▼"; opacity: 1; }

.races .row > td {
  padding: 7px 5px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.races .row { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.races .row:hover > td { background: var(--brand-soft); }
.races .row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.races .venue { font-weight: 600; }
.races .no { font-weight: 600; }
.races .time small { display: block; font-size: 10px; line-height: 1.2; color: var(--brand); font-weight: 700; }
.races .time small:empty { display: none; }
.races .wide .odds { margin-left: 3px; font-size: 12px; font-weight: 700; }
.races .wide .odds.low { color: var(--low); }
.races .votes { font-size: 12px; color: var(--muted); }
.races .votes.many { color: var(--text); font-weight: 700; }

/* 大口は背景色 */
.races tbody.is-big .row > td { background: var(--big-soft); }
.races tbody.is-big .row:hover > td { background: var(--big-line); }
/* 結果は左端の線（緑＝的中・赤＝不的中） */
.races tbody.is-hit .row > td:first-child { box-shadow: inset 4px 0 0 var(--hit); }
.races tbody.is-miss .row > td:first-child { box-shadow: inset 4px 0 0 var(--miss); }
.races tbody.st-cancel .row, .races tbody.st-none .row { opacity: .5; }
/* 次に発走するレース */
.races tbody.next .row > td { border-top: 2px solid var(--brand); }
/* 開いている行 */
.races tbody.open .row > td { font-weight: 700; }

/* ---- 開いたときの詳細 ---- */
.races .dt > td { padding: 0; border-top: 1px dashed var(--line); }
.detail { padding: 8px 8px 12px; font-size: 13px; background: var(--card); }
.detail h3 { font-size: 12px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.res { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res .meta { font-size: 12px; color: var(--muted); }
.mark { font-weight: 700; border-radius: 7px; padding: 2px 8px; font-size: 13px; white-space: nowrap; }
.mark.hit { background: var(--hit-soft); color: var(--hit); }
.mark.miss { background: var(--miss-soft); color: var(--miss); }
.mark.st { background: var(--bg); color: var(--muted); font-size: 12px; }

.tag { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.tag.line { background: var(--brand-soft); color: var(--brand); }
.tag.warn { background: var(--miss-soft); color: var(--miss); }

.riders, .pay { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 8px; }
.rider { display: inline-flex; align-items: center; gap: 4px; }
.rider em { font-style: normal; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 0 5px; }
.rider em.in { background: var(--hit-soft); color: var(--hit); }
.rider em.out { background: var(--miss-soft); color: var(--miss); }
.pay .lbl { font-size: 11px; color: var(--muted); }
.payitem { display: inline-flex; align-items: center; gap: 4px; }
.payitem.match { font-weight: 700; color: var(--hit); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 4px 3px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th { font-size: 11px; color: var(--muted); font-weight: 600; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .pop { color: var(--muted); width: 1%; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.entries .who { word-break: break-all; }
.entries .who a { font-weight: 600; text-decoration: none; }
.entries .who small, .entries td small { display: block; font-size: 10px; color: var(--muted); }
.entries tr.target { background: var(--brand-soft); }
.entries tr.scratched { opacity: .45; text-decoration: line-through; }
.pays th { font-size: 12px; color: var(--muted); font-weight: 600; width: 1%; white-space: nowrap; }
.pays .man { color: var(--miss); font-weight: 700; }
.lines { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.lineset { display: inline-flex; gap: 2px; padding: 3px; border-radius: 6px; background: var(--bg); }
/* 競り（同じ位置を2人で争う。2026-10-26） */
.seri { display: inline-flex; align-items: center; gap: 1px; padding: 0 2px; border: 1px dashed var(--miss); border-radius: 5px; }
.seri i { font-style: normal; font-size: 10px; font-weight: 700; color: var(--miss); margin-left: 1px; }

/* ---- 結果列（new3.php の「結果列 ON」）。ON のときだけ表を横スクロールにする ---- */
.races .rx { display: none; }
.races.show-res .rx { display: table-cell; }
.res-on .wrap { max-width: 1280px; }
.tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.races.show-res { table-layout: auto; width: max-content; min-width: 100%; }
.races.show-res col { width: auto; }
.races.show-res .row > td { overflow: visible; text-overflow: clip; }
.races.show-res > thead th.rx { border-left: 1px solid rgba(255,255,255,.25); }
.races.show-res .row > td.rx { border-left: 1px solid var(--line); font-size: 12px; }
/* 横に動かしても場名は左に残す */
.races.show-res > thead th:first-child,
.races.show-res .row > td.venue { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
.races.show-res > thead th:first-child { background: var(--brand); }
.races.show-res tbody:not(.is-big) .row > td.venue { background: var(--card); }
/* 開いた詳細は表の幅ではなく画面の幅で表示 */
.races.show-res .dt > td > .detail { position: sticky; left: 0; width: var(--wrapw, 100vw); }

.chip.toggle.on { background: var(--hit); border-color: var(--hit); }
.mk { font-weight: 700; margin-right: 4px; }
.mk.hit { color: var(--hit); }
.mk.miss { color: var(--miss); }
.pc { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; white-space: nowrap; }
.pc:last-child { margin-right: 0; }
.pc small { font-size: 10px; color: var(--muted); }
.pc.match { color: var(--hit); font-weight: 700; }
.pc.man { color: var(--man); font-weight: 700; }
.races .row .pc .car { width: 17px; height: 17px; font-size: 11px; }
.tgt .car { margin-right: 3px; }
.tgt em { font-style: normal; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 0 5px; margin-left: 4px; }
.tgt em.in { background: var(--hit-soft); color: var(--hit); }
.tgt em.out { background: var(--miss-soft); color: var(--miss); }

/* ---- 鉄板率（new3.php） ---- */
.tp b, .teppan b { font-weight: 700; }
.tp small { margin-left: 4px; font-size: 10px; color: var(--muted); }
.hi { color: var(--hit); }
.lo { color: var(--miss); }
.teppan .cond { font-size: 12px; }
.teppan tr.main { background: var(--hit-soft); }
.tpnote { font-size: 11px; color: var(--muted); margin: 4px 0 0; }
.tpnote a { margin-left: 6px; }

/* 幅の狭いスマホ（320px など）は一覧の文字と余白を詰めて切れないようにする */
@media (max-width: 359px) {
  .wrap { padding-left: 4px; padding-right: 4px; }
  .races .row > td { padding: 6px 3px; font-size: 12px; }
  .races > thead th { padding: 5px 3px; }
  .races .row .car { width: 17px; height: 17px; font-size: 11px; }
  .races .wide .odds { margin-left: 2px; font-size: 11px; }
  .races .votes { font-size: 11px; }
  .c-venue { width: 20%; }
  .c-no    { width: 8%; }
  .c-time  { width: 15%; }
  .c-votes { width: 20%; }
}

/* 広い画面は少しゆったり */
@media (min-width: 600px) {
  body { font-size: 15px; }
  .wrap { padding: 12px 12px 48px; }
  .races > thead th, .sortbtn { font-size: 12px; }
  .races .row > td { padding: 8px 8px; }
  .races .wide .odds, .races .votes { font-size: 14px; }
  .car { width: 22px; height: 22px; font-size: 13px; }
  .detail { padding: 10px 14px 16px; }
}
