/* App shell, broadcast overlays and site pages. Values come from tokens.css; components from components.css. */

/* ---------------------------------------------------------------- shell */
#stage { position: fixed; inset: 0; z-index: var(--z-scene); background: #0b0e13; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#stage canvas[hidden] { display: none; }
#view { position: relative; z-index: var(--z-overlay); }

.topbar { position: sticky; top: 0; z-index: var(--z-nav); display: flex; align-items: center; gap: var(--s-3);
  height: 64px; padding: 0 var(--gutter-r) 0 var(--gutter); background: var(--ink-0); border-bottom: 1px solid var(--ink-3); }
body[data-route="live"] .topbar { position: fixed; left: 0; right: 0; top: 0; height: auto; padding-top: max(20px, env(safe-area-inset-top, 0px)); padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); background: none; border: 0; pointer-events: none; }
body[data-route="live"] .topbar > * { pointer-events: auto; }
body[data-route="live"] .topbar__nav .pills { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-radius: var(--r-3); box-shadow: var(--shadow-glass); height: 36px; }
.topbar__nav .pills > * { font-size: var(--fs-14); padding: 6px 10px; }
.topbar__sp { flex: 1; }
.topbar__race { display: flex; align-items: stretch; height: 36px; }
.topbar__race > div { display: flex; align-items: center; gap: var(--s-2); padding: 0 14px; font-size: var(--fs-14); font-weight: var(--fw-semi); border-left: 1px solid var(--on); white-space: nowrap; }
.topbar__race > div:first-child { border-left: 0; }
.topbar__race .big { font-size: var(--fs-16); font-weight: var(--fw-bold); }
.topbar__race .muted { font-weight: var(--fw-regular); }
body:not([data-route="live"]) .topbar__race { background: var(--ink-1); box-shadow: none; border: 1px solid var(--ink-3); }
.topbar__acct { display: flex; gap: var(--s-2); align-items: center; }
.topbar__menu { display: none; }
.acct { display: flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 10px 0 12px; font-size: var(--fs-14); font-weight: var(--fw-semi); border: 0; cursor: pointer; color: var(--text); }
body:not([data-route="live"]) .acct { background: var(--ink-2); box-shadow: none; }
.acct i { width: 10px; height: 10px; border-radius: 50%; }
.menu { position: relative; }
.menu__list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: var(--s-1); display: flex; flex-direction: column; background: var(--glass-strong); border: 1px solid var(--ink-3); z-index: var(--z-modal); }
.menu__list > button, .menu__list > a { text-align: left; background: none; border: 0; color: var(--text); padding: var(--s-2) 10px; border-radius: var(--r-2); font-size: var(--fs-14); text-decoration: none; cursor: pointer; }
.menu__list > :hover { background: var(--hover); }
.menu__list hr { border: 0; border-top: 1px solid var(--hair); margin: var(--s-1) 0; }

