/* ケイバの地図 — スマホ優先。色は :root のトークンだけで決める */
:root {
  --bg: #f4efe1;          /* 新聞の紙 */
  --paper: #fffcf3;
  --ink: #1b211d;
  --muted: #5d665f;
  --line: #ddd4bd;
  --turf: #1f6e3d;        /* 芝 */
  --turf-2: #2f8a50;
  --turf-soft: #e1eedf;
  --dirt: #9a6a3c;        /* ダート */
  --dirt-soft: #f0e2cf;
  --gold: #c99a2e;        /* トロフィー */
  --red: #c8102e;         /* 本命の印 */
  --night: #13241a;       /* 掲示板 */
  --led: #ffb627;
  --g1: #0b4ea2; --g2: #c8102e; --g3: #128a3f;
  --map-bg: #e9e2cc; --grid: #d8cfb3;
  --radius: 12px;
  --tap: 46px;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1612; --paper: #17201b; --ink: #ecefe9; --muted: #a6b0a9; --line: #2f3a33;
    --turf: #3fae6a; --turf-2: #57c381; --turf-soft: #1b2c22; --dirt: #c9925c; --dirt-soft: #2e2419;
    --gold: #e2b74e; --red: #ff5a6e; --night: #0a120d; --map-bg: #18231c; --grid: #223128;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1612; --paper: #17201b; --ink: #ecefe9; --muted: #a6b0a9; --line: #2f3a33;
  --turf: #3fae6a; --turf-2: #57c381; --turf-soft: #1b2c22; --dirt: #c9925c; --dirt-soft: #2e2419;
  --gold: #e2b74e; --red: #ff5a6e; --night: #0a120d; --map-bg: #18231c; --grid: #223128;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.8; overflow-x: hidden;
}
a { color: var(--turf); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--paper); padding: 8px; z-index: 50; }

