/* 舟読み — モバイル前提のスタイル。
   デザインの軸は競艇の枠番カラー(1=白/2=黒/3=赤/4=青/5=黄/6=緑)。
   ファンには一目で意味が通る記号なので、これを情報設計の骨にする。 */

:root {
  --bg: #0e1116;
  --bg-soft: #161b23;
  --card: #1b212b;
  --card-2: #212836;
  --line: #2b3341;
  --fg: #e8edf5;
  --fg-dim: #97a3b6;
  --fg-faint: #6b7789;
  --accent: #4da3ff;
  --good: #3ddc97;
  --warn: #ffb648;
  --bad: #ff6b6b;

  --lane1: #ffffff; --lane1-fg: #111;
  --lane2: #1c1c1c; --lane2-fg: #fff;
  --lane3: #e2261c; --lane3-fg: #fff;
  --lane4: #1273e8; --lane4-fg: #fff;
  --lane5: #f5c400; --lane5-fg: #111;
  --lane6: #00a95f; --lane6-fg: #fff;

  --r: 14px;
  --pad: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP",
               "Yu Gothic UI", "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}

/* --- 上部バー --- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 17, 22, .86);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto;
  padding: 10px var(--pad);
  display: flex; align-items: baseline; gap: 10px;
}
.brand { font-size: 1.05rem; font-weight: 700; margin: 0; letter-spacing: .02em; }
.tagline { font-size: .72rem; color: var(--fg-faint); }

/* --- ビュー --- */
main { max-width: 720px; margin: 0 auto; padding: var(--pad); }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* --- コントロール --- */
.controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .74rem; color: var(--fg-dim); letter-spacing: .04em; }
select {
  appearance: none; width: 100%;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2397a3b6' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center/12px;
  color: var(--fg); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 40px 13px 14px; font-size: 1rem; font-family: inherit;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--line);
  color: var(--fg-dim); border-radius: 999px; padding: 8px 15px;
  font-size: .85rem; font-family: inherit; cursor: pointer; transition: .15s;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #08121f; font-weight: 700; }

/* --- レース一覧 --- */
.race-list { display: grid; gap: 10px; }
.race-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px var(--pad);
  cursor: pointer; transition: .15s; text-align: left; width: 100%;
  font-family: inherit; color: inherit;
}
.race-card:active { transform: scale(.985); background: var(--card-2); }
.rno { font-size: 1.35rem; font-weight: 800; min-width: 2.6em; letter-spacing: -.02em; }
.race-meta { flex: 1; min-width: 0; }
.race-venue { font-weight: 600; }
.race-sub { font-size: .78rem; color: var(--fg-dim); }
.race-right { text-align: right; font-size: .78rem; color: var(--fg-dim); white-space: nowrap; }
.badge {
  display: inline-block; font-size: .68rem; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); color: var(--fg-faint); border: 1px solid var(--line);
}
.badge.done { color: var(--fg-faint); }
.badge.soon { background: rgba(255,182,72,.14); color: var(--warn); border-color: rgba(255,182,72,.3); }
.badge.wait { color: var(--fg-faint); }

/* --- 時間順タブ(全会場を締切順に並べる) --- */
/* 会場チップと同じ形だが、区切りとして少し離し、選択時は色を変えて
   「会場ではない別の見方」だと分かるようにする。 */
