/* ============================================================
   競艇AI ダッシュボード v2.1 — ライトテーマ（SmartHR Design System 準拠）
   背景: Stone01 #f8f7f6 / カード: #fff + Border #d6d3d0
   Primary: Product Main #0077c7 / Link: #0071c1 / Danger: #e01e5a
   外部フォント・外部CDN禁止（@font-face は local() のみ）
   ============================================================ */

/* Windows の游ゴシックが font-weight:400 で細く出るのを防ぐ（DESIGN.md 指定の必須トリック） */
@font-face { font-family: AdjustedYuGothic; font-weight: 400; src: local("Yu Gothic Medium"); }
@font-face { font-family: AdjustedYuGothic; font-weight: 700; src: local("Yu Gothic Bold"); }

:root {
  /* Stone 系ウォームグレー（純グレー禁止） */
  --bg: #f8f7f6;            /* Stone01: ページ背景 */
  --bg2: #f2f1f0;           /* Over Background: グルーピング面 */
  --head: #edebe8;          /* Stone02: テーブルヘッダー */
  --surface: #ffffff;
  --border: #d6d3d0;
  --border-soft: #e8e6e3;
  --text: #23221e;          /* Text Black */
  --muted: #706d65;         /* Text Grey */
  --muted2: #7d7a72;        /* 最小キャプション用（Stone03 #aaa69f はコントラスト不足のため濃調整） */
  --stone3: #aaa69f;
  --stone4: #4e4c49;
  /* Primary / Link（Apple系 Action Blue に寄せて今日タブと統一） */
  --primary: #0066cc;       /* Action Blue */
  --primary-soft: rgba(0, 102, 204, 0.08);
  --primary-line: rgba(0, 102, 204, 0.45);
  --link: #0066cc;
  /* Semantic（白背景でAAコントラスト確保） */
  --green: #2e8159;         /* チャート緑 #4bb47d の濃色（損益プラス） */
  --green-soft: #e1f0e8;
  --red: #e01e5a;           /* Danger（損益マイナス） */
  --red-soft: #fce8ee;
  --amber: #8f6700;         /* Warning #ffcc17 の文字用濃色 */
  --amber-soft: #fdf3d1;
  --gold: #8a6d00;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.05);  /* Apple系: シャドウは最小限・境界線主体 */
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.10);
  --sidebar-w: 198px;
  --topbar-h: 54px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", BlinkMacSystemFont, AdjustedYuGothic, "Yu Gothic", YuGothic, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; letter-spacing: inherit; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- レイアウト骨格 ---------- */
#sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 40;
}
#main { margin-left: var(--sidebar-w); min-height: 100vh; }
#view { padding: 16px 20px 32px; max-width: 1280px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid var(--border-soft); }
.brand-ic { font-size: 22px; }
.brand-tx { display: flex; flex-direction: column; line-height: 1.3; }
.brand-tx b { font-size: 15px; letter-spacing: 0.04em; }
.brand-tx i { font-style: normal; font-size: 10px; color: var(--muted2); letter-spacing: 0.08em; }

.nav-side { display: flex; flex-direction: column; gap: 2px; padding: 10px; flex: 1; }
.nav-side a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 6px;
  color: var(--stone4); font-size: 13.5px; font-weight: 500;
}
.nav-side a svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-side a:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.nav-side a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; box-shadow: inset 3px 0 0 var(--primary); }
.side-foot { padding: 12px 16px; font-size: 10.5px; color: var(--muted2); border-top: 1px solid var(--border-soft); }

/* ---------- トップバー ---------- */
#topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.tb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-brand { display: none; font-size: 18px; }
#page-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.mock-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--amber); background: var(--amber-soft);
  border: 1px solid #e5c95c;
  padding: 2px 7px; border-radius: 5px;
}
.tb-right { display: flex; align-items: center; gap: 10px; }
.tb-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tb-updated { font-size: 11px; color: var(--muted2); white-space: nowrap; min-width: 86px; text-align: right; }
.btn-refresh svg { width: 14px; height: 14px; }
.btn-refresh.loading svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 汎用部品 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; min-height: 32px;
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--primary-line); background: #fbfbfa; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { border-color: var(--border); background: var(--surface); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #0068af; }

