/* WTWR_UNIFIED_RACING_HUB_V1
   One main Racing page: Today's card + bet builder + settled performance.
*/

/* Old top-level destinations stay in the DOM for their existing engines,
   but are no longer separate customer-facing pages. */
header nav .wtwr-racing-hub-old-nav{display:none!important}
#results{display:none!important}

/* WTWR_DEMO_ACCOUNT_CUTOVER_20260914: #demo-account was unconditionally
   hidden here on the (now false) assumption it was empty after #demoBank
   moved out -- wtwr-my-demo-account-v2.js legitimately mounts the real
   D1-backed account view (#wtwrMyDemoAccountV2) into it. Restored to the
   site's existing standard auth-gated visibility (member.html's
   html.wtwr-auth-flashguard/auth-pending/guest/expired #demo-account rules,
   the same pattern #today/#results/#strategy/#performance already use) by
   simply no longer overriding it here -- no new visibility logic added.
   Its one remaining stale element, the old shared-liquidity-ladder
   "WTWR DEMO LIVE MARKET" countdown banner (superseded by Full Field's real
   Bet365-via-Racing-API prices; its own copy -- "No Betfair/BETDAQ data
   yet" -- is now inaccurate), stays scope-hidden here so the account view
   presents cleanly; the banner's script/DOM are untouched, not deleted. */
#demo-account .wtwr-live-demo-banner{display:none!important}

/* WTWR_STAGE1_1_LEGACY_DEMOBANK_HIDE_20260914: the localStorage-only
   #demoBank/placeBet() route must not remain reachable to normal members
   now that wtwr-my-demo-account-v2.js is the real, D1-backed My Demo
   Account (see WTWR_DEMO_ACCOUNT_CUTOVER_20260914 above). Confirmed live
   (inventory + rendered-size checks) that #wtwrRacingBetZone's only child
   is #demoBank -- heading, KPIs, build-a-bet tool, AI guide, stake
   calculator, betslip, feedback, ledger, disclaimer, all legacy-only, zero
   overlap with real Today's Racing data, AI badges, result badges, or
   Full Field. The 58 "ADD TO BET" toggle buttons are NOT inside this zone
   -- they're built directly onto #todayTable's own rows, a sibling within
   .tablewrap -- hence the separate rule. CSS-only, reversible; no script,
   DOM-construction, or localStorage code touched or deleted. */
#wtwrRacingBetZone{display:none!important}
.wtwr-racing-bet-toggle{display:none!important}

/* WTWR_STAGE1_1B_CLEANUP_20260914 (A): wtwr-racing-flow-v21.js's
   ensureEndZone() unconditionally builds this "YOUR DEMO EXCHANGE ACCOUNT"
   wrapper every layout() pass; its body only ever fills if #wtwrDemoExchangeBankV1
   exists, and that element's sole creator (wtwr-demo-exchange-trading-v1.js)
   is not loaded (removed from member.html's includes 2026-09-11) -- so the
   body is permanently empty and the heading shows with nothing behind it.
   Confirmed independent of the D1-backed My Demo Account, Full Field,
   results, or the cron. Script/DOM untouched, just hidden. */
#wtwr-v21-end-summary{display:none!important}

/* WTWR_STAGE1_1B_CLEANUP_20260914 (B): wtwr-rulings-v1.js's localStorage-only
   named-filter feature (every visitor auto-seeded a "Black Vs Purple"
   ruling) injects its tabs/buttons into the real Useful Views strategy bar
   (#wtwr-racing-polish-tabs-v16b .v16b-tabs) rather than owning a section of
   its own -- scoped to these three selectors only, so the real ALL/strategy
   tabs in that same bar are untouched. Confirmed no server/D1 involvement
   ("does not touch V31, the worker, the data pipeline" -- the script's own
   header comment). Script/DOM untouched, just hidden.
   WTWR_STAGE1_1B_SPECIFICITY_FIX_20260914: the first deployed version of
   this rule (plain .wtwr-ruling-tab/.wtwr-ruling-action, specificity 0,1,0)
   lost to wtwr-racing-polish-v16b.css's own
   "#wtwr-racing-polish-tabs-v16b button{display:flex!important}" (ID +
   element, 1,0,1) -- both !important, so specificity decided it, and the
   ruling buttons stayed visible (confirmed live). Re-scoped under the same
   #wtwr-racing-polish-tabs-v16b ID to match/exceed it; #wtwr-ruling-manage-
   panel is unaffected by this (it's a sibling after the bar, never inside
   it) and needed no change. */
#wtwr-racing-polish-tabs-v16b .wtwr-ruling-tab,
#wtwr-racing-polish-tabs-v16b .wtwr-ruling-action,
#wtwr-ruling-manage-panel{display:none!important}

/* Preserve the original Demo access gate after moving the bank out of the
   #demo-account section. */
html.wtwr-auth-pending #wtwrRacingBetZone,
html.wtwr-guest #wtwrRacingBetZone,
html.wtwr-expired #wtwrRacingBetZone{display:none!important}

#wtwrRacingDayStatus{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin:14px 0;
  padding:12px 16px;
  border:1px solid #26425f;
  border-radius:14px;
  background:linear-gradient(90deg,rgba(13,34,57,.96),rgba(5,16,28,.94));
}
#wtwrRacingDayStatusText{display:flex;align-items:center;gap:12px;min-width:0}
#wtwrRacingDayStatusText strong{color:#6db8ff;white-space:nowrap;letter-spacing:.06em;font-size:.78rem}
#wtwrRacingDayStatusText span{color:#9cabbc;font-size:.79rem;line-height:1.4}
#wtwrRacingRefreshResults{
  flex:0 0 auto;
  min-height:38px;
  padding:8px 13px;
  border:1px solid #315372;
  border-radius:10px;
  background:#0b1724;
  color:#e8eef6;
  font-weight:800;
  cursor:pointer;
}
#wtwrRacingRefreshResults:disabled{opacity:.55;cursor:default}

