:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1b2430;
  --muted: #6b7684;
  --line: #e3e7ee;
  --accent: #0b5cad;
  --accent-soft: #e6f0fb;
  --hit: #d32f2f;
  --hit-soft: #fdecec;
  --miss: #8a94a3;
  --l1: #ffffff; --l1t: #111;
  --l2: #222222; --l2t: #fff;
  --l3: #e53935; --l3t: #fff;
  --l4: #1e63d6; --l4t: #fff;
  --l5: #f6c400; --l5t: #111;
  --l6: #2e9d4f; --l6t: #fff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b; --card: #1a2029; --text: #e7ebf0; --muted: #98a3b1; --line: #2a323d;
    --accent: #5aa4f0; --accent-soft: #1c2c40; --hit: #ff6b6b; --hit-soft: #3a1f22; --miss: #7d8794;
  }
}
:root[data-theme="dark"] {
  --bg: #11151b; --card: #1a2029; --text: #e7ebf0; --muted: #98a3b1; --line: #2a323d;
  --accent: #5aa4f0; --accent-soft: #1c2c40; --hit: #ff6b6b; --hit-soft: #3a1f22; --miss: #7d8794;
}

* { 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", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 15px; line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 52px; gap: 12px; }
.brand { font-weight: 800; font-size: 17px; color: var(--text); white-space: nowrap; }
.brand small { font-weight: 600; color: var(--accent); margin-left: 6px; font-size: 12px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; }
.nav a .s { display: none; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav a.on, .nav a:hover { background: var(--accent-soft); color: var(--accent); }

main { padding: 16px 0 40px; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* 日付切り替え */
.datebar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.datebar a { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; }
.datebar a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 数字のまとめ */
.stats { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .v small { font-size: 13px; font-weight: 600; margin-left: 2px; }

/* トップ: 日付の一覧 + 本体 */
.home { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.datelist { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.datelist summary { cursor: pointer; padding: 10px 14px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.datelist summary .muted { font-weight: 400; font-size: 13px; }
.datelist ul { list-style: none; margin: 0; padding: 0 6px 8px; max-height: 60vh; overflow-y: auto; }
.datelist li a { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 8px; color: var(--text); font-size: 13px; }
.datelist li a:hover { background: var(--bg); }
.datelist li a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
@media (min-width: 900px) {
  .home { grid-template-columns: 210px minmax(0, 1fr); align-items: start; }
  .home aside { position: sticky; top: 64px; }
  .datelist ul { max-height: calc(100vh - 140px); }
}

/* 会場カード */
.venue-card { display: block; color: var(--text); }
.venue-card:hover { border-color: var(--accent); }
.venue-card .name { font-size: 18px; font-weight: 800; }
.venue-card .title { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.venue-card .row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 8px; }
.grid.venues { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.venue-card .vc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.venue-card .day-label { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.venue-card .vc-bottom { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; gap: 6px; }
.venue-card .vc-hits { font-size: 13px; }
.venue-card .vc-hits b { font-size: 20px; color: var(--hit); }
.grade { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 2px; background: var(--line); color: var(--text); }
.grade.SG { background: #b8860b; color: #fff; }
.grade.G1 { background: #c62828; color: #fff; }
.grade.G2 { background: #1565c0; color: #fff; }
.grade.G3 { background: #2e7d32; color: #fff; }

/* 艇番 */
.lane { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 5px; font-weight: 800; font-size: 14px; flex: 0 0 auto; }
.lane.l1 { background: var(--l1); color: var(--l1t); border: 1px solid #999; }
.lane.l2 { background: var(--l2); color: var(--l2t); }
.lane.l3 { background: var(--l3); color: var(--l3t); }
.lane.l4 { background: var(--l4); color: var(--l4t); }
.lane.l5 { background: var(--l5); color: var(--l5t); }
.lane.l6 { background: var(--l6); color: var(--l6t); }
.combo { display: inline-flex; gap: 2px; align-items: center; }
.combo .lane { width: 20px; height: 20px; font-size: 12px; border-radius: 4px; }

/* レース一覧 */
.race-list { display: flex; flex-direction: column; gap: 8px; }
.race-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; color: var(--text); }
.race-row:hover { border-color: var(--accent); }
.race-row .rn { font-size: 20px; font-weight: 800; text-align: center; line-height: 1.1; }
.race-row .rn small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.race-row .mid { min-width: 0; }
.race-row .honmei { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.race-row .bets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.race-row .res { text-align: right; font-size: 13px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge.hit { background: var(--hit-soft); color: var(--hit); }
.badge.miss { background: var(--line); color: var(--miss); }
.badge.wait { background: var(--accent-soft); color: var(--accent); }
.payout { font-weight: 800; }

/* 出走表 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); }
td.left, th.left { text-align: left; }
.racer { font-weight: 700; }
.racer small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.bar { position: relative; height: 18px; min-width: 72px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: .25; }
.bar span { position: relative; font-weight: 700; font-size: 12px; line-height: 18px; }
tr.top td { background: var(--accent-soft); }

.bet-list { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.bet { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.bet .rank { font-size: 11px; color: var(--muted); width: 18px; }
.bet.hit { border-color: var(--hit); background: var(--hit-soft); }

/* 買い目の3タイプ */
.plans { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.plan .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan .pname { font-weight: 800; }
.plan .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.plan .tickets { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.8; word-break: break-all; }
.plan.hit { border-color: var(--hit); background: var(--hit-soft); }
.form { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.form .sep { color: var(--muted); font-weight: 700; }
.plan-line { display: grid; grid-template-columns: 5.5em 1fr auto 2.5em; align-items: center; gap: 6px; font-size: 13px; margin-top: 3px; }
.plan-line .pl { color: var(--muted); font-size: 12px; }
.plan-line .ftext { font-weight: 700; letter-spacing: .03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.plan-line .hitmark { color: var(--hit); font-weight: 800; font-size: 12px; }
/* その日の成績(買い目タイプ別) */
.perf-title { font-weight: 800; margin: 4px 0 8px; }
.perf-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.perf-card .pc-head { display: flex; justify-content: space-between; align-items: baseline; }
.perf-card .pc-name { font-weight: 800; }
.perf-card .pc-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.perf-card .k { font-size: 12px; color: var(--muted); }
.perf-card .v { font-size: 22px; font-weight: 800; }
.perf-card .v small { font-size: 13px; font-weight: 600; margin-left: 2px; }
/* トップ冒頭のAIの説明 */
.brand-intro { margin-bottom: 20px; padding: 18px; }
.brand-intro .bi-copy { font-size: 22px; font-weight: 800; line-height: 1.4; }
.brand-intro .bi-lead { margin: 8px 0 12px; color: var(--muted); font-size: 14px; }
.brand-intro .bi-types { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.brand-intro .bi-type { background: var(--bg); border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; color: var(--text); }
.brand-intro .bi-type.on { border-color: var(--accent); background: var(--accent-soft); }
.brand-intro .bi-type b { color: var(--accent); }
.brand-intro .bi-type span { font-size: 12px; color: var(--muted); }

/* 会場ページのAI予想(◎本線 ○ ▲) */
.picks { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.pick { display: inline-flex; align-items: center; gap: 4px; }
.pick .mark { font-weight: 800; color: var(--muted); }
.pick.main .mark { color: var(--hit); font-size: 16px; }
.pick:not(.main) .combo .lane { width: 16px; height: 16px; font-size: 11px; }
/* タイプ切り替え(会場ページ) */
.type-tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.type-tabs a { flex: 1; text-align: center; padding: 6px 4px; border-radius: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.type-tabs a.on { background: var(--accent); color: #fff; }

/* 会場ページのレースカード */
.race-card { padding: 12px; }
.race-card .rc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); }
.race-card .rc-head .rn { font-size: 20px; font-weight: 800; }
.race-card .rc-head .honmei { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.race-card .rc-head .more { margin-left: auto; font-size: 12px; color: var(--accent); }
.race-card .rc-res { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }

/* 買い目の縦並び */
.tickets-v { margin-top: 8px; }
.tickets-v .tv-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tickets-v .tv-head b { color: var(--text); }
.tickets-v ol { list-style: none; margin: 0; padding: 0; }
.tickets-v li { display: grid; grid-template-columns: 22px auto 1fr; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 6px; }
.tickets-v li .rank { font-size: 12px; color: var(--muted); text-align: right; }
.tickets-v li .small { text-align: right; }
.tickets-v li.hit { background: var(--hit-soft); }
.tickets-v li.hit .rank { color: var(--hit); font-weight: 800; }
.tickets-v details summary { font-size: 12px; color: var(--accent); cursor: pointer; padding: 4px; }
.plan.on { box-shadow: 0 0 0 2px var(--accent) inset; }
h3 { font-size: 15px; margin: 18px 0 8px; }

/* 3タイプの成績を並べた枠 */
.plan-rows { padding: 12px 14px; margin-bottom: 8px; }
.plan-rows .pr-title { font-weight: 800; margin-bottom: 4px; }
.plan-rows .pr-row { display: grid; grid-template-columns: 1fr auto 76px 76px; align-items: center; gap: 8px; padding: 8px 6px; border-top: 1px solid var(--line); border-radius: 6px; }
.plan-rows .pr-row.on { background: var(--accent-soft); }
.plan-rows .pr-name { font-weight: 700; }
.plan-rows .pr-num { text-align: right; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.plan-rows .pr-num small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.plan-rows p { margin: 6px 0 0; }

/* 近日公開の枠 */
.coming-soon { margin-bottom: 10px; border-style: dashed; }
.coming-soon .cs-title { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.coming-soon .cs-badge { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; }
.coming-soon p { margin: 4px 0 0; }

/* トップ: 直近7日の成績 */
.recent-perf { margin-bottom: 16px; }
.recent-perf .rp-title { font-weight: 800; margin-bottom: 8px; }
.recent-perf .rp-grid { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.recent-perf .rp-item { display: block; color: var(--text); background: var(--bg); border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; }
.recent-perf .rp-item.on { border-color: var(--accent); }
.recent-perf .rp-name { font-weight: 700; font-size: 13px; }
.recent-perf .rp-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 4px 0; }
.recent-perf .rp-nums small { display: block; font-size: 11px; color: var(--muted); }
.recent-perf .rp-nums b { font-size: 22px; font-variant-numeric: tabular-nums; }
.recent-perf .rp-nums i { font-style: normal; font-size: 12px; margin-left: 1px; }

/* トップ: AI注目レース */
.focus-list { padding: 4px 8px; }
.focus-list .fl-row { display: grid; grid-template-columns: 46px 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 4px; color: var(--text); border-top: 1px solid var(--line); }
.focus-list .fl-row:first-child { border-top: 0; }
.focus-list .fl-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.focus-list .fl-race { font-weight: 700; }
.focus-list .fl-honmei { display: inline-flex; gap: 4px; align-items: center; }
.focus-list .fl-form { font-weight: 700; font-size: 13px; }

/* トップ: 下のリンク */
.home-links { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 24px; }
.home-links a { display: flex; flex-direction: column; gap: 2px; color: var(--text); }

/* レースページ: 直前情報・他の券種 */
td.best { color: var(--accent); font-weight: 800; }
.ob-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.ob-box .ob-name { font-weight: 800; margin-bottom: 4px; }
.ob-box ol { list-style: none; margin: 0; padding: 0; }
.ob-box li { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 6px; }
.ob-box li.hit { background: var(--hit-soft); }
.ob-box .rank { font-size: 12px; color: var(--muted); }
.ob-box .ob-c { display: inline-flex; align-items: center; gap: 2px; }
.ob-box .ob-c .lane { width: 20px; height: 20px; font-size: 12px; }
.ob-box .sep { color: var(--muted); font-weight: 700; }

/* 成績ページ */
.chart svg { width: 100%; height: auto; display: block; }
.chart .g { stroke: var(--line); }
.chart .g100 { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.chart .l-rate { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart .l-roi { fill: none; stroke: var(--hit); stroke-width: 2.5; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; margin-top: 6px; }
.chart .legend .k-rate::before, .chart .legend .k-roi::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 4px; vertical-align: middle; }
.chart .legend .k-rate::before { background: var(--accent); }
.chart .legend .k-roi::before { background: var(--hit); }
.big-hits { padding: 4px 10px; }
.big-hits .bh-row { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); }
.big-hits .bh-row:first-child { border-top: 0; }
.big-hits .bh-row > .small:last-child { grid-column: 2 / -1; }

/* 文章のページ */
.article { max-width: 760px; }
.article p, .article li, .article dd { line-height: 1.85; }
.article ul, .article ol { padding-left: 1.3em; }
.faq { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0 0; }
.glossary dt { font-weight: 800; margin-top: 12px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }

.site-footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 12px; color: var(--muted); }
.site-footer p { margin: 4px 0; }
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0; }
.site-footer .footer-links a { color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

@media (max-width: 560px) {
  .nav a .l { display: none; }
  .nav a .s { display: inline; }
  .recent-perf .rp-nums { grid-template-columns: 1fr; }
  .recent-perf .rp-nums b { font-size: 18px; }
  .plan-rows .pr-row { grid-template-columns: 1fr 64px 64px; }
  .plan-rows .pr-row > .small { display: none; }
  .focus-list .fl-row { grid-template-columns: 40px 1fr auto auto; }
  .focus-list .fl-form { display: none; }
  .brand-intro .bi-copy { font-size: 19px; }
  .grid.venues { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .venue-card { padding: 8px; }
  .venue-card .name { font-size: 15px; }
  .venue-card .grade { display: none; }
  .venue-card .vc-top { flex-direction: column; gap: 0; }
  .venue-card .day-label { font-size: 11px; }
  .venue-card .title { font-size: 11px; }
  .venue-card .vc-bottom { flex-direction: column; gap: 0; margin-top: 6px; }
  .venue-card .vc-hits { font-size: 12px; }
  .venue-card .vc-hits b { font-size: 18px; }
  .venue-card .vc-bottom .small { font-size: 11px; }
  .brand small { display: none; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .race-row { grid-template-columns: 44px 1fr; }
  .race-row .res { grid-column: 1 / -1; text-align: left; display: flex; gap: 8px; align-items: center; }
}