.chip-time { margin-right: 6px; }
.chip-time.on { background: var(--warn); border-color: var(--warn); color: #1b1200; }
/* 時刻は "08:32" と5文字あり、"1R" 用の幅だと窮屈なので少し広げて字を詰める */
.rno-time { font-size: 1.05rem; min-width: 3.4em; font-variant-numeric: tabular-nums; }
/* 時間順のときは会場名の横にR番号を小さく添える(枠を増やさずに情報だけ足す) */
.rno-inline { font-size: .78rem; color: var(--fg-dim); font-weight: 700; margin-left: 2px; }
/* 次に締切が来る1レースだけ枠を目立たせる。144件の中の現在地になる */
.race-card.is-next { border-color: var(--warn); background: rgba(255,182,72,.06); }
.badge.next-tag { background: var(--warn); color: #1b1200; border-color: var(--warn); font-weight: 700; }
/* 終わったレースは下にまとめる。見えなくはせず、色だけ落として主役から外す */
.race-card.is-done { opacity: .62; }
.race-card.is-done:hover, .race-card.is-done:active { opacity: 1; }
.list-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 2px 0; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: .74rem; color: var(--fg-faint);
}
.list-divider span {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: .68rem;
}

/* --- 選手図鑑 --- */
.field-wide { flex: 1 1 100%; }
.racer-search {
  width: 100%; background: var(--card); border: 1px solid var(--line);
  color: var(--fg); border-radius: 10px; padding: 9px 12px;
  font-size: .95rem; font-family: inherit;
}
.racer-search:focus { outline: none; border-color: var(--accent); }
.racer-count { font-size: .74rem; color: var(--fg-faint); margin: 2px 2px 8px; }
.racer-count .muted { margin-left: 6px; }
.racer-list { display: grid; gap: 8px; }
.racer-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px var(--pad);
}
/* 星は行を開くボタンとは別に押せる必要がある(押し間違えると毎回詳細が開く) */
.fav-btn {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  color: var(--fg-faint); font-size: 1.15rem; line-height: 1;
  padding: 4px; border-radius: 8px; font-family: inherit;
}
.fav-btn.on { color: var(--warn); }
.fav-btn:active { transform: scale(.9); }
.fav-big { font-size: 1.6rem; }
.racer-open {
  flex: 1; min-width: 0; text-align: left; background: none; border: none;
  color: inherit; font-family: inherit; cursor: pointer; padding: 0;
}
.racer-name { display: block; font-weight: 700; font-size: .95rem; }
.racer-cls {
  font-size: .64rem; font-weight: 700; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--fg-dim); vertical-align: 1px;
}
.racer-cls.cls-A1 { background: rgba(255,182,72,.16); color: var(--warn); border-color: rgba(255,182,72,.3); }
.racer-cls.cls-A2 { background: rgba(90,200,250,.14); color: var(--accent); border-color: rgba(90,200,250,.3); }
.racer-line2 { display: block; font-size: .72rem; color: var(--fg-dim); margin-top: 2px; }
.racer-nums { text-align: right; white-space: nowrap; font-size: .95rem; }
.racer-nums .muted { display: block; font-size: .68rem; }
/* --- 買い目タブ(結局どれを買えばいいか) --- */
.pick-head {
  border-radius: var(--r); padding: 12px var(--pad); margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--card);
}
/* 「買っていい」と「見送り」を色で即断できるようにする。
   同じ形のまま文字だけ変えると、急いでいるとき読み違える */
.pick-head.go { border-color: var(--accent); background: rgba(90,200,250,.07); }
.pick-head.hold { border-color: var(--warn); background: rgba(255,182,72,.07); }
.pick-verdict { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.pick-conf { font-size: .8rem; color: var(--fg-dim); }
.pick-conf .muted { font-size: .72rem; }
/* 読みやすさのゲージ。目盛りが「見送りの境目」 */
.pick-gauge {
  position: relative; height: 6px; border-radius: 999px;
  background: var(--bg-soft); margin-top: 8px; overflow: visible;
}
.pick-gauge i {
  display: block; height: 100%; border-radius: 999px; background: var(--accent);
}
.pick-head.hold .pick-gauge i { background: var(--warn); }
.pick-mark {
  position: absolute; top: -3px; width: 2px; height: 12px;
  background: var(--fg-faint); border-radius: 1px;
}
.pick-stage { font-size: .7rem; color: var(--fg-faint); margin-top: 6px; }
.pick-list { display: grid; gap: 8px; }
.pick-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px var(--pad);
}
.pick-rank {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .75rem; font-weight: 800;
}
.pick-row:first-child .pick-rank {
  background: var(--accent); border-color: var(--accent); color: #08121f;
}
.pick-combo { flex: 1; display: flex; align-items: center; gap: 2px; }
.pick-arrow { color: var(--fg-faint); font-size: .7rem; margin: 0 1px; }
.pick-nums { text-align: right; white-space: nowrap; }
.pick-nums b { font-size: 1.05rem; }
.pick-nums .muted { display: block; font-size: .68rem; }
.pick-why { margin-top: 12px; }
.pick-why summary {
  cursor: pointer; font-size: .82rem; color: var(--fg-dim);
  padding: 8px 0;
}
.pick-why p { font-size: .8rem; margin: 6px 0; }