/* ---------------------------------------------------------------- broadcast */
.bc { position: fixed; inset: 0; pointer-events: none; }
.bc > * { pointer-events: auto; }
.bc__scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(9, 11, 15, .28) 0, rgba(9, 11, 15, 0) 120px, rgba(9, 11, 15, 0) 78%, rgba(9, 11, 15, .32) 100%); }
.bc__tower { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); top: 72px; max-height: calc(100dvh - 150px); overflow: hidden auto; scrollbar-width: none; }
.tower__slot { position: absolute; left: 0; right: 0; top: 0; transition: transform var(--t-med) var(--ease-out); }
.bc__top { position: absolute; left: 50%; top: 72px; transform: translateX(-50%); z-index: var(--z-banner); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none; max-width: calc(100vw - 2 * 272px - 96px); }
.bc__top > * { pointer-events: auto; }
.bc__pillslot:empty, .bc__banner:empty { display: none; }
.bc__center { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); }
.bc__panel { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-8); text-align: center; }
.bc__panel > b { font-size: var(--fs-20); }
.bc__lights .countdown { font-size: var(--fs-48); }
.bc__next { align-items: flex-start; text-align: left; min-width: 340px; }
.bc__win { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-20); }
.bc__pill { display: flex; align-items: center; gap: var(--s-3); height: 40px; padding: 0 14px 0 6px; white-space: nowrap; }
.bc__pill b { font-size: var(--fs-20); }
.bc__battle { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: 600px; max-width: calc(100vw - 48px - 380px - 24px - 360px); min-width: 420px; padding: var(--s-3) var(--s-4) 14px; }
.bt__h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bt__row { display: grid; grid-template-columns: minmax(0, 1fr) 130px minmax(0, 1fr); align-items: center; gap: var(--s-4); }
.bt__side { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.bt__side.r { align-items: flex-end; text-align: right; }
.bt__who { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-20); font-weight: var(--fw-bold); letter-spacing: .02em; white-space: nowrap; }
.bt__p { font-size: var(--fs-14); color: var(--text-2); }
.bt__meta { display: flex; align-items: center; gap: 10px; font-size: var(--fs-13); color: var(--text-2); white-space: nowrap; }
.bt__gap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bt__gap b { font-size: var(--fs-32); font-weight: var(--fw-bold); line-height: 1; }
.bt__gap span { font-size: var(--fs-13); font-weight: var(--fw-semi); }
.good { color: var(--good); } .bad { color: var(--alert); }
.bc__card { position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); bottom: 28px; width: 360px; }
.cc__h { display: flex; align-items: center; gap: 10px; height: 44px; padding-right: 14px; border-bottom: 1px solid var(--hair); }
.cc__p { width: 44px; height: 44px; display: grid; place-items: center; background: var(--text); color: var(--on-light); font-size: var(--fs-20); font-weight: var(--fw-black); border-radius: var(--r-3) 0 0 0; flex: none; }
.cc__nm { font-size: var(--fs-16); font-weight: var(--fw-bold); letter-spacing: .03em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc__nm small { display: block; font-size: var(--fs-12); font-weight: var(--fw-regular); color: var(--text-2); letter-spacing: 0; margin-top: -3px; }
.cc__gap { font-size: var(--fs-14); font-weight: var(--fw-semi); white-space: nowrap; }
.cc__bd { padding: var(--s-3) 14px 14px; display: flex; flex-direction: column; gap: var(--s-3); }
.cc__spd { display: flex; align-items: flex-end; gap: 14px; }
.cc__v { font-size: var(--fs-48); font-weight: var(--fw-bold); line-height: .9; min-width: 3ch; }
.cc__gear { width: 40px; height: 44px; border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--r-3); display: grid; place-items: center; font-size: var(--fs-24); font-weight: var(--fw-black); }
.cc__laps { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-13); }
.cc__laps b { color: var(--text); font-weight: var(--fw-semi); }
.cc__laps b.good { color: var(--good); }
.cc__spd .pedals { margin-left: auto; }
.cc__su { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-2); }
.cc__su > div { display: flex; flex-direction: column; gap: var(--s-1); }
.cc__tel { border-top: 1px solid var(--hair); padding-top: 10px; }
.cc__telh { display: flex; justify-content: space-between; font-size: var(--fs-12); color: var(--text-2); margin-bottom: 6px; }
.cc__tel svg { width: 100%; height: 64px; display: block; }
.cc__tel .grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.cc__tel .prev { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cc__tel .cur { fill: none; stroke: var(--team); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.cc__act { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-13); }
.kv .meter > i.tyre--S, .kv .meter > i.tyre--M, .kv .meter > i.tyre--H, .kv .meter > i.tyre--I, .kv .meter > i.tyre--W { border: 0; width: auto; height: 100%; display: block; }
.bc__cam { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); bottom: 28px; }
.bc__credit { position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); bottom: 6px; font-size: 11px; color: rgba(238, 241, 245, .45); }
.bc__credit a { color: inherit; }
.bc__mtop, .bc__sheet { display: none; }
.rclog { list-style: none; margin: 0; padding: 0; }
.rclog li { display: flex; gap: var(--s-2); padding: 10px var(--s-4); border-top: 1px solid var(--ink-3); font-size: var(--fs-13); }
.rclog li.k-sc, .rclog li.k-safety { color: var(--caution); }
.rclog li.k-crash, .rclog li.k-retired, .rclog li.k-penalty { color: var(--alert); }
.rclog li.k-rain, .rclog li.k-weather { color: var(--info); }
.rclog li.k-fastest { color: var(--fastest); }

