: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:grid;grid-template-columns:repeat(3,minmax(0,1fr));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}
.available-wager{display:flex;flex-wrap:nowrap;justify-content:space-between;gap:4px;font-size:12px;line-height:1.4;color:#173b2c;white-space:nowrap}
.available-wager strong{white-space:nowrap;min-width:0}
.wager-heading{display:flex;justify-content:space-between;align-items:center;gap:4px;min-width:0}
#betting #bet-form .wager-heading label{display:block;width:auto;font-size:12px;white-space:nowrap}
#high-roller-toggle{display:inline-flex;align-items:center;justify-content:center;gap:3px;min-height:28px;height:28px;width:auto;padding:3px 5px;font-size:10px;line-height:1;white-space:nowrap;background:#fafbf7;color:#173b2c}
#high-roller-toggle svg{width:12px;height:12px;flex:none}
#high-roller-toggle[aria-pressed=true]{background:#185b3e;color:#fff}
#high-roller-toggle[aria-pressed=true] svg{color:#F5C542}
#bankroll-explanation{line-height:1.4;color:#173b2c}
#reset-available{min-height:44px;padding:8px;font-size:13px}
#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{gap:6px}
#betting .quick-wagers button{min-width:0;padding:7px 2px;width:100%;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){
 .available-wager{font-size:11px}
 #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{font-size:11px}
 #betting #lock{font-size:13px}
}
/* Multi-Win slip: natural page height, no inner scrolling or grid changes. */
#betting #add-bet,#betting #lock{width:100%;min-height:48px;padding:10px 6px;font-size:14px;white-space:normal}
.bet-slip{margin-top:18px;border-top:1px solid #d9dfd4;padding-top:12px;min-width:0}
.bet-slip h3{font-size:15px;margin:0 0 10px}.bet-slip h3 span{display:block;color:#5e7165;font-size:12px;font-weight:400;margin-top:3px}
#slip-list{font-size:12px;color:#5e7165;overflow:visible}
.slip-entry{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:9px 0;border-bottom:1px solid #d9dfd4;color:#173b2c}
.slip-entry>span{display:grid;gap:4px;flex:1 1 85px;min-width:0;overflow-wrap:break-word}
.slip-entry button{width:44px;height:44px;min-width:44px;flex:0 0 44px;display:grid;place-items:center;min-height:44px;padding:7px 8px;font-size:12px;background:#f5f8ef;color:#7a352a;border-color:#dacac3}
.slip-total{display:flex;flex-wrap:wrap;gap:6px;justify-content:space-between;font-size:13px;margin:14px 0}
#duplicate-dialog{width:min(400px,calc(100% - 24px));padding:20px;border:1px solid #b8c7bc;border-radius:12px;color:#173b2c}
#duplicate-dialog::backdrop{background:#092c1a88}#duplicate-message{font-size:14px;line-height:1.5}#dismiss-duplicate{width:100%}
.bet-result{display:flex;gap:12px;justify-content:space-between;border-bottom:1px solid #dce3d7;padding:10px 0;font-size:13px}
.bet-result>span{display:grid;gap:4px;min-width:0}.bet-result>span:last-child{text-align:right;flex-shrink:0}.bet-result span span{color:#5e7165}
/* Compact W/P/S controls stay in the existing right-hand grid column. */
#betting .bet-types{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;margin:0 0 10px;min-width:0}
#betting .bet-types button{min-width:0;min-height:44px;padding:6px 1px;font-size:12px;letter-spacing:0;background:#f5f8ef;color:#185b3e}
#betting .bet-types button[aria-pressed=true]{background:#185b3e;color:white;border-color:#185b3e;box-shadow:inset 0 0 0 1px #fff5}
#type-note{display:block;margin:0 0 10px;font-size:11px;line-height:1.4}#type-note:empty{display:none}
/* Secondary condition text shares the type controls' existing 10px bottom gap. */
#betting .bet-types{margin-bottom:4px}
#type-explanation{display:block;text-align:center;font-size:12px;line-height:1.35;margin:0 0 6px;white-space:normal;overflow-wrap:normal}
.bet-type-heading{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;column-gap:4px;margin-bottom:2px}
#betting .bet-type-heading #bet-type-title{grid-column:2;margin:0}
#bet-type-info{display:grid;place-items:center;justify-self:start;width:36px;min-height:36px;padding:8px;border:0;background:transparent;color:#185b3e}
#bet-type-info svg{width:18px;height:18px}
#bet-type-explanation{margin:0 0 12px;font-size:12px;line-height:1.4;color:#5e7165;text-align:center;white-space:normal}
#bet-type-info-panel{margin:0 0 12px;font-size:12px;line-height:1.45;color:#173b2c}
#bet-type-info-panel p{margin:0 0 7px}
#close-bet-info{min-height:36px;padding:6px 12px;font-size:12px;background:#fafbf7;color:#185b3e}
/* Phase3D.2: one full-width type row, existing equal columns, full-width slip. */
#betting>.bet-types{grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;margin:0 0 12px}
#betting>.bet-types button{font-size:12px;min-height:44px;padding:6px 1px}
#exotic-selections{display:grid;gap:6px;min-width:0}
.exotic-card{display:flex;align-items:center;gap:3px;border:1px solid #b8c7bc;border-radius:8px;background:#f5f8ef;padding:7px 5px;min-width:0}
.exotic-card>div{display:grid;justify-items:center;text-align:center;gap:4px;flex:1;min-width:0;font-size:12px;overflow-wrap:break-word}
.exotic-card small{font-size:11px}.exotic-card .number{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;color:#101b16;font-weight:800}
.exotic-card button{flex:0 0 32px;width:32px;height:44px;min-height:44px;padding:0;background:transparent;color:#7a352a;border:0;font-size:22px}
#clear-selections{display:block;margin:3px 0 4px auto;min-height:36px;padding:3px 6px;background:none;border:0;color:#5e7165;text-decoration:underline;font-size:12px}
#approx-odds{display:flex;flex-wrap:wrap;justify-content:space-between;gap:3px;font-size:12px;min-width:0}
#approx-value{overflow-wrap:anywhere;text-align:right}
#betting .potential strong{overflow-wrap:anywhere;min-width:0}
#betting>.bet-slip{width:100%}
#betting .slip-entry{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:6px}
#betting .slip-horses{display:block;min-width:0;font-weight:700;font-size:13px;overflow-wrap:break-word}
.slip-details{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:6px 12px;min-width:0;font-size:12px}
.slip-details>span{overflow-wrap:anywhere;min-width:0}.slip-return{margin-left:auto;text-align:right}
@media(max-width:350px){#betting>.bet-types button{font-size:11px}.exotic-card{padding-inline:3px}.exotic-card>div{font-size:11px}#betting #bet-form .wager-heading label{font-size:10px}#high-roller-toggle{font-size:9px;padding-inline:4px;gap:2px}#high-roller-toggle svg{width:10px;height:10px}}
/* Phase3D.3: presentation only; independent removal control and centered content. */
#betting #bet-type-title{text-align:center;margin:0 0 6px}
.exotic-card{position:relative;display:block}
.exotic-card>div{width:100%}
.exotic-card small{display:grid;place-items:center;min-height:28px}
.exotic-card button{position:absolute;top:3px;right:3px;width:32px;height:32px;min-height:32px;color:#64786a}
.exotic-card button svg{width:16px;height:16px}
.slip-details{display:grid;grid-template-columns:minmax(0,1fr);justify-content:start;gap:4px;text-align:left}
.slip-return{margin-left:0;text-align:left}

/* Compact slip information; the unchanged touch target spans the full text group. */
#betting .slip-entry{row-gap:2px;column-gap:6px;align-items:start}
#betting .slip-horses{grid-column:1;grid-row:1;margin:0;padding:0}
#betting .slip-details{grid-column:1;grid-row:2;gap:2px;margin:0;padding:0}
#betting .slip-entry button{grid-column:2;grid-row:1/3;align-self:center;color:#64786a}

/* Phase 5B: approved branding only; account IDs and game geometry are unchanged. */
.player-header{gap:16px}
.player-brand{flex:1 1 280px;min-width:0;max-width:280px}
.player-brand h1{margin:0;line-height:1;letter-spacing:normal}
.brand-logo{display:block;width:100%;height:auto}
.player-brand .eyebrow{display:block;margin-top:4px;padding-inline-start:4px;font-size:10px;letter-spacing:1px;line-height:1.4}
.player-header .account{flex:0 1 auto;min-width:0;max-width:48%;overflow-wrap:anywhere}
@media(max-width:560px){
 .player-header{gap:8px;margin-bottom:16px}
 .player-brand{flex-basis:195px;max-width:195px}
 .player-brand .eyebrow{font-size:8px;letter-spacing:.5px}
}

/* Phase 5C: About navigation uses the familiar footer treatment. */
footer a{color:#5e7165;font-size:12px;text-underline-offset:3px;display:inline-flex;align-items:center;min-height:44px}
/* Phase 6C.2: viewport-visible update notice; lifecycle remains in player.js. */
#update-notice{
 position:fixed;
 top:calc(env(safe-area-inset-top,0px) + 12px);
 left:max(12px,env(safe-area-inset-left,0px));
 right:max(12px,env(safe-area-inset-right,0px));
 z-index:100;
 width:auto;max-width:460px;box-sizing:border-box;margin:0 auto;
 max-height:calc(100vh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px);
 max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 24px);
 overflow:auto;overscroll-behavior:contain;
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px;
 padding:12px 16px;border:1px solid #b8c7bc;border-radius:12px;
 background:#fff;color:#173b2c;box-shadow:0 6px 24px #17362633;
 overflow-wrap:anywhere;text-align:left;
}
#update-notice>strong{grid-column:1/-1;font-size:15px;line-height:1.35}
#update-notice>p{grid-column:1/-1;margin:0;font-size:13px;line-height:1.4}
#update-notice>button{min-width:0;min-height:48px;padding:10px 12px;font-size:14px;line-height:1.3}
#update-later{background:#f2f3eb;color:#173b2c}

/* Exhibition controls remain outside the transformed track scene. */
#exhibition{display:flex;align-items:center;justify-content:space-between;gap:6px;padding-top:5px;font-size:12px;flex-wrap:wrap}#exhibition-betting{min-height:44px;padding:6px 10px;font-size:12px;background:#faf3d7;color:#173b2c}

/* Keep the original Start Race footprint throughout the countdown. */
#start:has(.countdown-content){position:relative;padding:0;overflow:hidden}.countdown-content{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:1.05}.countdown-title{font-size:10px;letter-spacing:1px}.countdown-number{font-size:30px;line-height:1}.countdown-hint{font-size:10px;font-weight:400}

/* One contextual tip follows the controls it describes; no floating layer. */
#first-wager-guide{margin:4px 0 10px;padding:7px 8px;background:#FFF1C4;border:1px solid #D9A441;color:#744A0C;border-radius:6px;display:flex;flex-wrap:wrap;align-items:start;gap:3px 8px;font-size:12px;line-height:1.4}#first-wager-guide>div{flex:1 1 110px;min-width:0}#guide-title,#guide-message{display:block}#guide-title{margin-bottom:2px}#skip-tips{min-height:36px;padding:4px 2px;font-size:11px;background:transparent;border:0;color:#744A0C;text-decoration:underline;margin-left:auto}

/* Gold tips and manually opened reference help retain distinct identities. */
.guide-heading{display:flex;align-items:flex-start;gap:5px}.guide-bulb{width:14px;height:17px;flex:none;color:#A56A10}#bet-type-info-panel{background:#FFF1C4;border:1px solid #D9A441;border-left:3px solid #A56A10;border-radius:6px;color:#744A0C;padding:8px;margin:8px 0 12px}.help-heading{display:flex;align-items:center;gap:5px;margin-bottom:6px;color:#744A0C}.help-heading>span{color:#A56A10}#bet-type-info-panel #close-bet-info{background:transparent;color:#744A0C;border-color:#D9A441}.track-labels{min-height:13px}
