/* 展開シミュレーター — ライト1テーマ固定 */
:root {
  color-scheme: only light;
  --bg: #f6f4ee; --paper: #ffffff; --ink: #1d2420; --ink2: #4d5751; --ink3: #7b847e; --line: #e3e0d6;
  --turf: #2f7d4a; --turf-d: #1f5a35; --turf-l: #e7f2ea; --gold: #b8862b; --red: #c2412f; --blue: #2c63c9;
  --slow: #5b8fd6; --mid: #8a9a8f; --high: #d9643a;
  --sans: 'IBM Plex Sans JP', 'Hiragino Sans', 'Noto Sans JP', sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
html, body { color-scheme: only light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.65; -webkit-text-size-adjust: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
button, select, input { font: inherit; color: var(--ink); }
.hint { color: var(--ink2); font-size: 13px; margin: 8px 0 0; }

/* ヘッダー */
.hero { background: var(--turf-d); color: #fff; padding: 34px 0 30px; background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 60px, rgba(255,255,255,0) 60px 120px); }
.hero .kicker { margin: 0; font-family: var(--mono); letter-spacing: .2em; font-size: 12px; color: #cfe6d6; }
.hero h1 { margin: 4px 0 6px; font-size: clamp(26px, 5vw, 38px); letter-spacing: .04em; }
.hero .lead { margin: 0; color: #e6f1e9; }
.hero .lead b { color: #ffe08a; }

/* ステップ */
.step { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 18px 0; }
.step h2 { margin: 0 0 12px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--turf); color: #fff; font-size: 15px; font-family: var(--mono); }
h3 { font-size: 15px; margin: 0 0 8px; }
h3 small, h4 small { color: var(--ink3); font-weight: 400; font-size: 12px; margin-left: 6px; }

/* レース選択 */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.chips button { text-align: left; padding: 12px 14px; border: 1.5px solid var(--line); background: #fbfaf6; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; }
.chips button b { font-size: 16px; }
.chips button span { font-size: 12px; color: var(--ink2); }
.chips button.on { border-color: var(--turf); background: var(--turf-l); box-shadow: inset 0 0 0 1px var(--turf); }
.raceinfo { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink2); }
.raceinfo b { color: var(--ink); font-size: 15px; }
.custom { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px 16px; }
.custom label { display: flex; flex-direction: column; font-size: 12px; color: var(--ink2); gap: 3px; }
.custom select, .custom input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 110px; }

/* 出走馬 */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { font-size: 12px; color: var(--ink3); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: center; }
td { padding: 6px 8px; border-bottom: 1px solid #f0eee7; text-align: center; white-space: nowrap; }
.l { text-align: left; }
.entry td.name { font-weight: 500; min-width: 140px; }
.entry select, .entry input[type=text], .entry input[type=number] { padding: 5px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.entry input[type=text] { width: 140px; }
.entry input.odds { width: 76px; text-align: right; font-family: var(--mono); }
.entry .changed { border-color: var(--gold); background: #fff7e6; }
.entry select.c3, .entry select.c1_5 { background: #e9f5ec; border-color: #9cc9aa; }
.entry select.cm1_5, .entry select.cm3 { background: #fbeceb; border-color: #e5a9a0; }
.entry input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--turf); }
.entry tr.out td { opacity: .4; }
.entry tr.out td:last-child { opacity: 1; }
.num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 6px; border: 1px solid #555; font-family: var(--mono); font-weight: 500; font-size: 13px; }
.row-actions { margin-top: 10px; display: flex; gap: 8px; }
.row-actions button, .tbtns button { padding: 7px 12px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; }
.row-actions button:hover, .tbtns button:hover { border-color: var(--turf); }

/* 条件 */
.cond { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1 1 auto; padding: 10px 8px; border: 0; border-right: 1px solid var(--line); background: #fbfaf6; cursor: pointer; font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--turf); color: #fff; font-weight: 700; }
.go { display: flex; flex-direction: column; align-items: center; width: 100%; margin-top: 20px; padding: 14px; border: 0; border-radius: 12px; background: var(--turf); color: #fff; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--turf-d); }
.go small { font-size: 12px; font-weight: 400; color: #d8eedd; }
.go:hover { background: #33894f; }
.go:disabled { opacity: .6; cursor: wait; }
.status { margin: 10px 0 0; font-size: 13px; color: var(--ink2); text-align: center; min-height: 1em; }

/* レース再生 */
.theater-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.theater-head h2 { margin: 0; }
.tbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.trackbox { display: grid; grid-template-columns: 1fr 220px; gap: 14px; margin-top: 12px; }
#track { width: 100%; height: auto; background: #eef3ec; border-radius: 12px; display: block; }
#track .turf { fill: #5fa36f; }
#track .rail { fill: none; stroke: #fff; stroke-width: 2.5; }
#track .rail.outer { stroke: #e9efe6; }
#track line.goal { stroke: #c2412f; stroke-width: 3; }
#track line.start { stroke: #fff; stroke-width: 3; stroke-dasharray: 5 4; }
#track line.mark { stroke: #fff; stroke-width: 1.5; opacity: .7; }
#track .tlabel { font-size: 15px; text-anchor: middle; fill: var(--ink2); font-family: var(--sans); }
#track .tlabel.goal { fill: #c2412f; font-weight: 700; }
#track .infield { font-size: 28px; text-anchor: middle; fill: #8aa892; font-weight: 700; font-family: var(--sans); }
#track .infield.sub { font-size: 16px; font-weight: 500; }
#track .horse text { font-size: 12px; font-weight: 700; text-anchor: middle; font-family: var(--mono); }
#track .horse.win circle { stroke: #ffd24a; stroke-width: 4; }
.live { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ticker { background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 500; min-height: 66px; }
.order { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.order li { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-bottom: 1px solid #f0eee7; font-size: 13px; }
.order .pos { width: 18px; text-align: right; color: var(--ink3); font-family: var(--mono); }
.order .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order li.fin { font-weight: 700; }
.order li.r1 { background: #fff4cf; } .order li.r2 { background: #f1f3f5; } .order li.r3 { background: #f8ece3; }
.order .num { min-width: 22px; height: 22px; font-size: 12px; }

/* 予想 */
.marks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mark { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.mark.top { border-color: var(--gold); background: #fffaf0; box-shadow: inset 0 0 0 1px var(--gold); }
.mark .sym { font-size: 26px; line-height: 1; color: var(--red); font-weight: 700; width: 28px; text-align: center; }
.mbody { display: flex; flex-direction: column; min-width: 0; }
.mbody b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbody span { font-size: 13px; color: var(--ink2); }
.mbody em { font-style: normal; font-weight: 700; color: var(--ink); font-size: 16px; }
.mbody .sub { font-size: 12px; }
.marks .hint { grid-column: 1 / -1; }
.panel { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two .panel { margin-top: 18px; }
.up { color: var(--turf); font-weight: 700; font-size: 12px; } .down { color: var(--red); font-weight: 700; font-size: 12px; } .flat { color: var(--ink3); font-size: 12px; }

.fhead { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink3); }
.fline { position: relative; margin: 4px 14px 0; background: linear-gradient(#e7f2ea, #e7f2ea) center 0 / 100% 100%; border-radius: 10px; }
.fh { position: absolute; }
.fnote { font-size: 13px; color: var(--ink2); margin: 8px 0 0; }
.pace h4 { font-size: 14px; margin: 16px 0 6px; }
.pbar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; font-size: 12px; color: #fff; font-weight: 700; }
.pbar div { display: grid; place-items: center; white-space: nowrap; overflow: hidden; }
.pbar .slow, .pcols .slow b { background: var(--slow); } .pbar .mid, .pcols .mid b { background: var(--mid); } .pbar .high, .pcols .high b { background: var(--high); }
.pcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; font-size: 13px; }
.pcols b { color: #fff; padding: 1px 8px; border-radius: 5px; margin-right: 4px; }
.pcols span { display: block; color: var(--ink2); font-size: 12px; margin-top: 4px; }

.movers { list-style: none; padding: 0; margin: 0; }
.movers li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #f0eee7; }
.movers li div { display: flex; flex-direction: column; font-size: 13px; color: var(--ink2); }
.movers b { color: var(--ink); font-size: 14px; }
.movers em { font-style: normal; font-weight: 700; color: var(--ink); }
.movers .why { font-size: 12px; color: var(--turf-d); }
#down .why { color: var(--red); }
.movers .empty { color: var(--ink3); font-size: 13px; }

.prob td.mk { color: var(--red); font-weight: 700; font-size: 16px; }
.bar { position: relative; width: 160px; height: 22px; background: #f2f1ec; border-radius: 5px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #9fcfae; }
.bar span { position: relative; padding-left: 6px; font-size: 13px; font-family: var(--mono); line-height: 22px; }

.bets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.bet { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; background: #fff; }
.bet b { font-size: 16px; }
.bet span { font-size: 13px; color: var(--ink2); }
.bet .ret em { font-style: normal; font-weight: 700; color: var(--turf-d); font-size: 17px; }
.tag { align-self: flex-start; margin-top: 4px; font-size: 11px !important; padding: 1px 8px; border-radius: 99px; }
.tag.view { background: var(--turf-l); color: var(--turf-d) !important; }
.tag.gap { background: #fff1d6; color: #8a5a00 !important; }
.none { font-size: 15px; font-weight: 500; }

.foot { color: var(--ink3); font-size: 12px; padding-bottom: 40px; }


/* 2次元シミュレーション：馬群の拡大図と内外の表示 */
.views { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.packwrap h3 { margin: 0 0 4px; font-size: 14px; }
.packwrap h3 small { font-weight: 400; color: var(--ink3); font-size: 12px; margin-left: 6px; }
#pack { width: 100%; height: auto; display: block; border-radius: 10px; }
#pack .packturf { fill: #5fa36f; }
#pack .packrail { stroke: #fff; stroke-width: 4; }
#pack .packgrid { stroke: rgba(255,255,255,.25); stroke-width: 1; }
#pack .packlabel { font-size: 12px; fill: #f3f7f1; font-family: var(--sans); }
#pack .packlabel.mid { text-anchor: middle; }
#pack .packlabel.end { text-anchor: end; }
#pack .horse text { font-size: 11px; font-weight: 700; text-anchor: middle; font-family: var(--mono); }
#pack .horse.win circle { stroke: #ffd24a; stroke-width: 4; }
.order .lane { margin-left: auto; font-size: 11px; padding: 0 5px; border-radius: 4px; background: #eef1ec; color: var(--ink2); }
.order .lane.l0 { background: #e2efe5; color: var(--turf-d); } .order .lane.l2 { background: #f6e9df; color: #9a4a1f; }
/* JRA分析（予想スキル）の結果 */
.analysis { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fbfaf5; }
.analysis .grade { display: inline-block; min-width: 2.2em; text-align: center; padding: 2px 8px; border-radius: 6px; font-weight: 700; background: var(--turf); color: #fff; margin-right: 8px; }
.analysis .grade.g見 { background: #8a8f87; } .analysis .grade.gB { background: #6f8f74; } .analysis .grade.gS { background: var(--gold); }
.analysis .thesis { font-weight: 700; margin: 6px 0; }
.analysis ul { margin: 6px 0 0; padding-left: 1.2em; font-size: 13px; color: var(--ink2); }
.analysis .src { font-size: 12px; color: var(--ink3); margin-top: 8px; }

@media (max-width: 760px) {
  .step { padding: 16px 14px; border-radius: 12px; }
  .cond, .two, .trackbox { grid-template-columns: 1fr; }
  .order { max-height: 220px; columns: 2; column-gap: 0; }
  .order li { break-inside: avoid; }
  .pcols { grid-template-columns: 1fr; }
  .seg button { font-size: 13px; padding: 9px 6px; }
  .bar { width: 110px; }
}
