:root{font-family:Segoe UI,Arial,sans-serif;color:#173b2c;background:#f2f3eb}*{box-sizing:border-box}body{margin:0}main{max-width:1260px;margin:auto;padding:24px 28px}header,.section-title,.race-caption,.board-heading,.track-labels,footer{display:flex;justify-content:space-between;gap:16px;align-items:center}header{margin-bottom:20px}h1{font-size:30px;letter-spacing:-1px;margin:5px 0}h2{font-size:21px;margin:0}.eyebrow,.board-heading,.track-labels{font-size:11px;font-weight:700;letter-spacing:1.5px}.account{text-align:right;display:grid;gap:3px}.account strong{font-size:27px}small,footer,.section-title span{color:#5e7165;font-size:12px}.board{position:relative;background:#124c33;border-radius:14px;padding:18px 28px;color:#eaf0dc;box-shadow:0 8px 24px #17362618;scroll-margin-top:16px}.track{margin:12px 0 10px;padding:0 18px;background:#1b603d;border-radius:5px}.lane{height:34px;border-bottom:1px solid #ffffff24;position:relative}.lane:after{content:'';position:absolute;top:0;bottom:0;border-left:3px dashed #f5edce;left:86.7%}.lane:before{content:'';position:absolute;top:0;bottom:0;border-left:2px solid #ffffff44;left:0}.marker{position:absolute;top:4px;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:800;border:2px solid #ffffffb0;transform:translateX(-50%);z-index:1;color:#101b16;box-shadow:0 2px 4px #0006}.marker.winner{outline:3px solid #ffe38a;outline-offset:2px}.track-labels{padding-right:12%}.race-caption{padding:14px 3px;font-size:14px;flex-wrap:wrap}.panel{background:#fff;border:1px solid #d9dfd4;border-radius:12px;padding:20px;margin-bottom:18px}#horses{display:grid;grid-template-columns:repeat(9,minmax(0,1fr));gap:9px;margin:16px 0}button,input{font:inherit;min-height:48px;border-radius:7px;border:1px solid #b8c7bc;padding:12px}button{background:#185b3e;color:white;font-weight:700;cursor:pointer}button:disabled{opacity:.5;cursor:default}.horse{padding:12px 5px;background:#f9faf5;color:#173b2c;display:grid;justify-items:center;gap:9px;align-content:start}.horse[aria-pressed=true]{outline:3px solid #185b3e;background:#e5efdf}.horse .number{border-radius:50%;width:26px;height:26px;display:grid;place-items:center;color:#101b16}.horse .name{font-size:12px;min-height:32px}.horse strong{font-size:18px}form{display:flex;gap:24px;align-items:end}label{display:grid;gap:7px;font-size:13px;font-weight:600}input{width:180px;max-width:100%;background:#fafbf7}.potential{display:grid;gap:4px;flex:1;font-size:13px}.potential strong{font-size:23px}#start-overlay{position:absolute;inset:0;display:grid;place-items:center;background:#092c1a33;border-radius:14px}#start{font-size:22px;padding:20px 48px;border:2px solid #e8dfb5;background:#faf3d7;color:#173b2c;box-shadow:0 8px 30px #0005}#bet-error{color:#a63124;margin-bottom:0}dl{display:grid;grid-template-columns:repeat(4,1fr);gap:16px}dt{font-size:12px;color:#5e7165}dd{margin:6px 0;font-size:23px;font-weight:700}ol{list-style:none;padding:0;margin:20px 0}li{display:grid;grid-template-columns:36px 1fr auto;gap:12px;align-items:center;padding:11px 12px;border-bottom:1px solid #dce3d7;font-size:14px}li.podium{background:#edf2e4;font-weight:700}li.selected{box-shadow:inset 4px 0 #185b3e}#new-race{width:100%}footer{padding:10px 0;font-size:12px}#storage-note{font-size:12px;color:#8b471f}:focus-visible{outline:3px solid #c99e32;outline-offset:4px}[hidden]{display:none!important}@media(max-width:900px){#horses{grid-template-columns:repeat(3,minmax(0,1fr))}.horse .name{min-height:0}.horse{grid-template-columns:auto 1fr auto;align-items:center;padding:12px}.horse strong{font-size:16px}}@media(max-width:560px){main{padding:16px 12px}h1{font-size:23px}.eyebrow{font-size:8px}.account strong{font-size:21px}.board{padding:16px}.lane{height:32px}.marker{width:24px;height:24px}#horses{gap:8px}.horse{display:flex;flex-direction:column;gap:6px}.horse .name{font-size:11px;min-height:28px}form{flex-wrap:wrap;gap:16px}form label{width:100%}input{width:100%}form button{width:100%}dl{grid-template-columns:1fr 1fr}.panel{padding:16px}footer{align-items:start;flex-direction:column}.race-caption{font-size:13px}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Keep the betting heading comfortably below the viewport edge on every layout. */
#betting{scroll-margin-top:24px}
#reset-session{background:none;border:0;padding:4px;min-height:32px;color:#5e7165;font-size:12px;font-weight:400;text-decoration:underline}#reset-dialog{width:min(440px,calc(100% - 32px));border:1px solid #b8c7bc;border-radius:12px;padding:24px;color:#173b2c}#reset-dialog::backdrop{background:#092c1a88}#reset-description{font-size:14px;line-height:1.6}.reset-actions{display:flex;justify-content:flex-end;gap:12px;flex-wrap:wrap}#cancel-reset{background:white;color:#185b3e}
/* Whole-row odds selection; native buttons support Enter, Space and touch. */
#horses{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
#horses .horse{display:grid;grid-template-columns:28px minmax(0,1fr) auto;justify-items:start;align-items:center;align-content:center;text-align:left;gap:12px;padding:16px 14px;min-height:64px;width:100%;border:2px solid #d9dfd4}
#horses .horse .name{font-size:13px;min-height:0;overflow-wrap:anywhere}
#horses .horse strong{font-size:17px;justify-self:end;white-space:nowrap}
#horses .horse[aria-pressed=true]{background:#d5e8c9;border-color:#185b3e;outline:0;box-shadow:inset 4px 0 #185b3e}
#horses .horse:disabled{opacity:1;cursor:default}
#horses .horse:focus-visible{outline:3px solid #c99e32;outline-offset:3px}
@media(hover:hover){#horses .horse:not(:disabled):not([aria-pressed=true]):hover{background:#edf2e7;border-color:#97b29d}}
.selected-horse{display:flex;align-items:center;gap:12px;min-height:68px;padding:14px 16px;margin:8px 0 20px;border:1px solid #b8c7bc;border-radius:8px;background:#f5f8ef;font-size:14px}
.selected-horse .number{display:grid;place-items:center;flex:0 0 30px;height:30px;border-radius:50%;color:#101b16;font-weight:800}
.selected-horse>span:nth-child(2){display:grid;gap:4px;flex:1;min-width:0;overflow-wrap:anywhere}
.selected-horse>strong{white-space:nowrap}
@media(max-width:760px){#horses{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){#horses{grid-template-columns:minmax(0,1fr)}#horses .horse{padding:17px 14px;min-height:66px}.selected-horse{padding:12px;gap:10px}}
.wager-controls{display:grid;gap:8px;min-width:0}.quick-wagers{display:flex;gap:6px}.quick-wagers button{padding:8px 12px;min-height:44px;flex:1;background:#fafbf7;color:#185b3e;font-size:13px}.quick-wagers button[aria-pressed=true]{background:#d5e8c9;border-color:#185b3e;box-shadow:inset 0 0 0 1px #185b3e}#wager-note:empty{display:none}@media(max-width:560px){.wager-controls{width:100%}.quick-wagers button{width:auto}}
/* Marker fronts and the finish stripe share the exact simulation coordinate. */
#track .marker{transform:translateX(-100%)}
#track .lane:after{left:var(--finish)}

/* Always-adjacent betting columns, including phone portrait. */
#betting{padding:18px}
.bet-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
.odds-column,.wager-column{min-width:0}
#betting .section-title{min-height:28px;margin-bottom:10px;gap:6px}
#betting h2{font-size:18px}
#betting #horses{grid-template-columns:minmax(0,1fr);gap:5px;margin:0}
#betting #horses .horse{grid-template-columns:26px minmax(0,1fr) auto;min-height:46px;height:46px;padding:5px 10px;gap:9px;border-width:1px;border-radius:7px}
#betting #horses .horse .number{width:26px;height:26px}
#betting #horses .horse .name{font-size:13px;line-height:1.15;min-width:0}
#betting #horses .horse strong{font-size:15px}
#betting .selected-horse{display:grid;grid-template-columns:minmax(0,1fr);justify-items:center;text-align:center;gap:6px;min-width:0;min-height:0;margin:0 0 12px;padding:10px;font-size:13px;line-height:1.35}
#betting .selected-horse .selection-prompt{grid-column:1 / -1;white-space:normal;overflow-wrap:normal;word-break:normal}
#betting .selected-horse>span:nth-child(2){gap:0;overflow-wrap:normal;word-break:normal}
#betting .selected-horse .number{width:28px;height:28px}
#betting .selected-horse small{font-size:11px}
#betting #bet-form{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;align-items:stretch}
#betting #bet-form label,#betting .wager-controls{width:100%;min-width:0}
#betting #wager{width:100%;min-width:0;min-height:46px;padding:10px;font-size:16px}
#betting .quick-wagers{flex-wrap:wrap;gap:6px}
#betting .quick-wagers button{flex:1 1 44px;min-width:0;padding:7px 5px;width:auto;min-height:44px}
#betting .potential{min-width:0;gap:4px}
#betting .potential strong{font-size:25px;overflow-wrap:anywhere}
#betting #lock{width:100%;min-width:0;padding:12px 6px;min-height:48px}
#betting #bet-error:empty{display:none}
@media(max-width:650px){
 #betting{padding:10px}.bet-layout{gap:10px}
 #betting h2{font-size:15px}
 #betting #horses .horse{grid-template-columns:24px minmax(0,1fr) auto;padding:4px 6px;gap:5px;min-height:48px;height:48px}
 #betting #horses .horse .number{width:24px;height:24px;font-size:12px}
 #betting #horses .horse .name{font-size:12px}
 #betting #horses .horse strong{font-size:13px}
 #betting .selected-horse{padding:8px 6px;gap:6px}
 #betting .selected-horse .number{width:24px;height:24px}
 #betting .selected-horse>strong{grid-column:1}
 #betting .selected-horse small{display:none}
 #betting #bet-form{gap:12px}
 #betting .potential{font-size:12px}#betting .potential strong{font-size:22px}
 #betting .potential small{font-size:11px}
}
@media(max-width:390px){
 #betting{padding:8px}.bet-layout{gap:8px}
 #betting #horses .horse{gap:4px;padding-inline:4px;grid-template-columns:22px minmax(0,1fr) auto;min-height:52px;height:52px}
 #betting #horses .horse .number{width:22px;height:22px}
 #betting #horses .horse .name{font-size:11px}
 #betting #horses .horse strong{font-size:12px}
 #betting .quick-wagers button{flex-basis:40px;font-size:12px}
 #betting #lock{font-size:13px}
}
