/* Budget instruments, layered after the shared interface. Keep the reef intact. */
body[data-ui=cup]{--budget-pot:#acd2c5;--budget-tactics:#e6c788;--budget-edge:#c2d5ce26;--budget-error:#f0b6a3}
body[data-ui=cup] [hidden]{display:none!important}
body[data-ui=cup] :is(.race-layout,.arena,.race-ticket,#choices,.heading>div){min-width:0}
body[data-ui=cup] :is(.race-ticket,.race-ticket * ,#tactics,#tactics *,#finish,#finish *){box-sizing:border-box}
body[data-ui=cup] .heading>div>p:last-child{max-width:44ch;font-size:clamp(15px,1.5vw,20px);line-height:1.5;color:var(--ui-paper)}
body[data-ui=cup] .balance .budget-demo{display:inline-block;vertical-align:middle;margin-left:5px;padding:3px 6px;border:1px solid #e6c78866;border-radius:4px;background:#e6c78812;color:var(--budget-tactics);font:700 10px/1.2 var(--sans,Archivo,sans-serif);letter-spacing:.08em}
body[data-ui=cup] #choices{padding:0;margin:0;border:0}
body[data-ui=cup] #choices>:is(.budget-allocation,#strategy-options){display:block}
body[data-ui=cup] .budget-allocation{margin-top:18px;padding-top:18px;border-top:1px solid var(--budget-edge)}
body[data-ui=cup] .budget-label{display:block;font-size:13px;line-height:1.5;color:var(--ui-paper)}
body[data-ui=cup] .budget-label strong{font-weight:650}
body[data-ui=cup] :is(#allocation,#strategy-source,#course){min-width:0;max-width:100%;min-height:44px;margin-top:8px;padding:10px 28px 10px 10px;border:1px solid #a6c0b94d;border-radius:8px;background-color:#061e28;color:var(--ui-paper);font:14px/1.4 var(--sans,Archivo,sans-serif);color-scheme:dark}
body[data-ui=cup] #budget-bar{display:flex;gap:0;width:100%;height:9px;margin:17px 0 12px;overflow:hidden;border-radius:5px;background:#173942}
body[data-ui=cup] #budget-bar>span{display:block;min-width:0;max-width:100%;height:100%;flex-shrink:1;transition:width .18s ease}
body[data-ui=cup] #stake-bar{background:var(--budget-pot)}
body[data-ui=cup] #compute-bar{background:var(--budget-tactics)}
body[data-ui=cup] .budget-shares{display:grid;grid-template-columns:1fr 1fr;gap:12px}
body[data-ui=cup] .budget-shares>div{min-width:0}
body[data-ui=cup] .budget-shares span{display:block;margin-bottom:5px;color:var(--ui-muted);font-size:11px}
body[data-ui=cup] .budget-shares strong{display:block;font-size:clamp(17px,1.5vw,21px);font-weight:650;line-height:1.25;letter-spacing:-.035em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
body[data-ui=cup] .stake-share strong{color:var(--budget-pot)}
body[data-ui=cup] .compute-share strong{color:var(--budget-tactics)}
body[data-ui=cup] :is(#budget-copy,#strategy-note){margin:12px 0 0;color:var(--ui-muted);font-size:12px;line-height:1.6;overflow-wrap:anywhere}
body[data-ui=cup] #strategy-options{margin-top:18px;padding-top:16px;border-top:1px solid var(--budget-edge)}
body[data-ui=cup] #strategy-options>.course-label{margin-top:0}
body[data-ui=cup] #request-plan{display:block;width:100%;min-height:44px;margin:14px 0 0;padding:11px 12px;border:1px solid #e6c78866;border-radius:8px;background:#e6c7880b;color:var(--ui-paper);font:600 13px/1.4 var(--sans,Archivo,sans-serif);text-align:center;white-space:normal;cursor:pointer}
body[data-ui=cup] #strategy-status{margin:10px 0 0;font-size:12px;line-height:1.6;color:var(--budget-tactics);overflow-wrap:anywhere}
body[data-ui=cup] :is(#strategy-status,#plan,#tactic-cue,#finish-accounting,#live-receipt,#rival-budgets):empty{display:none}
body[data-ui=cup] #plan{margin:12px 0 0;padding:0 0 0 12px;border-left:2px solid #e6c78880;color:var(--ui-paper);font-size:12px;line-height:1.65;max-height:12rem;overflow:auto;overflow-wrap:anywhere;scrollbar-width:thin}
body[data-ui=cup] #strategy-disclosure{margin:14px 0 0;font-size:11px;line-height:1.6;color:var(--ui-muted)}
body[data-ui=cup] .entry-total{align-items:baseline;border-color:var(--budget-edge)}
body[data-ui=cup] .entry-total>span{min-width:0}
body[data-ui=cup] .entry-total strong{font-size:18px;letter-spacing:-.025em;font-variant-numeric:tabular-nums;color:var(--ui-paper)}
body[data-ui=cup] #cost-detail{font-size:11px;line-height:1.5}
body[data-ui=cup] .risk-note{font-size:11px;line-height:1.6}

/* Short actual-effect cues stay clear of the fish. */
body[data-ui=cup] .stage-caption .caption-lines{flex:1;min-width:0}
body[data-ui=cup] .stage-caption .caption-lines>span{display:block;max-width:none;overflow-wrap:anywhere;line-height:1.4}
body[data-ui=cup] #tactic-cue{margin-top:3px;color:var(--budget-tactics);font-size:11px}
body[data-ui=cup] .stage-caption #skip{flex-shrink:0;min-height:36px}
body[data-ui=cup] .pot{max-width:46%;min-width:0}
body[data-ui=cup] .pot small{line-height:1.5;overflow-wrap:anywhere}

/* JS supplies three section cards. Labels and controls retain their own space. */
body[data-ui=cup] #tactics{flex:none;margin:0;padding:0 20px;border:0;border-top:1px solid var(--budget-edge);background:#092630;color:var(--ui-paper)}
body[data-ui=cup] #tactics>summary{padding:16px 0;min-height:48px;font-size:14px;font-weight:600;cursor:pointer}
body[data-ui=cup] #tactics[open]>summary{padding-bottom:8px}
body[data-ui=cup] .tactics-intro{margin:0 0 14px;color:var(--ui-muted);font-size:12px;line-height:1.5}
body[data-ui=cup] #plan-sections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
body[data-ui=cup] #plan-sections>*{min-width:0;margin:0;padding:12px;border:1px solid var(--budget-edge);border-radius:8px;background:#061e2866;overflow-wrap:anywhere}
body[data-ui=cup] #plan-sections :is(h3,h4,legend){margin:0 0 10px;padding:0;color:var(--ui-paper);font-size:13px;font-weight:600;line-height:1.4}
body[data-ui=cup] #plan-sections label{display:block;margin-top:9px;color:var(--ui-muted);font-size:11px;line-height:1.5}
body[data-ui=cup] #plan-sections :is(select,input){width:100%;min-width:0;max-width:100%;min-height:40px;margin-top:5px;padding:8px;border:1px solid #a6c0b94d;border-radius:6px;background:#061e28;color:var(--ui-paper);font:12px/1.4 var(--sans,Archivo,sans-serif);color-scheme:dark}
body[data-ui=cup] #plan-sections :is(p,dl){margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--ui-muted)}
body[data-ui=cup] #plan-sections :is(output,dd){display:block;margin:3px 0 9px;color:var(--ui-paper);font-size:13px;line-height:1.5}
body[data-ui=cup] #plan-sections dt{font-size:11px;color:var(--ui-muted)}
body[data-ui=cup] #energy-note{margin:12px 0 16px;color:var(--budget-pot);font-size:12px;line-height:1.6;overflow-wrap:anywhere}

body[data-ui=cup] #finish{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:20px;background:#143a3c}
body[data-ui=cup] .finish-summary{flex:1 1 220px;min-width:0}
body[data-ui=cup] #finish-detail{overflow-wrap:anywhere;line-height:1.6}
body[data-ui=cup] #finish-accounting{flex:1 1 190px;min-width:0;padding:12px;border:1px solid #c2d5ce38;border-radius:8px;color:var(--ui-paper);font-size:12px;line-height:1.7;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
body[data-ui=cup] #finish-accounting :is(p,dl){margin:0}
body[data-ui=cup] #finish-accounting dd{margin:0 0 6px}
body[data-ui=cup] .finish-actions{display:flex;flex:1 0 100%;flex-wrap:wrap;align-items:center;gap:10px}
body[data-ui=cup] .finish-actions :is(button,a){width:auto;min-height:44px;margin:0;padding:12px 16px;border-radius:8px;font:600 13px/1.4 var(--sans,Archivo,sans-serif);text-align:center;white-space:normal}
body[data-ui=cup] #evidence{overflow-wrap:anywhere}
body[data-ui=cup] #rival-budgets{display:grid;grid-template-columns:minmax(80px,1fr) minmax(0,2fr);gap:8px 16px;margin:16px 0;padding:14px;border:1px solid var(--budget-edge);border-radius:8px;font-size:12px;line-height:1.6}
body[data-ui=cup] #rival-budgets dt{color:var(--ui-paper);font-weight:600}
body[data-ui=cup] #rival-budgets dd{margin:0;color:var(--ui-muted)}
body[data-ui=cup] #rival-budgets>div{grid-column:1/-1}
body[data-ui=cup] #live-receipt{min-width:0;max-height:20rem;overflow:auto;margin:16px 0;padding:14px;border:1px solid var(--budget-edge);border-radius:8px;background:#041b24;font-size:12px;line-height:1.6;scrollbar-width:thin}
body[data-ui=cup] #live-receipt :is(pre,code){max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere;font-size:11px;line-height:1.6}
body[data-ui=cup] #live-receipt pre{margin:0}

/* Pending, unavailable and failed requests remain legible and discoverable. */
body[data-ui=cup] :is(#strategy-options,#choices)[aria-busy=true] #strategy-status{padding-left:10px;border-left:2px solid var(--budget-tactics)}
body[data-ui=cup] :is(#strategy-status,#status,#strategy-note)[data-state=error],
body[data-ui=cup] :is(#strategy-status,#status,#strategy-note).error,
body[data-ui=cup] #strategy-options[data-state=error] #strategy-status{padding:10px 12px;border:1px solid #f0b6a366;border-radius:6px;background:#f0b6a30b;color:var(--budget-error)}
body[data-ui=cup] :is(#strategy-status,#status,#strategy-note)[data-state=unavailable]{padding:10px 12px;border:1px solid #e6c78866;border-radius:6px;color:var(--budget-tactics);background:#e6c7880b}
body[data-ui=cup] [aria-invalid=true]{border-color:var(--budget-error)!important}
body[data-ui=cup] :is(button,select,input):disabled,
body[data-ui=cup] [aria-disabled=true]{opacity:.65;cursor:not-allowed}
body[data-ui=cup] :is(button,select,input,a,summary):focus-visible{outline:2px solid #ffe2a0;outline-offset:3px}
body[data-ui=cup] :is(#tactics,#evidence,#strategy-options,#finish){scroll-margin-top:20px}
@media(hover:hover){
  body[data-ui=cup] :is(#request-plan,.finish-actions .secondary):not(:disabled):not([aria-disabled=true]):hover{border-color:var(--budget-tactics);background:#e6c7881f;color:#fff0cc}
  body[data-ui=cup] :is(#allocation,#strategy-source,#course,#plan-sections select):not(:disabled):hover{border-color:#c2d5ce99}
  body[data-ui=cup] :is(#tactics,#evidence)>summary:hover{color:var(--budget-tactics)}
  body[data-ui=cup] :is(#enter,#race-again):not(:disabled):hover{filter:brightness(1.08)}
}
@media(max-width:1050px) and (min-width:761px){
  body[data-ui=cup] #plan-sections{gap:6px}
  body[data-ui=cup] #plan-sections>*{padding:9px}
}
@media(max-width:760px){
  body[data-ui=cup] .heading>div>p:last-child{max-width:32ch;font-size:15px}
  body[data-ui=cup] #choices>:is(.budget-allocation,#strategy-options){display:block}
  body[data-ui=cup] .budget-shares strong{font-size:23px}
  body[data-ui=cup] #tactics{padding-inline:14px}
  body[data-ui=cup] #plan-sections{grid-template-columns:minmax(0,1fr);gap:8px}
  body[data-ui=cup] #plan-sections>*{padding:12px}
  body[data-ui=cup] #plan-sections :is(select,input){min-height:44px}
  body[data-ui=cup] #finish{align-items:stretch;gap:12px;padding:16px}
  body[data-ui=cup] :is(.finish-summary,#finish-accounting,.finish-actions){flex-basis:auto}
  body[data-ui=cup] .finish-actions{width:100%}
  body[data-ui=cup] #tactic-cue{font-size:10px}
  body[data-ui=cup] .stage-caption #skip{font-size:11px;padding-inline:8px}
}
@media(max-width:380px){
  body[data-ui=cup]>header{flex-wrap:wrap;gap:12px;padding-inline:16px}
  body[data-ui=cup]>header nav{min-width:0;max-width:100%;flex-wrap:wrap;gap:8px 12px}
  body[data-ui=cup] main{padding-inline:12px}
  body[data-ui=cup] .heading{flex-wrap:wrap;gap:16px}
  body[data-ui=cup] .heading>div{flex:1 1 100%}
  body[data-ui=cup] .race-ticket{padding:14px}
  body[data-ui=cup] .arena-top{padding-inline:12px;gap:8px}
  body[data-ui=cup] .arena h2{font-size:20px}
  body[data-ui=cup] .pot strong{font-size:18px}
  body[data-ui=cup] .pot small{font-size:9px}
  body[data-ui=cup] #fish-choices button{padding-inline:4px;min-width:0}
  body[data-ui=cup] #fish-choices small{font-size:10px;overflow-wrap:anywhere}
  body[data-ui=cup] #standings{flex-wrap:wrap;gap:10px;font-size:11px}
  body[data-ui=cup] #standings>li{min-width:0;overflow-wrap:anywhere}
  body[data-ui=cup] .finish-actions>*{flex:1 1 100%}
  body[data-ui=cup] .tide{gap:10px;grid-template-columns:minmax(0,1fr) 75px}
  body[data-ui=cup] #rival-budgets{grid-template-columns:minmax(0,1fr);gap:4px}
  body[data-ui=cup] #rival-budgets dd{margin-bottom:8px}
  body[data-ui=cup]>footer{flex-wrap:wrap;gap:12px}
}
@media(prefers-reduced-motion:reduce){
  body[data-ui=cup],body[data-ui=cup] *{scroll-behavior:auto!important}
  body[data-ui=cup] *,body[data-ui=cup] *::before,body[data-ui=cup] *::after{animation:none!important;transition:none!important}
}

/* Keep the race framed independently of the ticket's changing request state. */
@media(min-width:1060px){body[data-ui=cup] .race-layout{grid-template-columns:minmax(0,1fr) 340px}}
@media(min-width:761px){body[data-ui=cup] .arena{align-self:start}body[data-ui=cup] .water-stage{flex:none;height:620px;min-height:620px}}
body[data-ui=cup] #budget-copy{margin-top:8px}
body[data-ui=cup] #strategy-status:empty,body[data-ui=cup] #plan:empty{display:none}
body[data-ui=cup] #strategy-disclosure{font-size:11px;line-height:1.5}

body[data-ui=cup] #fish-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
body[data-ui=cup] #fish-choices button{display:flex;flex-direction:column;justify-content:center;gap:7px;text-align:center;padding:12px 4px;min-height:65px}
body[data-ui=cup] #fish-choices small{display:none}
body[data-ui=cup] #fish-choices strong{font-size:15px}
body[data-ui=cup] #fish-detail{font-size:12px;line-height:1.5;color:var(--ui-muted);min-height:18px;margin:9px 0 0}
body[data-ui=cup] .course-label{margin-top:15px}
body[data-ui=cup] #course-detail{display:none}

body[data-ui=cup] .water-stage .game-feedback{position:absolute;inset:auto auto 16px 50%;width:min(560px,calc(100% - 28px));max-height:calc(100% - 115px);z-index:5}
body[data-ui=cup] .water-stage .game-feedback__body{max-height:245px}
@media(max-width:760px){body[data-ui=cup] .water-stage .game-feedback__body{max-height:210px}}