select, input[type="date"] {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 9px; min-height: 32px; font-size: 12.5px;
  font-family: inherit; color-scheme: light;
}
select:focus, input:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.panel > h2 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.06em; line-height: 1.5;
  display: flex; align-items: center; gap: 8px;
}
.panel > h2 .more { margin-left: auto; font-size: 11.5px; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-2 .panel { margin-bottom: 0; }
.grid-2 { margin-bottom: 14px; }

/* 状態表示（ローディング / エラー / 空） */
.state-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 38px 16px; color: var(--muted); text-align: center; font-size: 13px;
}
.state-box.err { color: #b3164a; }
.state-box .state-sub { font-size: 11px; color: var(--muted2); word-break: break-all; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

/* ---------- 使い方ガイド（折りたたみ） ---------- */
.help {
  background: #f0f7fc; border: 1px solid #c8e0f0;
  border-radius: 8px; margin-bottom: 14px;
}
.help summary {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; cursor: pointer; list-style: none;
  font-size: 13px; font-weight: 700; color: #0a5a92;
  min-height: 44px;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: "▾"; margin-left: auto; color: var(--primary); font-size: 12px; }
.help[open] summary::after { content: "▴"; }
.help-body { padding: 0 14px 12px; font-size: 13px; line-height: 1.7; color: var(--text); }
.help-body p { margin: 0 0 8px; }
.help-body p:last-child, .help-body ul:last-child { margin-bottom: 0; }
.help-body ul { margin: 0 0 8px; padding-left: 1.4em; }
.help-body li { margin: 2px 0; }
.help-body b { color: #0a5a92; }

/* ---------- 用語集モーダル ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(35, 34, 30, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-2);
  max-width: 600px; width: 100%; max-height: 82vh; overflow: auto;
  padding: 18px 20px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.glossary { margin: 0; }
.glossary dt { font-weight: 700; font-size: 13.5px; margin: 12px 0 0; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0 0; font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ---------- KPIカード ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px 11px; min-width: 0;
  box-shadow: var(--shadow-1);
}
.kpi .k-lbl { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.kpi .k-val { font-size: 26px; font-weight: 700; line-height: 1.3; margin: 2px 0 1px; }
.kpi .k-val .kpi-unit { font-size: 14px; font-weight: 500; color: var(--muted); }
.kpi .k-sub { font-size: 11px; color: var(--muted2); display: flex; align-items: center; gap: 7px; }
.meter { flex: 0 0 64px; height: 5px; background: var(--head); border-radius: 3px; overflow: hidden; display: inline-block; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }

/* ---------- テーブル ---------- */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 2;
  background: var(--head); color: var(--stone4);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .r { text-align: right; }
.tbl th.r { text-align: right; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: var(--bg2); }
.tbl tbody tr.row-open { background: rgba(0, 119, 199, 0.06); }
.tbl tbody tr.row-edge td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* ---------- 艇番・級別・バッジ ---------- */
/* 艇番チップ: 公式カラー（1白/2黒/3赤/4青/5黄/6緑）。白背景でも識別できるよう全色に枠線 */
.tb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px;
  font-size: 12px; font-weight: 700; flex: 0 0 auto;
  font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.tb1 { background: #ffffff; color: #23221e; box-shadow: inset 0 0 0 1.5px #23221e; }
.tb2 { background: #23221e; color: #ffffff; box-shadow: inset 0 0 0 1px #23221e; }
.tb3 { background: #d6394f; color: #ffffff; box-shadow: inset 0 0 0 1px #b02c40; }
.tb4 { background: #1f6fd6; color: #ffffff; box-shadow: inset 0 0 0 1px #1859ad; }
.tb5 { background: #f2c500; color: #23221e; box-shadow: inset 0 0 0 1px #c9a300; }
.tb6 { background: #168a44; color: #ffffff; box-shadow: inset 0 0 0 1px #116b35; }

.kc {
  display: inline-block; font-size: 9.5px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; vertical-align: 1px;
  background: var(--head); color: var(--muted);
}
.kc-A1 { background: #f8edcc; color: var(--gold); }
.kc-A2 { background: #e1f0fa; color: #19618e; }

.bdg {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; border-radius: 5px;
  padding: 1px 6px; line-height: 1.5; flex: 0 0 auto;
}
.bdg-edge { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-line); }
.bdg-near { background: var(--amber-soft); color: var(--amber); border: 1px solid #e5c95c; }

.chip-st { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.chip-open { background: var(--primary-soft); color: var(--primary); }
.chip-fin { background: var(--head); color: var(--muted); }
.st-hit { color: var(--green); font-weight: 700; }
.st-miss { color: var(--red); }
.st-ref { color: var(--amber); }

.rank { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9px; background: var(--head); color: var(--muted); }
.rk1 { background: #f8edcc; color: var(--gold); box-shadow: inset 0 0 0 1px #d9c27a; }
.rk2 { background: #edebe8; color: var(--stone4); box-shadow: inset 0 0 0 1px #c1bdb7; }
.rk3 { background: #f3e3d3; color: #95541e; box-shadow: inset 0 0 0 1px #d8b48c; }
.rkx { background: var(--red-soft); color: var(--red); }

/* ---------- ホーム ---------- */
.dl-list { display: flex; flex-direction: column; gap: 8px; }
.dl-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 9px 12px; color: var(--text); min-height: 48px;
}
.dl-row:hover { border-color: var(--primary-line); text-decoration: none; }
.dl-time { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.dl-time b { font-size: 16px; font-weight: 700; }
.dl-time i { font-style: normal; font-size: 10px; color: var(--primary); }
.dl-time i.soon { color: var(--amber); font-weight: 700; }
.dl-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dl-race { font-size: 12px; color: var(--muted); }
.dl-pick { display: flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; overflow: hidden; }
.dl-right { text-align: right; font-size: 11.5px; color: var(--muted); }
.dl-right b { display: block; font-size: 14px; color: var(--text); }

/* ---------- レース ---------- */
.race-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.race-toolbar .sep { flex: 1; }
.date-label { font-size: 14.5px; font-weight: 700; padding: 0 2px; white-space: nowrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); color: var(--stone4);
  border: 1px solid var(--border); border-radius: 17px;
  padding: 7px 14px; min-height: 36px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--primary-line); }
.chip .c-n { font-size: 10.5px; font-weight: 500; color: var(--muted2); }
.chip .c-e { font-size: 10.5px; color: var(--primary); font-weight: 700; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.active .c-n { color: rgba(255, 255, 255, 0.85); }
.chip.active .c-e { color: #fff; }

.rdetail { padding: 2px 2px 6px; }
tr.rrow-detail > td { background: var(--bg); padding: 12px 14px 14px; white-space: normal; }
.rdetail-head { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; align-items: center; }
.rdetail-head b { color: var(--text); }
.rec-line {
  background: #eef6fc; border: 1px solid rgba(0, 119, 199, 0.35);
  border-radius: 7px; padding: 7px 11px; font-size: 12.5px; margin-bottom: 6px;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.rdetail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr); gap: 14px; margin-top: 10px; }
.boats { display: flex; flex-direction: column; gap: 5px; }
.boat {
  display: grid; grid-template-columns: 24px minmax(150px, 1.1fr) minmax(110px, 1fr) 60px;
  gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 7px; padding: 6px 10px;
}
.boat.top { border-color: var(--primary-line); background: #f7fbfe; }
.b-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.b-sub { font-size: 10.5px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar { position: relative; height: 18px; background: var(--head); border-radius: 4px; overflow: hidden; }
.pbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(0, 119, 199, 0.55), rgba(0, 119, 199, 0.95)); border-radius: 4px; }
.pbar .pv {
  position: absolute; right: 3px; top: 2px;
  line-height: 14px; font-size: 10px; font-weight: 700; color: var(--text);
  background: rgba(255, 255, 255, 0.88); border-radius: 3px; padding: 0 4px;
}
.b-rank { text-align: right; }
.side-sub { font-size: 11px; color: var(--muted2); margin: 8px 2px 0; }
.payouts-ttl { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 0.05em; margin: 0 0 6px; }

/* ---------- 履歴 ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-title { font-size: 14.5px; font-weight: 700; min-width: 96px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 10px; color: var(--muted2); padding: 2px 0; }
.cal .dow.sun { color: #bc4a4a; }
.cal .dow.sat { color: #3a78b5; }
.cal-day {
  appearance: none; border: 1px solid var(--border-soft); background: var(--bg);
  border-radius: 6px; min-height: 52px; padding: 4px 5px 3px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  cursor: pointer; color: var(--text); font-family: inherit;
}
.cal-day:hover { border-color: var(--primary-line); }
.cal-day.blank { visibility: hidden; }
.cal-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface); }
.cal-day .dn { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.cal-day.today .dn { color: var(--primary); font-weight: 700; }
.cal-day .ce { font-size: 11px; font-weight: 700; color: var(--primary); line-height: 1.4; }
.cal-day .dots { display: flex; gap: 2.5px; margin-top: auto; }
.cal-day .dots s { width: 5px; height: 5px; border-radius: 50%; background: var(--green); text-decoration: none; }
.cal-legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--muted2); margin-top: 8px; flex-wrap: wrap; }
.cal-legend s { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--green); text-decoration: none; margin-right: 4px; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filters .count { margin-left: auto; font-size: 11.5px; color: var(--muted2); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.pager .pg { font-size: 12.5px; color: var(--muted); min-width: 64px; text-align: center; }

/* ---------- 検証成績 ---------- */
.chart-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-left: auto; flex-wrap: wrap; }
.legend .li { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; background: #2d7df0; display: inline-block; }
.legend .sw.band { height: 9px; background: rgba(45, 125, 240, 0.12); border: 1px solid rgba(45, 125, 240, 0.35); }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-note { font-size: 10.5px; color: var(--muted2); margin-top: 6px; }
.strat-cur td { background: rgba(0, 119, 199, 0.06); }

/* ---------- システム ---------- */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.sys-grid .panel { margin-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { text-align: right; word-break: break-all; }
.okchip { font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 9px; white-space: nowrap; display: inline-block; }
.okchip.ok { background: var(--green-soft); color: var(--green); }
.okchip.ng { background: var(--red-soft); color: var(--red); }
.prog-row { margin: 8px 0 12px; }
.prog-lbl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.prog { height: 8px; background: var(--head); border-radius: 4px; overflow: hidden; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, #2d7df0, var(--primary)); border-radius: 4px; }
.bignum { font-size: 24px; font-weight: 700; }

/* ---------- モバイル下部タブ ---------- */
.nav-tab { display: none; }

/* ============================================================
   レスポンシブ（≤768px: サイドバー→下部タブバー）
   ============================================================ */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #main { margin-left: 0; }
  #view { padding: 12px 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 18px); }
  #topbar { padding: 0 12px; }
  .tb-brand { display: inline; }
  #page-title { font-size: 15px; }
  .tb-date { display: none; }
  .tb-updated { display: none; }
  .tb-refresh-tx { display: none; }
  .tb-glossary-tx { display: none; }
  .btn-refresh, .btn-glossary { min-width: 38px; justify-content: center; }
  .modal-backdrop { padding: 14px; }
  .modal { padding: 14px 16px 16px; }

  .nav-tab {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .nav-tab a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 44px; color: var(--muted); font-size: 9.5px; font-weight: 600;
  }
  .nav-tab a:hover { text-decoration: none; }
  .nav-tab a svg { width: 20px; height: 20px; }
  .nav-tab a.active { color: var(--primary); font-weight: 700; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 11px 12px 9px; }
  .kpi .k-val { font-size: 21px; }
  .grid-2 { grid-template-columns: 1fr; }
  .rdetail-grid { grid-template-columns: 1fr; }
  .boat { grid-template-columns: 24px minmax(0, 1fr) 56px; grid-template-areas: "tb name rank" "tb bar bar"; row-gap: 5px; }
  .boat .b-info { grid-area: name; min-width: 0; }
  .boat .b-bar { grid-area: bar; }
  .boat .b-rank { grid-area: rank; }
  .boat .tb { grid-area: tb; }
  .tbl td, .tbl th { padding: 8px 7px; }
  .hide-m { display: none; }
  .tbl .wrap { white-space: normal; min-width: 118px; }
  .panel { padding: 12px 12px; }
  .dl-right { display: none; }
}
@media (max-width: 420px) {
  .hide-s { display: none; }
  table.tbl { font-size: 11.5px; }
  .tbl td, .tbl th { padding: 7px 5px; }
  .cal-day { min-height: 46px; }
}

/* ---------- 今日の買い場（判断カード） ---------- */
.judge-list { display: flex; flex-direction: column; gap: 12px; }
.judge-card {
  background: var(--bg); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 12px 14px;
}
.judge-card.jc-hit { border-left-color: var(--green); }
.jc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.jc-race { font-size: 16px; }
.jc-deadline { font-size: 12.5px; color: var(--muted); }
.jc-deadline b { font-size: 15px; color: var(--text); }
.jc-deadline i { font-style: normal; font-size: 11px; color: var(--primary); margin-left: 4px; }
.jc-deadline i.soon { color: var(--amber); font-weight: 700; }
.jc-rule { margin: 10px 0 2px; font-size: 15px; }
.jc-rule b { font-size: 18px; color: var(--primary); }
.jc-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.btn-odds {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff !important; font-weight: 700;
  font-size: 13.5px; padding: 9px 16px; border-radius: 6px; min-height: 40px;
}
.btn-odds:hover { opacity: 0.88; text-decoration: none; }
.jc-judge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.odds-in {
  width: 76px; min-height: 38px; padding: 4px 8px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.odds-in:focus { outline: 2px solid var(--primary-line); }
.odds-verdict { font-size: 13.5px; }
.jc-reasons { margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.jc-result { margin-top: 8px; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.jc-more { display: inline-block; margin-top: 8px; font-size: 12.5px; }

/* ---------- 本日のタイムライン ---------- */
.tl-list { display: flex; flex-direction: column; gap: 4px; max-height: 480px; overflow-y: auto; }
.tl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px; color: var(--text);
  border: 1px solid transparent; font-size: 13px;
}
.tl-row:hover { background: var(--primary-soft); text-decoration: none; }
.tl-row.tl-past { color: var(--muted2); }
.tl-row.tl-past .num { color: inherit; }
.tl-row.tl-edge { background: var(--amber-soft); border-color: var(--border-soft); }
.tl-time { min-width: 44px; font-weight: 700; }
.tl-race { min-width: 84px; }
.tl-pick { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.tl-right { margin-left: auto; font-size: 12.5px; white-space: nowrap; }

/* ---------- 買い方パネル ---------- */
.bet-panel { margin-top: 14px; }
@media (max-width: 480px) {
  /* タイムラインの360px横はみ出し対策(実測でtl-rowが+8px) */
  .tl-row { gap: 6px; padding: 6px; font-size: 12px; }
  .tl-race { min-width: 60px; }
  .tl-pick { overflow: hidden; }
  .tl-pick .num { display: none; }
  .tl-right { font-size: 11px; }
}

/* ===== #/predict モードA: 全レース予想 ===== */
.pcards { display: flex; flex-direction: column; gap: 8px; }
.pcard { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-1); }
.pcard-mb { border-color: var(--primary-line); box-shadow: inset 3px 0 0 var(--primary), var(--shadow-1); }
.pc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.pc-r { font-size: 15px; }
.pc-dl { font-size: 11.5px; color: var(--muted); }
.pmb { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 9px; border-radius: 10px; }
.pc-marks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
.pmk { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.pmk-m { color: var(--red); font-size: 13px; font-weight: 700; }
.pmk-nm { color: var(--text); }
.pmk-p { color: var(--muted2); font-size: 11.5px; }
.pc-forms { display: flex; flex-wrap: wrap; gap: 6px; }
.pf { display: inline-flex; align-items: baseline; gap: 5px; background: var(--bg2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 3px 9px; font-size: 12.5px; }
.pf-bt { font-size: 10.5px; color: var(--muted2); font-weight: 700; }
.pf-c { color: var(--text); letter-spacing: 0.02em; }
.pf-pr { font-size: 10.5px; color: var(--muted); }
@media (max-width: 480px) {
  .pc-forms { gap: 5px; }
  .pf { padding: 3px 7px; font-size: 12px; }
  .pc-marks { gap: 3px 10px; }
}

/* ============================================================
   今日タブ（買い判断カード・Apple系ライト）
   設計: docs/superpowers/specs/2026-06-14-kyotei-product-redesign-design.md
   ============================================================ */
.kt-wrap { max-width: 1080px; margin: 0 auto; }
.kt-h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 4px; }
.kt-h1-em { color: var(--green); }
.kt-h1-calm { color: var(--muted); }
.kt-h1-sub { font-size: 14px; color: var(--muted); margin: 6px 0 0; line-height: 1.55; }

/* PC=テーブル行リスト / スマホ=カード（@mediaで出し分け） */
.kt-cards { display: none; }  /* PCではカード非表示 */
.kt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; }

/* PC: 横並びテーブル行リスト（見やすさ重視） */
.kt-table { width: 100%; border-collapse: collapse; margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.kt-table thead th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 0.02em; padding: 11px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.kt-table thead th.r, .kt-table td.r { text-align: right; }
.kt-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); font-size: 14px; vertical-align: middle; white-space: nowrap; }
.kt-table tbody tr:last-child td { border-bottom: none; }
.kt-table tbody tr:hover { background: var(--bg2); }
.kt-table tr.kt-done { opacity: 0.5; }
.kt-row-verdict { display: inline-block; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 9999px; }
.kt-row-race { font-weight: 700; }
.kt-row-cd { font-weight: 700; color: var(--amber); }
.kt-row-cd.kt-cd-soon { color: var(--red); }
.kt-row-dl { display: block; font-size: 11px; color: var(--muted2); font-weight: 400; }
.kt-row-name { font-size: 13px; }
.kt-row-odds { color: var(--green); font-weight: 700; }
.kt-table .tb { width: 26px; height: 26px; font-size: 14px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.kt-row-act { display: flex; gap: 6px; align-items: center; }
.kt-row-tele { background: var(--primary); color: #fff; padding: 6px 13px; border-radius: 9999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.kt-row-tele:hover { background: #0068af; text-decoration: none; }
.kt-row-act button { background: var(--surface); border: 1px solid var(--border); border-radius: 9999px; padding: 6px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.kt-row-act button:hover { border-color: var(--primary-line); background: #fbfbfa; }

/* 締切済（参考・記録のみ）= グレー・薄く */
.kt-verdict-closed, .kt-row-verdict-closed { background: var(--muted); }
/* ライン割れ（記録済み・参考）= アンバー警告。買い推奨でないことを示す */
.kt-row-verdict-miss { background: #d97706; }
/* オッズ待ち（オッズ未取得で判定保留）= 中立グレー。買い/ライン割れと区別 */
.kt-row-verdict-wait { background: var(--muted); }
.kt-card-closed { opacity: 0.72; background: var(--bg2); }
.kt-tr-closed { opacity: 0.6; }
.kt-none { color: var(--muted); font-size: 14px; padding: 14px 4px; }
.kt-card-wait { background: var(--bg2); }
.kt-card.kt-done { opacity: 0.6; }

/* ── P1 ミニマルカード（約108px・2026-06-14採用）。3行: 識別/理由+額/操作 ── */
.kt-top { display: flex; align-items: center; gap: 9px; }
.kt-num {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; letter-spacing: -0.5px; color: #fff;
}
.kt-num[data-b="1"] { background: #1d1d1f; }
.kt-num[data-b="2"] { background: #0a66c2; }
.kt-num[data-b="3"] { background: #d70015; }
.kt-num[data-b="4"] { background: #1a7fc4; }
.kt-num[data-b="5"] { background: #e8a400; color: #1d1d1f; }
.kt-num[data-b="6"] { background: #1ea64a; }
.kt-id { flex: 1; min-width: 0; }
.kt-name { font-size: 14px; font-weight: 600; letter-spacing: -0.3px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kt-place { color: var(--muted); font-weight: 500; font-size: 12px; margin-right: 6px; }
.kt-time { font-size: 11px; color: var(--muted); line-height: 1.2; margin-top: 1px; }
.kt-time .min { font-weight: 600; color: var(--text); }
.kt-time.urgent .min { color: var(--red); }
.kt-chip { flex: 0 0 auto; align-self: flex-start; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 9999px; }
.kt-chip.buy { background: var(--green); color: #fff; }
.kt-chip.closed { background: #e5e5e7; color: #86868b; }
.kt-chip.miss { background: #fff3e0; color: #c2410c; }  /* ライン割れ(記録済み・参考) */
.kt-chip.wait { background: #e5e5e7; color: #86868b; }  /* オッズ待ち(判定保留) */

/* ── 結果バッジ（締切済の的中/外れ/返還）。AI投票の締切済リストで本命艇の結末を表す ── */
.kt-res { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 9999px; white-space: nowrap; }
.kt-res.hit { background: #e6f7ec; color: #1a7f37; }       /* 🎯 的中 = グリーン */
.kt-res.miss { background: #fdeaea; color: #c2271c; }      /* ❌ 外れ = レッド */
.kt-res.refund { background: #eef3fb; color: #2c5fb3; }    /* ↩️ 返還(F/L/K/不成立) = ブルー(ノーカウント) */
.kt-res.wait { background: #e5e5e7; color: #86868b; }      /* 結果待ち = グレー */
.kt-dl-sm { color: var(--muted); font-weight: 500; margin-left: 6px; }
.kt-time-res { font-size: 12px; }

.kt-mid { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--border); }
.kt-reason { font-size: 12px; letter-spacing: -0.2px; color: var(--text); line-height: 1.25; }
.kt-reason b { font-weight: 600; }
.kt-bet { flex: 0 0 auto; display: flex; align-items: baseline; gap: 5px; }
.kt-bet .l { font-size: 9px; color: var(--muted); }
.kt-bet .v { font-size: 16px; font-weight: 600; letter-spacing: -0.5px; }
.kt-waiting { margin-top: 11px; background: var(--bg2); border: 1px dashed var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px; color: var(--muted); }

.kt-act { display: flex; gap: 6px; margin-top: 8px; }
.kt-act .kt-btn, .kt-act .kt-bought, .kt-act .kt-skip {
  flex: 1; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 12px; font-weight: 500; letter-spacing: -0.2px; color: var(--text);
  border-radius: 8px; padding: 7px 4px; display: flex; align-items: center; justify-content: center;
}
.kt-act .kt-btn:active, .kt-act .kt-bought:active, .kt-act .kt-skip:active { transform: scale(0.97); }
.kt-act .kt-btn.odds { flex: 1.4; color: var(--primary); border-color: #cfe1f5; text-decoration: none; }
.kt-rec-msg { margin-top: 8px; color: var(--red); font-size: 12px; }

.kt-more { margin-top: 9px; }
.kt-more summary { color: var(--link); font-size: 12px; cursor: pointer; list-style: none; }
.kt-more summary::-webkit-details-marker { display: none; }
.kt-more-body { margin-top: 8px; font-size: 13px; color: var(--text); display: flex; flex-direction: column; gap: 5px; }
.kt-more-note { color: var(--muted2); font-size: 11px; margin-top: 4px; }

.kt-calm { margin-top: 16px; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px 20px; }
.kt-calm-t { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.kt-calm-d { font-size: 14px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }

.kt-sec-h { margin: 24px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ── AI投票: フィルタバー＋列ソート（エクセル風） ── */
.vote-bar { display: flex; flex-wrap: wrap; gap: 9px 14px; align-items: center; margin: 14px 0; padding: 11px 13px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.vote-bar label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.vote-bar select, .vote-bar input { font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); }
.vote-bar input[type="number"] { width: 72px; }
.vote-clear { font-size: 12px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; }
.vote-clear:hover { border-color: var(--primary-line); background: #fbfbfa; }
.vote-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.kt-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.kt-table th.sortable:hover { color: var(--primary); }
.kt-th-arr { font-size: 10px; opacity: 0.4; margin-left: 2px; }
.kt-th-arr.on { opacity: 1; color: var(--primary); }
/* AI投票: 日付ナビ（前日/翌日/今日へ＋日付ピッカー） */
.vote-datenav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 4px; }
.vote-date-btn { font-size: 13px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; }
.vote-date-btn:hover { border-color: var(--primary-line); background: #fbfbfa; }
.vote-date-btn.vote-today { background: var(--primary); color: #fff; border-color: var(--primary); }
.vote-date-input { font-size: 13px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); }
.vote-date-label { font-size: 13px; font-weight: 600; color: var(--text); margin-left: 4px; }

.kt-bank { margin-top: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kt-bank-k { font-size: 12px; color: var(--muted); display: block; }
.kt-bank-v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.kt-bank-hint { display: block; font-size: 11px; color: var(--muted2); margin-top: 2px; }
.kt-bank-act { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.kt-bank-edit { background: none; border: none; color: var(--link); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 2px; }
.kt-bank-edit:hover { text-decoration: underline; }

.kt-bank-form { margin-top: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.kt-bank-flabel { font-size: 12px; color: var(--muted); display: block; margin-bottom: 8px; }
.kt-bank-frow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kt-bank-input { flex: 1; min-width: 140px; font-size: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); }
.kt-bank-note { font-size: 11.5px; color: var(--muted2); margin: 10px 0 0; line-height: 1.6; }
.kt-bank-msg { margin-top: 8px; color: var(--red); font-size: 12px; }

/* ログイン画面（Basic認証の代替・cookieセッション） */
.login-backdrop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.login-backdrop[hidden] { display: none; }  /* display:flex が UA の [hidden] を上書きするため明示的に消す */
.login-card { width: 100%; max-width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-1); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-label { font-size: 12px; color: var(--muted); }
.login-input { font-size: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.login-btn { padding: 12px; font-size: 15px; }
.login-msg { color: var(--red); font-size: 12.5px; }

.kt-row-odds-link { font-size: 12px; color: var(--link); white-space: nowrap; }
.kt-row-odds-link:hover { text-decoration: underline; }
.kt-row-odds-btn { font-size: 12.5px; font-weight: 600; color: var(--primary); border: 1px solid var(--primary-line); border-radius: 9999px; padding: 6px 12px; white-space: nowrap; }
.kt-row-odds-btn:hover { background: var(--primary-soft); text-decoration: none; }
.kt-cta-note { font-size: 11.5px; color: var(--muted2); text-align: center; display: block; margin-top: 6px; }

/* 買った/見送り 選択ハイライト（押下後もボタンは残し、選択側を塗る） */
.kt-bought.kt-sel { background: var(--green); border-color: var(--green); color: #fff; }
.kt-bought.kt-sel:hover { background: var(--green); }
.kt-skip.kt-sel { background: var(--stone4); border-color: var(--stone4); color: #fff; }
.kt-skip.kt-sel:hover { background: var(--stone4); }

/* 状態タブ: 総合ステータス・鮮度バッジ */
.sys-summary { margin: 4px 0 14px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; border: 1px solid var(--border); }
.sys-summary.ok { background: var(--green-soft); color: var(--green); border-color: #bfe3cf; }
.sys-summary.ng { background: var(--amber-soft); color: var(--amber); border-color: #e9d79a; }
.fresh { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 9999px; margin-left: 6px; vertical-align: middle; }
.fresh-ok { background: var(--green-soft); color: var(--green); }
.fresh-warn { background: var(--amber-soft); color: var(--amber); }
.fresh-ng { background: var(--red-soft); color: var(--red); }
.okchip.pending { background: var(--primary-soft); color: var(--primary); }

/* サブタブ（AI実績内の切替） */
.subtabs { display: flex; gap: 6px; overflow-x: auto; margin: 14px 0 14px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.subtab { flex: 0 0 auto; font-size: 13px; font-weight: 600; padding: 8px 16px; border: 1px solid var(--border); border-radius: 9999px; background: var(--surface); color: var(--muted); cursor: pointer; white-space: nowrap; }
.subtab:hover { border-color: var(--primary-line); }
.subtab.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ページャ（レース別） */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.pg-info { font-size: 13px; color: var(--muted); }

/* AI実績タブ: ヘッドライン */
.kt-headline { text-align: center; padding: 24px 18px; }
.hl-lead { font-size: 14px; color: var(--muted); }
.hl-main { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 8px 0 6px; }
.hl-main .hl-arrow { color: var(--muted2); margin: 0 6px; font-weight: 500; }
.hl-sub { font-size: 12px; color: var(--muted2); }

/* AI実績/条件入力 */
.sim-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.sim-lab { font-size: 13px; color: var(--muted); min-width: 84px; }
.sim-input { font-size: 16px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); width: 140px; }
.sim-unit { font-size: 13px; color: var(--muted); }
.sim-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sim-chip { font-size: 14px; font-weight: 600; padding: 8px 16px; border: 1px solid var(--border); border-radius: 9999px; background: var(--surface); color: var(--text); cursor: pointer; }
.sim-chip:hover { border-color: var(--primary-line); }
.sim-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.sim-note { font-size: 11.5px; color: var(--muted2); margin: 12px 0 0; line-height: 1.6; }
/* WinBoat（成績タブ AI推奨フォワード）専用の最小追加 */
.sim-chip-sub { display: block; font-size: 10px; font-weight: 500; opacity: 0.8; margin-top: 1px; }
.wb-tag { display: inline-block; font-size: 9.5px; font-weight: 700; vertical-align: middle; padding: 1px 5px; border-radius: 9999px; background: var(--bg2); color: var(--muted); }
.wb-adv { margin: 10px 0 0; border-top: 1px dashed var(--border); padding-top: 8px; }
.wb-adv summary { font-size: 12px; color: var(--link); cursor: pointer; list-style: none; padding: 4px 0; }
.wb-adv summary::-webkit-details-marker { display: none; }
.wb-adv summary::after { content: " ▾"; }
.wb-adv[open] summary::after { content: " ▴"; }
.wb-bias { background: var(--amber-soft); color: var(--amber); border: 1px solid #e9d79a; border-radius: 9px; padding: 10px 12px; margin-top: 14px; }

/* 成績タブ: 規律バナー・実測内訳・結果バッジ */
.disc { margin: 4px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.disc-row { background: var(--amber-soft); color: var(--amber); border: 1px solid #e9d79a; border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.res-sub { font-size: 12px; color: var(--muted); margin: 2px 0 12px; line-height: 1.6; }
.res-h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.rs { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; }
.rs-hit { background: var(--green-soft); color: var(--green); }
.rs-miss { background: var(--red-soft); color: var(--red); }
.rs-ref { background: var(--bg2); color: var(--muted); }
.rs-wait { background: var(--primary-soft); color: var(--primary); }
.rs-skip { background: var(--bg2); color: var(--muted2); }

/* スマホ: テーブル非表示・カード縦積み（アプリ風）。既存の sidebar→tab 切替(768px)に合わせる */
@media (max-width: 768px) {
  .kt-wrap { max-width: 100%; }
  .kt-h1 { font-size: 24px; }
  .kt-table { display: none; }
  .kt-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
  .kt-calm { max-width: none; }
}

/* ============================================================
   記録カレンダー（成績タブ「実測」＝買い場の判定・損益）— 専用カード
   既存 .cal* グリッドを流用し、判定済み/未判定ドット・損益・選択を追加
   ============================================================ */
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }
.lg-cal { margin: 16px 0 4px; }
/* 月セルに損益・選択枠・ドット色を追加（基本レイアウトは .cal-day を流用） */
.cal-day.lg-cell { position: relative; }
.cal-day.lg-cell[data-empty="1"] { background: var(--surface); cursor: default; }
.cal-day.lg-cell[data-empty="1"]:hover { border-color: var(--border-soft); }
.cal-day.sel { border-color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); background: var(--primary-soft); }
.cal-day .lg-pl { font-size: 9.5px; font-weight: 700; line-height: 1.2; }
.cal-day .lg-pl.pos { color: var(--green); }
.cal-day .lg-pl.neg { color: var(--red); }
.cal-day .dots s.d-buy { background: var(--primary); }
.cal-day .dots s.d-undec { background: var(--amber); }
.cal-legend s.d-buy { background: var(--primary); }
.cal-legend s.d-undec { background: var(--amber); }

/* 日別リスト */
.lg-daywrap { margin-top: 14px; }
.lg-day-h { font-size: 13px; color: var(--muted); margin: 4px 2px 10px; }
.lg-day-h b { color: var(--text); font-size: 14px; }
.lg-rows { display: flex; flex-direction: column; gap: 8px; }

/* 1買い場カード（成績タブ専用・横長／縦長にしない） */
.lg-row { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.lg-row-main { display: flex; align-items: center; gap: 10px; }
.lg-num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.lg-num[data-b="1"] { background: #1d1d1f; }
.lg-num[data-b="2"] { background: #0a66c2; }
.lg-num[data-b="3"] { background: #d70015; }
.lg-num[data-b="4"] { background: #1a7fc4; }
.lg-num[data-b="5"] { background: #e8a400; color: #1d1d1f; }
.lg-num[data-b="6"] { background: #1ea64a; }
.lg-id { min-width: 0; flex: 1 1 auto; }
.lg-race { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-name { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 7px; }
.lg-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.lg-stake { font-size: 11px; color: var(--muted); }
.lg-pf { flex: 0 0 auto; text-align: right; font-size: 13px; font-weight: 700; min-width: 70px; }

/* 判定チップ（記録状態） */
.lg-vd { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; }
.lg-vd.vd-buy { background: var(--green-soft); color: var(--green); }
.lg-vd.vd-skip { background: var(--bg2); color: var(--stone4); }
.lg-vd.vd-none { background: var(--amber-soft); color: var(--amber); }

/* 判定操作ボタン群 */
.lg-act { display: flex; gap: 6px; margin-top: 10px; }
.lg-b {
  flex: 1 1 0; min-height: 38px; font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text);
  cursor: pointer;
}
.lg-b:hover { border-color: var(--primary-line); }
.lg-b:active { transform: scale(0.98); }
.lg-b:disabled { opacity: 0.45; cursor: default; }
.lg-b:disabled:hover { border-color: var(--border); }
.lg-b.buy.on { background: var(--green); border-color: var(--green); color: #fff; }
.lg-b.buy.on:hover { background: var(--green); }
.lg-b.skip.on { background: var(--stone4); border-color: var(--stone4); color: #fff; }
.lg-b.skip.on:hover { background: var(--stone4); }
.lg-b.clear { flex: 0 0 auto; padding: 0 12px; color: var(--muted); }

/* 賭け額入力フォーム */
.lg-stakeform { margin-top: 10px; padding: 10px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 9px; }
.lg-sf-l { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.lg-sf-hint { color: var(--muted2); font-weight: 500; }
.lg-sf-row { display: flex; gap: 6px; }
.lg-sf-input {
  flex: 1 1 auto; min-width: 0; min-height: 38px; padding: 0 10px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.lg-sf-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.lg-sf-ok, .lg-sf-cancel { flex: 0 0 auto; }

.lg-row-msg { margin-top: 8px; font-size: 12px; color: var(--muted); }
.lg-row-msg.err { color: var(--red); }

@media (max-width: 768px) {
  .kpi-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 420px) {
  .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .lg-act { flex-wrap: wrap; }
  .lg-b { flex: 1 1 calc(50% - 3px); }
  .lg-b.clear { flex: 1 1 100%; }
}