/* hand driving */
.drivepad { position: fixed; inset: auto 0 0 0; z-index: var(--z-sheet); pointer-events: none; }
.drivepad > * { pointer-events: auto; }
.drivepad__help { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); white-space: nowrap; font-size: var(--fs-13); }
.drivepad__touch { display: none; }
@media (pointer: coarse) {
  .drivepad__touch { display: flex; justify-content: space-between; padding: var(--s-4); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .drivepad__touch button { width: 76px; height: 76px; border-radius: var(--r-pill); border: 1px solid var(--line-3); background: var(--glass); color: var(--text); font-weight: var(--fw-bold); margin: 0 4px; }
  .drivepad__touch button.on { background: var(--text); color: var(--on-light); }
  .drivepad__help { bottom: auto; top: 70px; }
}

/* ---------------------------------------------------------------- pages */
.page { min-height: calc(100dvh - 64px); display: flex; flex-direction: column; }
.page > main { flex: 1; }
.wrap { width: 100%; max-width: var(--page-max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.foot { border-top: 1px solid var(--ink-3); padding: var(--s-6) 0 var(--s-10); color: var(--text-3); font-size: var(--fs-13); margin-top: var(--s-10); }
.foot a { color: var(--text-2); }
.row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.sp { flex: 1; }
.title { display: flex; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-8) 0 var(--s-5); }
.title h1 { margin: 0; font-size: var(--fs-32); line-height: var(--lh-tight); text-wrap: balance; }
.title .muted { font-size: var(--fs-16); }
.tabs { margin-bottom: var(--s-6); }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s-6); min-width: 0; }
.season-pick .input { width: 180px; }

/* schedule */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-6); padding: var(--s-8) 0; }
.live { position: relative; border-radius: var(--r-4); overflow: hidden; aspect-ratio: 16 / 9; max-width: 100%; text-decoration: none; color: var(--text);
  background: radial-gradient(120% 90% at 70% 10%, #23324a 0, #111722 55%, #0b0e13 100%); border: 1px solid var(--ink-3); }
.live__map { position: absolute; inset: 8% 10% 28%; display: grid; place-items: center; opacity: .9; }
.live__map svg { width: 100%; height: 100%; }
.live__map path { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.live__tl { position: absolute; left: var(--s-6); top: var(--s-5); display: flex; gap: 10px; }
.live__bl { position: absolute; left: var(--s-6); right: var(--s-6); bottom: 22px; display: flex; align-items: flex-end; gap: var(--s-6); }
.live h1 { margin: 0; font-size: var(--fs-32); line-height: var(--lh-tight); text-wrap: balance; }
.live__mini { margin-left: auto; min-width: 200px; background: var(--glass); border-radius: var(--r-3); padding: 6px 0; }
.mr { display: grid; grid-template-columns: 22px 3px minmax(0, 1fr) auto; column-gap: var(--s-2); align-items: center; height: 24px; padding: 0 10px 0 var(--s-1); font-size: var(--fs-14); }
.mr .p { text-align: center; font-weight: var(--fw-bold); } .mr .n { font-weight: var(--fw-bold); } .mr .n em { font-style: normal; font-weight: var(--fw-regular); color: var(--text-2); margin-left: 3px; } .mr .g { color: var(--text-2); }
.live--idle { display: block; }
.nextrace .note { font-size: var(--fs-13); color: var(--text-2); border-top: 1px solid var(--ink-3); padding-top: var(--s-3); }
.sec { padding: var(--s-2) 0 var(--s-10); }
.sech { display: flex; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-4); flex-wrap: wrap; }
.sech h2 { margin: 0; font-size: var(--fs-24); }
.sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-3); }
.rc { padding: 14px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); transition: border-color var(--t-fast); }
a.rc:not([aria-disabled]):hover { border-color: var(--line-3); }
.rc[aria-disabled] { cursor: default; }
.rc__tm { font-size: var(--fs-20); font-weight: var(--fw-bold); }
.st { font-size: var(--fs-12); font-weight: var(--fw-bold); letter-spacing: var(--label-track); color: var(--text-2); }
.st.live { color: var(--alert); } .st.next { color: var(--text); }
.rc__ty { font-size: var(--fs-16); font-weight: var(--fw-bold); }
.rc__meta { font-size: var(--fs-13); }
.rc__win { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-13); color: var(--text-2); border-top: 1px solid var(--ink-3); padding-top: var(--s-2); }
.rc__win b { color: var(--text); }
.season { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); }
.sc2 { padding: var(--s-4); display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text); }
.sc2__pos { font-size: var(--fs-32); font-weight: var(--fw-bold); width: 32px; color: var(--text-2); }
.sc2__nm { font-size: var(--fs-16); font-weight: var(--fw-bold); flex: 1; }
.sc2__pts { font-size: var(--fs-24); font-weight: var(--fw-bold); }
.sc2__pts small { font-size: var(--fs-13); color: var(--text-2); font-weight: var(--fw-semi); margin-left: var(--s-1); }

