/* SASX — dark trading-floor theme in Scent Australia sage. */
:root {
  --bg: #0b0f0d;
  --panel: #131a16;
  --panel-2: #1a231e;
  --panel-3: #212c26;
  --line: #26312b;
  --line-2: #33413a;
  --text: #e9efe9;
  --muted: #8fa096;
  --faint: #66756c;
  --sage: #5f8a5c;
  --sage-2: #86ad82;
  --sage-ink: #0d1a0c;
  --cream: #efe7d6;
  --gold: #ffcb45;
  --gold-2: #ffb000;
  --up: #2fbf71;
  --up-soft: rgba(47, 191, 113, .14);
  --down: #ff5a5f;
  --down-soft: rgba(255, 90, 95, .14);
  --amber: #ffb547;
  --blue: #5aa9ff;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --top-h: 58px;
  --nav-h: 66px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior-y: contain; }
html, body { margin: 0; }
body {
  background: radial-gradient(1100px 520px at 50% -12%, #18241c 0%, var(--bg) 58%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}
.num, .price, .mkt-time, .money { font-variant-numeric: tabular-nums; }
button, select, .tab, .c4-cell, .row-btn { touch-action: manipulation; }
[hidden] { display: none !important; }

/* ------------------------------ Top bar ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 80;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: rgba(11, 15, 13, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  min-height: var(--top-h);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 900; font-size: 18px; letter-spacing: 1.5px; line-height: 1.05; }
.brand-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .2px; }
@media (max-width: 360px) { .brand-sub { display: none; } }

/* The market clock — always top right. */
.mkt-timer {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  padding: 6px 11px 6px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--text); cursor: pointer; font: inherit; text-align: right;
  min-width: 118px; transition: border-color .3s, background .3s;
}
.mt-label { display: flex; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 800; letter-spacing: 1px; color: var(--muted); white-space: nowrap; }
.mt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.mkt-time { font-size: 19px; font-weight: 900; line-height: 1.05; letter-spacing: .3px; }
.mkt-time small { font-size: 12px; font-weight: 700; color: var(--muted); }
.mkt-timer.open { border-color: rgba(47, 191, 113, .45); }
.mkt-timer.open .mt-dot { background: var(--up); box-shadow: 0 0 0 3px rgba(47, 191, 113, .18); }
.mkt-timer.freeze { border-color: rgba(255, 181, 71, .7); background: #221b10; animation: freezeglow 1s ease-in-out infinite; }
.mkt-timer.freeze .mt-dot { background: var(--amber); }
.mkt-timer.freeze .mt-label, .mkt-timer.freeze .mkt-time { color: var(--amber); }
.mkt-timer.post { border-color: rgba(90, 169, 255, .6); background: #101a26; }
.mkt-timer.post .mt-dot { background: var(--blue); animation: blink 1s steps(2) infinite; }
.mkt-timer.post .mt-label { color: var(--blue); }
.mkt-timer.closed .mt-dot { background: var(--faint); }
@keyframes freezeglow { 50% { box-shadow: 0 0 18px rgba(255, 181, 71, .35); } }
@keyframes blink { 50% { opacity: .25; } }

/* ------------------------------ Layout ------------------------------ */
.wrap {
  max-width: 760px; margin: 0 auto;
  padding: 14px max(14px, env(safe-area-inset-right)) calc(var(--nav-h) + 28px) max(14px, env(safe-area-inset-left));
}
.loading { color: var(--muted); text-align: center; padding: 48px 0; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.screen-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 2px 12px; }
.screen-title h2 { font-size: 22px; font-weight: 850; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.gold { color: var(--gold); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { height: 10px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 0 0 14px; box-shadow: var(--shadow);
}
.card > h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card > h3 .muted { font-weight: 600; font-size: 12px; margin-left: auto; }
.card.flush { padding: 4px 0; }
.card.flush > h3 { padding: 10px 14px 4px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* ------------------------------ Controls ----------------------------- */
button, .btn {
  font: inherit; font-weight: 750; cursor: pointer; border: 0; border-radius: 12px;
  padding: 12px 16px; color: var(--sage-ink);
  background: linear-gradient(180deg, var(--sage-2), var(--sage));
}
button:active { transform: translateY(1px); }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-2); }
button.gold { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #1d1405; }
button.buy { background: linear-gradient(180deg, #45d487, var(--up)); color: #04170c; }
button.sell { background: linear-gradient(180deg, #ff7b7f, var(--down)); color: #2a0506; }
button.danger { background: transparent; color: var(--down); border: 1px solid #4a262a; }
button.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
button.xs { padding: 5px 9px; font-size: 12px; border-radius: 9px; }
button.block { width: 100%; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
input, select {
  font: inherit; width: 100%; padding: 12px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 11px; outline: none;
}
input:focus, select:focus { border-color: var(--sage-2); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 5px; font-weight: 600; }
.field { margin: 0 0 12px; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; }
.seg button { flex: 1; background: transparent; color: var(--muted); padding: 9px 6px; border-radius: 10px; font-size: 14px; }
.seg button.on { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.seg button.on.buy-on { background: var(--up-soft); color: var(--up); }
.seg button.on.sell-on { background: var(--down-soft); color: var(--down); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 12px; font-size: 13px; font-weight: 750; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2);
}
.chip.on { background: var(--cream); color: #1b1a14; border-color: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 8px;
  font-size: 12.5px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.flat { background: var(--panel-3); color: var(--muted); }

.run-badge {
  display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px 1px 4px; border-radius: 999px;
  font-size: 11px; font-weight: 900; line-height: 1.5; letter-spacing: .2px;
}
.run-badge .ico { font-size: 13px; line-height: 1; }
.run-badge.bull { background: rgba(47, 191, 113, .16); color: var(--up); border: 1px solid rgba(47, 191, 113, .4); }
.run-badge.bear { background: rgba(255, 90, 95, .14); color: var(--down); border: 1px solid rgba(255, 90, 95, .4); }
.run-badge.fresh { animation: badgepop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes badgepop { from { transform: scale(.3); opacity: 0; } }

.banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px;
  font-size: 13.5px; font-weight: 650; margin: 0 0 12px; border: 1px solid var(--line-2); background: var(--panel-2);
}
.banner .ico { font-size: 18px; }
.banner.open { border-color: rgba(47, 191, 113, .35); background: rgba(47, 191, 113, .07); }
.banner.freeze { border-color: rgba(255, 181, 71, .55); background: rgba(255, 181, 71, .08); color: #ffd79a; }
.banner.post { border-color: rgba(90, 169, 255, .5); background: rgba(90, 169, 255, .08); color: #bcdcff; }
.banner.closed { color: var(--muted); }
.banner.info { border-color: rgba(134, 173, 130, .4); background: rgba(95, 138, 92, .1); }

/* ------------------------------ Bottom nav --------------------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  display: flex; justify-content: center;
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  background: rgba(11, 15, 13, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 1px 5px; background: transparent; color: var(--faint); border-radius: 12px;
  font-size: 10.5px; font-weight: 750; letter-spacing: .1px; white-space: nowrap;
}
.tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab svg { width: 23px; height: 23px; }
@media (max-width: 370px) { .tab { font-size: 9.5px; } .tab svg { width: 21px; height: 21px; } }
.tab.on { color: var(--cream); }
.tab.on svg { color: var(--sage-2); }
.tab .badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--down); color: #fff; font-size: 10.5px; font-weight: 900; line-height: 17px; text-align: center;
  border: 2px solid var(--bg);
}
.tab .live-dot {
  position: absolute; top: 4px; left: calc(50% + 8px); width: 10px; height: 10px; border-radius: 50%;
  background: var(--down); border: 2px solid var(--bg); animation: livepulse 1.1s ease-in-out infinite;
}
@keyframes livepulse { 50% { box-shadow: 0 0 0 5px rgba(255, 90, 95, .25); } }
.tab .live-dot.gold { background: var(--gold); animation-name: livepulsegold; }
@keyframes livepulsegold { 50% { box-shadow: 0 0 0 5px rgba(255, 203, 69, .3); } }

/* ------------------------------ Auth --------------------------------- */
.auth { max-width: 420px; margin: 4vh auto 0; }
.auth-hero { text-align: center; margin: 0 0 18px; }
.auth-hero img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 12px 40px rgba(79, 109, 76, .45); }
.auth-hero h1 { font-size: 30px; font-weight: 900; letter-spacing: 3px; margin: 12px 0 2px; }
.auth-hero p { margin: 0; color: var(--muted); }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 18px; }
.perk { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.perk b { display: block; font-size: 17px; }
.perk span { font-size: 11px; color: var(--muted); }

/* ------------------------------ Markets ------------------------------ */
.index-card { display: flex; align-items: center; gap: 14px; }
.index-val { font-size: 34px; font-weight: 900; letter-spacing: -.5px; line-height: 1; }
.index-sub { margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mover { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; }
.mover .tiny { color: var(--muted); font-weight: 700; letter-spacing: .5px; }

.stock-list { list-style: none; margin: 0; padding: 0; }
.stock-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 70px auto; align-items: center; gap: 10px;
  padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; position: relative;
}
.stock-row:first-child { border-top: 0; }
.stock-row:hover { background: rgba(255, 255, 255, .02); }
.stock-row.home { background: linear-gradient(90deg, rgba(95, 138, 92, .16), transparent 70%); }
.stock-row.home::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--sage-2); }
.flag {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 19px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.flag.home { background: var(--sage); border-color: transparent; }
.flag.home img { width: 26px; height: 26px; }
.tick-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ticker { font-weight: 850; letter-spacing: .3px; }
.co-name { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark { width: 70px; height: 28px; display: block; }
.px-col { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 76px; }
.price { font-weight: 850; font-size: 15.5px; }
.stock-row.flash-up { animation: flashup 1.6s ease-out; }
.stock-row.flash-down { animation: flashdown 1.6s ease-out; }
@keyframes flashup { from { background: rgba(47, 191, 113, .28); } }
@keyframes flashdown { from { background: rgba(255, 90, 95, .26); } }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px 6px; }
.toggle-link { background: none; border: 0; padding: 0; color: var(--sage-2); font-size: 12.5px; font-weight: 750; }
.empty { padding: 18px 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* --------------------------- Stock sheet ---------------------------- */
.sheet-backdrop {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--top-h); z-index: 90; background: rgba(0, 0, 0, .55);
  display: flex; align-items: flex-end; justify-content: center; animation: fadein .2s ease;
}
.sheet {
  width: 100%; max-width: 620px; max-height: calc(100% - 12px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sheetup .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 2px auto 10px; }
@keyframes sheetup { from { transform: translateY(40px); opacity: .4; } }
@keyframes fadein { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sheet-close { margin-left: auto; padding: 7px 11px; }
.big-price { font-size: 36px; font-weight: 900; letter-spacing: -.5px; line-height: 1.05; }
.run-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; margin: 10px 0 4px; font-weight: 750; font-size: 14px; }
.run-banner .ico { font-size: 28px; }
.run-banner.bull { background: rgba(47, 191, 113, .1); border: 1px solid rgba(47, 191, 113, .35); color: #9be8bd; }
.run-banner.bear { background: rgba(255, 90, 95, .09); border: 1px solid rgba(255, 90, 95, .35); color: #ffb0b2; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; }
.stat .tiny { color: var(--muted); font-weight: 700; }
.stat b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }

.chart-wrap { position: relative; margin: 6px 0 4px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-wrap svg { display: block; width: 100%; height: 210px; overflow: visible; }
.chart-tip {
  position: absolute; top: 0; pointer-events: none; transform: translateX(-50%);
  background: #0e1411; border: 1px solid var(--line-2); border-radius: 9px; padding: 4px 8px;
  font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.chart-tip .muted { font-weight: 600; }
.chart-axis { fill: var(--faint); font-size: 10.5px; font-family: inherit; font-variant-numeric: tabular-nums; }

/* ------------------------------ Portfolio ---------------------------- */
.hero-worth { font-size: 40px; font-weight: 900; letter-spacing: -1px; line-height: 1.05; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; min-width: 0; }
.kpi .tiny { color: var(--muted); font-weight: 700; }
.kpi b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hold-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.hold-row:first-of-type { border-top: 0; }
.rank-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.rank-row.me { background: rgba(95, 138, 92, .13); }
.rank { font-weight: 900; color: var(--muted); text-align: center; }
.trade-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.side-tag { font-size: 10.5px; font-weight: 900; padding: 2px 6px; border-radius: 6px; letter-spacing: .5px; }
.side-tag.buy { background: var(--up-soft); color: var(--up); }
.side-tag.sell { background: var(--down-soft); color: var(--down); }

/* ------------------------------- Trade ------------------------------- */
.qty-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 8px; }
.qty-row input { text-align: center; font-size: 22px; font-weight: 850; padding: 9px; }
.qty-row button { font-size: 22px; padding: 0; }
.summary { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; margin: 14px 0; font-size: 14px; }
.summary b { text-align: right; font-variant-numeric: tabular-nums; }
.summary .total { font-size: 18px; }
.trade-btn { font-size: 17px; padding: 15px; }
.trade-btn:disabled { background: var(--panel-3); color: var(--muted); opacity: 1; }
.pick-stock { display: flex; align-items: center; gap: 10px; }

/* ------------------------------ Connect 4 ---------------------------- */
.invite {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin: 0 0 12px;
  background: linear-gradient(180deg, #2a2210, #1c1a12); border: 1px solid rgba(255, 203, 69, .45);
  animation: fadein .3s ease;
}
.invite .ico { font-size: 28px; }
.game-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.game-row:first-of-type { border-top: 0; }
.game-row.sel { background: rgba(95, 138, 92, .12); }
.disc { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; display: inline-block; vertical-align: -2px; }
.disc.red { background: radial-gradient(circle at 35% 30%, #ff8a8a, #e83c3c 70%); }
.disc.yellow { background: radial-gradient(circle at 35% 30%, #ffe08a, #ffb000 70%); }
.turn-tag { font-size: 11px; font-weight: 900; padding: 3px 8px; border-radius: 999px; background: var(--gold); color: #1d1405; white-space: nowrap; }
.turn-tag.wait { background: var(--panel-3); color: var(--muted); }

.c4-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.c4-head { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
.c4-side { display: flex; align-items: center; gap: 7px; opacity: .5; transition: opacity .3s; min-width: 0; max-width: 40%; }
.c4-side.turn { opacity: 1; }
.c4-side .nm { font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c4-side.turn .disc { box-shadow: 0 0 0 3px rgba(255, 203, 69, .7), 0 0 16px rgba(255, 203, 69, .5); }
.c4-vs { font-weight: 900; color: var(--faint); font-size: 12px; letter-spacing: 1px; }
.c4-pot { font-size: 12.5px; font-weight: 800; color: var(--gold); letter-spacing: .3px; }
.c4-status { font-weight: 850; font-size: 16px; color: var(--muted); min-height: 22px; text-align: center; }
.c4-status.my-turn { color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
.c4-status.done { color: var(--text); font-size: 19px; }
@keyframes pulse { 50% { opacity: .55; } }
.c4-board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  background: linear-gradient(180deg, #2f6f4e, #21573b);
  padding: 9px; border-radius: 16px; width: min(100%, 420px);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .15);
}
.c4-cell {
  aspect-ratio: 1 / 1; border-radius: 50%; border: 0; padding: 0; width: 100%;
  background: #0c1410; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .65); cursor: default;
}
.c4-board.mine .c4-cell { cursor: pointer; }
.c4-board.mine .c4-cell.hover-col { background: #16241c; }
.c4-cell.red { background: radial-gradient(circle at 35% 30%, #ff8a8a, #e83c3c 70%); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .3); }
.c4-cell.yellow { background: radial-gradient(circle at 35% 30%, #ffe08a, #ffb000 70%); box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .3); }
.c4-cell.win { animation: winglow .9s ease-in-out infinite alternate; }
@keyframes winglow { to { box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255, 255, 255, .8); } }
.c4-cell.drop { animation: c4drop .62s linear both; position: relative; z-index: 2; }
@keyframes c4drop {
  0%   { transform: translateY(var(--d)); animation-timing-function: cubic-bezier(.5, 0, 1, .6); }
  46%  { transform: translateY(0); animation-timing-function: cubic-bezier(.2, 0, .4, 1); }
  62%  { transform: translateY(-26%); animation-timing-function: cubic-bezier(.6, 0, 1, .6); }
  76%  { transform: translateY(0); animation-timing-function: cubic-bezier(.2, 0, .4, 1); }
  86%  { transform: translateY(-9%); animation-timing-function: cubic-bezier(.6, 0, 1, .6); }
  94%  { transform: translateY(0); }
  97%  { transform: translateY(-2%); }
  100% { transform: translateY(0); }
}
.c4-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ------------------------------- Races ------------------------------- */
.race-hero { display: flex; align-items: center; gap: 12px; }
.race-hero .trophy { font-size: 34px; }
.race-count { font-weight: 900; font-size: 22px; color: var(--gold); font-variant-numeric: tabular-nums; }
.race-bank { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.race-bank b { font-size: 22px; font-variant-numeric: tabular-nums; }
.race-pick { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.race-pick:first-of-type { border-top: 0; }
.race-pick.mine { background: rgba(255, 203, 69, .07); }
.silk { position: relative; display: inline-block; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 6px; }
.silk svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.silk .sn {
  position: absolute; right: -5px; bottom: -3px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  font-size: 10px; font-weight: 900; line-height: 16px; text-align: center; color: #111; background: #f5f3ee; box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.silk.sm { width: 24px; height: 24px; }
.silk.sm .sn { min-width: 13px; height: 13px; line-height: 13px; font-size: 8.5px; padding: 0 2px; right: -5px; bottom: -3px; }
.silk.xl { width: 66px; height: 66px; }
.silk.xl .sn { min-width: 24px; height: 24px; line-height: 24px; font-size: 13px; border-radius: 12px; right: -4px; bottom: -2px; }
.horse-name { font-weight: 800; }
.horse-meta { font-size: 11.5px; color: var(--muted); }
.backers { font-size: 11.5px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.odds-col { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.odds { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.place-odds { font-size: 10.5px; font-weight: 800; color: var(--muted); }
.my-bet { font-size: 11.5px; font-weight: 900; color: #1d1405; background: var(--gold); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.form-guide { display: flex; gap: 5px; flex-wrap: wrap; }
.form-guide { gap: 9px; }
.form-guide .silk { width: 28px; height: 28px; }
.result-line { font-size: 14px; margin: 4px 0 10px; }
.play-money { text-align: center; font-size: 11.5px; color: var(--faint); margin: 8px 0 0; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* "Join now" flashes — top of screen, never blocking. Only the cards
   themselves take taps; the space around them stays usable. */
.flash-stack {
  position: fixed; left: 0; right: 0; top: calc(var(--top-h) + 8px); z-index: 86;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 10px;
  pointer-events: none;
}
.flash {
  pointer-events: auto; width: min(100%, 470px);
  display: flex; align-items: center; gap: 10px; padding: 9px 8px 9px 12px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 46, 39, .97), rgba(21, 28, 24, .97));
  border: 1px solid rgba(255, 203, 69, .55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: flashin .35s cubic-bezier(.2, 1.2, .4, 1);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.flash.info { border-color: rgba(134, 173, 130, .5); }
.flash.bye { transition: opacity .25s ease, transform .25s ease; opacity: 0; transform: translateY(-10px); }
.flash-ico { font-size: 22px; flex: 0 0 auto; }
.flash.game .flash-ico { animation: gallop .45s ease-in-out infinite alternate; }
.flash-body { flex: 1; min-width: 0; }
.flash-title { font-weight: 850; font-size: 14px; line-height: 1.25; }
.flash.game .flash-title { color: var(--gold); }
.flash-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.flash-go { flex: 0 0 auto; }
.flash-x { flex: 0 0 auto; background: transparent; color: var(--faint); padding: 6px 8px; font-size: 14px; border-radius: 9px; }
@keyframes flashin { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
@keyframes gallop { to { transform: translateY(-3px); } }

/* Reflex Showdown overlay — only for people who joined. Sits under the top
   bar so the market clock stays visible. */
.reflex-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--top-h); z-index: 79;
  display: grid; place-items: center; text-align: center; padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 30%, #162019 0%, #070a08 75%);
  user-select: none; -webkit-user-select: none; touch-action: manipulation; animation: fadein .2s ease;
}
.reflex-overlay.armed { background: #050706; }
.reflex-overlay.go { background: radial-gradient(circle at 50% 40%, #ffd75e 0%, #ffb000 75%); cursor: pointer; }
.reflex-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 460px; width: 100%; }
.reflex-kicker { letter-spacing: 4px; color: var(--gold); font-weight: 900; font-size: 13px; }
.reflex-big { font-size: 38px; font-weight: 900; line-height: 1.1; }
.reflex-overlay.go .reflex-big { color: #1d1405; font-size: 22vw; animation: pop .2s ease; }
@media (min-width: 560px) { .reflex-overlay.go .reflex-big { font-size: 120px; } }
.reflex-sub { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.reflex-tip { font-size: 13px; color: var(--muted); max-width: 340px; }
.reflex-leave { margin-top: 10px; }
.reflex-results { width: 100%; display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.reflex-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); font-weight: 750; text-align: left; }
.reflex-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reflex-row .ms { font-variant-numeric: tabular-nums; color: var(--muted); }
.reflex-row.winner { border-color: rgba(255, 203, 69, .6); background: rgba(255, 203, 69, .1); }
.reflex-row.winner .ms { color: var(--gold); font-weight: 900; }
.reflex-row.me { box-shadow: inset 3px 0 0 var(--sage-2); }
.reflex-entrants { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.reflex-entrants .chip { cursor: default; }

/* ------------------------------ Misc --------------------------------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 12px); z-index: 95;
  max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 13px; font-weight: 700; font-size: 14px;
  background: #1d2a22; border: 1px solid var(--line-2); box-shadow: var(--shadow); text-align: center;
  animation: toastin .25s ease;
}
.toast.err { background: #2b1416; border-color: #5a2a2e; color: #ffc9cb; }
@keyframes toastin { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 99; }
.admin-row { padding: 10px 14px; border-top: 1px solid var(--line); }
.admin-row:first-of-type { border-top: 0; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.dev-clock { border: 1px dashed var(--amber); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media (min-width: 700px) {
  .stock-row { grid-template-columns: 38px minmax(0, 1fr) 110px auto; }
  .spark { width: 110px; }
}

/* ======================= Trading fun ======================= */
.mini-badge { display: inline-flex; align-items: center; font-size: 12px; line-height: 1; padding: 2px 4px; border-radius: 6px; background: var(--panel-3); font-weight: 900; }
.mini-badge.div { background: rgba(255, 203, 69, .14); color: var(--gold); }
.mini-badge.div.special { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #1d1405; }
.mini-badge.rumour { background: rgba(90, 169, 255, .16); }
.mini-badge.wild { background: rgba(255, 90, 95, .12); }
.mini-badge.steady { background: rgba(134, 173, 130, .16); }
.star-on { font-size: 12px; }
.news-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); }
.news-row[role="button"] { cursor: pointer; }
.news-text { font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.news-tick { display: inline-block; font-size: 10.5px; font-weight: 900; letter-spacing: .4px; padding: 1px 6px; border-radius: 6px; background: var(--panel-3); color: var(--cream); margin-right: 6px; vertical-align: 1px; }
.news-row.event .news-text, .news-row.bell .news-text { color: var(--cream); }
.news-row.dividend .news-text { color: var(--gold); }
.rumour-live { background: rgba(90, 169, 255, .07); }
.rumour-tag { font-size: 10px; font-weight: 900; letter-spacing: 1px; padding: 3px 6px; border-radius: 6px; background: var(--blue); color: #061423; flex: 0 0 auto; animation: pulse 1.6s ease-in-out infinite; }
.floor-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.persona { display: grid; gap: 4px; margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 650; }
.run-banner.rumour { background: rgba(90, 169, 255, .09); border: 1px solid rgba(90, 169, 255, .4); color: #c4e0ff; }
.banner.rumour { border-color: rgba(90, 169, 255, .5); background: rgba(90, 169, 255, .08); color: #c4e0ff; }
.order-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.order-row.done { opacity: .6; }
.div-today { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.div-today b { font-size: 24px; color: var(--gold); font-variant-numeric: tabular-nums; }
.seg.mini { padding: 3px; border-radius: 10px; }
.seg.mini button { padding: 5px 10px; font-size: 12px; }
.card > h3 .seg.mini { margin-left: auto; }
.notify-prefs { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-link { font-size: 12.5px; word-break: break-all; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px dashed var(--line-2); font-family: ui-monospace, Menlo, Consolas, monospace; }

/* Cash burst on a profitable sell */
.burst-layer { position: fixed; inset: 0; pointer-events: none; z-index: 98; }
.burst-coin { position: fixed; font-size: 22px; transform: translate(-50%, -50%); animation: coinfly 1.2s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes coinfly {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(220deg) scale(1.1); opacity: 0; }
}
.burst-text { position: fixed; transform: translate(-50%, -50%); font-size: 28px; font-weight: 900; color: var(--up); text-shadow: 0 2px 12px rgba(0, 0, 0, .6); animation: floatup 1.5s ease-out forwards; }
@keyframes floatup { from { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } to { opacity: 0; transform: translate(-50%, -160%) scale(1); } }

/* ======================= Racing ======================= */
.race-hero-card.feature { border-color: rgba(255, 203, 69, .55); background: linear-gradient(180deg, rgba(255, 203, 69, .08), var(--panel) 60%); }
.race-name { font-size: 22px; font-weight: 900; line-height: 1.15; margin: 2px 0 6px; }
.race-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.race-meta .chip { cursor: default; padding: 5px 10px; font-size: 12px; }
.race-meta .chip.feature { background: linear-gradient(180deg, var(--gold), var(--gold-2)); color: #1d1405; border-color: transparent; }
.race-tip { margin: 0 14px 6px; padding: 8px 10px; border-radius: 10px; background: rgba(95, 138, 92, .12); border: 1px solid rgba(134, 173, 130, .3); font-size: 12.5px; font-weight: 700; }
.form-str { font-size: 10.5px; font-weight: 800; color: var(--muted); margin-left: 6px; letter-spacing: .5px; }
.result-rows { display: grid; gap: 4px; margin-bottom: 8px; }
.result-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; }
.result-row .silk { width: 26px; height: 26px; }
.result-row .rk { width: 30px; text-align: center; font-weight: 900; color: var(--muted); }
.result-row.winner b { color: var(--gold); }

/* ======================= Office TV ======================= */
body.tv-mode .wrap { max-width: none; padding: 16px 24px 64px; }
body.tv-mode .nav { display: none !important; }
.tv-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.tv-index { display: flex; align-items: baseline; gap: 14px; margin: 0 2px 12px; }
.tv-index-val { font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tv-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tv-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
.tv-tile.home { border-color: var(--sage-2); }
.tv-tile.up { box-shadow: inset 0 -3px 0 rgba(47, 191, 113, .5); }
.tv-tile.down { box-shadow: inset 0 -3px 0 rgba(255, 90, 95, .5); }
.tv-tile.flash-up { animation: flashup 1.6s ease-out; }
.tv-tile.flash-down { animation: flashdown 1.6s ease-out; }
.tv-tile .spark { width: 100%; height: 30px; }
.tv-price { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tv-right { display: grid; gap: 14px; }
.tv-right .card { margin: 0; }
.tv-favs { display: grid; gap: 6px; margin-top: 8px; }
.tv-reflex { font-size: 18px; font-weight: 900; color: var(--gold); border-color: rgba(255, 203, 69, .55); animation: pulse 1.4s ease-in-out infinite; }
.tv-ticker { position: fixed; left: 0; right: 0; bottom: 0; height: 46px; display: flex; align-items: center; overflow: hidden; background: #0f1512; border-top: 1px solid var(--line); z-index: 70; }
.tv-ticker-track { display: inline-flex; gap: 120px; white-space: nowrap; font-weight: 800; font-size: 18px; animation: marquee 90s linear infinite; padding-left: 100%; }
@keyframes marquee { to { transform: translateX(-100%); } }
.tv-sound { position: fixed; right: 20px; bottom: 60px; z-index: 75; }
@media (max-width: 1000px) {
  .tv-grid { grid-template-columns: 1fr; }
  .tv-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ======================= The office Melbourne Cup ======================= */
.cup-banner {
  position: relative; overflow: hidden; margin: 0 0 14px; padding: 16px; border-radius: var(--radius);
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 203, 69, .22) 0%, transparent 55%), linear-gradient(160deg, #1d2a1f, #151b17 70%);
  border: 1px solid rgba(255, 203, 69, .55); box-shadow: var(--shadow), 0 0 30px rgba(255, 176, 0, .08);
  text-align: center;
}
.cup-banner::after { content: '🏆'; position: absolute; right: -12px; bottom: -18px; font-size: 96px; opacity: .08; pointer-events: none; }
.cup-banner.today { border-color: var(--gold); animation: cupglow 2.4s ease-in-out infinite; }
@keyframes cupglow { 50% { box-shadow: var(--shadow), 0 0 34px rgba(255, 176, 0, .35); } }
.cup-kicker { font-size: 11px; font-weight: 900; letter-spacing: 3px; color: var(--gold); }
.cup-title { font-size: 21px; font-weight: 900; line-height: 1.15; margin: 4px 0 2px; }
.cup-when { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cup-count { font-size: 30px; font-weight: 900; color: var(--gold); margin: 8px 0 2px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.cup-note { font-size: 12.5px; color: var(--muted); max-width: 420px; margin: 6px auto 0; }
.cup-mine { margin: 10px auto 0; max-width: 360px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 203, 69, .4); text-align: left; display: grid; gap: 6px; }
.cup-mine .tiny { color: var(--gold); font-weight: 900; letter-spacing: 1px; }
.cup-banner.compact { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 14px; cursor: pointer; }
.cup-banner.compact::after { display: none; }
.cup-banner.compact .cup-count { font-size: 18px; margin: 0; white-space: nowrap; }
.cup-trophy { font-size: 28px; }
.cup-name { font-weight: 900; }
.cup-banner.compact .tiny { color: var(--muted); font-weight: 700; }
.sweep-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.sweep-row .rk { width: 26px; text-align: center; font-weight: 900; color: var(--muted); }
.sweep-row.mine { background: rgba(255, 203, 69, .08); box-shadow: inset 3px 0 0 var(--gold); }
.sweep-row.won .horse-name { color: var(--gold); }
.rr-sweep { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--cream); }

/* ===================== Race coverage (TV broadcast) ===================== */
/* Sits under the top bar so the market clock stays visible. Phones stack the
   picture above the graphics; tablets, desktops and the office TV lay the
   graphics over the picture like a real broadcast. */
.race-overlay {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--top-h); z-index: 78;
  display: flex; flex-direction: column; background: #050806; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom); animation: fadein .25s ease;
}
.race-overlay > * { flex-shrink: 0; }
.rc-head {
  height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  background: linear-gradient(180deg, #101a14, #0a110d); border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.race-overlay.cup .rc-head { background: linear-gradient(180deg, #2a2410, #15120a); border-bottom-color: rgba(255, 203, 69, .35); }
.rc-live {
  position: relative; flex: 0 0 auto; padding: 4px 8px 4px 19px; border-radius: 6px;
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px; color: #fff; background: #e5383b;
}
.rc-live::before { content: ''; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #fff; animation: pulse 1.1s ease-in-out infinite; }
.rc-live.replay { background: #33443b; }
.rc-live.replay::before { animation: none; border-radius: 0; width: 0; height: 0; background: none; border-left: 7px solid #fff; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; margin-top: -4.5px; }
.rc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rc-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-overlay.cup .rc-title b { color: var(--gold); }
.rc-title span { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-btn { width: 38px; height: 38px; padding: 0; border-radius: 11px; font-size: 15px; color: var(--text); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }

.rc-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #0d1a10; }
.rc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: filter .3s ease; }
.rc-stage.photo .rc-canvas { filter: grayscale(1) contrast(1.3) brightness(1.06); }
.rc-stage.flash::after { content: ''; position: absolute; inset: 0; background: #fff; pointer-events: none; animation: photoflash .85s ease-out forwards; }
@keyframes photoflash { 0% { opacity: .95; } 30% { opacity: 0; } 50% { opacity: .55; } 100% { opacity: 0; } }

/* The multiplier dice: a chip on the picture, not a cover over it. */
.rc-dice {
  position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 4px; border-radius: 999px; background: rgba(6, 11, 8, .7); border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 10px; font-weight: 900; letter-spacing: 1.2px; color: var(--muted);
}
.rc-die {
  min-width: 34px; height: 26px; padding: 0 6px; border-radius: 8px; display: grid; place-items: center;
  font-size: 13px; color: #17110a; background: linear-gradient(160deg, #fff, #d9d4c7); box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .18);
}
.rc-dice.spin .rc-die { animation: dietumble .28s linear infinite; }
.rc-dice.landed .rc-die { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.rc-dice.hot { color: var(--gold); border-color: rgba(255, 203, 69, .65); box-shadow: 0 0 20px rgba(255, 176, 0, .35); }
.rc-dice.hot .rc-die { background: linear-gradient(160deg, #ffd75e, #ffb000); }
@keyframes dietumble {
  0% { transform: rotate(-9deg); } 25% { transform: rotate(0) translateY(-3px); }
  50% { transform: rotate(9deg); } 75% { transform: rotate(0) translateY(-2px); } 100% { transform: rotate(-9deg); }
}

/* Big moments: AND THEY'RE OFF · INTO THE STRAIGHT · PHOTO. */
.rc-banner {
  position: absolute; left: 50%; top: 34%; z-index: 4; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -50%) skewX(-10deg) scale(.86); opacity: 0;
  padding: 8px 34px; font-size: clamp(20px, 6.2vw, 46px); font-weight: 900; font-style: italic; letter-spacing: 1px; text-transform: uppercase; color: #fff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, .45);
  background: linear-gradient(90deg, rgba(20, 74, 46, 0), rgba(20, 74, 46, .94) 14%, rgba(20, 74, 46, .94) 86%, rgba(20, 74, 46, 0));
  transition: opacity .25s ease, transform .4s cubic-bezier(.2, 1.4, .4, 1);
}
.rc-banner.on { opacity: 1; transform: translate(-50%, -50%) skewX(-10deg) scale(1); }
.rc-banner.gold { color: #1d1405; text-shadow: none; background: linear-gradient(90deg, rgba(255, 176, 0, 0), rgba(255, 186, 0, .96) 14%, rgba(255, 186, 0, .96) 86%, rgba(255, 176, 0, 0)); }
.rc-banner.photo { font-style: normal; letter-spacing: 10px; padding: 4px 18px 4px 28px; font-size: clamp(32px, 10vw, 70px); background: rgba(0, 0, 0, .55); border: 3px solid #fff; transform: translate(-50%, -50%) scale(1.15); }
.rc-banner.photo.on { transform: translate(-50%, -50%) scale(1); }

/* Lower third: distance to go + the caller. */
.rc-lower { display: flex; margin: 8px 8px 0; border-radius: 12px; overflow: hidden; background: rgba(13, 21, 17, .94); border: 1px solid rgba(255, 255, 255, .09); }
.rc-togo { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 86px; padding: 6px 10px; background: linear-gradient(160deg, #237a4c, #144a2e); }
.race-overlay.cup .rc-togo { background: linear-gradient(160deg, #ffcf4d, #e6a000); color: #1d1405; }
.rc-togo b { font-size: 22px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.rc-togo span { margin-top: 3px; font-size: 9.5px; font-weight: 900; letter-spacing: 2px; opacity: .8; }
.rc-callwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 8px 12px; }
.rc-call { min-height: 2.5em; display: flex; align-items: center; font-size: 14px; font-weight: 800; line-height: 1.25; }
.rc-call.in { animation: callin .35s ease; }
@keyframes callin { from { opacity: 0; transform: translateY(6px); } }
.rc-bar { height: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, .12); }
.rc-bar i { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--sage-2), var(--gold)); }

/* The running order. Rows slide when horses swap places. */
.rc-tower { position: relative; margin: 8px 8px 0; transition: height .3s ease; }
.rt-row {
  position: absolute; left: 0; right: 0; top: 0; height: 27px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 4px;
  border-radius: 8px; font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, .045);
  transition: transform .32s cubic-bezier(.3, .8, .3, 1), opacity .3s ease;
}
.rt-row.off { opacity: 0; pointer-events: none; }
.rt-row.first { background: linear-gradient(90deg, rgba(255, 203, 69, .2), rgba(255, 255, 255, .045) 70%); }
.rt-row.mine { color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.rt-pos { width: 22px; text-align: center; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.rt-row.first .rt-pos { color: var(--gold); }
.rt-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-gap { font-size: 11.5px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }

/* The result. */
.rc-results {
  z-index: 5; display: grid; gap: 10px; margin: 8px; padding: 14px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(25, 36, 29, .97), rgba(14, 21, 17, .97));
  border: 1px solid rgba(255, 203, 69, .45); box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  animation: rcin .5s cubic-bezier(.2, 1.2, .4, 1);
}
.rc-results[hidden] { display: none; }
@keyframes rcin { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.rcr-hero { display: flex; align-items: center; gap: 14px; }
.rcr-who { min-width: 0; }
.rcr-kicker { font-size: 10.5px; font-weight: 900; letter-spacing: 2.5px; color: var(--gold); }
.rcr-winner { font-size: 23px; font-weight: 900; line-height: 1.1; margin: 2px 0; }
.rcr-sub { font-size: 12px; font-weight: 700; color: var(--muted); }
.rcr-rows { display: grid; gap: 4px; }
.rcr-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, .045); }
.rcr-row.mine { box-shadow: inset 3px 0 0 var(--gold); }
.rcr-pos { width: 28px; text-align: center; font-weight: 900; color: var(--muted); }
.rcr-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.rcr-name b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcr-row.mine .rcr-name b { color: var(--gold); }
.rcr-name span { font-size: 11px; font-weight: 700; color: var(--muted); }
.rcr-div { font-size: 13px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.rcr-note { text-align: center; font-size: 12.5px; font-weight: 800; }
.rcr-pays { text-align: center; font-size: 13px; font-weight: 800; color: var(--gold); }
.rcr-btns { display: flex; gap: 8px; }
.you-win { justify-self: center; font-weight: 900; font-size: 18px; color: #1d1405; background: linear-gradient(180deg, var(--gold), var(--gold-2)); padding: 6px 14px; border-radius: 999px; }

@media (max-width: 699px) {
  .race-overlay { overflow-y: auto; }
  .rc-stage { flex: 0 0 auto; height: min(56vh, 108vw); transition: height .45s ease; }
  /* Result time: a smaller picture so the whole result fits on screen. */
  .race-overlay.done .rc-stage { height: min(30vh, 64vw); }
  .race-overlay.done .rc-tower, .race-overlay.done .rc-lower { display: none; }
}
@media (min-width: 700px) {
  .rc-lower {
    position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 3; width: min(600px, 56%); margin: 0;
    background: rgba(10, 18, 14, .8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .rc-tower { position: absolute; left: 16px; top: 104px; z-index: 3; width: 250px; margin: 0; }
  .rt-row { background: rgba(8, 14, 11, .74); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  .rt-row.first { background: linear-gradient(90deg, rgba(120, 92, 20, .85), rgba(8, 14, 11, .74) 70%); }
  .rc-results { position: absolute; right: 16px; top: 64px; width: 390px; max-height: calc(100% - 80px); overflow-y: auto; margin: 0; }
  .race-overlay.done .rc-tower { opacity: 0; transition: opacity .4s; }
}
body.tv-mode .rc-title b { font-size: 20px; }
body.tv-mode .rc-call { font-size: 18px; }

/* The next race's field cantering past, on the Races screen. */
.race-poster-wrap {
  position: relative; margin: -14px -14px 12px; aspect-ratio: 16 / 7; min-height: 150px; overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0; background: #0d1a10; border-bottom: 1px solid var(--line);
}
.race-poster-wrap[role="button"] { cursor: pointer; }
.race-poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.race-poster-tag {
  position: absolute; left: 10px; top: 10px; padding: 4px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 900; letter-spacing: 1px;
  color: #fff; background: rgba(6, 11, 8, .66); border: 1px solid rgba(255, 255, 255, .16); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.race-poster-tag.live { background: #e5383b; border-color: transparent; animation: pulse 1.4s ease-in-out infinite; }

/* ---- Hurdles: the sponsor card, slow motion, marks on the progress bar ---- */
.rc-sponsor {
  position: absolute; left: 10px; bottom: 10px; z-index: 4; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px; border-radius: 12px; max-width: min(calc(100% - 140px), 360px);
  background: linear-gradient(180deg, #ffffff, #eef2ec); color: #17361f; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  border-left: 5px solid #1f6b43; opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity .3s ease, transform .45s cubic-bezier(.2, 1.3, .4, 1);
}
.rc-sponsor.on { opacity: 1; transform: none; }
.rc-sponsor.water { border-left-color: #2b77ad; }
.rcs-logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; background: #1f6b43; flex: 0 0 auto; }
.rc-sponsor.water .rcs-logo { background: #2b77ad; }
.rcs-k { display: block; font-size: 9.5px; font-weight: 900; letter-spacing: 1.6px; color: #5f8a5c; }
.rc-sponsor.water .rcs-k { color: #2b77ad; }
.rcs-n { display: block; font-size: 17px; font-weight: 900; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-slowmo {
  position: absolute; right: 10px; top: 12px; z-index: 4; opacity: 0; pointer-events: none;
  padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 900; letter-spacing: 3px; color: #fff; background: rgba(0, 0, 0, .55);
  transition: opacity .2s ease;
}
.rc-slowmo.on { opacity: 1; }
.rc-stage.slowmo .rc-slowmo { animation: pulse 1s ease-in-out infinite; }
.rc-lb { position: absolute; left: 0; right: 0; height: 7%; background: #000; z-index: 2; pointer-events: none; transition: transform .35s ease; }
.rc-lb.top { top: 0; transform: translateY(-100%); }
.rc-lb.bottom { bottom: 0; transform: translateY(100%); }
.rc-stage.slowmo .rc-lb, .rc-stage.replaying .rc-lb { transform: none; }
.rc-stage.replaying .rc-canvas { filter: saturate(.92) contrast(1.06); }
.rc-stage.slowmo .rc-canvas { filter: saturate(1.12) contrast(1.04); }
.rc-bar { position: relative; overflow: visible; }
.rc-bar i { border-radius: 2px; }
.rc-notch { position: absolute; top: -3px; width: 3px; height: 10px; margin-left: -1.5px; border-radius: 2px; background: #f6f5f0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.rc-notch.water { background: #62bdff; }
.hurdle-names { display: grid; gap: 8px; }
.hn-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0; font-size: 13px; font-weight: 800; color: var(--muted); }
.hn-row input { width: 100%; }
@media (min-width: 700px) {
  .rc-sponsor { left: auto; bottom: auto; top: 64px; right: 16px; transform: translateX(30px); }
  .rc-slowmo { right: auto; left: 50%; top: 14px; transform: translateX(-50%); }
}

/* ======================= Phish Hunt ======================= */
.games-seg { margin: 0 0 14px; }
.games-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; }
.badge.inline { display: inline-block; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--down); color: #fff; font-size: 10.5px; font-weight: 900; line-height: 17px; text-align: center; }
.live-dot.inline { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); animation: livepulsegold 1.1s ease-in-out infinite; }

/* The question you get at a poster. */
.hunt-q { display: grid; gap: 12px; padding-bottom: 6px; }
.hq-kicker { font-size: 10.5px; font-weight: 900; letter-spacing: 2px; color: var(--gold); }
.hq-topic { font-size: 12.5px; font-weight: 800; color: var(--sage-2); }
.hq-q { font-size: 19px; font-weight: 850; line-height: 1.3; }
.hq-answers { display: grid; gap: 8px; }
.hq-a {
  display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 12px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font-size: 14.5px; font-weight: 650; line-height: 1.35;
}
.hq-a:disabled { cursor: default; opacity: 1; }
.hq-letter { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 900; background: var(--panel-3); color: var(--muted); }
.hq-a.picked { border-color: var(--gold); }
.hq-a.right { border-color: var(--up); background: var(--up-soft); }
.hq-a.right .hq-letter { background: var(--up); color: #05210f; }
.hq-a.wrong { border-color: var(--down); background: var(--down-soft); }
.hq-a.wrong .hq-letter { background: var(--down); color: #fff; }
.hq-a.dim { opacity: .5; }
.hq-verdict { font-size: 17px; font-weight: 900; }
.hq-verdict.ok { color: var(--up); }
.hq-verdict.miss { color: var(--down); }
.hq-why { font-size: 14px; line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: rgba(95, 138, 92, .12); border: 1px solid rgba(134, 173, 130, .3); }
.hq-reward { font-size: 13px; font-weight: 800; color: var(--gold); }

/* The Hunt tab. */
.hunt-hero { background: radial-gradient(120% 140% at 100% 0%, rgba(90, 169, 255, .14) 0%, transparent 55%), var(--panel); }
.hunt-kicker { font-size: 11px; font-weight: 900; letter-spacing: 2.5px; color: var(--gold); }
.hunt-title { font-size: 20px; font-weight: 900; line-height: 1.2; margin: 4px 0 6px; }
.hunt-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 14px 0 10px; }
.ht { display: grid; justify-items: center; gap: 3px; padding: 9px 4px; border-radius: 12px; background: var(--panel-2); border: 1px dashed var(--line-2); text-align: center; }
.ht b { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; background: var(--panel-3); color: var(--muted); }
.ht span { font-size: 10.5px; font-weight: 750; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht.ok { border-style: solid; border-color: rgba(47, 191, 113, .5); }
.ht.ok b { background: var(--up); color: #05210f; }
.ht.miss { border-style: solid; border-color: rgba(255, 181, 71, .5); }
.ht.miss b { background: var(--amber); color: #2a1a00; }
.hunt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hunt-stats > div { display: grid; justify-items: center; padding: 8px; border-radius: 10px; background: var(--panel-2); }
.hunt-stats b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hunt-stats span { font-size: 11px; font-weight: 750; color: var(--muted); }
.hunt-rules { display: grid; gap: 6px; }
.hunt-report { border-color: rgba(90, 169, 255, .35); }
.auth-hunt { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 203, 69, .1); border: 1px solid rgba(255, 203, 69, .5); font-weight: 800; text-align: center; }

/* Admin. */
.hunt-sub { margin: 16px 0 8px; font-size: 11px; font-weight: 900; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.hunt-posters { display: grid; gap: 8px; }
.hunt-posters .hn-row { grid-template-columns: 120px minmax(0, 1fr); }
.hunt-table { display: grid; gap: 2px; }
.hunt-table .row { gap: 10px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.hunt-all { margin-top: 10px; }
.hunt-all summary { cursor: pointer; font-weight: 800; font-size: 13px; color: var(--sage-2); }
.hunt-qa { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 3px; }

/* The posters — only ever seen on paper. */
#printArea { display: none; }
@media print {
  body.printing > *:not(#printArea) { display: none !important; }
  body.printing { background: #fff !important; }
  body.printing #printArea { display: block; }
  @page { size: A4; margin: 12mm; }
  .poster {
    break-after: page; page-break-after: always; height: calc(297mm - 24mm); display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5mm; color: #111; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; text-align: center;
    border: 3mm solid #1f6b43; border-radius: 8mm; padding: 10mm; box-sizing: border-box;
  }
  .poster:last-child { break-after: auto; page-break-after: auto; } /* no blank page at the end */
  .pz-title { font-size: 50pt; font-weight: 900; letter-spacing: 2pt; color: #1f4d2e; line-height: 1; }
  .pz-sub { font-size: 16pt; font-weight: 800; color: #333; }
  .pz-scan { font-size: 24pt; font-weight: 900; letter-spacing: 1.5pt; color: #fff; background: #1f4d2e; border-radius: 4mm; padding: 2.5mm 9mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pz-how { font-size: 14pt; font-weight: 700; color: #222; }
  .pz-prize { font-size: 13pt; font-weight: 700; color: #333; max-width: 150mm; line-height: 1.35; }
  .pz-qr { width: 95mm; height: 95mm; }
  .pz-qr svg { width: 100%; height: 100%; }
  .pz-code { font-size: 13pt; font-weight: 700; color: #333; }
  .pz-code b { display: block; margin-top: 1mm; font-size: 30pt; font-weight: 900; letter-spacing: 3pt; color: #111; font-family: ui-monospace, Menlo, Consolas, monospace; }
  .pz-url { font-size: 11pt; color: #555; }
  .pz-url b { color: #111; }
  .pz-foot { font-size: 12pt; font-weight: 800; color: #1f6b43; }
}

/* Phish Hunt: the admin's question list and editor. */
.hq-group { border-top: 1px solid var(--line); padding: 8px 0; }
.hq-group > summary { cursor: pointer; font-weight: 800; font-size: 14px; padding: 4px 0; }
.hq-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px dashed var(--line); }
.hq-row.off { opacity: .55; }
.hq-row .small { line-height: 1.35; }
.hq-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.hq-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .5px; color: #1d1405; background: var(--gold); vertical-align: 1px; }
.hq-tag.off { color: var(--muted); background: var(--panel-3); }
.danger-text { color: var(--down) !important; }
.hq-edit { display: grid; gap: 12px; padding-bottom: 6px; }
.hq-edit label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 0; }
.hq-edit textarea { width: 100%; resize: vertical; font: inherit; font-size: 15px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.hq-edit-sub { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: -4px; }
.hq-edit-answers { display: grid; gap: 8px; }
.hq-edit-a { display: flex !important; align-items: center; gap: 8px !important; }
.hq-edit-a input[type="radio"] { width: 20px; height: 20px; accent-color: var(--up); flex: 0 0 auto; }
.hq-edit-a input[type="text"] { flex: 1; min-width: 0; }

/* Phish Hunt: the app's own QR scanner (full screen, over everything but toasts). */
body.scanning { overflow: hidden; }
.scan-overlay {
  position: fixed; inset: 0; z-index: 92; display: flex; flex-direction: column; background: #000; color: #fff;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.scan-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 16px; }
.scan-top b { flex: 1; min-width: 0; }
.scan-x { width: 40px; height: 40px; border-radius: 50%; padding: 0; font-size: 18px; color: #fff; background: rgba(255, 255, 255, .14); }
.scan-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #0b0f0d; }
.scan-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.scan-overlay.live video { opacity: 1; }
.scan-frame {
  position: absolute; left: 50%; top: 46%; width: min(68vw, 46vh, 320px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); pointer-events: none;
}
.scan-frame i { position: absolute; width: 34px; height: 34px; border: 4px solid var(--gold); }
.scan-frame i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 18px; }
.scan-frame i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 18px; }
.scan-frame i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 18px; }
.scan-frame i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 18px; }
.scan-line { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 12px var(--gold); opacity: 0; }
.scan-overlay.live .scan-line { opacity: .85; animation: scanline 2.2s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 10%; } to { top: 90%; } }
.scan-overlay.nocam .scan-frame { box-shadow: none; opacity: .35; }
.scan-msg {
  position: absolute; left: 16px; right: 16px; bottom: 16px; padding: 10px 14px; border-radius: 12px; text-align: center;
  font-size: 14px; font-weight: 750; line-height: 1.35; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px);
}
.scan-msg.bad { background: rgba(120, 22, 26, .9); }
.scan-bottom { padding: 14px 16px 16px; background: var(--panel); border-top: 1px solid var(--line); color: var(--text); }
.scan-or { font-size: 13px; font-weight: 750; color: var(--muted); margin-bottom: 8px; }
.scan-type { display: flex; gap: 8px; }
.scan-type input { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; }
.scan-type input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .scan-overlay.live .scan-line { animation: none; top: 50%; } }
.hunt-scan { margin: 12px 0 4px; font-size: 17px; padding: 14px; }
.hq-reward.none { color: var(--muted); font-weight: 700; }
.hn-code { display: block; font-size: 11px; font-weight: 900; letter-spacing: 1px; color: var(--gold); }

/* Phish Hunt coins, bet on the Cup. */
.coin-card { border-color: rgba(255, 203, 69, .35); }
.coin-body { display: grid; gap: 10px; padding: 4px 14px 14px; }
.coin-card:not(.flush) { display: grid; gap: 8px; }
.coin-big { display: flex; align-items: center; gap: 12px; }
.coin-big b { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.coin-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-size: 26px; background: radial-gradient(circle at 35% 30%, rgba(255, 203, 69, .35), rgba(255, 203, 69, .08)); }
.coin-body label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--muted); margin: 0; }
.coin-body select { width: 100%; font-size: 15px; }
.coin-slip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.coin-slip .seg { flex: 1; min-width: 170px; }
.coin-step { display: flex; align-items: center; gap: 8px; }
.coin-step button { width: 38px; height: 38px; padding: 0; font-size: 20px; }
.coin-n { min-width: 28px; text-align: center; font-size: 20px; font-weight: 900; }
.coin-sub { padding: 10px 14px 6px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 900; letter-spacing: .6px; color: var(--muted); text-transform: uppercase; }

/* Cup mode: the field, the runner editor, fallers and the TV. */
.me-sweep { gap: 10px; margin: 2px 0 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); }
.runner-list { display: grid; gap: 6px; }
.runner-row { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 58px auto auto; align-items: center; gap: 6px; }
.runner-row input { width: 100%; min-width: 0; padding: 8px 10px; font-size: 15px; }
.runner-row .swatch { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.fall-chip { padding: 5px 9px; opacity: .45; }
.fall-chip.on { opacity: 1; }
.rt-row.fell:not(.off) { opacity: .6; }
.rt-row.fell .rt-gap { color: var(--down); font-weight: 900; }
.rcr-row.fell .rcr-name span { color: var(--down); }
.rc-banner.fall { background: linear-gradient(90deg, rgba(214, 40, 57, 0), rgba(214, 40, 57, .95) 14%, rgba(214, 40, 57, .95) 86%, rgba(214, 40, 57, 0)); }
.tv-left.tv-cup { display: grid; gap: 14px; }
.tv-left.tv-cup .card { margin: 0; }

/* The red poster's warning, before its question. */
.hq-red { display: grid; justify-items: center; gap: 10px; padding: 22px 16px; border-radius: 16px; text-align: center; color: #fff; background: radial-gradient(120% 120% at 50% 0%, #e0283c, #8f0c1c); animation: redpulse .5s ease-in-out 3; }
.hq-red-flag { font-size: 52px; line-height: 1; }
.hq-red-title { font-size: 12px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; opacity: .9; }
.hq-red-text { font-size: 19px; font-weight: 800; line-height: 1.35; }
@keyframes redpulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(224, 40, 60, 0); } 50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(224, 40, 60, .35); } }
.red-flash { position: fixed; inset: 0; z-index: 97; pointer-events: none; background: #e0283c; opacity: 0; animation: redflash 1.2s ease-out forwards; }
@keyframes redflash { 0% { opacity: 0; } 10% { opacity: .6; } 25% { opacity: .1; } 40% { opacity: .5; } 55% { opacity: .08; } 70% { opacity: .35; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hq-red { animation: none; } .red-flash { display: none; } }
.hq-red-note { font-size: 13.5px; font-weight: 800; padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, .22); }
.hunt-red-reveal { border-color: rgba(224, 40, 60, .5); }