/* 選手ページの見出しは星を左に置くので横並びにする */
.racer-head { display: flex; align-items: flex-start; gap: 8px; }
/* いまの調子(直近90日 / 今期 / 今節)を3枠で並べる */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.form-cell {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 6px; text-align: center;
}
.form-cell b { display: block; font-size: 1.1rem; margin: 2px 0 1px; }
.form-label { font-size: .68rem; color: var(--fg-dim); }
.form-sub { display: block; font-size: .64rem; color: var(--fg-faint); }

/* --- レース詳細 --- */
.back {
  background: none; border: none; color: var(--accent);
  font-size: .9rem; padding: 4px 0 12px; cursor: pointer; font-family: inherit;
}
.race-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 2px; }
.race-facts { color: var(--fg-dim); font-size: .82rem; margin-bottom: 14px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--fg-dim);
  border-radius: 10px; padding: 10px; font-size: .9rem; font-family: inherit; cursor: pointer;
}
.tab.active { background: var(--card-2); color: var(--fg); border-color: var(--accent); font-weight: 700; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

/* --- 艇カード --- */
.boat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 10px; overflow: hidden;
}
.boat-head { display: flex; align-items: center; gap: 12px; padding: 12px var(--pad); }
.lane {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
  border: 1px solid rgba(255,255,255,.15);
}
.lane-1 { background: var(--lane1); color: var(--lane1-fg); }
.lane-2 { background: var(--lane2); color: var(--lane2-fg); }
.lane-3 { background: var(--lane3); color: var(--lane3-fg); }
.lane-4 { background: var(--lane4); color: var(--lane4-fg); }
.lane-5 { background: var(--lane5); color: var(--lane5-fg); }
.lane-6 { background: var(--lane6); color: var(--lane6-fg); }
.boat-name { flex: 1; min-width: 0; }
.boat-name b { font-size: 1.02rem; }
.boat-name .sub { display: block; font-size: .74rem; color: var(--fg-dim); }
.boat-rank { font-size: .8rem; color: var(--fg-dim); text-align: right; }
.boat-rank .r1 { color: var(--good); font-weight: 800; font-size: 1.1rem; }

.why { padding: 0 var(--pad) 14px; }
.why-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.why-label { font-size: .74rem; color: var(--fg-dim); width: 6.6em; flex: 0 0 auto; }
.bar { flex: 1; height: 7px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--good)); }
.why-val { font-size: .8rem; font-variant-numeric: tabular-nums; width: 5.4em; text-align: right; flex: 0 0 auto; }
.why-note { font-size: .72rem; color: var(--fg-faint); margin-top: 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill {
  font-size: .72rem; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 9px; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.pill b { color: var(--fg); }
.recent { letter-spacing: .18em; font-variant-numeric: tabular-nums; }

/* --- 期待値 --- */
.notice {
  border-radius: 12px; padding: 12px 14px; font-size: .8rem; line-height: 1.65;
  margin-bottom: 12px; border: 1px solid;
}
.notice.warn { background: rgba(255,182,72,.09); border-color: rgba(255,182,72,.28); color: #ffd79a; }
.notice.info { background: rgba(77,163,255,.08); border-color: rgba(77,163,255,.25); color: #b8d8ff; }

.ev-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px; margin-bottom: 8px;
}
.combo { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4.6em; }
.ev-mid { flex: 1; min-width: 0; font-size: .74rem; color: var(--fg-dim); }
.ev-val { text-align: right; font-variant-numeric: tabular-nums; }
.ev-val b { font-size: 1.05rem; }
.ev-hi b { color: var(--good); }
.ev-mid2 b { color: var(--fg); }
.ev-lo b { color: var(--fg-dim); }
.flag { font-size: .66rem; color: var(--warn); }

.metric-row { display: flex; gap: 10px; margin-bottom: 12px; }
.metric {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; text-align: center;
}
.metric .k { font-size: .7rem; color: var(--fg-dim); }
.metric .v { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* --- 汎用 --- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: var(--pad); margin-bottom: 12px;
}
.intro-card {
  position: relative; border-color: rgba(77,163,255,.28);
  background: rgba(77,163,255,.06); font-size: .84rem; line-height: 1.65;
  padding-right: calc(var(--pad) + 26px);
}
.intro-close {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--fg-dim);
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.prose h2 { font-size: 1.15rem; margin: 0 0 8px; }
.prose h3 { font-size: .95rem; margin: 18px 0 6px; color: var(--accent); }
.prose p, .prose li { font-size: .87rem; color: var(--fg-dim); }
.prose b, .prose strong { color: var(--fg); }
.prose .lead { font-size: 1rem; color: var(--fg); }
.prose ul { padding-left: 1.2em; }
.prose a { color: var(--accent); }
.muted { color: var(--fg-faint); font-size: .75rem; }

.btn {
  width: 100%; background: var(--accent); color: #08121f; border: none;
  border-radius: 12px; padding: 14px; font-size: .95rem; font-weight: 700;
  font-family: inherit; cursor: pointer;
}
.btn:disabled { background: var(--card-2); color: var(--fg-faint); }
.btn.ghost { background: var(--card); color: var(--fg); border: 1px solid var(--line); }

.loading { text-align: center; color: var(--fg-dim); font-size: .85rem; padding: 26px 0; }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--fg-faint); padding: 34px 0; font-size: .88rem; }

table.mini { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.mini th, table.mini td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--fg-dim); font-weight: 500; font-size: .72rem; }
table.mini td:first-child, table.mini th:first-child { text-align: left; }
table.mini td { font-variant-numeric: tabular-nums; }