/* team */
.teamhead { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; padding: var(--s-8) 0 var(--s-6); }
.teamhead h1 { margin: 0; font-size: var(--fs-32); line-height: var(--lh-tight); }
.teamhead .stat { min-width: 90px; }
.spark--wide { width: 100%; height: 120px; }
.cars3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-4); margin: var(--s-6) 0; }
.carttl { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-20); }
.page .card + .card, .page section.card { margin-bottom: var(--s-6); }

/* race */
.replay-ph { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--text-2); font-size: var(--fs-13); background: var(--ink-2); border-radius: var(--r-3); padding: var(--s-4); }
.replay-ph code { font-family: var(--mono); font-size: 12px; }

/* docs */
.doc { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-10); padding: var(--s-8) 0; }
.doc__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 88px; align-self: start; }
.doc__nav a { color: var(--text-2); text-decoration: none; padding: 6px 10px; border-radius: var(--r-2); font-weight: var(--fw-semi); }
.doc__nav a:hover { color: var(--text); background: var(--hover); }
.doc__body { max-width: 760px; font-size: var(--fs-16); line-height: 1.6; }
.doc__body h1 { margin: 0 0 var(--s-3); font-size: var(--fs-32); line-height: var(--lh-tight); }
.doc__body h2 { font-size: var(--fs-20); margin: var(--s-10) 0 var(--s-3); padding-top: var(--s-4); border-top: 1px solid var(--ink-3); }
.doc__body .lede { color: var(--text-2); font-size: var(--fs-16); margin: 0 0 var(--s-6); }
.doc__body code { font-family: var(--mono); font-size: .86em; background: var(--ink-2); padding: 1px 6px; border-radius: var(--r-2); }
.doc__body pre { font-family: var(--mono); font-size: 13px; line-height: 1.5; background: var(--ink-1); border: 1px solid var(--ink-3); border-radius: var(--r-4); padding: 14px var(--s-4); overflow-x: auto; }
.doc__body pre code { background: none; padding: 0; }
.doc__body a { color: var(--text); }
.doc__body li { margin: 6px 0; }
.doc__body .tbl td { white-space: normal; height: auto; padding: 10px var(--s-3); font-size: var(--fs-14); line-height: 1.4; }
.doc__tbl td:first-child { white-space: nowrap; }
.cta { margin-top: var(--s-8); }