#wtwrRacingPerformanceZone{margin:12px 0 16px}
#wtwrRacingPerformanceZone .wtwr-results-performance-truth{margin-top:0}

#wtwrRacingBetZone{margin:16px 0}
#wtwrRacingBetZone #demoBank{
  margin:0!important;
  padding:16px!important;
  border-radius:16px!important;
}
#wtwrRacingBetZone .demo-bank-head{align-items:center}
#wtwrRacingBetZone .demo-bank-head p{display:none!important}
#wtwrRacingBetZone .demo-bank-kpis{margin:14px 0!important;gap:9px!important}
#wtwrRacingBetZone .demo-bank-kpis .metric{padding:12px!important;border-radius:12px!important}
#wtwrRacingBetZone .demo-bank-kpis .metric strong{font-size:1.08rem!important}
#wtwrRacingBetZone .demo-builder{padding:14px!important;border-radius:14px!important}
#wtwrRacingBetZone .demo-builder-head{align-items:end!important}
#wtwrRacingBetZone .demo-note{margin:10px 0 0!important}
#wtwrRacingBetZone .demo-betslip{margin-top:12px!important;padding:12px 14px!important}
#wtwrRacingBetZone .demo-ledger-grid{margin-top:12px!important}
#wtwrRacingBetZone .demo-ledger{padding:14px!important;border-radius:14px!important}
#wtwrRacingBetZone .demo-disclaimer{margin-bottom:0!important}

/* The old My Demo race table/filter/strategy area remains hidden in the DOM
   because it is still the trusted state engine behind the new Today buttons. */
#wtwrRacingBetZone #wtwrMyDemoWorkflowStackV2,
#wtwrRacingBetZone .demo-selection-wrap,
#wtwrRacingBetZone .demo-filter-grid,
#wtwrRacingBetZone .demo-filter-actions,
#wtwrRacingBetZone #wtwrAIUniformPolishShell,
#wtwrRacingBetZone #wtwrDemoCompactEvidence,
#wtwrRacingBetZone .wtwr-demo-strategy-info,
#wtwrRacingBetZone #wtwrDemoStrategyInfo{display:none!important}

/* Add-to-bet control directly on Today's P1/P2 horse side. */
#todayTable td{position:relative}
.wtwr-racing-bet-toggle{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-top:11px;
  min-height:31px;
  padding:5px 9px;
  border:1px solid #315474;
  border-radius:999px;
  background:#0a1825;
  color:#9fc9ef;
  font-size:.68rem;
  line-height:1;
  font-weight:900;
  letter-spacing:.04em;
  cursor:pointer;
}
.wtwr-racing-bet-toggle:hover:not(:disabled){border-color:#54a9ee;color:#d8efff}
.wtwr-racing-bet-toggle.selected{border-color:#2db77f;background:rgba(17,87,62,.25);color:#74eab3}
.wtwr-racing-bet-toggle:disabled{opacity:.35;cursor:not-allowed}

/* Result badge is painted onto the SAME live racing horse cell. */
.wtwr-racing-result-badge{
  position:absolute;
  top:12px;
  right:12px;
  z-index:4;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:48px;
  min-height:27px;
  padding:4px 9px;
  border-radius:8px;
  font-size:.69rem;
  font-weight:950;
  letter-spacing:.05em;
  opacity:1!important;
  filter:none!important;
}
/* WTWR_RESULT_STATUS_SHARED_V1 (2026-09-19): .first/.placed colour rules
   removed -- now owned by wtwr-result-status-shared-v1.css's
   .wtwr-rstat-1st/-2nd/-3rd classes, which resultClass() in
   wtwr-unified-racing-hub-20260818_200516.js emits directly (also fixed
   in the same change: this badge was never actually being created
   before, only ever removed). .lost/.void keep this surface's own
   existing look, unchanged. */
.wtwr-racing-result-badge.lost{background:#0a0f17;color:#e3e8ef;border:1px solid #59677a}
.wtwr-racing-result-badge.void{background:#263445;color:#d8e0e9}

/* Once same-day results are present, keep the true result badge vivid even
   if the opposite/context horse is intentionally subdued. */
#today.wtwr-racing-results-active #todayTable td.wtwr-strategy-side-muted,
#today.wtwr-racing-results-active #todayTable td.wtwr-filter-side-muted{
  opacity:1!important;
  filter:none!important;
  background:rgba(2,7,13,.48)!important;
  box-shadow:inset 0 0 0 9999px rgba(2,7,13,.07)!important;
}
#today.wtwr-racing-results-active #todayTable td.wtwr-strategy-side-muted > *:not(.wtwr-racing-result-badge),
#today.wtwr-racing-results-active #todayTable td.wtwr-filter-side-muted > *:not(.wtwr-racing-result-badge){
  opacity:.52!important;
  filter:saturate(.46) brightness(.88)!important;
}
#today.wtwr-racing-results-active #todayTable td .wtwr-racing-result-badge{
  opacity:1!important;
  filter:none!important;
}

@media(max-width:900px){
  #wtwrRacingDayStatus{align-items:flex-start;flex-direction:column}
  #wtwrRacingDayStatusText{align-items:flex-start;flex-direction:column;gap:5px}
  #wtwrRacingBetZone .demo-bank-kpis{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:620px){
  #wtwrRacingBetZone .demo-bank-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .wtwr-racing-result-badge{position:static;margin:8px 0 0}
}