/* --- 下部ナビ --- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: rgba(14,17,22,.94);
  backdrop-filter: saturate(160%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.navbtn {
  flex: 1; background: none; border: none; color: var(--fg-faint);
  padding: 9px 0 8px; font-size: .68rem; font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.navbtn .ico { font-size: 1.2rem; line-height: 1; }
.navbtn.active { color: var(--accent); }

@media (min-width: 640px) {
  body { padding-bottom: 0; }
  .tabbar { position: sticky; bottom: 0; }
}

/* --- 予想ゲーム --- */
.pick-head { font-weight: 700; font-size: .96rem; }
.pick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pickbtn {
  border: 2px solid transparent; border-radius: 11px; padding: 9px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: inherit; cursor: pointer; transition: .13s;
  filter: saturate(.55) brightness(.72);
}
.pickbtn.on { filter: none; border-color: var(--accent); transform: translateY(-2px); }
.pb-no { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.pb-p { font-size: .62rem; opacity: .82; font-variant-numeric: tabular-nums; }

.pick-result.won { border-color: rgba(61,220,151,.45); background: rgba(61,220,151,.07); }
.pick-result.lost { border-color: var(--line); }
.pick-body { margin: 4px 0 10px; font-size: .9rem; color: var(--fg-dim); }
.score-line {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--line); font-size: .82rem; color: var(--fg-dim);
}
.score-line b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.metric .v.pos { color: var(--good); }
.metric .v.neg { color: var(--bad); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge-item {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; opacity: .38;
}
.badge-item.got { opacity: 1; border-color: rgba(77,163,255,.4); background: rgba(77,163,255,.07); }
.bi-label { font-weight: 700; font-size: .84rem; }
.bi-desc { font-size: .7rem; color: var(--fg-dim); }

/* --- 夢枠 --- */
/* 夢枠は「配当の大きさ」だけでなく「なぜその配当なのか」まで見せる。
   外枠(.dream-card)が1点ぶん、その中が見出し(.dream)と根拠(.dream-body)。 */
.dream-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 13px; margin-bottom: 10px; overflow: hidden;
}
.dream-card.top { border-color: rgba(245,196,0,.45); background: rgba(245,196,0,.06); }
.dream {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
}
.dream-card.top .dream { border-bottom: 1px solid rgba(245,196,0,.22); }
.dream-card .dream { border-bottom: 1px solid var(--line); }
.dream-body { padding: 12px 15px 14px; }
.dl-title {
  font-size: .72rem; color: var(--fg-dim); font-weight: 600;
  letter-spacing: .06em; margin: 4px 0 8px;
}
.dl-boat {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 9px; margin-bottom: 5px;
  background: var(--bg-soft);
}
/* 全国平均でいちばん起きにくい着順 = 高配当の理由。ここだけ目立たせる */
.dl-boat.gate { background: rgba(255,182,72,.1); border: 1px solid rgba(255,182,72,.28); }
.dl-name { flex: 1; min-width: 0; }
.dl-name b { font-size: .92rem; }
.dl-sub { display: block; font-size: .68rem; color: var(--fg-faint); }
.dl-pos { text-align: right; font-size: .74rem; color: var(--fg-dim); flex: 0 0 auto; }
.dl-pos b { color: var(--fg); font-variant-numeric: tabular-nums; }
.dl-gate-note {
  font-size: .74rem; color: #ffd79a; margin: 8px 0 2px; line-height: 1.6;
}
.dl-row {
  display: flex; align-items: baseline; gap: 8px;
  font-size: .78rem; color: var(--fg-dim); margin-bottom: 4px;
}
.dl-row > span:first-child { width: 3em; flex: 0 0 auto; }
.dl-row b { color: var(--fg); font-variant-numeric: tabular-nums; }
.dl-n { margin-left: auto; font-size: .68rem; color: var(--fg-faint); }
.dream-rank { font-size: 1.05rem; color: var(--warn); width: 1.4em; text-align: center; }
.dream-main { flex: 1; min-width: 0; }
.dream-combo { font-size: 1.16rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.dream-sub { font-size: .72rem; color: var(--fg-dim); }
.dream-pay { text-align: right; }
.dream-pay b { display: block; font-size: 1.06rem; font-variant-numeric: tabular-nums; }
.dream-pay span { font-size: .68rem; color: var(--fg-dim); }

/* --- 実力と現実の2つの数字 --- */
.roi-card { border-color: rgba(77,163,255,.28); }
.roi-pair { display: flex; align-items: stretch; gap: 8px; margin: 12px 0 4px; }
.roi-box {
  flex: 1; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 10px; text-align: center;
}
.roi-box.pos { border-color: rgba(61,220,151,.4); background: rgba(61,220,151,.07); }
.roi-box.pos .roi-v { color: var(--good); }
.roi-box.neg .roi-v { color: var(--fg); }
.roi-k { font-size: .68rem; color: var(--fg-dim); }
.roi-v { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.25; }
.roi-note { font-size: .64rem; color: var(--fg-faint); }
.roi-arrow {
  align-self: center; font-size: .7rem; color: var(--bad);
  font-weight: 700; white-space: nowrap; padding: 0 2px;
}

.warn-text { color: var(--warn); }

/* --- しくみ(折りたたみセクション) --- */
.acc {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 10px; overflow: hidden;
}
.acc > summary {
  list-style: none; cursor: pointer; padding: 14px var(--pad);
  font-weight: 700; font-size: .95rem; display: flex;
  align-items: center; justify-content: space-between; gap: 10px;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
  content: ""; width: 8px; height: 8px; flex: 0 0 auto;
  border-right: 2px solid var(--fg-dim); border-bottom: 2px solid var(--fg-dim);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform .18s;
}
.acc[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.acc[open] > summary { border-bottom: 1px solid var(--line); }
.acc-body { padding: 12px var(--pad) var(--pad); }
.acc-body p { font-size: .85rem; color: var(--fg-dim); margin: 0 0 10px; }
.acc-body p:last-child { margin-bottom: 0; }
.acc-body b { color: var(--fg); }
.acc-body ul { padding-left: 1.2em; margin: 0; }
.acc-body li { font-size: .85rem; color: var(--fg-dim); margin-bottom: 6px; }
.acc-body a { color: var(--accent); }

/* --- 選手ページ(下から出るシート) --- */
.racer-link { cursor: pointer; }
.racer-chev { color: var(--fg-faint); font-weight: 400; margin-left: 3px; }
.racer-link:active { opacity: .6; }

.sheet {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(0, 0, 0, .55);
}
.sheet.open { display: block; }
.sheet-inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 86vh; overflow-y: auto;
  background: var(--bg-soft); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  /* 下端はタブバーに隠れるので、その高さぶん余白を足す */
  padding: 14px var(--pad) calc(var(--pad) + 72px);
  animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(18px); opacity: .4 } to { transform: none; opacity: 1 } }