/* script editor */
.ed { display: flex; flex-direction: column; gap: var(--s-3); }
.ed__body { display: flex; height: min(60vh, 560px); border: 1px solid var(--line-2); border-radius: var(--r-3); overflow: hidden; background: #0b0d12; }
.ed__gutter { margin: 0; padding: var(--s-3) var(--s-2); width: 48px; text-align: right; color: var(--text-3); font: 13px/1.5 var(--mono); overflow: hidden; user-select: none; background: var(--ink-1); }
.ed__code { flex: 1; resize: none; border: 0; outline: none; background: none; color: var(--text); padding: var(--s-3); font: 13px/1.5 var(--mono); tab-size: 4; white-space: pre; overflow: auto; }
.ed__log { margin: 0; max-height: 120px; overflow: auto; font: 12px/1.5 var(--mono); color: var(--text-2); background: var(--ink-2); border-radius: var(--r-3); padding: var(--s-2) var(--s-3); white-space: pre-wrap; }
.ed__log.err { color: var(--alert); }
.ed__note { margin: 0 0 var(--s-2); font-size: 13px; }
.acct form, form.acct { display: contents; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1100px) {
  .hide-sm { display: none !important; }
  .bc__battle { display: none; }
}
@media (max-width: 960px) {
  .hero, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .live__mini { display: none; }
  .live h1 { font-size: var(--fs-24); }
  .doc { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
  .doc__nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .topbar { gap: var(--s-2); height: 56px; }
  .topbar__nav { display: none; position: absolute; left: 0; right: 0; top: 100%; }
  body.menu-open .topbar__nav { display: block; background: var(--ink-1); border-bottom: 1px solid var(--ink-3); padding: var(--s-2) var(--gutter-r) var(--s-3) var(--gutter); }
  body.menu-open .topbar__nav .pills { flex-direction: column; align-items: stretch; background: none; box-shadow: none; height: auto; }
  .topbar__menu { display: inline-grid; place-items: center; width: 36px; height: 36px; }
  .topbar__race { display: none; }
  .topbar__acct .btn--ghost { display: none; }
  body[data-route="live"] .topbar { padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); }
  body[data-route="live"] .topbar .wordmark { font-size: 17px; }
  body[data-route="live"] .topbar__menu { background: var(--glass); }
  .bc__tower { top: 60px; left: max(12px, env(safe-area-inset-left, 0px)); width: 210px; }
  .bc__tower .tower__head { display: none; }
  .bc__tower .trow { grid-template-columns: 22px 3px minmax(0, 1fr) 44px 16px; column-gap: 6px; }
  .bc__tower .bat, .bc__tower .v1tag, .bc__tower .drsdot { display: none; }
  .bc__top { top: auto; bottom: calc(184px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 24px); max-width: none; }
  .bc__pill { height: 36px; font-size: var(--fs-13); }
  .bc__pill b { font-size: var(--fs-16); }
  .bc__banner .banner { height: 36px; max-width: 100%; }
  .bc__banner .banner__k { font-size: var(--fs-12); padding: 0 10px; }
  .bc__banner .banner__t { font-size: var(--fs-13); padding: 0 12px; }
  .bc__card, .bc__cam, .bc__credit { display: none; }
  .bc__center { top: 34%; width: calc(100vw - 24px); }
  .bc__next { min-width: 0; }
  .bc__mtop { display: flex; position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); top: calc(max(12px, env(safe-area-inset-top, 0px)) + 48px); height: 36px; align-items: center; gap: 10px; padding: 0 10px; font-size: var(--fs-13); font-weight: var(--fw-semi); }
  .bc__mtop:empty { display: none; }
  .bc__sheet { display: flex; height: 70dvh; transform: translateY(calc(70dvh - 172px - env(safe-area-inset-bottom, 0px))); }
  .bc__sheet.is-open { transform: none; }
  .bc__sheet .trow { height: 40px; font-size: var(--fs-15, 15px); padding: 0 var(--s-4); grid-template-columns: 28px 4px minmax(0, 1fr) 56px 18px 36px 6px; }
  .bc__mcard .cc__h { height: auto; padding: 0 var(--s-4) var(--s-2); border: 0; }
  .bc__mcard .cc__p { border-radius: var(--r-3); width: 40px; height: 40px; }
  .bc__mcard .cc__bd { padding: 0 var(--s-4) var(--s-4); }
  .title h1, .teamhead h1, .doc__body h1 { font-size: var(--fs-24); }
  .hero { padding: var(--s-5) 0; }
  .live { aspect-ratio: 4 / 3; }
}

/* live feed paused after 30 min without input (net.js) */
.idle-pause { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: var(--z-modal); display: flex; flex-direction: column; gap: 2px;
  padding: var(--s-3) var(--s-4); background: var(--glass-strong); border: 1px solid var(--line-3); border-radius: var(--r-3); box-shadow: var(--shadow-modal);
  color: var(--text); font: inherit; font-size: var(--fs-14); text-align: center; cursor: pointer; }
.idle-pause span { color: var(--text-2); font-size: var(--fs-13); }

