:root {
  color-scheme: light;
  --ink: #172e24;
  --muted: #54635b;
  --forest: #174c37;
  --line: #d2dbd4;
  --paper: #fff;
  --soft: #f1f4ee;
  --accent: #e8ee8a;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: #f3f5f1;
}
* {box-sizing: border-box}
[hidden] {display: none !important}
body {margin: 0; min-height: 100vh}
button,select {font: inherit; color: inherit}
button,select:not(:disabled),a {cursor: pointer}
button {touch-action: manipulation}
button:disabled, select:disabled {cursor: default}
:focus-visible {outline: 3px solid #ba6806; outline-offset: 3px}
button:disabled {opacity: .64}
h1,h2,h3,h4,p {margin: 0}
.wrap,.mast {width: min(1112px, calc(100% - 64px)); margin-inline: auto}
.site-header {background: #102f25; color: #fff; border-top: 3px solid var(--accent)}
.mast {min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 12px}
.brand,.history-toggle,.result-head,.card-heading,.dialog-heading,.race-heading,.site-footer .wrap {display: flex; align-items: center}
.brand {gap: 12px}
.brand h1 {font-size: 22px; font-weight: 800; letter-spacing: .05em}
.brand-mark {position: relative; display: block; width: 34px; height: 30px}
.brand-mark i {display: block; position: absolute; left: 3px; height: 5px; background: var(--accent); border-radius: 0 4px 0 2px; transform: skew(-22deg)}
.brand-mark i:nth-child(1) {width: 30px; top: 4px}
.brand-mark i:nth-child(2) {width: 23px; top: 12px}
.brand-mark i:nth-child(3) {width: 16px; top: 20px}
.history-toggle {gap: 8px; padding: 7px 12px; border: 1px solid #688074; border-radius: 4px; background: transparent; color: #fff; font-size: 13px; font-weight: 600; min-height: 36px}
.history-toggle:hover {background: #2b4c3d}
.record-icon {width: 13px; height: 14px; border: 1.5px solid currentColor; border-radius: 2px; position: relative}
.record-icon::after {content:""; position:absolute; width:6px; height:1px; top:4px; left:2px; background:currentColor; box-shadow:0 3px currentColor}
.league-tabs {display: flex; gap: 22px; margin-top: 17px; border-bottom: 1px solid #bac8be}
.league {border: 0; border-bottom: 3px solid transparent; background: transparent; color: #52655a; font-weight: 700; padding: 10px 5px 11px; font-size: 15px}
.league.active {border-bottom-color: var(--forest); color: var(--forest)}
.league:hover,.text-button:hover {color: #116e4b}
.weekend-note {align-self:center; margin-left:auto; color:var(--muted); font-size:12px; font-weight:650}
.notice-card {border:1px solid #c9d4c7; border-radius:5px; background:#fbfcf8; margin-top:12px}
.notice-head {display:flex; justify-content:space-between; align-items:center; padding:7px 14px; gap:8px}
.notice-head>div {display:flex; align-items:baseline; gap:9px; flex-wrap:wrap}
.notice-head h2 {font-size:15px; color:var(--forest)}
.notice-head span,.notice-explain {font-size:12px; color:#475c4c}
.notice-head button {min-height:33px}
.notice-explain {border-top:1px solid var(--line); padding:8px 14px; line-height:1.6}
.notice-scroll {max-height:242px; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 14px 8px}
.notice-item {border-top:1px solid #dbe3d7; padding:7px 0; font-size:13px; line-height:1.6}
.notice-item button {font:inherit; font-weight:750; border:0; background:transparent; color:var(--forest); padding:0; text-decoration:underline; text-underline-offset:3px}
.notice-item ul {margin:2px 0; padding-left:1.3em}
.notice-item ul li {margin:0}
.jra-forecast {background:#f2f5ed; border-left:3px solid #789367; padding:10px 12px; margin-top:12px}
.jra-forecast p,.jra-forecast strong {font-size:14px}
.jra-forecast table {margin-top:8px;background:white}
.named-field {padding:0 20px 15px;font-size:13px;line-height:1.8}
.named-field strong {display:block;margin-bottom:2px}
.review-section {padding:12px 16px; border-top:1px solid var(--line)}
.review-section h4 {font-size:15px}
.review-section>p {font-size:12px;color:var(--muted);margin:4px 0 8px;line-height:1.6}
.review-section table {margin-top:7px}
.hit-success {font-weight:750;color:#a32e30}
.race-browser {display:grid; grid-template-columns: 1.35fr 1fr .8fr; gap:18px; background:var(--paper); border:1px solid var(--line); border-radius:5px; padding:14px 18px; margin-top:17px}
.select-field {min-width:0; display:grid; gap:5px}
.select-field>span,.picker-label {font-size:12px; font-weight:700}
.select-field>span {color:var(--muted)}
select {appearance:none; -webkit-appearance:none; border:1px solid #aebdb3; border-radius:4px; padding:6px 32px 6px 10px; min-width:0; width:100%; min-height:38px; font-size:15px; font-weight:650; background-color:white; background-image:linear-gradient(45deg,transparent 49%,#52665a 51%),linear-gradient(135deg,#52665a 49%,transparent 51%); background-size:5px 5px; background-position:calc(100% - 17px) 52%,calc(100% - 12px) 52%; background-repeat:no-repeat}
.load-state {padding:28px 4px; color: var(--muted)}
.load-state>button {margin-top:10px}
.race-heading {gap:16px; margin:24px 0 15px; flex-wrap:wrap; align-items:baseline}
.race-heading h2 {font-size:clamp(28px, 3.1vw, 39px); letter-spacing:.015em; line-height:1.15; font-weight:800}
.race-heading h2 strong {font-family:Arial,sans-serif; font-size:1.1em; letter-spacing:-.055em; margin-left:.22em}
.race-meta {font-size:13px; font-weight:600; color:var(--muted)}
.workspace {display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr); align-items:start; gap:18px}
.scenario-intro {margin:-2px 0 14px; color:#284935; font-size:clamp(16px,2vw,20px); font-weight:700; line-height:1.55}
.scenario-card,.field-card,.result-card,.jra-card {background:var(--paper); border:1px solid var(--line); border-radius:6px; overflow:hidden}
.card-heading {min-height:54px; padding:12px 20px; justify-content:space-between; gap:10px}
.card-heading h3,.result-head h3 {font-size:19px; font-weight:750; letter-spacing:.025em; line-height:1.35}
.model-type,.stage-badge {font-size:12px; font-weight:700; color:#3e5a48; white-space:nowrap}
.stage-badge {border:1px solid #cad8cd; background:#f3f7f1; padding:3px 9px; border-radius:3px}
.focal-head {position:relative; background:#174d39; padding:16px 20px 17px; color:white; overflow:hidden; isolation:isolate}
.focal-head::after {content:""; position:absolute; z-index:-1; top:-78px; right:-88px; width:270px; height:155px; border-radius:95px; border:1px solid #39705c; transform:rotate(-20deg); box-shadow:0 0 0 7px #174d39,0 0 0 8px #39705c,0 0 0 15px #174d39,0 0 0 16px #39705c}
.picker-label {color:#e0eddc}
.mode-tabs {display:inline-flex; margin:0 0 12px; padding:2px; border:1px solid #739382; border-radius:5px; background:#133e2f}
.mode-tabs button {border:0; border-radius:3px; background:transparent; color:#fff; min-height:31px; padding:4px 11px; font-size:12px; font-weight:700}
.mode-tabs button[aria-pressed=true] {background:#edf3da; color:#193f2d}
.mode-tabs {align-items:center; flex-wrap:wrap}
.auto-label {font-size:11px; color:#c8d9ce; margin:0 1px 0 7px}
.mode-tabs button {padding-inline:8px}
.estimate-card {margin-top:16px; border:1px solid var(--line); border-radius:6px; background:white; overflow:hidden}
.estimate-card summary {cursor:pointer; padding:12px 18px; font-size:16px}
.estimate-card summary span {display:inline-block; margin-left:10px; font-size:13px; color:var(--muted)}
.estimate-controls {display:flex; align-items:center; gap:10px; padding:1px 18px 12px; font-size:13px; color:var(--ink)}
.estimate-controls input {width:96px; padding:5px 8px; border:1px solid #aebdb3; border-radius:4px; font:inherit; color:inherit}
.estimate-table td:last-child {font-weight:750}
.estimate-table td small {font-weight:normal; line-height:1.45; color:#54635a}
.horse-grid {display:grid; grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr)); gap:6px; margin:7px 0 9px}
.horse-choice {display:flex; align-items:center; gap:7px; min-height:44px; min-width:0; padding:5px 7px; font:inherit; text-align:left; color:white; background:#215740; border:1px solid #72927d; border-radius:5px}
.horse-choice:enabled:hover {background:#2f674c; border-color:#d7e8d2}
.horse-choice[aria-pressed=true],.horse-choice[aria-pressed=true]:hover {color:#173726; background:#e7efcb; border-color:#edf4d7; font-weight:750}
.horse-choice:focus-visible {outline:2px solid white; outline-offset:2px}
.horse-choice.tied-candidate {border-style:dashed; border-color:#f6e2a1}
.horse-choice:disabled {opacity:.54}
.choice-number {flex:none; min-width:25px; padding:3px; text-align:center; color:#17452e; background:#f4f6ec; border-radius:3px; font:750 15px/1.25 Arial,sans-serif; font-variant-numeric:tabular-nums}
.horse-choice[aria-pressed=true] .choice-number {background:#214e37; color:white}
.choice-name {font-size:12px; letter-spacing:.015em; line-height:1.4; overflow-wrap:anywhere}
.focal-head>p {font-size:12px; line-height:1.6; margin-top:6px; color:#e4eee5}
.odds-panel {border-bottom:1px solid var(--line); background:#f6f8f3}
.odds-panel summary {position:relative; padding:10px 38px 10px 20px; list-style:none; cursor:pointer; color:var(--ink); min-height:48px}
.odds-panel summary::-webkit-details-marker {display:none}
.odds-panel summary::after {content:""; position:absolute; right:20px; top:calc(50% - 5px); width:7px; height:7px; border:solid #43664e; border-width:0 1.5px 1.5px 0; transform:rotate(45deg)}
.odds-panel[open] summary::after {transform:rotate(225deg); top:calc(50% - 2px)}
.odds-top {display:flex; align-items:center; flex-wrap:wrap; gap:8px}
.odds-top strong {font-size:14px}
.feed-status,.odds-meta {font-size:12px; color:#495e50}
.feed-status {display:inline-flex; align-items:center; gap:4px}
.feed-status::before {content:""; width:6px; height:6px; border-radius:50%; background:#768879}
.feed-status.connected::before {background:#207640}
.feed-status.reconnecting::before {background:#a96b15}
.odds-meta {display:block; line-height:1.55; margin-top:2px; font-variant-numeric:tabular-nums}
#odds-content {background:white}
.odds-table td,.odds-table th {padding:6px 12px}
.odds-table th:nth-child(1),.odds-table th:nth-child(2) {width:48px}
.odds-table td:last-child,.odds-table th:last-child {text-align:right; white-space:nowrap}
.odds-table .favorite-row {background:#edf4e5}
.odds-panel summary:focus-visible {outline-offset:-3px}
.plot-wrap {margin:14px 16px 0; height:154px}
#rank-plot {display:block; width:100%; height:100%; cursor:crosshair}
.stage-nav {display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:5px; padding:0 18px 16px}
.stage-nav button {border:1px solid var(--line); background:#fff; color:var(--muted); border-radius:4px; padding:5px 0; min-height:43px; white-space:nowrap; font-size:11px; line-height:1.45; font-weight:650}
.stage-nav button span {display:block; font-size:13px; font-weight:750; color:var(--ink)}
.stage-nav button[aria-pressed=true] {background:#e9f3e8; color:var(--forest); border-color:#67977a}
.stage-nav button[aria-pressed=true] span {color:var(--forest)}
.scenario-foot {border-top:1px solid var(--line); display:flex; align-items:center; flex-wrap:wrap; gap:10px 13px; padding:12px 18px}
.small-text,.result-footer {font-size:12px; line-height:1.65; color:var(--muted)}
.solid-button,.outline-button,.link-row a {border-radius:4px; font-weight:700; font-size:13px; min-height:38px; padding:8px 13px}
.solid-button {border:1px solid var(--forest); color:#fff; background:var(--forest)}
.solid-button:hover:enabled {background:#226344}
.outline-button,.link-row a {border:1px solid #799481; background:#fff; color:var(--forest); text-decoration:none}
.outline-button:hover:enabled,.link-row a:hover {background:#eff6ed}
table {border-collapse:collapse; width:100%; text-align:left; font-size:14px; font-variant-numeric:tabular-nums}
th {font-weight:650}
.field-table thead,.data-table thead {border-block:1px solid var(--line); background:#f1f5f0; color:#526456; font-size:12px}
.field-table th,.field-table td {padding:5px 7px; line-height:1.3}
.field-table th:first-child,.field-table td:first-child {padding-left:18px; width:60px}
.field-table th:nth-child(2),.field-table td:nth-child(2) {width:54px}
.field-table td:first-child {color:var(--muted); font:700 14px/1.2 Arial,sans-serif}
.field-table td:last-child {font-weight:650}
.field-table tr+tr,.data-table tr+tr {border-top:1px solid #e5eae4}
.field-table .selected {background:#e7f1df; box-shadow:inset 3px 0 #47784e}
.bib {display:inline-grid; place-items:center; font:700 13px/1 Arial,sans-serif; border:1px solid #c4cec5; border-radius:3px; background:#fff; min-width:23px; height:22px}
.selected .bib {border-color:var(--forest); background:var(--forest); color:white}
.result-card {margin-top:17px}
.prediction-notice {border-left:3px solid #a3b58c; color:#455345; background:#edf1e8; margin:14px 0; padding:9px 12px; font-size:13px; line-height:1.75}
.result-head {justify-content:space-between; gap:12px; padding:16px 20px}
.result-head p {margin-top:3px}
.sub-tabs {display:flex; gap:18px; padding:0 20px; border-top:1px solid var(--line)}
.sub-tabs button,.text-button {border:0; color:var(--forest); background:transparent; font-weight:650; font-size:13px}
.sub-tabs button {padding:11px 3px; border-bottom:2px solid transparent}
.sub-tabs button[aria-pressed=true] {border-bottom-color:var(--forest)}
.field-scroll,.comparison-scroll,#money-pane {overflow:auto}
.data-table th,.data-table td {padding:8px 13px; vertical-align:top}
.data-table td small {display:block; font-size:11px; color:var(--muted)}
.comparison td:first-child,.money td:last-child {font-weight:750}
.money .payout-hit-row {background:#fff0ee;color:#8a2327;box-shadow:inset 3px 0 #b63f40}
.official-combination,.payout-amount {display:inline-flex;gap:5px;align-items:baseline;flex-wrap:wrap}
.payout-hit-badge,.high-payout-badge {display:inline-block;padding:1px 5px;border-radius:3px;font-size:11px;font-weight:750;line-height:1.45;white-space:nowrap}
.payout-hit-badge {color:white;background:#a32e30}
.high-payout {color:#804006;font-weight:800}
.high-payout-badge {color:#673500;background:#ffe2a1;border:1px solid #d69c44}
.result-footer {padding:12px 18px; border-top:1px solid var(--line)}
.result-footer a,.history-list button {color:var(--forest); text-underline-offset:3px}
.result-footer p {margin-bottom:4px}
.pane-note {padding:9px 18px; color:var(--muted); font-size:12px}
.jra-detail {border-top:1px solid var(--line); padding:20px}
.hold-card {background:var(--paper); border:1px solid #d7d4bf; border-radius:6px; overflow:hidden}
.hold-label {font-size:12px; font-weight:700; color:#644b1b; background:#f6efd9; border:1px solid #d6c187; padding:3px 8px; border-radius:3px; white-space:nowrap}
.hold-detail {padding:15px 20px 18px; border-top:1px solid #e4dfcd}
.hold-detail h4 {font-size:14px}
.hold-detail p {font-size:14px; line-height:1.75; margin-top:4px}
.legacy-panel {border-top:1px solid var(--line); padding:10px 20px 12px; background:#f7f8f3}
.legacy-panel summary {cursor:pointer; font-size:14px; font-weight:650}
.legacy-panel>.small-text {margin:9px 0 6px}
.legacy-caption {font-size:12px; color:var(--muted)}
.legacy-order {list-style:none; display:flex; flex-wrap:wrap; gap:5px; padding:0; margin:5px 0 0}
.legacy-order li {display:flex; align-items:center; gap:5px}
.legacy-order li+li::before {content:"→"; font-size:12px; color:var(--muted)}
.jra-detail h4 {font-size:23px}
.jra-detail p {margin:7px 0 0}
.link-row {display:flex; gap:8px; flex-wrap:wrap; margin-top:16px}
#race-ad {margin-top:18px; border:1px dashed #b1bfb3; background:#edf1eb; padding:12px 18px; border-radius:4px; color:#59665b; display:flex; align-items:center; gap:12px; font-size:12px}
.ad-label {border:1px solid #a8b7aa; border-radius:2px; padding:1px 5px; font-size:11px}
.site-footer {margin-top:30px; border-top:1px solid var(--line)}
.site-footer .wrap {padding:15px 0 20px; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted)}
.text-button {padding:6px}
dialog {width:min(540px,calc(100% - 26px)); padding:21px; border:1px solid var(--line); border-radius:7px; max-height:82vh; color:var(--ink)}
dialog::backdrop {background:rgb(14 37 24 / 48%)}
.dialog-heading {justify-content:space-between; gap:12px; margin-bottom:12px}
.dialog-heading h2 {font-size:21px}
.close-button {width:35px; height:35px; line-height:1; font-size:22px; border:1px solid var(--line); background:#fff; border-radius:4px}
dialog p {font-size:14px; line-height:1.7; margin:10px 0}
.history-list {list-style:none; padding:0; margin:12px 0}
.history-list li {border-top:1px solid var(--line); padding:8px 0; line-height:1.6; font-size:13px}
.history-list button {border:0; padding:0; background:transparent; font-weight:700; text-decoration:underline}
.history-list span {display:block}
@media(max-width:760px) {
  .wrap,.mast {width: min(100% - 30px,640px)}
  .workspace {grid-template-columns:minmax(0,1fr); gap:14px}
  .race-browser {gap:8px; padding:12px; grid-template-columns:1.2fr .9fr .65fr}
  .race-heading {gap:5px 12px; margin:20px 0 12px}
  .race-meta {font-size:12px}
  .field-table td {padding-block:6px}
  .plot-wrap {height:145px}
}
@media(max-width:450px) {
  .mast {min-height:56px}
  .brand {gap:7px}
  .brand h1 {font-size:19px}
  .brand-mark {transform:scale(.84); transform-origin:left center; width:29px}
  .history-toggle {font-size:12px; padding:6px 8px}
  .league-tabs {margin-top:8px}
  .race-browser {gap:7px; padding:10px; margin-top:12px}
  .select-field>span {font-size:11px}
  .select-field select {font-size:13px; padding-left:5px; padding-right:17px; background-position:calc(100% - 9px) 52%,calc(100% - 5px) 52%; background-size:4px 4px}
  .card-heading {padding:11px 14px; min-height:48px}
  .card-heading h3,.result-head h3 {font-size:17px}
  .focal-head {padding:13px 14px}
  .plot-wrap {margin:12px 9px 0; height:128px}
  .stage-nav {padding:0 10px 12px; gap:3px}
  .stage-nav button {min-height:42px}
  .scenario-foot,.result-head {padding:12px 14px}
  .data-table th,.data-table td {padding:7px 6px; font-size:12px}
  #race-ad {padding:10px; gap:7px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