.sheet-close {
  float: right; background: var(--card); color: var(--fg-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: .78rem;
}
.racer-head { margin-bottom: 12px; }
.racer-head b { font-size: 1.15rem; display: block; }
.racer-head .sub { font-size: .78rem; color: var(--fg-dim); }
#racer-body h4 {
  font-size: .8rem; color: var(--fg-dim); font-weight: 600;
  margin: 16px 0 8px; letter-spacing: .04em;
}
.racer-bars .why-row { margin-bottom: 6px; }
.racer-n { font-size: .72rem; color: var(--fg-faint); width: 44px; text-align: right; }

/* --- オッズの鮮度と更新 --- */
.odds-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px var(--pad); margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); font-size: .78rem; color: var(--fg-dim);
}
.odds-age { flex: 1 1 auto; }
.odds-age b { color: var(--fg); font-variant-numeric: tabular-nums; }
.odds-age b.stale { color: #f5a524; }
.odds-auto { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; cursor: pointer; }
.odds-auto input { accent-color: var(--accent); width: 15px; height: 15px; }
.odds-btn {
  flex: 0 0 auto; background: var(--card-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: .78rem;
}
.odds-btn:disabled { opacity: .5; }
.odds-btn:active:not(:disabled) { background: var(--line); }

/* --- 見立て(舟読み vs オッズ) --- */
.outlook-label { font-weight: 700; color: var(--fg); }
.bar-model { background: linear-gradient(90deg, #f5c400, #ff8a3d) !important; }
.outlook-sep { border-bottom: 1px dashed var(--line); margin: 10px 0 2px; }
.split-note {
  font-size: .74rem; color: #ffd79a; margin-top: 6px;
}
.boat-split { border-color: rgba(255,182,72,.4); }

/* --- 分割ビュー(ペイン) ---
   ＋を押すとペインが増える。1枚のときは今までどおり普通のページ、
   2枚以上のときだけグリッドに切り替えて各ペインが独立にスクロールする。
   スマホの縦画面で左右に割ると1枚187pxしかなく読めないので、
   狭いときは上下、横長のときは左右に並べる。 */
.panes { max-width: 720px; margin: 0 auto; padding: var(--pad); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-bar { display: none; }
.pane-body { min-height: 0; }

.panes.split {
  max-width: 1400px; padding: 8px; gap: 8px; display: grid;
  /* 画面いっぱいに収め、はみ出しはペインの中でスクロールさせる */
  height: calc(100dvh - 46px - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.panes.split .pane {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.panes.split .pane.focused { border-color: var(--accent); }
.panes.split .pane-bar {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.panes.split .pane.focused .pane-bar { background: var(--card-2); }
.pane-title {
  flex: 1; min-width: 0; font-size: .76rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pane-close {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-dim);
  font-size: .9rem; line-height: 1; padding: 0; cursor: pointer;
}
.panes.split .pane-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; }
/* 分割中はページ全体をスクロールさせない(各ペインの中だけが動く) */
body.split-mode { overflow: hidden; }

/* 3画面は「上に1枚・下に2枚」で固定する。
   4分割はスマホだと1枚が小さすぎて実用にならなかったので上限を3にした。 */
.panes.split[data-n="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.panes.split[data-n="3"] .pane:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
.panes.split[data-n="3"] .pane:nth-child(2) { grid-column: 1; grid-row: 2; }
.panes.split[data-n="3"] .pane:nth-child(3) { grid-column: 2; grid-row: 2; }

@media (min-width: 720px) {
  .panes.split[data-n="2"] { grid-template-columns: 1fr 1fr; }
}

/* 並べ替え: 見出しの⠿を掴んで、入れ替えたい画面の上で離す */
.pane-grip {
  flex: 0 0 auto; color: var(--fg-faint); font-size: .9rem;
  padding: 2px 4px; cursor: grab; touch-action: none; user-select: none;
}
.pane.dragging { opacity: .55; }
.pane.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

@keyframes menu-pop { from { opacity: 0; transform: translateY(6px) } to { opacity: 1 } }
.navbtn:disabled { opacity: .3; }
.navbtn-add .ico { font-weight: 700; }

/* --- 買い目メモ --- */
.slip-add {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--accent);
  font-size: .95rem; line-height: 1; padding: 0; cursor: pointer; font-family: inherit;
}
.slip-add.added { background: var(--accent); color: #08121f; border-color: var(--accent); }
.dream .slip-add { margin-left: 8px; }

.slip-chip {
  position: fixed; right: 14px; z-index: 55;
  bottom: calc(72px + env(safe-area-inset-bottom));
  background: var(--accent); color: #08121f; border: none;
  border-radius: 999px; padding: 10px 16px; font-size: .82rem; font-weight: 700;
  font-family: inherit; box-shadow: 0 6px 18px rgba(0,0,0,.4); cursor: pointer;
}
.slip-group { margin-bottom: 14px; }
.slip-race { font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
.slip-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; margin-bottom: 5px;
}
.slip-type { font-size: .68rem; color: var(--fg-dim); flex: 0 0 3.4em; }
.slip-combo { flex: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.slip-odds { font-size: .74rem; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.slip-del {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-dim);
  font-size: .8rem; line-height: 1; padding: 0; cursor: pointer;
}

/* --- ブラウザ画面 --- */
/* hidden属性より class の display が強いので、明示的に打ち消す。
   これを書き忘れて「＋メニューが常に画面に出たまま」になっていた。 */
.add-menu[hidden] { display: none; }
.add-menu {
  position: fixed; right: 8px; z-index: 70;
  bottom: calc(66px + env(safe-area-inset-bottom));
  animation: menu-pop .14s ease-out;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 4px;
}
.add-menu button {
  background: none; border: none; color: var(--fg); font-family: inherit;
  font-size: .84rem; padding: 10px 14px; border-radius: 8px;
  text-align: left; white-space: nowrap; cursor: pointer;
}
.add-menu button:active { background: var(--bg-soft); }

.pane-web { min-height: 0; }
.web-bar {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
  padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--card);
}
.web-lock { font-size: .74rem; flex: 0 0 auto; }
.web-url {
  flex: 1; min-width: 0; background: var(--bg-soft); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; font-size: .74rem; font-family: inherit;
}
.web-go, .web-ext {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-dim);
  font-size: .8rem; line-height: 26px; text-align: center; text-decoration: none;
  padding: 0; cursor: pointer; font-family: inherit;
}
.web-body { flex: 1; min-height: 0; position: relative; background: #fff; }
/* 拡大縮小。zoom を掛けた要素の中では % が既に 1/z されて解決されるので、
   width/height は 100% のままでよい(自分で 1/z すると二重に効いて枠がはみ出す)。
   結果、見た目は画面いっぱいのまま、中のページの表示領域だけが
   広く(縮小時)または狭く(拡大時)なる = 本物のズームと同じ挙動になる。 */
.web-frame {
  width: 100%; height: 100%;
  border: 0; display: block; zoom: var(--z, 1);
}
.web-frame[hidden] { display: none; }   /* class の display が hidden属性に勝つため */
.web-start, .web-msg {
  padding: 14px; background: var(--bg); height: 100%; overflow-y: auto;
}
.web-start .why-note, .web-msg .why-note { color: var(--fg-dim); }

/* 画面ごとの拡大縮小 */
.pane-body { zoom: var(--z, 1); }
.pane-zoom {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-dim);
  font-size: .78rem; line-height: 1; padding: 0; cursor: pointer; font-family: inherit;
}
.pane-zoom:active { background: var(--line); }

/* 的中率のバー(成績画面の主役) */
.hit-bar {
  height: 12px; background: var(--bg-soft); border-radius: 999px;
  overflow: hidden; margin: 10px 0 12px;
}
.hit-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--good));
}

/* 期待値: 大きい数字がオッズ基準、その下に舟読み基準 */
.ev-net { display: block; font-size: .58rem; color: var(--fg-faint); font-weight: 400; }

/* 舟読みの期待値(単勝のみ) */
.ev-model { display: block; font-size: .6rem; color: var(--warn); font-weight: 400; }
.ev-model.hot { color: var(--good); font-weight: 700; }
.ev-sort { margin-bottom: 8px; }

/* 夢枠の倍率選択 */
.dream-min { margin-bottom: 10px; }

/* 前付け(枠番より内に入ること)。起きるとレースが荒れる */
.pill.mae { background: rgba(255,107,107,.14); border-color: rgba(255,107,107,.35); color: #ffb3b3; }
.pill.mae b { color: #ff8f8f; }
.mae-note { font-size: .74rem; color: #ffb3b3; margin-top: 6px; line-height: 1.55; }
.boat-mae { border-color: rgba(255,107,107,.45); }

/* 前付けの全パターン表。上がった枠と下がった枠を色で示す */
.mae-matrix { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mae-matrix td.up { color: var(--good); }
.mae-matrix td.dn { color: var(--bad); }

/* 検証用の長文セクション。見出しで区切って読めるようにする */
.acc-body h4 {
  font-size: .82rem; color: var(--accent); margin: 16px 0 6px; font-weight: 700;
}
.acc-body h4:first-child { margin-top: 4px; }
.acc-body code {
  background: var(--bg-soft); padding: 1px 5px; border-radius: 4px;
  font-size: .78em; color: var(--fg);
}

/* 「もし前付けしてきたら」の試算 */
.sim-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px var(--pad); margin-bottom: 12px;
}
.sim-head { font-size: .82rem; font-weight: 700; margin-bottom: 8px; }
.sim-chips { margin-bottom: 6px; }
.sim-label { color: #c9a6ff !important; }
.bar-sim { background: linear-gradient(90deg, #a06bff, #d9a6ff) !important; }

/* 前付けの起こりやすさを織り込んだ見立て */
.blend-label { color: #ffb3b3 !important; }
.bar-blend { background: linear-gradient(90deg, #ff6b6b, #ffb648) !important; }
.blend-note { font-size: .76rem; }

/* レース結果の速報(正式な成績は翌朝、それまでの繋ぎ) */
.result-box {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(80, 200, 140, .10); border: 1px solid rgba(80, 200, 140, .32);
}
.result-head { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.result-tag {
  font-size: .66rem; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: rgba(80, 200, 140, .22); color: #7fe0ad;
}
.result-order { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.result-item { display: flex; align-items: center; gap: 5px; }
.result-item .lane { width: 24px; height: 24px; font-size: .8rem; }
.result-rank { font-size: .8rem; color: var(--muted); }
.result-item.dq .result-rank { color: #ff9a9a; }
.result-facts { margin-top: 8px; font-size: .82rem; }

/* 実績(公開台帳)。買い目の組番は等幅で桁を揃える */
.track-body .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: .02em; }
.track-body table.mini td, .track-body table.mini th { white-space: nowrap; }

/* データ更新の遅延掲示(メンテナンス告知)。目立つが叫ばない琥珀色 */
.health-banner {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, #b45309 18%, var(--card));
  border-bottom: 1px solid #b45309;
  padding: 8px 14px; font-size: .86rem; line-height: 1.5;
}
.health-banner b { color: #d97706; }
.health-banner .hb-detail { opacity: .85; }

/* 買い目メモの金額入力と収支記録 */
.slip-stake { width: 4.6em; padding: 3px 6px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--fg); text-align: right; }
.slip-stake-wrap { font-size: .85rem; white-space: nowrap; }
.wallet-del { border: none; background: none; color: var(--muted); font-size: 1rem;
  cursor: pointer; padding: 2px 6px; }

/* 成績ハブの切り替え(あなた / 舟読みAI) */
.seg { display: flex; gap: 6px; margin-bottom: 6px; }
.seg-btn { flex: 1; padding: 9px 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--muted); font-size: .95rem; cursor: pointer; }
.seg-btn.active { background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 700; }
.seg-note { margin: 0 0 12px; font-size: .8rem; }

/* オッズバー: 状態と「なぜその間隔か」を2行で出す */
.odds-bar-row { display: flex; align-items: center; gap: 10px; }
.odds-note { font-size: .74rem; color: var(--fg-faint); line-height: 1.4; margin-top: 3px; }
.odds-note:empty { display: none; }