/* ---------------------------------------------------------------- markets (/markets) */
.mk-title { padding-bottom: var(--s-4); }
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-6); align-items: start; }
.mk-side { position: sticky; top: 76px; }
.mk-how { padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4); }
.mk-how ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-14); }
.mk-how p { margin: var(--s-3) 0 0; font-size: var(--fs-13); }
.mk-wallet:empty { display: none; }
.mk-wallet { margin-bottom: var(--s-5); }
.mk-stats { display: flex; gap: var(--s-8); align-items: center; flex-wrap: wrap; padding: var(--s-4) var(--s-5); background: var(--ink-1); border: 1px solid var(--ink-3); border-radius: var(--r-4); }
.mk-reset { margin-left: auto; }
.mk-cta { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); padding: var(--s-4) var(--s-5); flex-wrap: wrap; }
.mk-cta > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.mk-card { overflow: hidden; }
.mk-card__h { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5) 0; }
.mk-card__h h2 { margin: 0; font-size: var(--fs-20); line-height: var(--lh-tight); }
.mk-vol { font-size: var(--fs-13); white-space: nowrap; }
.mk-card__meta { padding: 2px var(--s-5) var(--s-3); font-size: var(--fs-13); }
.mk-card__meta b { color: var(--text); font-weight: var(--fw-semi); }
.mk-chart { padding: 0 var(--s-5) var(--s-3); }
.mk-chart svg { width: 100%; height: 190px; display: block; }
.mk-chart .mk-gl { stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mk-ax { fill: var(--text-3); font-size: 11px; }
.mk-line { fill: none; stroke: var(--team); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.mk-legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-13); margin-top: var(--s-2); align-items: center; }
.mk-legend > span:not(.muted) { display: inline-flex; align-items: center; gap: 6px; }
.mk-legend .tick { height: 12px; }
.mk-legend .muted { margin-left: auto; font-size: var(--fs-12); }
.mk-rows { border-top: 1px solid var(--ink-3); }
.mk-row { display: grid; grid-template-columns: 4px minmax(0, 1fr) 80px 72px 104px; align-items: center; gap: var(--s-3); min-height: 56px; padding: 6px var(--s-5) 6px var(--s-4); border-bottom: 1px solid var(--ink-3); }
.mk-row:last-child { border-bottom: 0; }
.mk-row .tick { height: 28px; }
.mk-row__n { min-width: 0; display: flex; flex-direction: column; }
.mk-row__n b { font-size: var(--fs-16); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row__n small { font-size: var(--fs-12); color: var(--text-2); }
.mk-row__spark { color: var(--team); }
.mk-row__spark .spark__line { stroke: var(--team); }
.mk-row__p { display: flex; flex-direction: column; align-items: flex-end; }
.mk-row__p b { font-size: var(--fs-24); font-weight: var(--fw-bold); line-height: 1; font-variant-numeric: tabular-nums; }
.mk-row__p small { font-size: var(--fs-12); font-weight: var(--fw-semi); }
.mk-buy { background: color-mix(in srgb, var(--good) 16%, var(--ink-2)); border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); font-weight: var(--fw-bold); justify-content: center; font-variant-numeric: tabular-nums; }
.mk-buy:hover { background: color-mix(in srgb, var(--good) 26%, var(--ink-2)); }
.mk-row--out { opacity: .45; }
.mk-row--won { background: color-mix(in srgb, var(--good) 8%, transparent); }
.mk-row__end { display: flex; justify-content: flex-end; }
.mk-more { display: block; width: 100%; padding: var(--s-3); background: none; border: 0; border-top: 1px solid var(--ink-3); color: var(--text-2); font: inherit; font-size: var(--fs-13); cursor: pointer; }
.mk-more:hover { color: var(--text); background: var(--hover); }
.mk-empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); padding: var(--s-10) var(--s-6); text-align: center; }
.mk-empty__ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-2); font-size: var(--fs-24); font-weight: var(--fw-black); color: var(--text-2); }
.mk-empty b { font-size: var(--fs-20); }
.mk-small { padding: var(--s-5) var(--s-4); font-size: var(--fs-13); }
.mk-pos { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto auto; gap: var(--s-3); align-items: center; padding: 10px var(--s-4); border-top: 1px solid var(--ink-3); }
.mk-pos:first-child { border-top: 0; }
.mk-pos .tick { height: 32px; }
.mk-pos__n { display: flex; flex-direction: column; min-width: 0; }
.mk-pos__n small { font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-pos__v { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.mk-pos__v small { font-size: var(--fs-12); font-weight: var(--fw-semi); }
.mk-pos__wait { font-size: var(--fs-12); }
.mk-pos--done { grid-template-columns: 4px minmax(0, 1fr) auto; }
.mk-sub { padding: var(--s-2) var(--s-4); font-size: var(--fs-12); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--label-track); border-top: 1px solid var(--ink-3); }
.mk-board { list-style: none; margin: 0; padding: var(--s-1) 0; }
.mk-board li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s-2); padding: 6px var(--s-4); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.mk-board li.own { background: var(--wash); }
.mk-board__r { color: var(--text-3); }
.mk-feed { list-style: none; margin: 0; padding: var(--s-1) 0; }
.mk-feed li { padding: 8px var(--s-4); font-size: var(--fs-13); border-top: 1px solid var(--ink-3); display: flex; flex-direction: column; gap: 1px; }
.mk-feed li:first-child { border-top: 0; }
.mk-feed small { color: var(--text-3); font-size: var(--fs-12); }