/* ヘッダー: 枠番の8色の帯 → ロゴ → 区分ナビ */
.waku-stripe { display: block; width: 100%; height: 6px; }
.site-head { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.head-row { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); line-height: 1.15; }
.logo .wm b { display: block; font-family: var(--serif); font-weight: 900; font-size: 22px; letter-spacing: .04em; }
.logo .wm small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .12em; }
.head-search { margin-left: auto; display: flex; align-items: center; }
.head-search input { width: 8.5em; min-height: 40px; border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; padding: 0 12px; font-size: 16px; background: var(--bg); color: var(--ink); }
.head-search button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 46px; border: 0; border-radius: 0 999px 999px 0; background: var(--turf); color: #fff; }
.nav { background: var(--turf); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav .wrap { display: flex; }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 13px; color: #f2f7f0; text-decoration: none; font-size: 15px; font-weight: 600; }
.nav a .ic { width: 18px; height: 18px; opacity: .9; }
.nav a[aria-current="page"] { background: rgba(0,0,0,.18); box-shadow: inset 0 -4px 0 var(--gold); color: #fff; }

/* 今週の開催の帯（掲示板風） */
.ticker { background: var(--night); color: #f6f1de; font-size: 14px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.ticker::-webkit-scrollbar { display: none; }
.ticker .wrap { display: flex; align-items: center; gap: 18px; min-height: 40px; }
.ticker .tk-l { color: var(--led); font-weight: 800; letter-spacing: .1em; }
.ticker a { color: #f6f1de; text-decoration: none; }
.ticker a:hover { color: var(--led); }

/* パンくず・見出し */
.crumbs { font-size: 13px; color: var(--muted); margin: 14px 0 2px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--muted); }
h1, h2, h3 { font-family: var(--serif); font-weight: 900; }
h1 { font-size: 27px; line-height: 1.35; margin: 10px 0 12px; letter-spacing: .02em; }
h2 { font-size: 21px; line-height: 1.45; margin: 40px 0 14px; display: flex; align-items: center; gap: 10px; }
h2::before { content: "◎"; color: var(--red); font-size: .9em; }
h2::after { content: ""; flex: 1; height: 3px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); opacity: .35; }
h3 { font-size: 18px; margin: 26px 0 8px; }
h3::before { content: "○ "; color: var(--turf); }
.lead { font-size: 17px; color: var(--muted); }
main { padding-bottom: 56px; min-height: 60vh; }

/* トップの地図 */
.hero { position: relative; margin: 14px 0 6px; }
.hero-card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 2px 0 var(--line); }
.hero-text { padding: 18px 18px 4px; }
.hero-text .kicker { font-size: 13px; letter-spacing: .2em; color: var(--turf); font-weight: 800; }
.hero-text h1 { font-size: 30px; margin: 4px 0 6px; }
.hero-text p { margin: 0 0 10px; color: var(--muted); }
.hero-map { display: block; width: 100%; height: auto; }
.hero-map .sea { fill: var(--map-bg); }
.hero-map .grid { stroke: var(--grid); stroke-width: 1; }
.hero-map .turf { fill: var(--turf); }
.hero-map .dirt { fill: var(--dirt); }
.hero-map .infield { fill: var(--turf-2); }
.hero-map .rail { fill: none; stroke: #fff; stroke-width: 3; }
.hero-map .rail.thin { stroke-width: 2; opacity: .8; }
.hero-map .pole { stroke: #fff; stroke-width: 3; }
.hero-map .pond { fill: #7fb8d6; opacity: .85; }
.hero-map .route { fill: none; stroke: var(--gold); stroke-width: 3; stroke-dasharray: 2 10; stroke-linecap: round; }
.hero-map .goal { fill: var(--red); stroke: #fff; stroke-width: 3; }
.hero-map .goal-pole { stroke: #fff; stroke-width: 4; }
.hero-map .stand { fill: var(--ink); opacity: .82; }
.hero-map .speed line { stroke: #fff; stroke-width: 3; stroke-linecap: round; opacity: .8; }
.hero-map .compass circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.hero-map .compass path { fill: var(--red); }
.hero-map .compass text { font-size: 16px; font-weight: 800; fill: var(--ink); }
.hero-map .mk-pin { fill: var(--red); stroke: #fff; stroke-width: 2; }
.hero-map .mk-dot { fill: #fff; }
.hero-map .lbl { font-size: 25px; font-weight: 900; fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 7px; stroke-linejoin: round; font-family: var(--serif); }
.hero-map a:hover .mk-pin { fill: var(--gold); }
@media (max-width: 640px) { .hero-map .lbl { display: none; } }

/* 地図の区画（12区分） */
.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.map-tile { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; align-items: center; min-height: 84px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .12s, border-color .12s; }
.map-tile:hover { border-color: var(--turf); transform: translateY(-2px); }
.map-tile .ic-wrap { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--turf-soft); color: var(--turf); }
.map-tile .t { font-weight: 800; font-size: 15px; line-height: 1.35; }
.map-tile .d { font-size: 12px; color: var(--muted); line-height: 1.4; }
.map-tile .no { position: absolute; right: 10px; top: 6px; font-size: 11px; color: var(--muted); font-family: var(--serif); }
.map-tile.wait { opacity: .78; }
@media (max-width: 480px) {
  .map-tile { grid-template-columns: 34px 1fr; gap: 0 8px; padding: 10px; min-height: 74px; }
  .map-tile .ic-wrap { width: 34px; height: 34px; }
  .map-tile .ic-wrap .ic { width: 20px; height: 20px; }
  .map-tile .t { font-size: 13.5px; white-space: nowrap; }
  .map-tile .d { font-size: 11.5px; }
  .map-tile .no { display: none; }
  .logo .wm b { font-size: 19px; }
  .logo .wm small { font-size: 10px; letter-spacing: .06em; }
  .head-search input { width: 6.6em; }
}
.logo .wm b, .logo .wm small { white-space: nowrap; }
.map-tile.wait .ic-wrap { background: var(--dirt-soft); color: var(--dirt); }

.badge { display: inline-block; font-size: 12px; line-height: 1.7; padding: 0 9px; border-radius: 999px; background: var(--turf-soft); color: var(--turf); font-weight: 800; width: fit-content; }
.badge.wait { background: var(--dirt-soft); color: var(--dirt); }
.grade { display: inline-block; min-width: 2.6em; text-align: center; font-size: 12px; font-weight: 900; color: #fff; border-radius: 4px; padding: 0 6px; line-height: 1.8; }
.grade.g1 { background: var(--g1); } .grade.g2 { background: var(--g2); } .grade.g3 { background: var(--g3); }

/* カード・ブロック */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.blocks { display: grid; gap: 16px; }
@media (min-width: 760px) { .blocks { grid-template-columns: 1fr 1fr; } .blocks .wide { grid-column: 1 / -1; } }
.block { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.block > header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--turf); color: #fff; }
.block > header .ic { width: 20px; height: 20px; }
.block > header b { font-family: var(--serif); font-size: 17px; letter-spacing: .04em; }
.block > header a { margin-left: auto; color: #fff; font-size: 13px; }
.block.dirt > header { background: var(--dirt); }
.block.night > header { background: var(--night); }
.block .bd { padding: 6px 14px 14px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { display: block; padding: 11px 2px; min-height: var(--tap); text-decoration: none; color: var(--ink); }
.list a strong { display: block; color: var(--turf); line-height: 1.5; }
.list a span { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.empty { color: var(--muted); font-size: 15px; padding: 10px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); text-decoration: none; color: var(--ink); font-weight: 700; }
.chips a:hover { border-color: var(--turf); color: var(--turf); }

/* 今週の重賞・開催 */
.race-day { border-bottom: 1px dashed var(--line); padding: 10px 0; }
.race-day:last-child { border-bottom: 0; }
.race-day .dt { font-family: var(--serif); font-weight: 900; }
.race-day .mt { font-size: 13px; color: var(--muted); }
.stake { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.stake b { font-family: var(--serif); font-size: 17px; }
.stake .cs { font-size: 13px; color: var(--muted); }

/* 競馬場カード */
.vgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.vcard { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; text-decoration: none; color: var(--ink); }
.vcard:hover { border-color: var(--turf); }
.vcard .vn { font-family: var(--serif); font-weight: 900; font-size: 20px; }
.vcard .vs { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-schem { width: 100%; height: auto; display: block; }
.course-schem .sc-track { fill: none; stroke: var(--turf); stroke-width: 12; }
.course-schem .sc-straight { stroke: var(--gold); stroke-width: 12; stroke-linecap: round; }
.course-schem .arw { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.course-schem .sc-goal { stroke: var(--ink); stroke-width: 2.5; }
.course-schem .sc-goalc { fill: var(--red); }
.course-schem .sc-turn { font-size: 19px; font-weight: 900; fill: var(--ink); font-family: var(--serif); }
.course-schem .st { font-size: 13px; fill: var(--muted); }

/* 掲示板風の数字 */
.board { background: var(--night); color: #f6f1de; border-radius: var(--radius); padding: 10px; display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 12px 0; border: 3px solid #2c3d31; }
@media (min-width: 700px) { .board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.board > div { background: #050b07; border-radius: 8px; padding: 8px 10px; min-width: 0; }
@media (max-width: 420px) { .board .v { font-size: 21px; } .board .k { font-size: 11px; } }
.board .k { font-size: 12px; color: #bfc9bf; letter-spacing: .08em; }
.board .v { font-family: "DSEG7 Classic", "Courier New", ui-monospace, monospace; color: var(--led); font-size: 26px; font-weight: 800; letter-spacing: .04em; line-height: 1.2; text-shadow: 0 0 8px rgba(255,182,39,.45); }
.board .v small { font-size: 14px; color: #f6d48a; margin-left: 2px; }
.venue-head { display: grid; gap: 12px; align-items: center; grid-template-columns: minmax(0, 1fr); }
.venue-head > *, .blocks > *, .grid > *, .vgrid > * { min-width: 0; }
h1, h2 { overflow-wrap: anywhere; }
.venue-head .card { max-width: 440px; width: 100%; padding: 10px 12px; }
.two-schem .card { padding: 8px; }
@media (min-width: 760px) { .venue-head { grid-template-columns: 1.2fr 1fr; } }

/* 事実と解説を分ける */
.fact { background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--turf); border-radius: var(--radius); padding: 4px 16px 14px; margin: 16px 0; }
.note { background: var(--turf-soft); border-radius: var(--radius); padding: 4px 16px 14px; margin: 16px 0; }
.label { font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 12px 0 0; letter-spacing: .08em; }
.caution { background: var(--dirt-soft); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; font-size: 15px; }
.src { font-size: 13px; color: var(--muted); word-break: break-all; }
.fact h2 { margin-top: 18px; }

/* 表: 横スクロール時に先頭列を固定 */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin: 8px 0 4px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; }
th, td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
thead th { background: var(--turf); color: #fff; font-weight: 700; position: sticky; top: 0; }
tbody th { font-weight: 700; }
th:first-child, td:first-child { position: sticky; left: 0; text-align: left; z-index: 1; background: var(--paper); }
thead th:first-child { background: var(--turf); z-index: 2; }
tbody tr:nth-child(even) td, tbody tr:nth-child(even) th { background: color-mix(in srgb, var(--paper) 92%, var(--turf)); }
tr:last-child td, tr:last-child th { border-bottom: 0; }

/* グラフ */
figure { margin: 12px 0 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
figcaption { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.chart text { fill: var(--ink); font-size: 13px; }
.chart .b1 { fill: var(--turf); }
.chart .b2 { fill: var(--gold); }
.chart .neg { fill: var(--red); }
.chart .axis { stroke: var(--muted); stroke-width: 1; }

/* 新聞の紙面イメージ */
.paper-mock { background: #fffdf6; color: #1b211d; border: 1px solid #cfc5a8; border-radius: 6px; padding: 12px; font-size: 12px; box-shadow: 4px 4px 0 #d8ccaa; max-width: 420px; }
.paper-mock .pm-title { font-family: var(--serif); font-weight: 900; font-size: 18px; border-bottom: 3px double #1b211d; margin-bottom: 6px; }
.paper-mock .pm-cols { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.paper-mock .pm-cols div { border: 1px solid #cfc5a8; min-height: 120px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 4px; }
.paper-mock .pm-cols span { display: block; width: 100%; height: 6px; background: #ece4cc; }
.paper-mock .pm-mk { font-weight: 900; color: var(--red); }

/* 記事 */
article p, article li { max-width: 46em; }
.meta-line { font-size: 13px; color: var(--muted); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.cat-chips span { font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: var(--paper); }

/* 検索 */
.search-box { display: flex; gap: 8px; margin: 10px 0 12px; }
.search-box input { flex: 1; min-width: 0; min-height: 50px; font-size: 17px; padding: 0 14px; border: 2px solid var(--turf); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.search-box button { min-height: 50px; padding: 0 18px; border: 0; border-radius: var(--radius); background: var(--turf); color: #fff; font-weight: 800; font-size: 16px; }

/* フッター */
.site-foot { background: var(--night); color: #cfd8cf; font-size: 14px; padding: 0 0 40px; }
.site-foot .waku-stripe { margin-bottom: 20px; }
.site-foot a { color: #f6f1de; }
.site-foot .links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 12px; }
.site-foot .links a { min-height: var(--tap); display: inline-flex; align-items: center; }
.site-foot .fname { font-family: var(--serif); font-weight: 900; font-size: 20px; color: #fff; }