/* bet slip: a floating panel on desktop, a bottom sheet on phones */
.mk-slip { position: fixed; right: max(24px, env(safe-area-inset-right, 0px)); bottom: 24px; width: 360px; z-index: var(--z-sheet); background: var(--glass-strong);
  border: 1px solid var(--line-3); border-radius: var(--r-4); box-shadow: var(--shadow-modal); padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.mk-slip[hidden] { display: none; }
.mk-slip__h { display: flex; align-items: center; gap: var(--s-3); }
.mk-slip__h > div:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.mk-slip__h small { font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-slip__h b { font-size: var(--fs-16); }
.mk-slip__p { display: flex; flex-direction: column; align-items: flex-end; }
.mk-slip__p b { font-size: var(--fs-24); line-height: 1; }
.mk-slip__p small { font-size: var(--fs-12); color: var(--text-2); }
.mk-slip__side { width: 100%; }
.mk-slip__side button { flex: 1; }
.mk-amt { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-13); }
.mk-amt .input { height: 48px; font-size: var(--fs-20); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.mk-chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.chip-btn { height: 32px; padding: 0 var(--s-3); border-radius: var(--r-pill); border: 1px solid var(--line-3); background: var(--ink-2); color: var(--text); font: inherit; font-size: var(--fs-13); font-weight: var(--fw-semi); cursor: pointer; }
.chip-btn:hover { background: var(--ink-3); }
.mk-sum { display: flex; flex-direction: column; gap: 4px; padding: var(--s-3); border-radius: var(--r-3); background: rgba(255, 255, 255, .04); font-size: var(--fs-13); }
.mk-sum__line { display: flex; justify-content: space-between; gap: var(--s-3); }
.mk-sum__big { font-size: var(--fs-16); padding: 4px 0; }
.mk-go { height: 48px; font-size: var(--fs-16); font-weight: var(--fw-bold); }
.mk-slip__foot { margin: 0; font-size: var(--fs-12); text-align: center; }
.mk-slip .err { margin: 0; color: var(--alert); font-size: var(--fs-13); }

/* live page: win-chance widget */
.bc__odds { position: absolute; right: max(24px, env(safe-area-inset-right, 0px)); top: 72px; width: 236px; padding: 10px 0 6px; text-decoration: none; color: var(--text); display: block; }
.bc__odds:empty { display: none; }
.bc__odds .od__h { display: flex; justify-content: space-between; align-items: center; padding: 0 14px 6px; }
.bc__odds .od__r { display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; gap: var(--s-2); align-items: center; height: 26px; padding: 0 14px; font-size: var(--fs-14); }
.bc__odds .od__r .tick { height: 16px; }
.bc__odds .od__r b { font-variant-numeric: tabular-nums; }
.bc__odds .od__bar { height: 3px; margin: 0 14px 4px 25px; background: var(--hair-2); border-radius: 2px; overflow: hidden; }
.bc__odds .od__bar i { display: block; height: 100%; background: var(--team); }
.bc__odds .od__f { padding: 4px 14px 0; font-size: var(--fs-12); color: var(--text-2); }
.bc__odds:hover .od__f { color: var(--text); }

@media (max-width: 960px) {
  .mk-grid { grid-template-columns: minmax(0, 1fr); }
  .mk-side { position: static; }
}
@media (max-width: 760px) {
  .mk-stats { gap: var(--s-5); padding: var(--s-3) var(--s-4); }
  .mk-stats .stat b { font-size: var(--fs-20); }
  .mk-reset { margin-left: 0; width: 100%; }
  .mk-card__h { padding: var(--s-4) var(--s-4) 0; flex-wrap: wrap; }
  .mk-card__h h2 { font-size: var(--fs-16); }
  .mk-card__h .sp { display: none; }
  .mk-vol { width: 100%; order: 3; }
  .mk-card__meta, .mk-chart { padding-left: var(--s-4); padding-right: var(--s-4); }
  .mk-chart svg { height: 150px; }
  .mk-row { grid-template-columns: 4px minmax(0, 1fr) 58px 92px; padding: 6px var(--s-3) 6px var(--s-3); gap: var(--s-2); }
  .mk-row__spark { display: none; }
  .mk-row__p b { font-size: var(--fs-20); }
  .mk-slip { left: 0; right: 0; bottom: 0; width: auto; border-radius: var(--r-5) var(--r-5) 0 0; padding: var(--s-4) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom, 0px)); }
  .bc__odds { top: calc(max(12px, env(safe-area-inset-top, 0px)) + 92px); right: max(12px, env(safe-area-inset-right, 0px)); width: 136px; padding: 6px 0 4px; }
  .bc__odds .od__h { padding: 0 10px 4px; }
  .bc__odds .od__r { padding: 0 10px; font-size: var(--fs-13); height: 22px; }
  .bc__odds .od__bar, .bc__odds .od__f { display: none; }
}

/* camera lock: in the camera bar (desktop), on the car card, and on the phone's top strip */
.bc__lock { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; border-right: 1px solid var(--hair); }
.bc__lock[hidden] { display: none; }
.bc__lock .ic { width: 15px; height: 15px; }
.bc__lock b { font-weight: var(--fw-semi); }
.bc__lock[aria-pressed="true"], .cc__lock[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--brand) 24%, transparent); }
.cc__lock { flex: none; }
.bc__mlock { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; border: 0; font: inherit; color: var(--text);
  background: color-mix(in srgb, var(--brand) 28%, transparent); }
.bc__mlock .ic { width: 13px; height: 13px; }

/* ---------------------------------------------------------------- sound: the button and its mixer (js/sound/panel.js) */
.bc__snd { display: inline-flex; align-items: center; justify-content: center; position: relative; margin-left: 4px; border-left: 1px solid var(--hair); }
.bc__snd .ic, .bc__msnd .ic { width: 16px; height: 16px; }
.bc__msnd { display: inline-flex; align-items: center; justify-content: center; position: relative; width: 28px; height: 28px; margin-right: -4px;
  border: 0; border-radius: 999px; background: none; color: var(--text); padding: 0; }
.bc__snd.is-waiting::after, .bc__msnd.is-waiting::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); animation: snd-pulse 1.4s ease-in-out infinite; }
@keyframes snd-pulse { 50% { opacity: .25; transform: scale(.7); } }
.snd { position: fixed; z-index: var(--z-modal); padding: var(--s-3) var(--s-4) var(--s-2); border-radius: var(--r-4); display: grid; gap: var(--s-2); }
.snd__h { display: flex; align-items: center; justify-content: space-between; }
.snd__st { margin: -4px 0 2px; font-size: var(--fs-13); }
.snd__row { --team: var(--brand); grid-template-columns: 64px minmax(0, 1fr) 28px; }
.snd.is-off .snd__row { opacity: .45; }
.snd__hint { margin: 2px 0 0; font-size: var(--fs-12); line-height: 1.4; }
.snd__sw { position: relative; width: 38px; height: 22px; cursor: pointer; }
.snd__sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.snd__sw i { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; pointer-events: none; }
.snd__sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.snd__sw input:checked + i { background: var(--brand); }
.snd__sw input:checked + i::after { transform: translateX(16px); }
.snd__sw input:focus-visible + i { outline: 2px solid var(--text); outline-offset: 2px; }
/* the Book: makers on each market card, and the maker panel */
.mk-books { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; font-size: var(--fs-13); padding: 0 var(--s-5) var(--s-2); }
.mk-books .chip small { margin-left: 4px; }
.mk-note { font-size: var(--fs-13); margin: 0; padding: var(--s-2) var(--s-4); }
.mk-maker__cta { padding: 0 var(--s-4) var(--s-4); }
.mk-maker { display: flex; flex-direction: column; gap: var(--s-3); padding: 0 var(--s-4) var(--s-4); }
.mk-maker .mk-note { padding: 0; }
.mk-stats--flat { padding: var(--s-3) 0; background: none; border: 0; gap: var(--s-6); }
.mk-maker .row { display: flex; gap: var(--s-2); align-items: end; flex-wrap: wrap; }
.mk-maker .row .input { width: 96px; }
.mk-maker label.mk-note { display: flex; flex-direction: column; gap: 4px; }
.mk-code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; width: 100%; height: 240px; padding: var(--s-2); resize: vertical; white-space: pre; }
.mk-log { font-size: 11px; max-height: 120px; overflow: auto; white-space: pre-wrap; margin: 0; }
