/* Stable Manager UI. One stylesheet: tokens, layout, components. No inline styles in ui.js except per-item colours.
   Direction: Aurora. A dark mesh of turf-green, orange and dirt-brown light drifts behind frosted-glass cards; Inter Variable at
   oversized display sizes; neon glow on accents; springy motion. Signature: every card is lit by a spotlight that follows
   the cursor, with a glowing edge and a slight tilt (ui.js sets --mx/--my/--rx/--ry). */
:root {
  /* racing palette: turf green and sunset orange glow over a dark dirt-brown night; --c3 is the light accent for focus and edges */
  --night:#0c0805;
  /* green into a long run of saddle brown, with orange only at the tip */
  --aurora:linear-gradient(100deg, #22c55e 0%, #36b552 30%, #7f9a45 50%, #a86a35 68%, #c27c40 86%, #f97316 100%);   /* green holds further across before the brown and orange come in */
  --glass:rgba(30,20,12,.55);
  /* colours that carry racing meaning stay conventional: gold/silver/bronze for G1/G2/G3 and wins, green turf, brown dirt */
  --gold:#f6c945; --grass:#3fbf6a; --dirt:#b07a4a;
  --turf:#0f5132;
  --spring:cubic-bezier(.34,1.56,.64,1); --out:cubic-bezier(.16,1,.3,1);
  /* motion system: three durations, one entrance curve, one exit curve, and a real damped spring (about 2.5% overshoot) for things that settle */
  --d1:140ms; --ease-std:cubic-bezier(.2,0,0,1); --ease-emph:cubic-bezier(.05,.7,.1,1); --ease-in:cubic-bezier(.3,0,1,1);
  --spring-lin:linear(0, 0.054, 0.178, 0.33, 0.485, 0.625, 0.743, 0.836, 0.907, 0.957, 0.99, 1.01, 1.021, 1.025, 1.025, 1.022, 1.019, 1.015, 1.011, 1.008, 1.005, 1.003, 1.002, 1.001, 1, 1, 0.999, 0.999, 0.999);
  --sy:0;   /* scroll position, set by ui.js for parallax */
}
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; color:var(--ink); font-optical-sizing:auto; }

/* the aurora: three blurred light sources that drift, and move slower than the page when it scrolls */
.aurora { position:fixed; inset:-20vh -10vw; z-index:0; pointer-events:none; transform:translate3d(0, calc(var(--sy) * -0.15px), 0); }
.aurora i { position:absolute; border-radius:50%; filter:blur(90px); opacity:.55; mix-blend-mode:screen; animation:drift 26s ease-in-out infinite alternate; }
/* green and brown split the top of the page about half and half, meeting behind the tabs */
.aurora i:nth-child(1) { width:70vw; height:56vw; left:-2vw; top:-14vh; background:var(--c1); opacity:.55; }
.aurora i:nth-child(2) { width:62vw; height:56vw; right:-20vw; top:-14vh; background:var(--c-dirt); opacity:.6; animation-duration:32s; animation-delay:-8s; }
.aurora i:nth-child(3) { width:34vw; height:28vw; left:40vw; top:60vh; background:var(--c2); opacity:.2; animation-duration:38s; animation-delay:-16s; }
.aurora::after { content:""; position:absolute; inset:0; background:radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(12,8,5,.75) 80%); }
@keyframes drift { 0% { transform:translate(0,0) scale(1); } 50% { transform:translate(6vw,4vh) scale(1.12); } 100% { transform:translate(-4vw,8vh) scale(.94); } }
#app { position:relative; z-index:1; }

button, select, input { font:inherit; color:inherit; }
button { background:none; border:0; padding:0; cursor:pointer; text-align:left; }
.num, td.n, th.n, .money { font-variant-numeric:tabular-nums; }
.mute { color:var(--mute); }
.good { color:var(--good); } .bad { color:var(--bad); }
.glow {
  display:inline-block; padding:.06em .14em .1em .02em; margin:-.06em -.14em -.1em -.02em; }   /* a little room around the gradient text so the last digit is never clipped (the "#59" on Sim Week) */

/* nav */
.nav { position:sticky; top:0; z-index:50; transition:background-color .3s, border-color .3s; }
body.scrolled .nav { backdrop-filter:blur(18px) saturate(150%); -webkit-backdrop-filter:blur(18px) saturate(150%); }
.nav-in { max-width:1320px; margin:0 auto; display:flex; align-items:center; gap:24px; }
.brand { display:flex; align-items:center; gap:10px; white-space:nowrap; }
.brand svg { flex:none; }
.tabs { display:flex; margin:0 auto; border-radius:999px; }
.tab { border-radius:999px; white-space:nowrap; }
.count { place-items:center; margin-left:6px; border-radius:999px; }
.dot { display:inline-block; width:6px; height:6px; border-radius:50%; margin-left:6px; vertical-align:2px; }
.status { display:flex; align-items:center; gap:14px; white-space:nowrap; color:var(--mute); }
.status b { color:var(--ink); font-weight:600; }
.status button { color:var(--faint); font-size:13px; }
.status button:hover { color:var(--ink); }

.shell { max-width:1320px; margin:0 auto; padding:12px 24px 130px; }

/* home hero: the week, set huge */
.hero { position:relative; padding:14px 0 18px; transform:translate3d(0, calc(var(--sy) * 0.25px), 0); opacity:calc(1 - var(--sy) / 600); }
.hero p { margin:0 0 6px; text-transform:uppercase; }
.hero h1 { margin:0; }   /* long labels like "Feb 26-Mar 4" may wrap on phones */
/* gradient text is clipped to its own box, so give the glyphs room above, below and past the last letter */
.hero h1 .glow { display:inline-block; }

/* buttons */
.btn { display:inline-flex; align-items:center; gap:8px; border-radius:999px; backdrop-filter:blur(12px); }
.btn:disabled { opacity:.35; cursor:default; }
.btn.primary { font-weight:600; }
.go { right:28px; bottom:28px; z-index:40; display:inline-flex; align-items:center; gap:10px; border-radius:999px; }
@keyframes sheen { 0% { background-position:0% 0; } 50% { background-position:100% 0; } 100% { background-position:0% 0; } }

/* glass cards, lit by the cursor */
.tiles { display:grid; grid-template-columns:repeat(4, 1fr); }
.tiles.three { grid-template-columns:repeat(3, 1fr); }
.tile { --mx:50%; --my:0%; --rx:0deg; --ry:0deg;
  display:flex; flex-direction:column; gap:10px; border-radius:28px; position:relative; isolation:isolate; color:var(--ink);
  background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(24px) saturate(140%); -webkit-backdrop-filter:blur(24px) saturate(140%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 20px 50px rgba(0,0,0,.35); transform-style:preserve-3d; }
.tile::before { content:""; position:absolute; inset:0; border-radius:inherit; z-index:-1; pointer-events:none; opacity:0; transition:opacity .3s;
  background:radial-gradient(200px circle at var(--mx) var(--my), rgba(255,255,255,.06), transparent 42%); }
.tile::after { content:""; position:absolute; inset:-1px; border-radius:inherit; padding:1px; pointer-events:none; opacity:0; transition:opacity .3s;
  background:radial-gradient(150px circle at var(--mx) var(--my), var(--c3), var(--c2) 36%, transparent 62%);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor; mask-composite:exclude; }
.tile:hover::before { opacity:1; }
.tile:hover::after { opacity:.7; }   /* the glowing edge a little dimmer */
/* the same cursor light on every other glass panel (no tilt): tables, rows, stat bands, boards, banners, popups */
:is(.scroll, .row, .rs-band, .bb, .banner, .hub, .farm-head, .modal, .wk-card) { --mx:50%; --my:0%; position:relative; isolation:isolate; }
:is(.scroll, .row, .rs-band, .bb, .banner, .hub, .farm-head, .modal, .wk-card)::before { content:""; position:absolute; inset:0; border-radius:inherit; z-index:-1; pointer-events:none; opacity:0; transition:opacity .3s;
  background:radial-gradient(200px circle at var(--mx) var(--my), rgba(255,255,255,.06), transparent 42%); }
:is(.scroll, .row, .rs-band, .bb, .banner, .hub, .farm-head, .modal, .wk-card)::after { content:""; position:absolute; inset:-1px; border-radius:inherit; padding:1px; pointer-events:none; opacity:0; transition:opacity .3s;
  background:radial-gradient(150px circle at var(--mx) var(--my), var(--c3), var(--c2) 36%, transparent 62%);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor; mask-composite:exclude; }
:is(.scroll, .row, .rs-band, .bb, .banner, .hub, .farm-head, .modal, .wk-card):hover::before { opacity:1; }
:is(.scroll, .row, .rs-band, .bb, .banner, .hub, .farm-head, .modal, .wk-card):hover::after { opacity:.7; }
.tile.wide { grid-column:span 2; }
.tile h3 { margin:0 0 4px; }
.tile p { margin:0; color:var(--mute); }
.tile .label { margin:8px 0 4px; }
.tile .name { font-size:18px; color:var(--ink); }
.tile .sub { color:var(--mute); }
.tile .meta { font-size:12px; color:var(--faint); }
.tile .none { color:var(--faint); font-size:13px; }
.tile dl { display:flex; flex-wrap:wrap; gap:8px 36px; margin:0; }
.tile dd { margin:4px 0 0; font-variant-numeric:tabular-nums; }
.tile dd small { letter-spacing:0; color:var(--faint); margin-left:3px; }
.lines { list-style:none; margin:0; padding:0; display:grid; }
.lines li { display:flex; justify-content:space-between; align-items:baseline; gap:12px; padding:7px 0; border-bottom:1px solid var(--edge-soft); }
.lines li:last-child { border-bottom:0; }
.lines li b { color:var(--ink); min-width:0; overflow-wrap:anywhere; }   /* wraps rather than cutting off */
.lines li span { color:var(--mute); white-space:nowrap; }
.lines li.more { color:var(--faint); }
.detail p.when { margin:0 0 8px; padding:0 4px; font-size:12.5px; }
.lines li.tgt { flex-wrap:wrap; row-gap:2px; }
.lines li.tgt span { white-space:normal; text-align:right; }
.lines li.tgt small { flex-basis:100%; font-size:11.5px; color:var(--faint); }

/* controls */
.seg { display:inline-flex; border-radius:999px; backdrop-filter:blur(12px); }
.seg button { border-radius:999px; color:var(--mute); }
.seg button:hover { color:var(--ink); }
select, input[type=number] { border-radius:999px; backdrop-filter:blur(12px); }
select:hover { border-color:rgba(255,255,255,.22); }
select option { color:var(--ink); }
.tools { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-bottom:18px; }
.tools .grow { flex:1; }
.tools > b { font-size:18px; font-weight:700; letter-spacing:-.02em; }
label.check { display:inline-flex; align-items:center; gap:6px; cursor:pointer; color:var(--mute); }
input[type=checkbox] { accent-color:var(--c2); }

/* tables */
.scroll { overflow-x:auto; overflow-y:hidden; border:1px solid var(--edge); border-radius:24px; backdrop-filter:blur(24px) saturate(140%); -webkit-backdrop-filter:blur(24px) saturate(140%); box-shadow:0 20px 50px rgba(0,0,0,.3); }
table { width:100%; border-collapse:collapse; }
th { text-align:left; white-space:nowrap; }
td { padding:11px 14px; vertical-align:middle; color:var(--ink2); }
tbody tr:last-child td { border-bottom:0; }
th.n, td.n { text-align:right; }
tr.mine td { background:var(--mine); }
tr.dim td { opacity:.4; }
tbody tr { transition:background .15s; }
tbody tr.mine:hover td { background:var(--mine); }
tr.click { cursor:pointer; }
tr.click[aria-expanded="true"] td { background:rgba(255,255,255,.07); }
tr.pp > td { padding:4px 14px 18px 28px; }
tr.pp table { background:transparent; }
.pp-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:2px 0 12px; font-size:13px; }
/* a dropdown open inside the stable table must not be clipped by the table's box */
.scroll:has(.dd.open) { overflow:visible; z-index:30; }
tr.pp:has(.dd.open) { position:relative; z-index:30; }
.pp-head .dd-menu { min-width:260px; }
tr.win td:first-child { color:var(--gold); font-weight:700; }

/* list rows */
.row { display:flex; align-items:center; gap:16px; width:100%; border-radius:18px; backdrop-filter:blur(20px); }
.row .lead { min-width:28px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.row .lead.wide { min-width:96px; }
.row .meta { color:var(--mute); }
.row .end { margin-left:auto; display:flex; align-items:center; gap:8px; }
.row.mute { color:var(--mute); }
.detail { margin:-4px 0 12px 18px; padding:12px 16px 16px; border-radius:0 0 18px 18px; backdrop-filter:blur(20px); }
.detail .scroll { margin:0 0 8px; border-radius:0; box-shadow:none; backdrop-filter:none; }
.detail .row { border-radius:0; margin:0; backdrop-filter:none; }
.detail .row:hover { transform:none; }

/* small parts */
.chip { display:inline-block; padding:0 8px; border-radius:999px; color:var(--ink2); }
.chip.claimed { background:rgba(248,113,113,.2); color:#fca5a5; border-color:rgba(248,113,113,.55); }   /* a horse claimed away from us */
.chip.mine { cursor:pointer; }
.cloth { display:inline-block; min-width:22px; text-align:center; border-radius:5px; font-size:12px; padding:0 4px; }
.meter { display:inline-block; border-radius:999px; vertical-align:middle; overflow:hidden; }
.meter i { display:block; height:100%; border-radius:999px; }
.meter.low i { background:var(--bad); box-shadow:none; }
.surf { border-radius:50%; background:var(--dirt); flex:none; }
.surf.turf { background:var(--grass); }
.surf.tapeta { background:#7f9bbd; }   /* synthetic: slate blue, apart from brown dirt and green turf */
.banner { padding:13px 18px; border-radius:18px; background:var(--glass); border:1px solid var(--edge); margin-bottom:16px; color:var(--ink2); backdrop-filter:blur(20px); }
.banner.bad { color:var(--bad); border-color:rgba(255,93,143,.35); }
.stats { display:flex; flex-wrap:wrap; gap:16px 56px; margin:8px 0 24px; }
.stats b { display:block; font-variant-numeric:tabular-nums; }
.save-warn { position:sticky; top:0; z-index:70; display:flex; gap:12px; align-items:center; justify-content:center; flex-wrap:wrap; padding:8px 14px; background:#8a2323; color:#fff; font-size:13px; text-align:center; }
.busy { position:fixed; inset:0; z-index:80; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.35); opacity:0; animation:busyin .2s .3s forwards; }
.busy-box { background:var(--glass-2); border:1px solid var(--edge); color:var(--ink); padding:14px 22px; border-radius:12px; font-size:15px; display:flex; gap:10px; align-items:center; }
.busy-dot { width:10px; height:10px; border-radius:50%; background:currentColor; animation:busypulse .8s infinite alternate; }
@keyframes busyin { to { opacity:1; } }
@keyframes busypulse { from { opacity:.25; } to { opacity:1; } }
.toast { position:fixed; left:50%; bottom:100px; transform:translateX(-50%); background:var(--glass-2); backdrop-filter:blur(20px); border:1px solid var(--edge); color:var(--ink); padding:10px 18px; border-radius:999px; z-index:60; font-size:13px; }

/* start */
.start { max-width:960px; margin:0 auto; padding:3vh 24px 12px; }   /* padding, not margin: a top margin would collapse through the body and show the page background as a dark band */
.start h1 { text-align:center; margin:0 0 24px; }
.start .tiles { grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); }
.start .tile { min-height:150px; }
.form { display:flex; flex-wrap:wrap; gap:10px; margin-top:24px; justify-content:center; }

/* replay */
.track { border-radius:16px; padding:6px 0; margin:10px 0; position:relative; overflow:hidden; }
.lane { position:relative; height:22px; }
.lane:last-of-type { border-bottom:0; }
.hr { position:absolute; top:2px; left:0; height:18px; min-width:20px; padding:0 7px; border-radius:9px; font-size:11px; display:flex; align-items:center; white-space:nowrap; }
.wire { position:absolute; top:0; bottom:0; right:0; width:3px; background:repeating-linear-gradient(#fff 0 6px,#000 6px 12px); }

/* entrance when a tab opens (only on tab change): the hero leads, then the cards follow in reading order, 40ms apart (the whole stagger stays under 400ms),
   each rising a short way with an emphasized ease-out; nothing runs longer than about 0.8s */
@keyframes rise { from { opacity:0; transform:translateY(26px) scale(.985); } to { opacity:1; transform:none; } }
@keyframes title { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:none; } }
.enter .hero h1 { animation:title .6s var(--ease-emph) both; }
.enter .hero p { animation:title .5s var(--ease-emph) .06s both; }
.enter .tiles > *, .enter > .hub, .enter > .tools, .enter > .scroll, .enter > .row, .enter > .card, .enter > .banner, .enter > h1, .enter > .stats { animation:rise .42s var(--ease-emph) backwards; }   /* backwards, not both: the tilt needs transform back afterwards */
.enter .tiles > :nth-child(1), .enter > :nth-child(1) { animation-delay:.04s; }
.enter .tiles > :nth-child(2), .enter > :nth-child(2) { animation-delay:.08s; }
.enter .tiles > :nth-child(3), .enter > :nth-child(3) { animation-delay:.12s; }
.enter .tiles > :nth-child(4), .enter > :nth-child(4) { animation-delay:.16s; }
.enter .tiles > :nth-child(5), .enter > :nth-child(5) { animation-delay:.2s; }
.enter .tiles > :nth-child(6), .enter > :nth-child(6) { animation-delay:.24s; }
.enter .tiles > :nth-child(7), .enter > :nth-child(7) { animation-delay:.28s; }
.enter .tiles > :nth-child(n+8), .enter > :nth-child(n+8) { animation-delay:.32s; }
/* exits: a dialog or menu leaves faster than it arrived (about 70%), accelerating out */
@keyframes popout { to { opacity:0; transform:translateY(8px) scale(.97); } }
@keyframes fadeout { to { opacity:0; } }
.modal-wrap.leaving .modal, .wk.leaving .wk-card { animation:popout .15s var(--ease-in) forwards; }
.modal-wrap.leaving .modal-back, .wk.leaving { animation:fadeout .15s var(--ease-in) forwards; }
.dd-menu.leaving { animation:popout .1s var(--ease-in) forwards; pointer-events:none; }
.tab:active { transform:scale(.96); }
@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after { transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; }
  .enter *, .aurora i, .go { animation:none !important; } html { scroll-behavior:auto; }
  .tile { transform:none !important; } .hero { transform:none; opacity:1; }
}

/* home: hero, then two rows on a 12-column grid */
.tiles.home { grid-template-columns:repeat(12, 1fr); }
.tiles.home { gap:14px; }
.tiles.home.hgrid { display:grid; grid-template-columns:minmax(0, 3fr) minmax(0, 1fr); align-items:stretch; perspective:none; }
/* Home fits the window with no scrolling: no spare room under the tiles (the floating Run week button sits in the empty corner of
   Finances instead), and everything shrinks a little on short windows */
.shell[data-tab="home"] { padding-bottom:16px; }
.hgrid .t-fin { padding-bottom:78px; }
@media (max-height:780px) { .shell[data-tab="home"] { padding-bottom:6px; } .shell[data-tab="home"] .hero h1 { font-size:clamp(36px, 4.6vw, 70px); } .tiles.home .tile { padding:12px 18px 14px; } .hgrid .t-fin { padding-bottom:70px; } .hgrid .hl, .tiles.home { gap:10px; } }
@media (max-height:680px) { .shell[data-tab="home"] .hero { display:none; } }
body.fitting .tile, body.fitting .hero, body.fitting .tiles.home * { transform:none !important; animation:none !important; transition:none !important; }
/* tighter Home steps, added by fitHome when the tiles are still taller than the window after rows are dropped */
.tiles.home.tight .hero { padding:0 0 8px; }
.tiles.home.tight .hero h1 { font-size:clamp(34px, 4.2vw, 62px); }
.tiles.home.tight .tile { padding:12px 18px 12px; gap:4px; }
.tiles.home.tight .tile h3, .tiles.home.tight .t-sim h3 { font-size:19px; }
.tiles.home.tight .tile dd { font-size:32px; }
.tiles.home.tight .t-fin { padding-bottom:60px; }
.tiles.home.tight .tile .label { margin-top:2px; }
.tiles.home.tighter .hero p { display:none; }
.tiles.home.tighter .hero h1 { font-size:clamp(28px, 3.4vw, 48px); }
.tiles.home.tighter .tile { padding:10px 16px 10px; gap:3px; }
.tiles.home.tighter .tile dd { font-size:28px; }
.tiles.home.tighter .tile .lines li { padding-top:4px; padding-bottom:4px; }
.hgrid .hlc { display:flex; flex-direction:column; min-width:0; }   /* the heading sits over the left block only, so the right column starts at the very top */
.hgrid .hlc .hero { padding:4px 0 14px; }
.hgrid .hl { display:grid; grid-template-columns:repeat(12, minmax(0, 1fr)); grid-template-rows:auto 1fr; gap:14px; align-content:stretch; flex:1 1 auto; perspective:1400px; }   /* the bottom row grows so both columns always end on the same line */
.hgrid .hcr { display:flex; flex-direction:column; gap:14px; perspective:1400px; }
.hgrid .hcr .tile { flex:1 1 auto; }
.hgrid .t-sim { grid-column:span 7; } .hgrid .t-hub { grid-column:span 5; } .hgrid .t-perf { grid-column:span 4; } .hgrid .t-board { grid-column:span 8; }
.hgrid .hl .tile { min-height:0; }
.tiles.home .tile { min-height:130px; padding:16px 22px 18px; gap:6px; }   /* compact tiles so the whole home screen fits: no stretching dead space */
.t-sim { grid-column:span 6; } .t-hub, .t-cal { grid-column:span 3; }
.t-perf { grid-column:span 3; } .t-board { grid-column:span 6; } .t-fin { grid-column:span 3; }
.t-sim { background:radial-gradient(90% 120% at 100% 0%, rgba(249,115,22,.22), transparent 60%), radial-gradient(80% 120% at 0% 100%, rgba(34,197,94,.3), transparent 60%), var(--glass); }
.t-sim h3 { font-size:30px; }
.split { display:flex; gap:18px 28px; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; }
.split .lines { flex:0 1 270px; min-width:210px; padding:6px 14px; border-radius:18px; background:rgba(12,8,5,.45); border:1px solid var(--edge-soft); }
.form-row { margin-top:auto; padding-top:12px; }
.form-row .label { margin:0 0 8px; }
.form-line { display:flex; flex-wrap:wrap; gap:6px; }
.fin { padding:5px 13px; border-radius:999px; background:rgba(255,255,255,.07); border:1px solid var(--edge-soft); font-size:13px; font-weight:600; color:var(--ink2); font-variant-numeric:tabular-nums; }
.fin.won { background:linear-gradient(180deg, #ffe07a, #d9a91c); border-color:transparent; color:#2a1d00; box-shadow:0 0 16px rgba(246,201,69,.45); }
.hub-mini { display:flex; align-items:center; gap:14px; margin:2px 0 6px; }
.hub-mini p { margin:0; }
.hub-mini .silks { filter:drop-shadow(0 8px 18px rgba(0,0,0,.5)); }
.tile .meter.wide { width:100%; height:5px; margin-top:10px; }
.t-hub dl, .t-fin .stack { margin-top:auto; }
.headline { margin:2px 0 6px !important; display:flex; flex-direction:column-reverse; gap:6px; }
.headline span { font-size:18px; font-weight:700; color:var(--ink); letter-spacing:-.02em; }
.headline b { font-variant-numeric:tabular-nums; }
.t-perf .meta { margin-top:auto; }
.stack { flex-direction:column; gap:12px !important; }
.stack dd { font-size:22px; letter-spacing:-.03em; }
.stack div:first-child dd { font-size:34px; letter-spacing:-.045em; }
.tile .cols { display:grid; grid-template-columns:1fr 1fr; gap:6px 22px; }
table.board th { padding:0 0 8px; font-size:10.5px; border-bottom:1px solid var(--edge); }
table.board th:first-child { color:var(--ink2); }
table.board th.n { padding-left:12px; }
table.board td { padding:7px 0; font-size:13px; border-bottom:1px solid var(--edge-soft); white-space:nowrap; color:var(--ink2); }
table.board td:first-child { max-width:118px; overflow:hidden; text-overflow:ellipsis; }
table.board td.n { color:var(--ink); padding-left:12px; font-weight:600; }
table.board tbody tr:hover td { background:none; }
table.board tr.you td:first-child { color:#fdba74; text-shadow:0 0 10px rgba(249,115,22,.6); font-weight:700; }
.silks { flex:none; }
.silks.px { image-rendering:pixelated; }
.silks.px.sm { image-rendering:auto; }   /* small sizes (the tables, the pattern picker) are scaled down smoothly: nearest-neighbour would drop pixels */
td .silks, .name .silks { vertical-align:middle; }

/* stable hub panel */
.hub { display:flex; gap:28px; align-items:center; padding:24px 28px; margin-bottom:20px; border-radius:28px; background:radial-gradient(80% 140% at 0% 0%, rgba(34,197,94,.28), transparent 60%), var(--glass); border:1px solid var(--edge); backdrop-filter:blur(24px); flex-wrap:wrap; position:relative; }
.hub-silks .silks { filter:drop-shadow(0 12px 24px rgba(0,0,0,.5)); }
.hub-form { display:flex; flex-wrap:wrap; gap:16px 24px; flex:1; align-items:flex-end; min-width:260px; }
.field { display:flex; flex-direction:column; gap:6px; }
.field > span, .swatch span { font-size:10.5px; color:var(--faint); font-weight:600; letter-spacing:.12em; text-transform:uppercase; }
.field input[type=text] { padding:10px 16px; border:1px solid var(--edge); border-radius:14px; background:rgba(12,8,5,.5); color:var(--ink); min-width:210px; transition:border-color .2s, box-shadow .2s; }
.field input[type=text]:focus { border-color:rgba(253,186,116,.6); box-shadow:0 0 0 4px rgba(253,186,116,.12); outline:none; }
.swatches { display:flex; gap:14px; align-items:flex-end; }
.swatch { display:flex; flex-direction:column; gap:6px; cursor:pointer; }
.swatch input { width:52px; height:30px; padding:2px; border-radius:999px; cursor:pointer; }
.swatch input::-webkit-color-swatch-wrapper { padding:0; } .swatch input::-webkit-color-swatch { border:0; border-radius:999px; }
.patterns { flex-basis:100%; display:grid; grid-template-columns:repeat(auto-fill, minmax(62px, 1fr)); gap:8px; padding-top:18px; border-top:1px solid var(--edge-soft); }
.patterns button { display:grid; place-items:center; padding:6px 0; border-radius:16px; background:rgba(12,8,5,.45); border:1px solid var(--edge-soft); transition:border-color .2s, transform .35s var(--spring); }
.patterns button:hover { border-color:rgba(255,255,255,.25); transform:translateY(-3px); }
.patterns button[aria-pressed="true"] { border-color:var(--c3); box-shadow:none; }

/* races: one control row, then a compact card (a 10-race card fits on one screen) */
.tools.bar { flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.tools.bar .dd-btn, .tools.bar .seg button, .tools.bar label.check { font-size:14px; }
.tools.bar .seg { flex:none; flex-wrap:nowrap; }   /* the days always stay on one line */
.tools.bar .seg button { padding:7px 13px; white-space:nowrap; }
.tools.bar label.check { white-space:nowrap; padding:0 4px; }
.card .row { padding:9px 16px; margin-bottom:5px; border-radius:14px; gap:14px; }
.card .row .meta { font-size:12.5px; }
.card .detail { margin:-3px 0 8px 16px; }

/* dropdowns (ui.js select()): a pill that sizes to its text, and a menu in the app's glass style */
.dd { position:relative; display:inline-block; flex:none; }
.dd-btn { display:inline-flex; align-items:center; white-space:nowrap; transition:background .2s, border-color .2s; }
.dd-btn.ph { color:var(--ink2); }
.dd-btn svg { flex:none; }
.dd.open > .dd-btn svg { transform:rotate(180deg); }
.dd.sm .dd-btn { gap:6px; }
@keyframes pop { from { opacity:0; transform:translateY(-6px) scale(.98); } to { opacity:1; transform:none; } }
.dd-menu { position:absolute; left:0; z-index:70; min-width:max(100%, 200px); max-height:min(60vh, 460px); overflow-y:auto; }
.dd-menu button { display:flex; align-items:center; gap:10px; width:100%; white-space:nowrap; transition:background .12s, color .12s; }
.dd-menu button[aria-selected="true"] { color:var(--ink); }
.dd-menu .dd-group { font-weight:600; color:var(--ink); }
.dd-menu .dd-group span { flex:1; }
.dd-menu .dd-group em { font-style:normal; font-weight:500; font-size:12.5px; color:var(--mute); }
.dd-menu .dd-group svg { opacity:.5; transform:rotate(-90deg); transition:transform .2s var(--out); }
.dd-menu .dd-group[aria-expanded="true"] svg { transform:none; }
.dd-menu .dd-sub { padding-left:26px; }
.dd-menu .dd-note { margin:0; padding:6px 12px 8px 26px; font-size:12.5px; color:var(--faint); }
/* lift the row holding an open menu above its neighbours (glass rows are their own stacking layers) */
.tools:has(.dd.open), .row:has(.dd.open), .hub:has(.dd.open), .form:has(.dd.open) { position:relative; z-index:30; }

/* calendar */
.row.cal { cursor:default; flex-wrap:wrap; }
.row.cal .meta { flex:1 1 auto; }
select.target { padding:4px 12px; font-size:12px; }
.cols { display:grid; grid-template-columns:1fr 1fr; gap:0 24px; }

/* roster: one line per horse */
table.roster td, table.roster th { white-space:nowrap; padding-left:10px; padding-right:10px; }
table.roster .meter { width:44px; }
/* the stable table never scrolls sideways: the Class and Status columns wrap when the window is narrow, and the spacing tightens */
.scroll:has(> table.roster) { overflow-x:hidden; }
table.roster { width:100%; }
table.roster:not(.ppl) td:nth-child(8), table.roster:not(.ppl) td:nth-child(10) { white-space:normal; }
@media (max-width:1500px) { table.roster td, table.roster th { padding-left:7px; padding-right:7px; } }
table.roster td .btn { white-space:nowrap; }
.btn.xs { padding:3px 11px; font-size:12px; gap:5px; }
/* confirmation popup (sell / farm) */
.modal-wrap { position:fixed; inset:0; z-index:70; display:grid; place-items:center; padding:20px; }
.modal-back { position:absolute; inset:0; background:rgba(6,4,2,.6); backdrop-filter:blur(6px); }
.modal { position:relative; width:min(440px, 100%); padding:24px 26px 20px; border-radius:24px; background:var(--glass-2); border:1px solid var(--edge); backdrop-filter:blur(28px); box-shadow:0 30px 80px rgba(0,0,0,.55); animation:pop .22s var(--out); }
.modal h3 { margin:0 0 14px; font-size:19px; letter-spacing:-.01em; }
.modal .m-row { display:flex; justify-content:space-between; gap:18px; padding:8px 0; border-bottom:1px solid var(--edge-soft); font-size:14px; color:var(--ink2); }
.modal .m-row b { color:var(--ink); font-weight:600; text-align:right; }
.modal p { margin:14px 0 0; font-size:13.5px; line-height:1.5; color:var(--ink2); }
.modal .m-btns { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
/* the farm: a drop-down section at the bottom of the Stable tab */
.farm { margin-top:22px; }
.farm-head { display:flex; align-items:center; justify-content:space-between; gap:14px; width:100%; padding:13px 20px; border-radius:20px; background:rgba(255,255,255,.05); border:1px solid var(--edge); color:var(--ink); font-size:14px; backdrop-filter:blur(14px); transition:background .2s, border-color .2s; }
.farm-head:hover { background:rgba(255,255,255,.09); border-color:rgba(255,255,255,.22); }
.farm-head > span:first-child { display:inline-flex; align-items:center; gap:10px; margin-right:auto; }
.farm-head svg { flex:none; opacity:.6; transition:transform .25s var(--out); }
.farm-head[aria-expanded="true"] svg { transform:rotate(180deg); }
.farm .scroll { margin-top:10px; }
table.roster td.n .mute { line-height:1.2; font-size:12px; color:var(--faint); }

@media (max-width:1100px) {
  .nav-in { flex-wrap:wrap; } .tabs { order:3; flex-basis:100%; justify-content:flex-start; margin:0; overflow-x:auto; scrollbar-width:none; }
}
@media (max-width:1000px) {
  .t-sim { grid-column:span 12; } .t-hub, .t-cal, .t-fin, .t-perf { grid-column:span 6; } .t-board { grid-column:span 12; }
  .tiles.home.hgrid { grid-template-columns:1fr; }
  .hgrid .t-sim, .hgrid .t-board { grid-column:span 12; } .hgrid .t-hub, .hgrid .t-perf { grid-column:span 6; }
  .hgrid .hcr { flex-direction:row; flex-wrap:wrap; } .hgrid .hcr .tile { flex:1 1 280px; }
}
@media (max-width:860px) {
  .tiles, .tiles.three { grid-template-columns:repeat(2, 1fr); }
  .cols { grid-template-columns:1fr; }
  .tile .cols { grid-template-columns:1fr 1fr; }
  .status .when-d { display:none; }
}
@media (max-width:560px) {
  .shell { padding:8px 14px 110px; } .nav-in { padding:12px 14px; }
  .tiles, .tiles.three { grid-template-columns:1fr; } .tile.wide { grid-column:auto; }
  .tiles.home > .tile { grid-column:1 / -1; }
  .tile .cols { grid-template-columns:1fr; }
  .hero h1 { font-size:clamp(48px, 17vw, 80px); }
  .detail { margin-left:0; }
  .go { right:16px; bottom:16px; padding:13px 22px; }
}

/* ---------- 3D race replay overlay (replay3d.js) ---------- */
.r3d { position:fixed; inset:0; z-index:200; background:#05080c; color:var(--ink); font-family:var(--sans); overflow:hidden; user-select:none; }
.r3d-canvas { position:absolute; inset:0; width:100%; height:100%; display:block; outline:0; }
.r3d-vig { position:absolute; inset:0; pointer-events:none; background:radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0,0,0,.38) 100%), linear-gradient(180deg, rgba(0,0,0,.35), transparent 14%, transparent 80%, rgba(0,0,0,.4)); }
.r3d-msg { position:absolute; inset:0; display:grid; place-items:center; font-size:15px; color:var(--mute); }
.r3d-top { position:absolute; top:14px; left:16px; right:16px; display:flex; align-items:flex-start; gap:12px; flex-wrap:wrap; pointer-events:none; }
.r3d-top > * { pointer-events:auto; }
.r3d-bug { position:absolute; top:14px; left:16px; max-width:min(560px, calc(100% - 330px)); border-radius:8px; overflow:hidden; background:rgba(14,16,20,.72); border:1px solid rgba(255,255,255,.08); }
.bug-main { display:flex; align-items:stretch; font-variant-numeric:tabular-nums; }
.bug-main > * { display:flex; align-items:center; gap:8px; padding:7px 14px; }
.bug-track { font-weight:700; letter-spacing:.06em; text-transform:uppercase; font-size:13px; }
.bug-call { border-left:1px solid var(--edge); font-size:16px; min-width:130px; }
.bug-call small, .bug-race small { font-size:10px; letter-spacing:.12em; color:var(--faint); font-weight:700; }
.bug-call b { font-weight:700; }
.bug-race { margin-left:auto; background:rgba(255,255,255,.08); color:var(--ink); border-left:1px solid rgba(255,255,255,.08); }
.bug-race small { color:var(--faint); } .bug-race b { font-size:15px; font-weight:700; }
.bug-sub { display:flex; gap:10px; align-items:baseline; padding:5px 14px 6px; font-size:12px; border-top:1px solid var(--edge); color:var(--ink2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bug-sub b { font-weight:600; color:var(--ink); } .bug-sub span { color:var(--faint); overflow:hidden; text-overflow:ellipsis; }
.r3d-top { justify-content:flex-end; }
.r3d-map { position:absolute; top:62px; right:16px; width:150px; height:84px; border-radius:12px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(18px); display:grid; place-items:center; pointer-events:none; }
.r3d-map svg { display:block; }
.r3d-map circle { transition:none; }
.r3d-board { position:absolute; left:16px; bottom:132px; width:min(330px, calc(100% - 32px)); padding:6px; border-radius:12px; background:var(--glass-2); border:1px solid var(--edge); backdrop-filter:blur(18px); box-shadow:0 8px 24px rgba(0,0,0,.35); }
.r3d-board ol { list-style:none; margin:0; padding:0; }
.r3d-board li { display:grid; grid-template-columns:28px 1fr auto 42px; align-items:center; gap:8px; padding:3px 6px; border-radius:7px; font-size:13px; font-weight:600; letter-spacing:.02em; text-transform:uppercase; cursor:pointer; border:1px solid transparent; }
.r3d-board li:hover { background:rgba(255,255,255,.07); }
.r3d-board li.mine { background:var(--mine); border-color:rgba(249,115,22,.35); }
.r3d-board li.follow { border-color:rgba(255,255,255,.4); }
.r3d-board li.far { opacity:.9; border-top:1px dashed var(--edge); border-radius:0 0 7px 7px; }
.r3d-board .cloth { display:grid; place-items:center; height:22px; border-radius:5px; font-weight:800; font-size:13px; }
.r3d-odds { color:var(--gold); font-variant-numeric:tabular-nums; text-align:right; }
.r3d-board .r3d-tip { margin:4px 6px 0; font-size:10.5px; text-transform:none; letter-spacing:0; }
.r3d-strip { position:absolute; left:360px; width:300px; bottom:132px; height:46px; border-radius:10px; background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); border:1px solid var(--edge); overflow:hidden; pointer-events:none; }
.r3d-strip .chip { position:absolute; left:0; top:0; width:26px; height:20px; display:grid; place-items:center; border-radius:5px; font:800 12px/1 var(--sans); border:1px solid rgba(0,0,0,.45); will-change:transform; }
.r3d-strip .chip.mine { outline:2px solid #f97316; z-index:2; }
.r3d-strip .chip.lead { box-shadow:0 0 0 2px #fff; z-index:3; }
.r3d kbd { font:600 10px/1 var(--sans); padding:2px 5px; margin-left:4px; border-radius:5px; background:rgba(255,255,255,.1); color:var(--mute); }
.r3d .seg { background:var(--glass); }
.r3d-pos { color:var(--faint); font-variant-numeric:tabular-nums; font-weight:600; text-align:right; }
.r3d-nm { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.r3d-gap { color:var(--mute); font-size:11.5px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.r3d-bar { position:absolute; left:16px; right:16px; bottom:16px; display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:999px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(18px); }
.r3d-bar .btn { white-space:nowrap; }
.r3d-bar .btn svg { flex:none; }
.r3d-prog { flex:1; height:8px; border-radius:99px; background:rgba(255,255,255,.12); cursor:pointer; position:relative; min-width:80px; }
.r3d-prog i { position:absolute; left:0; top:0; bottom:0; width:0; border-radius:inherit; background:var(--aurora); box-shadow:0 0 12px rgba(249,115,22,.5); }
.r3d-clock { font-variant-numeric:tabular-nums; font-weight:600; font-size:13px; min-width:52px; text-align:right; }
.r3d-flash { position:absolute; left:50%; top:22%; transform:translate(-50%,0); padding:10px 26px; border-radius:999px; font-size:clamp(20px,3.2vw,34px); font-weight:800; letter-spacing:-.02em; background:var(--glass-2); border:1px solid var(--edge); backdrop-filter:blur(14px); opacity:0; transition:opacity .35s; pointer-events:none; }
.r3d-flash.on { opacity:1; }
.r3d-tags { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.r3d-tag { position:absolute; left:0; top:0; padding:2px 8px 2px 3px; border-radius:999px; font-size:12px; font-weight:600; white-space:nowrap; background:rgba(12,8,5,.72); border:1px solid var(--edge); transition:opacity .2s; will-change:transform; }
.r3d-tag.mine { border-color:rgba(249,115,22,.7); box-shadow:0 0 14px rgba(249,115,22,.4); }
.r3d-banner { position:absolute; inset:0; display:grid; place-items:center start; padding:110px 20px 140px; pointer-events:none; }
.r3d-banner[hidden] { display:none; }
.r3d-card { pointer-events:auto; width:min(440px, 100%); max-height:100%; overflow:auto; padding:18px 22px 16px; border-radius:24px; background:var(--glass-2); border:1px solid var(--edge); backdrop-filter:blur(26px); box-shadow:0 30px 80px rgba(0,0,0,.55); animation:r3dpop .45s var(--out); }
@keyframes r3dpop { from { opacity:0; transform:translateY(18px) scale(.97); } }
.r3d-card h3 { margin:0 0 8px; font-size:18px; letter-spacing:-.02em; }
.r3d-card table { width:100%; border-collapse:collapse; }
.r3d-card td { padding:5px 6px; font-size:13.5px; border-bottom:1px solid var(--edge-soft); }
.r3d-card td.p { width:24px; color:var(--faint); font-weight:700; }
.r3d-card td.m { text-align:right; color:var(--ink2); font-variant-numeric:tabular-nums; white-space:nowrap; }
.r3d-card tr:first-child td { font-weight:700; color:var(--gold); }
.r3d-card tr.mine td { background:var(--mine); }
.r3d-btns { display:flex; justify-content:flex-end; gap:8px; margin-top:14px; }
@media (max-width: 860px) {
  .r3d-strip { left:auto; right:16px; bottom:78px; width:min(300px, calc(100% - 32px)); }
  .r3d-bug { max-width:calc(100% - 32px); top:58px; } .r3d-map { display:none; } .r3d-board { bottom:128px; } .bug-sub { display:none; }
  .r3d-banner { padding:90px 16px 100px; }
  .r3d-bar { flex-wrap:wrap; border-radius:22px; }
}
@media (prefers-reduced-motion:reduce) { .r3d-card { animation:none; } .r3d-flash { transition:none; } }

/* ---------- Results tab: landing tiles, My Results band, Around the Tracks ---------- */
.tiles.res { grid-template-columns:repeat(2, 1fr); align-items:stretch; }
.tiles.res .tile { display:flex; flex-direction:column; gap:12px; text-align:left; }
.tiles.res .tile dl dd { font-size:clamp(28px, 3vw, 42px); }   /* the numbers underneath are smaller so the box title leads */
.tiles.res .tile dl dt, .tiles.res .tile .label, .tiles.res .rs-c span { font-size:10px; }
.tiles.res .rs-c b { font-size:20px; }
.tiles.res .tile .meta, .tiles.res .lines li { font-size:12px; }
/* the two Results boxes read as buttons: a clear border, a title with an arrow, a big Open pill, and a lift on hover */
.tiles.res .tile { cursor:pointer; border-color:rgba(255,255,255,.2); box-shadow:inset 0 1px 0 rgba(255,255,255,.12), 0 20px 50px rgba(0,0,0,.35), 0 0 0 1px rgba(249,115,22,.14), 0 0 36px rgba(34,197,94,.1); transition:transform .5s var(--spring), border-color .25s, box-shadow .25s; }
.tiles.res .tile h3 { letter-spacing:-.04em; display:flex; align-items:center; gap:14px; margin-bottom:6px; }
.tiles.res .tile h3::after { content:"\203A"; display:inline-grid; place-items:center; width:48px; height:48px; border-radius:50%; font-size:36px; line-height:1; padding-bottom:4px; background:var(--aurora); color:#fff; box-shadow:0 0 22px rgba(249,115,22,.4); transition:transform .3s var(--spring); }
.tiles.res .tile:hover { border-color:rgba(255,255,255,.4); }
.tiles.res .tile:hover h3::after { transform:translateX(6px); }
.rs-open { align-self:stretch; display:flex; align-items:center; justify-content:center; gap:10px; margin-top:10px; padding:12px 22px; border-radius:999px; font-size:15px; font-weight:700; letter-spacing:-.01em; color:#fff; background:var(--aurora); box-shadow:0 0 30px rgba(249,115,22,.3); transition:transform .3s var(--spring), box-shadow .3s; }
.rs-open i { font-style:normal; transition:transform .3s var(--spring); }
.tiles.res .tile:hover .rs-open { box-shadow:0 0 44px rgba(249,115,22,.5); transform:translateY(-2px); }
.tiles.res .tile:hover .rs-open i { transform:translateX(5px); }
/* the Results landing fits the window exactly, like Home: no page scrolling; the lists inside show fewer rows on shorter windows */
.shell:has(.tiles.res) { padding-bottom:14px; }
.tiles.res { height:calc(100vh - 102px); grid-template-rows:minmax(0, 1fr); }
.tiles.res .tile { min-height:0; overflow:hidden; padding:26px 30px 22px; }
@media (max-height:860px) { .tiles.res .lines li:nth-child(n+6) { display:none; } }
@media (max-height:740px) { .tiles.res .lines li:nth-child(n+4) { display:none; } .tiles.res .tile h3 { font-size:44px; } }
@media (max-width:1000px) { .tiles.res { height:auto; grid-template-rows:none; } .tiles.res .tile { overflow:visible; } }
.tiles.res .tile > .rs-open { margin-top:auto; }
.tiles.res .rs-chips { margin-top:auto; }
.tiles.res .rs-chips + .rs-open { margin-top:10px; }
.tiles.res .rs-mini { display:grid; grid-template-columns:repeat(3, 1fr); gap:18px 14px; padding:16px 0; border-top:1px solid var(--edge-soft); border-bottom:1px solid var(--edge-soft); }
.tiles.res .lines li span { white-space:normal; text-align:right; }
.tiles.res .label { margin:6px 0 0; }
.chip.tgt { cursor:help; }
.tip { position:fixed; z-index:90; display:flex; flex-direction:column; padding:11px 14px; border-radius:14px; backdrop-filter:blur(22px); line-height:1.35; color:var(--ink2); pointer-events:none; animation:pop .16s var(--out); }
.tip b { color:var(--ink); font-size:13.5px; }
.chip.tgt { background:rgba(246,201,69,.16); color:var(--gold); border-color:rgba(246,201,69,.4); padding:0 6px; line-height:16px; font-size:9.5px; }
/* Calendar: the My targets button stands out among the filters */
.btn.mytargets { border-color:rgba(255,255,255,.35); font-weight:700; padding:10px 20px; box-shadow:0 0 28px rgba(249,115,22,.42); }
.btn.mytargets .count { border-radius:999px; background:rgba(0,0,0,.3); font-size:12px; text-align:center; }
.btn.mytargets.on { outline:2px solid #fff; outline-offset:2px; }
th.sortable { cursor:pointer; user-select:none; white-space:nowrap; }
th.sortable:hover, th.sortable.on { color:var(--ink); }
table.ppl td.rk { color:var(--faint); width:34px; }
table.ppl tr.you td { background:var(--mine, rgba(249,115,22,.12)); }
th.two { line-height:1.35; }
th.two span { opacity:.7; font-weight:500; }   /* the second line of a two-line column heading ("Horse" over "Race") */
.tiles.res .tile .meta { margin-top:2px; }
/* Settings menu, top right */
.dd.settings { margin-left:6px; }
.dd.settings .dd-btn { width:38px; justify-content:center; }
.dd.settings .dd-btn svg { display:block; }
.dd.settings.open .dd-btn svg, .dd.settings .dd-btn:hover svg { transform:rotate(60deg); }
.dd.settings .dd-menu { left:auto; right:0; min-width:170px; }
/* New-career screen: bankroll wheel, summary, circuit info */
.start.setup { max-width:1040px; margin:0 auto; padding:24px 24px 48px; text-align:center; }
.setup-top { display:flex; justify-content:flex-start; margin-bottom:6px; }
.start.setup h1 { font-size:clamp(26px, 3.4vw, 44px); margin:0 0 4px; letter-spacing:-.045em; }
.start.setup .sub { margin:0 0 22px; color:var(--mute); }
.setup-grid { display:grid; grid-template-columns:minmax(260px, 340px) minmax(0, 1fr); gap:28px; align-items:stretch; text-align:left; }
.wheel-wrap { position:relative; height:336px; border-radius:28px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(24px); overflow:hidden; }
.wheel { height:100%; overflow-y:auto; scroll-snap-type:y mandatory; scrollbar-width:none; outline:none;
  -webkit-mask-image:linear-gradient(to bottom, transparent 0, #000 28%, #000 72%, transparent 100%); mask-image:linear-gradient(to bottom, transparent 0, #000 28%, #000 72%, transparent 100%); }
.wheel::-webkit-scrollbar { display:none; }
.wheel-pad { height:136px; }
.wheel-item { scroll-snap-align:center; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; width:100%; height:64px; padding:0 14px; line-height:1.05; font-size:30px; font-weight:800; letter-spacing:-.04em; color:var(--faint); opacity:.55; transform:scale(.86); transition:transform .6s var(--spring-lin), opacity var(--d2), color var(--d2); }
.wheel-item em { font-style:normal; font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; }
.wheel-item.on { opacity:1; transform:scale(1); color:var(--ink); }
.wheel-item.on.t-claiming em { color:#fdba74; } .wheel-item.on.t-allowance em { color:#86efac; } .wheel-item.on.t-stakes em { color:#fde68a; }
.wheel-focus { position:absolute; left:14px; right:14px; top:136px; height:64px; border-radius:20px; border:1px solid rgba(255,255,255,.22); background:rgba(255,255,255,.06); pointer-events:none; box-shadow:0 0 28px rgba(34,197,94,.12); }
.setup-sum { padding:24px 28px; border-radius:28px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(24px); display:flex; flex-direction:column; gap:6px; }
.setup-sum .tier { margin:0; font-size:12px; font-weight:800; letter-spacing:.16em; text-transform:uppercase; }
.setup-sum .tier.t-claiming { color:#fdba74; } .setup-sum .tier.t-allowance { color:#86efac; } .setup-sum .tier.t-stakes { color:#fde68a; }
.setup-sum .cash { margin:0; font-size:clamp(40px, 5vw, 60px); font-weight:800; letter-spacing:-.045em; line-height:1.05; }
.setup-sum .blurb { margin:2px 0 8px; color:var(--mute); max-width:46ch; }
.setup-sum .facts { display:grid; grid-template-columns:repeat(2, auto); gap:6px 28px; justify-content:start; margin:4px 0 14px; }
.setup-sum .facts dt { font-size:10.5px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:var(--faint); }
.setup-sum .facts dd { margin:2px 0 0; display:flex; align-items:center; gap:8px; font-size:18px; }
.start-go { align-self:flex-start; padding:12px 28px; font-size:16px; }
.cinfo { display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr)); gap:24px; margin-top:28px; text-align:left; padding:22px 26px; border-radius:28px; background:var(--glass); border:1px solid var(--edge-soft); }
.cinfo h3 { margin:0 0 8px; font-size:13px; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); }
.cinfo .lines li { display:flex; justify-content:space-between; gap:14px; }
.cinfo .lines li span { color:var(--mute); text-align:right; }
@media (max-width:760px) { .setup-grid { grid-template-columns:1fr; } .setup-sum .facts { grid-template-columns:repeat(2, auto); } }
/* Saved careers dialog */
.modal.saves { box-sizing:border-box; width:min(640px, calc(100vw - 32px)); max-height:calc(100vh - 80px); overflow-x:hidden; overflow-y:auto; }
.modal.saves .m-btns { flex-wrap:wrap; margin-bottom:0; }
.modal.saves > :last-child { margin-bottom:0; }
.modal.saves::after { inset:0; }   /* the glow ring sits 1px outside the box and would make it scroll */
.save-row { display:flex; align-items:center; gap:12px; padding:12px 14px; margin:8px 0; border-radius:16px; background:rgba(255,255,255,.05); border:1px solid var(--edge-soft); }
.save-row.cur { border-color:rgba(34,197,94,.45); background:rgba(34,197,94,.08); }
.save-info { flex:1; min-width:0; } .save-info p { margin:2px 0 0; font-size:12.5px; color:var(--mute); }
.save-btns { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.start-saves { display:flex; justify-content:center; margin-top:22px; }
/* Road to the Kentucky Derby / Oaks (Calendar > Derby trail) */
.trail { margin-bottom:14px; }
.trail .tools { margin-bottom:8px; } .trail .scroll { margin-bottom:12px; overflow-x:hidden; }
.trail table { width:100%; }
.trail table tr.cut td { padding:4px 14px; font-size:10.5px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); background:rgba(255,255,255,.04); border-top:1px dashed var(--edge); }
.trail table tr.mine td { background:rgba(34,197,94,.1); }
.chip.pts { background:rgba(249,115,22,.16); color:#fdba74; border-color:rgba(249,115,22,.35); font-variant-numeric:tabular-nums; }
.chip.good { background:rgba(34,197,94,.18); color:#86efac; border-color:rgba(34,197,94,.4); }
/* Career landing: the record on the left, then Best horses / Seasons / Milestones / Log and a short Customize box */
.tiles.res.car { grid-template-columns:1.15fr 1fr 1fr; grid-template-rows:auto auto auto; align-content:start; }   /* the three rows hug their text; the record tile spans all three and stretches to their combined height, so its bottom is flush with the right-hand tiles */
.tiles.car .tile h3 { font-size:clamp(26px, 2.6vw, 38px); margin-bottom:2px; }
.tiles.car .tile h3::after { width:34px; height:34px; font-size:26px; padding-bottom:3px; }
.tiles.car .tile.rec { grid-row:1 / 4; cursor:default; }
.tiles.car .tile.rec h3::after { display:none; }
.tiles.car .tile { padding:20px 24px 16px; gap:8px; }
.tiles.car .tile.car-c, .tiles.car .tile.car-j { min-height:0; }
.tiles.car .car-j .lines li { display:grid; grid-template-columns:minmax(0, 1fr) auto; }
.rapport { display:inline-block; width:64px; height:6px; border-radius:3px; background:rgba(255,255,255,.12); vertical-align:middle; overflow:hidden; margin-right:6px; }
.rapport i { display:block; height:100%; border-radius:3px; background:var(--aurora); }
.tiles.car .lines li { gap:10px; } .tiles.car .lines li b { flex:none; max-width:46%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tiles.car .lines li span { text-align:right; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tiles.car .car-m .lines li, .tiles.car .car-l .lines li { display:grid; grid-template-columns:150px minmax(0, 1fr); align-items:center; }
.tiles.car .car-m .lines li b, .tiles.car .car-l .lines li b { max-width:none; color:var(--faint); font-weight:600; font-size:11px; }
.tiles.car .car-m .lines li span, .tiles.car .car-l .lines li span { text-align:left; }
.tiles.car .rec .rs-mini { grid-template-columns:repeat(3, 1fr); }
@media (max-width:1000px) { .tiles.res.car { grid-template-columns:1fr; grid-template-rows:none; } .tiles.car .tile.rec { grid-row:auto; } .tiles.car .tile.car-c { grid-column:auto; } }
/* Career fits one window (no page scroll) on a desktop-sized screen; on a phone or a very short window it scrolls as usual */
@media (min-width:1001px) and (min-height:800px) {
  html:has(.tiles.res.car), body:has(.tiles.res.car) { overflow:hidden; }
}
.rs-chips { display:flex; gap:6px; margin-top:auto; }
.btn.icon { padding:2px 11px; font-size:17px; line-height:1.2; }
.rs-band { display:grid; grid-template-columns:repeat(auto-fit, minmax(90px, 1fr)); gap:14px 10px; padding:16px 20px; margin-bottom:14px; border-radius:24px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(24px); }
.rs-c { display:flex; flex-direction:column; min-width:0; }
.rs-c b { font-size:24px; line-height:1.1; font-weight:800; letter-spacing:-.04em; font-variant-numeric:tabular-nums; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rs-c span { font-size:10.5px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); }
.rs-c small { font-size:12px; color:var(--mute); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rs-yr { grid-column:1 / -1; margin:0; padding-top:10px; border-top:1px solid var(--edge-soft); color:var(--ink2); font-size:13px; }
table.tight td { padding:8px 14px; }
table.tight td .sub { font-size:12px; color:var(--faint); line-height:1.3; }
table.tight td:nth-child(2) { white-space:normal; }
.rt-wk { display:inline-flex; align-items:center; gap:6px; color:var(--ink2); font-weight:600; font-size:14px; }
.rt-wk .num { min-width:118px; text-align:center; }
.rt-note { margin:0 0 10px; font-size:12.5px; color:var(--faint); }
.rrow { flex-wrap:wrap; }
.rrow .title { flex:0 1 330px; min-width:0; }   /* distance and purse sit right beside the race conditions; the winner stays on the right */
.rrow .meta { flex:1 1 auto; white-space:nowrap; }
.rt-win { color:var(--ink2); font-size:13px; white-space:nowrap; }
.rt-win b { color:var(--ink); font-weight:600; }
.rt-win .fg { color:var(--gold); font-weight:700; font-variant-numeric:tabular-nums; }
.rrow.mine { background:var(--mine); border-color:rgba(249,115,22,.4); }
.rrow .end { flex-wrap:wrap; justify-content:flex-end; }
.rrow .chip.mine { cursor:default; }

/* Top Beyers: responsive grid of boards, ten rows each */
.bbs { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; align-items:start; }
@media (max-width:1280px) { .bbs { grid-template-columns:repeat(3, minmax(0, 1fr)); } }
@media (max-width:980px) { .bbs { grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width:640px) { .bbs { grid-template-columns:1fr; } .tiles.res { grid-template-columns:1fr; } }
.bb { padding:12px 12px 8px; border-radius:20px; background:var(--glass); border:1px solid var(--edge); backdrop-filter:blur(20px); min-width:0; }
.bb header { display:flex; align-items:baseline; justify-content:space-between; gap:8px; margin-bottom:6px; }
.bb h3 { margin:0; font-size:14px; font-weight:700; letter-spacing:-.02em; }
.bb header span { font-size:11px; color:var(--faint); white-space:nowrap; }
.bb ol { list-style:none; margin:0; padding:0; }
.bb li { display:grid; grid-template-columns:14px minmax(0, 1fr) 70px 52px 30px; gap:5px; align-items:center; padding:3px 4px; border-bottom:1px solid var(--edge-soft); font-size:12px; color:var(--mute); font-variant-numeric:tabular-nums; }
.bb li:last-child { border-bottom:0; }
.bb li i { font-style:normal; color:var(--faint); text-align:right; font-size:11px; }
.bb .bn { white-space:normal; overflow-wrap:anywhere; line-height:1.2; color:var(--ink2); }
.bb .bn b { color:var(--ink); font-weight:600; }
.bb .bn small { color:var(--faint); font-size:10.5px; }
.bb .bf { font-size:15px; font-weight:800; color:var(--ink); text-align:right; letter-spacing:-.02em; }
.bb .bd b { color:var(--ink2); font-weight:700; }
.bb .bd, .bb .bx { white-space:nowrap; font-size:11px; }
.bb .bx { display:flex; align-items:center; gap:4px; justify-content:flex-end; }
.bb li.mine { background:var(--mine); border-radius:8px; box-shadow:inset 2px 0 0 var(--c2); }
.bb li.mine .bn b { color:#fdba74; }
.bbe { margin:12px 4px 14px; font-size:13px; color:var(--faint); }

/* week review overlay (above the page, below the 3D replay) */
body.wk-open { overflow:hidden; }
.wk { position:fixed; inset:0; z-index:150; display:grid; place-items:center; padding:16px; background:rgba(8,5,3,.72); backdrop-filter:blur(18px) saturate(130%); -webkit-backdrop-filter:blur(18px) saturate(130%); overflow:auto; }
.wk-card { width:min(620px, 100%); max-height:100%; overflow:auto; padding:18px 22px 18px; border-radius:28px; background:radial-gradient(90% 60% at 0% 0%, rgba(34,197,94,.2), transparent 65%), var(--glass-2); border:1px solid var(--edge); box-shadow:0 40px 100px rgba(0,0,0,.6); animation:r3dpop .35s var(--out); }
.wk-top, .wk-nav { display:flex; align-items:center; gap:10px; }
.wk-top { margin-bottom:10px; } .wk-nav { margin-top:16px; padding-top:14px; border-top:1px solid var(--edge-soft); }
.wk-n { font-size:11px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); }
.wk-card .grow { flex:1; }
.wk-notes { margin-bottom:12px; padding:9px 14px; border-radius:14px; background:rgba(255,255,255,.05); border:1px solid var(--edge-soft); font-size:12.5px; color:var(--ink2); }
.wk-notes p { margin:2px 0; }
.wk-head { display:flex; gap:14px; align-items:flex-start; }
.wk-head h2 { margin:0 0 2px; font-size:24px; letter-spacing:-.03em; line-height:1.15; }
.wk-head p { margin:2px 0; font-size:13.5px; }
.wk-head > div { flex:1; min-width:0; }
.wk-place { text-align:right; font-size:96px; font-weight:900; letter-spacing:-.06em; line-height:.9; white-space:nowrap; flex:none; }
.wk-place small { display:block; font-size:15px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; color:var(--mute); margin-top:8px; }
.wk-place.w { color:var(--gold); text-shadow:0 0 34px rgba(246,201,69,.6); }   /* the finish is colour-coded like the grade chips: gold, silver, bronze */
.wk-place.s { color:var(--silver); text-shadow:0 0 30px rgba(201,209,217,.4); }
.wk-place.t { color:var(--bronze); text-shadow:0 0 30px rgba(205,138,75,.45); }
.wk-stats { display:grid; grid-template-columns:repeat(3, 1fr); gap:10px 14px; margin:16px 0 4px; }
.wk-stats div { padding:8px 12px; border-radius:14px; background:rgba(255,255,255,.05); border:1px solid var(--edge-soft); min-width:0; }
.wk-stats span { display:block; font-size:10.5px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); }
.wk-stats b { display:block; font-size:17px; font-weight:700; letter-spacing:-.02em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; }
.wk-won { margin:10px 2px 0; font-size:13.5px; color:var(--ink2); }
.wk-act { margin-top:12px; }
@media (max-width:520px) { .wk-stats { grid-template-columns:repeat(2, 1fr); } .wk-place { font-size:64px; } .wk-head { flex-wrap:wrap; } }.bbs.all li { grid-template-columns:14px minmax(0, 1fr) 92px 52px 30px; }
.rt-win.ours b { color:#fdba74; }
.rt-d { max-width:100%; overflow-x:auto; scrollbar-width:none; }
@media (max-width:640px) { .rt-d { flex-basis:100%; } .rrow .end { margin-left:0; justify-content:flex-start; } }

/* replay: the ?tune=1 camera panel, and the sound button */
.r3d-tune { position:absolute; left:12px; top:84px; z-index:6; width:260px; max-height:70vh; overflow:auto; border-radius:12px; }
.r3d-snd[aria-pressed="false"] { opacity:.6; }

/* ---------- Dropdowns, matching the Origin dropdown: 36px rounded trigger, flush full-width rows, opens from the trigger's edge with a slight scale ---------- */
.dd-btn { height:36px; gap:8px; border-radius:8px; border:1px solid rgba(255,255,255,.14); font-size:12px; font-weight:500; }
.dd-btn:focus-visible { outline:0; }
.dd.open > .dd-btn, .dd.pick > .dd-btn { font-weight:500; }
.dd-btn svg { opacity:.65; transition:transform var(--d2) var(--spring-lin, cubic-bezier(.34,1.4,.5,1)); }
.tools.bar .dd-btn { height:38px; font-size:13px; }
.dd.sm .dd-btn { height:28px; font-size:12px; border-radius:6px; }
.dd.settings .dd-btn { height:38px; border-radius:8px; }
@keyframes ddopen { from { opacity:0; transform:translateY(-8px) scale(.96); } to { opacity:1; transform:none; } }
.dd-menu { top:calc(100% + 8px); padding:6px 0; border-radius:8px; background:rgba(20,22,27,.98); border:1px solid rgba(255,255,255,.14); box-shadow:0 12px 32px rgba(0,0,0,.55); transform-origin:top left; animation:ddopen var(--d2) var(--spring-lin, cubic-bezier(.34,1.4,.5,1)); }
.dd.settings .dd-menu { transform-origin:top right; }
.dd-menu button { padding:8px 12px; border-radius:0; font-size:12px; font-weight:500; color:var(--ink); }
.dd-menu button:hover { background:rgba(255,255,255,.07); color:var(--ink); }
.dd-menu button[aria-selected="true"] { background:transparent; font-weight:600; padding-right:32px; position:relative; }
.dd-menu button[aria-selected="true"]::after { content:""; position:absolute; right:12px; top:50%; width:9px; height:5px; margin-top:-4px; border-left:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg); }
@media (prefers-reduced-motion:reduce) { .dd-menu { animation:none; } }
/* ---------- Liquid switches and segmented controls ---------- */
label.check input[type="checkbox"] { appearance:none; -webkit-appearance:none; position:relative; flex:none; margin:0; border-radius:999px; cursor:pointer; }
label.check input[type="checkbox"]::before { content:""; position:absolute; border-radius:999px; }
.seg { position:relative; }
.seg button { position:relative; z-index:1; }
.seg-blob { position:absolute; left:0; top:0; z-index:0; border-radius:999px; background:rgba(255,255,255,.14); box-shadow:inset 0 1px 0 rgba(255,255,255,.15); pointer-events:none; will-change:transform, width; }

/* ---------- Neon edge: the highlighted buttons are dark with a light beam running around the rim, instead of the colour gradient fill ---------- */
@property --beam { syntax:'<angle>'; initial-value:0deg; inherits:false; }
@keyframes neonbeam { to { --beam:360deg; } }
.go { position:fixed; }
.go-ring { position:absolute; left:-1px; top:-1px; width:calc(100% + 2px); height:calc(100% + 2px); overflow:visible; pointer-events:none; }
/* one line of light that bends round the button's outline, at one steady speed */
.go-ring rect { x:1px; y:1px; width:calc(100% - 2px); height:calc(100% - 2px); ry:50%; rx:auto; fill:none; stroke:url(#gog); stroke-width:2px; stroke-linecap:round; stroke-dasharray:16 84; filter:drop-shadow(0 0 4px rgba(249,115,22,.75)) drop-shadow(0 0 8px rgba(34,197,94,.45)); animation:goline 12s linear infinite; }
@keyframes goline { from { stroke-dashoffset:0; } to { stroke-dashoffset:-100; } }
.go-ring rect.go-head { stroke:#fff; stroke-dasharray:0.3 99.7; stroke-dashoffset:-15.7; stroke-width:2.6px; filter:drop-shadow(0 0 2px #fff) drop-shadow(0 0 5px rgba(255,255,255,.6)); animation-name:gohead; }
@keyframes gohead { from { stroke-dashoffset:-15.7; } to { stroke-dashoffset:-115.7; } }
@media (prefers-reduced-motion:reduce) { .go-ring rect { animation:none; } }/* settings gear: just a translucent gear, no box around it */
.dd.settings .dd-btn, .dd.settings .dd-btn:hover, .dd.settings.open > .dd-btn { background:transparent; border-color:transparent; box-shadow:none; backdrop-filter:none; }
.dd.settings .dd-btn svg { opacity:.55; transition:opacity .2s, transform .4s var(--spring); }
.dd.settings .dd-btn:hover svg, .dd.settings.open .dd-btn svg { opacity:.9; }

/* all dropdown triggers: plain text with an arrow, no box */
.dd-btn, .dd-btn:hover, .dd.open > .dd-btn, .dd.pick > .dd-btn { background:transparent; border-color:transparent; box-shadow:none; backdrop-filter:none; }
.dd-btn { padding:0 8px; color:var(--ink2); }
.dd-btn:hover, .dd.open > .dd-btn { color:var(--ink); }
.dd.pick > .dd-btn { color:var(--ink); font-weight:600; }
.dd-btn:focus-visible { box-shadow:0 0 0 2px rgba(255,255,255,.22); border-radius:8px; }
.tools.bar .dd-btn { padding:0 8px; }
.dd.sm .dd-btn { padding:0 6px; }
.dd.settings .dd-btn { padding:8px; color:inherit; }

/* eligible switch: translucent track */
label.check input[type="checkbox"] { backdrop-filter:blur(8px); }

/* ---------- Finances stat card (Home) ---------- */
.fincard { display:flex; flex-direction:column; min-width:0; }
.fin-top { display:flex; justify-content:space-between; gap:10px; }
.fin-lab { font-size:12px; letter-spacing:.1em; text-transform:uppercase; color:var(--faint); font-weight:600; }
.fin-pill { display:inline-flex; align-items:center; gap:4px; padding:2px 9px; border-radius:999px; font-size:12px; font-weight:600; font-variant-numeric:tabular-nums; background:rgba(255,255,255,.07); color:var(--mute); }
.fin-pill svg { width:8px; height:8px; }
.fin-pill.up { background:rgba(34,197,94,.14); color:#4ade80; }
.fin-pill.down { background:rgba(244,63,94,.14); color:#fb7185; }
.fin-val { margin-top:6px; font-size:30px; font-weight:700; letter-spacing:-.035em; line-height:1; font-variant-numeric:tabular-nums; }
.fin-val.bad { color:#fb7185; }
.fin-sub { margin-top:6px; font-size:12px; color:var(--faint); min-height:15px; }
.fin-spark { position:relative; height:52px; margin-top:10px; cursor:crosshair; touch-action:none; }
.fin-spark svg { display:block; width:100%; height:100%; overflow:visible; }
.fin-dot { position:absolute; width:8px; height:8px; margin:-4px 0 0 -4px; border-radius:50%; background:#f97316; box-shadow:0 0 10px rgba(249,115,22,.7); transition:opacity .15s; }
.fin-dot::after { content:""; position:absolute; inset:0; border-radius:50%; background:inherit; animation:findot 1.8s ease-out infinite; }
@keyframes findot { from { transform:scale(1); opacity:.5; } to { transform:scale(2.8); opacity:0; } }
.fin-cur { position:absolute; top:0; bottom:0; left:0; width:0; border-left:1px dashed rgba(255,255,255,.3); opacity:0; pointer-events:none; transition:opacity .12s; }
.fincard.scrub .fin-cur { opacity:1; } .fincard.scrub .fin-dot { opacity:0; }
.fin-row { display:flex; align-items:baseline; justify-content:space-between; margin-top:12px; padding-top:10px; border-top:1px solid var(--edge-soft); font-size:13px; color:var(--mute); }
.fin-row b { color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums; } .fin-row small { color:var(--faint); font-weight:500; margin-left:2px; }
@media (prefers-reduced-motion:reduce) { .fin-dot::after { animation:none; } }
.fin-top { align-items:flex-start; } .fin-chg { display:flex; flex-direction:column; align-items:flex-end; gap:3px; } .fin-wk { font-size:11px; color:var(--faint); }

/* Home: Calendar lines up with the top row (Sim Week, Stable Hub) and Finances with the bottom row (Top Performance, Leaderboard) */
@media (min-width:1001px) {
  .tiles.home.hgrid { grid-template-rows:auto auto 1fr; row-gap:0; }
  .hgrid .hlc { display:contents; }
  .hgrid .hlc .hero { grid-column:1; grid-row:1; }
  .hgrid .hl { grid-column:1; grid-row:2 / 4; display:grid; grid-template-columns:repeat(12, minmax(0, 1fr)); grid-template-rows:subgrid; gap:14px; }
  .hgrid .hcr { grid-column:2; grid-row:2 / 4; display:grid; grid-template-rows:subgrid; row-gap:14px; }
  .hgrid .hcr .tile { min-height:0; }
}

/* ---------- Top tabs: dark pill bar with one light pill that slides to the active tab ---------- */
.tabs { position:relative; }
.tab { position:relative; z-index:1; }
.tab-ind { position:absolute; left:0; top:0; z-index:0; border-radius:999px; pointer-events:none; will-change:transform, width; }

/* tabs bar: translucent again */
.tabs { box-shadow:none; backdrop-filter:blur(14px); }

/* active tab: our gradient on the sliding pill, with white text */
.tab-ind { background:linear-gradient(100deg, #22c55e 0%, #1fa850 40%, #7f9a45 62%, #a86a35 82%, #9a6234 100%); box-shadow:0 0 22px rgba(120,140,60,.45), inset 0 1px 0 rgba(255,255,255,.3); }

/* ---------- Week review: purse split and the winner's flag ---------- */
.wk-split { margin:12px 0 4px; padding:10px 14px 8px; border-radius:12px; background:rgba(255,255,255,.04); border:1px solid var(--edge-soft); font-size:13px; }
.wk-split-h { display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding-bottom:6px; margin-bottom:4px; border-bottom:1px solid var(--edge-soft); font-weight:600; flex-wrap:wrap; }
.wk-split-h small { color:var(--faint); font-weight:500; font-size:11.5px; font-variant-numeric:tabular-nums; }
.wk-split > div:not(.wk-split-h) { display:flex; justify-content:space-between; padding:3px 0; color:var(--mute); font-variant-numeric:tabular-nums; }
.wk-split b { color:var(--ink); font-weight:600; }
.wk-split .net { margin-top:3px; padding-top:6px; border-top:1px solid var(--edge-soft); color:var(--ink); } .wk-split .net b { color:#4ade80; }
.wk-card.won { border-color:rgba(250,204,21,.45); box-shadow:0 30px 80px rgba(0,0,0,.55), 0 0 40px -14px rgba(250,204,21,.45); }
.wk-flag { top:-11px; left:22px; padding:3px 12px; border-radius:999px; background:linear-gradient(180deg,#fde047,#eab308); color:#2a1d00; font-size:11px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; box-shadow:0 4px 14px rgba(234,179,8,.4); }
.wk-flag { position:static; display:inline-block; margin:0 0 10px; }
@media (max-width:700px) { .hero { transform:none; opacity:1; padding:18px 0 14px; } .shell { padding-top:18px; } }
.tip { gap:7px; min-width:200px; } .tip > b:first-child { padding-bottom:5px; border-bottom:1px solid var(--edge-soft); } .tip span { display:block; } .tip span b { font-size:12.5px; } .tip .tip-note { color:var(--faint); font-size:11.5px; padding-top:2px; } .tip .tip-note b { display:inline; min-width:0; }
.tip span b { display:inline; min-width:0; margin:0; } .tip span:has(> b) { display:grid; grid-template-columns:84px 1fr; column-gap:8px; align-items:baseline; } .tip { max-width:360px; } .tip .tip-note { white-space:nowrap; }

/* ---------- Stable: stall rows ---------- */
.stalls { display:grid; gap:10px; }
.stall { position:relative; display:grid; border-radius:16px; border:1px solid var(--edge); cursor:pointer; transition:background var(--d2), border-color var(--d2); }
.stall::before { content:""; position:absolute; left:0; top:10px; bottom:10px; width:4px; border-radius:0 4px 4px 0; background:#22c55e; }
.stall.mid::before { background:#eab308; } .stall.low::before { background:#f43f5e; }
.stall:hover { background:linear-gradient(90deg, rgba(255,255,255,.09), rgba(255,255,255,.04)); border-color:rgba(255,255,255,.2); }
.stall-no { font:800 15px/1 var(--sans); color:var(--faint); text-align:center; letter-spacing:.02em; }
.stall-id { align-items:center; gap:12px; min-width:0; }
.stall-name { font-size:16px; font-weight:700; letter-spacing:-.01em; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.stall-sub { margin-top:2px; font-size:12.5px; color:var(--mute); }
.stall-rec b { font-variant-numeric:tabular-nums; font-size:15px; }
.stall-cond { display:flex; flex-direction:column; gap:6px; }
.cond-read { font-size:13.5px; font-weight:600; }
.stall.mid .cond-read { color:#facc15; } .stall.low .cond-read { color:#fb7185; }
.stall-train, .slot { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.slot.in b { font-size:14px; } .slot.in .mute { font-size:12px; }
.slot .btn { margin-top:2px; }
.stall-act { display:flex; gap:6px; }
.stall-pp { grid-column:1 / -1; margin-top:6px; padding-top:10px; border-top:1px solid var(--edge-soft); cursor:default; }
.stall-pp .pp-block table { width:100%; }
.pks { display:flex; flex-direction:column; gap:2px; max-height:52vh; overflow:auto; scrollbar-width:none; margin:10px 0; }
.pks::-webkit-scrollbar { display:none; }
.pk { display:grid; grid-template-columns:1fr auto auto auto; align-items:center; gap:12px; padding:9px 4px; border-bottom:1px solid var(--edge-soft); font-size:13.5px; }
.pk-tag { font-size:11.5px; font-weight:600; padding:2px 9px; border-radius:999px; background:rgba(34,197,94,.14); color:#4ade80; white-space:nowrap; }
.pk-tag.mid { background:rgba(234,179,8,.14); color:#facc15; } .pk-tag.bad { background:rgba(244,63,94,.14); color:#fb7185; }
.pk-fee { font-size:12px; white-space:nowrap; }
.modal.wide { width:min(680px, 94vw); }
@media (max-width:1100px) { .stall { grid-template-columns:28px 1fr 1fr; } .stall-act { grid-column:2 / -1; } }
@media (max-width:600px) { .stall { grid-template-columns:1fr; padding-left:18px; } .stall-no { display:none; } }

/* ---------- Career: cash chart ---------- */
.cc { margin:14px 0 4px; }
.cc-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:6px; }
.cc-now { display:flex; align-items:baseline; gap:8px; } .cc-val { font-size:22px; font-weight:700; letter-spacing:-.03em; font-variant-numeric:tabular-nums; } .cc-sub { color:var(--faint); font-size:12px; }
.cc-plot { position:relative; height:164px; cursor:crosshair; touch-action:none; }
.cc-plot svg { display:block; width:100%; height:100%; overflow:visible; }
.cc-cur { position:absolute; top:0; bottom:0; left:0; width:0; border-left:1px dashed rgba(255,255,255,.35); opacity:0; pointer-events:none; transition:opacity .12s; } .cc.scrub .cc-cur { opacity:1; }
.cc-break { display:grid; grid-template-columns:auto auto 1fr; gap:18px; align-items:baseline; margin-top:8px; font-size:13px; color:var(--mute); }
.cc-break span { margin-right:6px; } .cc-break b { color:var(--ink); font-variant-numeric:tabular-nums; } .cc-break b.up, .cc-wk .up { color:#4ade80; } .cc-wk .dn { color:#fb7185; }
.cc-det { min-height:18px; font-size:12px; color:var(--faint); } .cc-wk { margin:0; }

/* ---------- New career: steps, your stable, and the guided first week ---------- */
.steps { display:flex; justify-content:center; gap:10px; list-style:none; margin:4px 0 14px; padding:0; flex-wrap:wrap; }
.steps li { display:flex; align-items:center; gap:8px; padding:4px 12px 4px 5px; border-radius:999px; font-size:12.5px; font-weight:600; color:var(--faint); background:rgba(255,255,255,.04); border:1px solid var(--edge-soft); }
.steps li i { display:grid; place-items:center; width:20px; height:20px; border-radius:50%; font-style:normal; font-size:11px; background:rgba(255,255,255,.08); }
.steps li.on { color:var(--ink); border-color:rgba(255,255,255,.25); } .steps li.on i { background:var(--aurora); color:#fff; }
.steps li.done { color:var(--mute); } .steps li.done i { background:rgba(34,197,94,.25); color:#4ade80; }
.start-hub { max-width:640px; margin:18px auto 0; }
.start-next { display:flex; justify-content:center; margin-top:22px; }
.coach { position:fixed; left:24px; bottom:28px; z-index:60; max-width:320px; padding:14px 16px; border-radius:14px; line-height:1.4; color:var(--ink2); }
.coach p { margin:0 0 10px; } .coach b { color:var(--ink); }
.coach-hl { outline-offset:3px; border-radius:inherit; position:relative; z-index:5; }
@keyframes coachpulse { 50% { outline-color:rgba(249,115,22,.9); } }
@media (prefers-reduced-motion:reduce) { .coach-hl { animation:none; } }

/* ---------- Stable: the stall door ---------- */
.stall { background:linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); }
.stall::before { display:none; }
.stall-no, .stall-id { display:none; }
.stall-door { position:relative; align-self:stretch; padding:12px 14px 12px 38px; min-height:104px; border-radius:15px 0 0 15px; border-right:1px solid rgba(0,0,0,.45);
  background:
    linear-gradient(180deg, transparent calc(50% - 1px), rgba(0,0,0,.5) calc(50% - 1px), rgba(0,0,0,.5) calc(50% + 1px), rgba(255,255,255,.07) calc(50% + 1px), rgba(255,255,255,.07) calc(50% + 2px), transparent calc(50% + 2px)),
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 38px, rgba(0,0,0,.28) 38px 39px),
    linear-gradient(180deg, rgba(150,92,40,.62), rgba(88,52,22,.7)); box-shadow:inset 0 0 0 1px rgba(255,200,140,.12), inset 0 -10px 24px rgba(0,0,0,.28); }
.door-no { position:absolute; left:10px; top:10px; width:20px; height:20px; display:grid; place-items:center; border-radius:50%; font:800 11px/1 var(--sans); color:#2a1a06; background:radial-gradient(circle at 35% 30%, #f5deb3, #b9894a); box-shadow:0 1px 3px rgba(0,0,0,.5); }
.door-plate { display:inline-block; max-width:100%; padding:4px 12px 5px; border-radius:5px; background:linear-gradient(180deg, #e9c46a, #b98a2e); color:#2a1a06; box-shadow:0 1px 0 rgba(255,255,255,.35) inset, 0 3px 8px rgba(0,0,0,.45); }
.door-plate b { display:block; font-size:15px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.door-tgt { right:10px; }
.door-body { display:flex; align-items:center; gap:10px; margin-top:12px; }
.door-body .stall-sub { color:rgba(255,240,220,.85); margin:0; text-shadow:0 1px 2px rgba(0,0,0,.6); }
.stall-act { padding:14px 0; }
@media (max-width:1100px) { .stall { grid-template-columns:minmax(220px, 1fr) 1fr; padding-right:12px; } .stall-door { grid-row:span 2; } .stall-act { grid-column:2; } }
@media (max-width:600px) { .stall { grid-template-columns:1fr; padding:0; } .stall-door { border-radius:15px 15px 0 0; } .stall-rec, .stall-cond, .stall-train, .slot, .stall-act { padding-left:14px; padding-right:14px; } }
.rec-page { display:flex; flex-direction:column; gap:18px; } .rec-top { display:flex; flex-wrap:wrap; gap:28px; align-items:flex-end; } .rec-big { display:flex; gap:34px; margin:0; } .rec-big dt { font-size:11px; letter-spacing:.12em; text-transform:uppercase; color:var(--faint); font-weight:600; } .rec-big dd { margin:2px 0 0; font-size:42px; font-weight:800; letter-spacing:-.04em; } .rec-chart { padding:16px 18px; border-radius:18px; background:rgba(255,255,255,.04); border:1px solid var(--edge); } .rec-range { display:flex; justify-content:flex-end; margin-bottom:6px; } .cc.big .cc-plot { height:340px; } .cc.big .cc-val { font-size:30px; } .rec-h { margin:6px 0 0; font-size:18px; } .rec-note { font-size:12px; margin:0; } td.up { color:#4ade80; } td.dn { color:#fb7185; }
.rec-top .rs-mini { display:grid; grid-template-columns:repeat(6, auto); gap:6px 26px; margin:0; }
.cc-break b.dn { color:#fb7185; }
.stall-train { align-self:stretch; justify-content:center; }

/* the open training menu must show past the stall edge and over the next stall */
.stall { overflow:visible; }
.stall:has(.dd.open) { z-index:40; }
.stall .dd-menu { z-index:80; }

/* ---------- Stable: the Dutch door, with the horse looking out ---------- */
.stall { grid-template-columns:200px minmax(150px, 1fr) minmax(120px, .7fr) minmax(104px, .6fr) minmax(170px, 1fr) auto; gap:20px; padding:12px 18px 12px 12px; align-items:center; }
.stall .stall-door, .stall.ok .stall-door, .stall.mid .stall-door, .stall.low .stall-door { padding:0; min-height:0; display:flex; flex-direction:column; background:none; box-shadow:none; border:0; border-radius:0; align-self:center; }
.door-top { position:relative; height:92px; border:4px solid #7a4a22; border-bottom:0; border-radius:70px 70px 0 0; overflow:hidden; background:radial-gradient(ellipse 80% 90% at 50% 100%, #4a3524, #15100b 70%); box-shadow:inset 0 6px 16px rgba(0,0,0,.65); }
.door-head { position:absolute; left:50%; bottom:-8px; width:96px; height:96px; margin-left:-48px; transform-origin:50% 100%; transition:transform .5s var(--spring, ease); filter:drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.stall:hover .door-head { transform:translateY(-3px) rotate(-3deg); }
.door-head.tired { transform:translateY(10px) rotate(6deg); }
.stall:hover .door-head.tired { transform:translateY(8px) rotate(4deg); }
.door-lamp { position:absolute; left:50%; top:6px; width:8px; height:8px; margin-left:-4px; border-radius:50%; background:#22c55e; box-shadow:0 0 8px #22c55e; }
.stall-door.mid .door-lamp { background:#eab308; box-shadow:0 0 8px #eab308; } .stall-door.low .door-lamp { background:#f43f5e; box-shadow:0 0 8px #f43f5e; }
.door-silks { position:absolute; right:10px; top:14px; filter:drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.door-tgt { position:absolute; left:6px; top:10px; z-index:2; }
.door-bottom { position:relative; padding:12px 12px 12px; text-align:center; border:4px solid #7a4a22; border-top:7px solid #a06a33;
  background:
    linear-gradient(to top right, transparent calc(50% - 1.5px), rgba(0,0,0,.38) calc(50% - 1.5px), rgba(0,0,0,.38) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(to top left, transparent calc(50% - 1.5px), rgba(0,0,0,.38) calc(50% - 1.5px), rgba(0,0,0,.38) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    repeating-linear-gradient(90deg, transparent 0 33px, rgba(0,0,0,.3) 33px 34px),
    linear-gradient(180deg, #96602c, #6a3f1b); box-shadow:inset 0 -8px 18px rgba(0,0,0,.3); }
.door-bottom .door-no { position:absolute; left:6px; top:6px; }
.door-bottom .door-plate { position:relative; display:block; margin:0 auto 6px; max-width:100%; }
.door-sub { position:relative; font-size:11.5px; line-height:1.25; color:#fff3df; text-shadow:0 1px 2px rgba(0,0,0,.8); }
.stall-rec, .stall-cond, .stall-train, .slot, .stall-act { padding-top:0; padding-bottom:0; }
@media (max-width:1100px) { .stall { grid-template-columns:200px 1fr; } .stall-door { grid-row:span 3; } .stall-act { grid-column:2; } }
@media (max-width:600px) { .stall { grid-template-columns:1fr; } .stall-door { grid-row:auto; max-width:240px; margin:0 auto; } }

/* ---------- Stable: the barn (sidebar, trainer bar, shedrow, horse card) ---------- */
.barnpage { display:grid; }
.barn-side { top:88px; overflow:auto; border-radius:18px; background:var(--glass); border:1px solid var(--edge); scrollbar-width:thin; }
.side-list { display:flex; flex-direction:column; }
.side-h { position:relative; border:1px solid transparent; text-align:left; width:100%; transition:background var(--d2), border-color var(--d2); }
.side-h:hover { background:rgba(255,255,255,.07); } .side-lamp { width:7px; height:7px; border-radius:50%; flex:none; box-shadow:0 0 6px currentColor; }
.side-t { min-width:0; } .side-t b { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .side-t small { display:block; }
.barn-main { min-width:0; }
.barn-top { justify-content:space-between; border-radius:16px; background:var(--glass); border:1px solid var(--edge); }
.bt-l, .bt-r { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.bt-t { text-transform:uppercase; color:var(--faint); font-weight:600; } .bt-note { font-size:12.5px; color:var(--mute); }
.shed-wrap { position:relative; }
.shed { overflow-x:auto; overflow-y:hidden; border:1px solid var(--edge); scrollbar-width:none; background:repeating-linear-gradient(90deg, #244f82 0 8.4px, #1b3d68 8.4px 10px); box-shadow:inset 0 0 0 1px rgba(0,0,0,.2); }
.shed::-webkit-scrollbar { display:none; }
.shed-track { display:flex; width:max-content; min-width:100%; }
.stall-unit { flex:none; width:230px; height:340px; padding:0; border:0; background:none; cursor:pointer; display:block; opacity:.82; transition:opacity var(--d3), filter var(--d3); }
.stall-unit:hover { opacity:1; } .stall-unit.sel { opacity:1; }
.stall-unit:focus-visible { outline:2px solid #fff; outline-offset:-3px; }
.shed-svg { display:block; } .shed-svg text { font-family:var(--sans); }
.hh { transform-box:fill-box; transform-origin:50% 100%; transition:transform .5s var(--ease-emph, ease); }
.stall-unit:hover .hh { transform:translateY(-3px) rotate(-2deg); } .hh.tired { transform:translateY(8px) rotate(5deg); } .stall-unit:hover .hh.tired { transform:translateY(6px) rotate(3deg); }
.shed-arrow { position:absolute; top:50%; transform:translateY(-50%); z-index:3; border-radius:50%; backdrop-filter:blur(14px); }
.shed-arrow.l { left:12px; } .shed-arrow.r { right:12px; } .shed-arrow:disabled { cursor:default; }
.cond-low { color:#fb7185; } .cond-mid { color:#facc15; }
@media (max-width:900px) { .barnpage { grid-template-columns:1fr; } .barn-side { position:static; max-height:none; } .side-list { flex-direction:row; overflow-x:auto; } .side-h { width:auto; flex:none; } }

/* ---------- Stable barn: photographic heads, tighter layout ---------- */
.stall-unit { position:relative; }
.st-wrap { position:relative; display:block; width:230px; height:340px; }
.st-back, .st-front { position:absolute; left:0; top:0; width:230px; height:340px; display:block; }
.st-front text { font-family:var(--sans); }
.st-head { position:absolute; inset:0; clip-path:inset(24.1% 14.4% 39.7% 17.4%); }
.hhd { position:relative; display:block; }
.st-head .hhd { position:absolute; aspect-ratio:1; transition:transform .55s var(--ease-emph, ease); transform-origin:75% 85%; }
.stall-unit:hover .st-head .hhd { transform:translateY(-2%) rotate(-1.5deg); }
.st-head.tired .hhd { transform:translateY(7%) rotate(4deg); } .stall-unit:hover .st-head.tired .hhd { transform:translateY(5%) rotate(2deg); }
.hhd img { position:absolute; inset:0; width:100%; height:100%; display:block; user-select:none; pointer-events:none; }
.hhd-m { position:absolute; inset:0; width:100%; height:100%; -webkit-mask-size:100% 100%; mask-size:100% 100%; pointer-events:none; mix-blend-mode:normal; opacity:.94; }
.shed { border-radius:18px; }
.side-th { position:relative; flex:none; width:52px; height:44px; border-radius:10px; background-color:#1b3d68; background-repeat:no-repeat; background-size:290%; background-position:93% 26%; border:1px solid var(--edge); }
.side-th i { position:absolute; right:-3px; top:-3px; width:9px; height:9px; border-radius:50%; border:2px solid #14110f; }
.side-lamp { display:none; }
.side-h.sel { box-shadow:0 0 0 1px rgba(234,179,8,.55), 0 0 18px -6px rgba(234,179,8,.6); background:rgba(234,179,8,.1); border-color:rgba(234,179,8,.45); }
.stall-unit.sel { filter:drop-shadow(0 0 12px rgba(234,179,8,.6)); }
.barn-top { grid-template-columns:auto auto 1fr; }
.bt-b:last-child { align-items:flex-end; justify-content:center; }
.bt-b .bt-note { font-size:12px; color:var(--mute); max-width:300px; }
.wk-cost { font-weight:700; letter-spacing:-.02em; display:flex; align-items:center; gap:8px; } .wk-cost i { font-style:normal; color:#eab308; font-size:22px; }
.shed-wrap { margin-top:12px; } @media (max-width:900px) { .barn-top { grid-template-columns:1fr; } .bt-b { border-right:0; border-bottom:1px solid var(--edge-soft); } }
.st-head .hhd { left:19.5%; top:22.2%; width:72%; }

/* ---------- Stable: the scene (selected horse close up, shedrow behind, details panel) ---------- */
.scene { position:relative; overflow:hidden; isolation:isolate; }
.scene-main { transform-origin:50% 90%; transition:transform .6s var(--ease-emph, ease); }
.scene-main img { position:absolute; inset:0; width:100%; height:100%; display:block; user-select:none; pointer-events:none; }
/* the side-on portrait standing in until the front-facing art exists */
.scene-row { position:absolute; inset:0; pointer-events:none; }
.row-h { position:absolute; padding:0; border:0; background:none; cursor:pointer; pointer-events:auto; filter:drop-shadow(0 8px 12px rgba(0,0,0,.5)) brightness(.82); transition:filter var(--d3), transform var(--d3); }
.row-h img { display:block; width:100%; height:auto; pointer-events:none; user-select:none; }
.row-h:hover { filter:drop-shadow(0 8px 12px rgba(0,0,0,.5)) brightness(1.08); transform:translateY(-2px); }
.scene-nav { position:absolute; left:14px; bottom:14px; display:flex; }
.scene-nav .shed-arrow { transform:none; } .scene-panel { position:absolute; border-radius:18px; background:rgba(15,12,9,.74); border:1px solid rgba(234,179,8,.28); backdrop-filter:blur(14px); box-shadow:0 18px 50px rgba(0,0,0,.5); }
.sp-head { display:flex; align-items:center; gap:12px; } .sp-head h2 { letter-spacing:-.01em; color:#fff3d6; }
.sp-sub { display:flex; align-items:center; flex-wrap:wrap; color:var(--ink2); } .sp-sub i { width:1px; height:14px; background:rgba(255,255,255,.25); margin:0 12px; }
.sp-cols { display:grid; } .sp-col { display:flex; flex-direction:column; gap:10px; min-width:0; }
.sp-box, .sp-row { border-radius:12px; background:rgba(255,255,255,.045); border:1px solid rgba(255,255,255,.1); }
.lab { display:block; letter-spacing:.1em; text-transform:uppercase; color:var(--faint); font-weight:600; margin-bottom:3px; }
.sp-rec { display:flex; justify-content:space-between; gap:16px; } .rec-n { font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; } .rec-n s { text-decoration:none; color:var(--faint); font-weight:500; padding:0 2px; }
.rec-e { font-size:26px; font-weight:800; color:#facc15; letter-spacing:-.02em; } .sp-rec small { display:block; color:var(--faint); font-size:11px; margin-top:2px; }
.sp-cls { display:grid; grid-template-columns:1.2fr 1fr 1fr; gap:10px; } .sp-cls b { font-size:19px; letter-spacing:-.01em; }
.sp-row { display:grid; gap:12px; align-items:center; } .sp-row .meter { width:100%; } .sp-row small { color:var(--mute); font-size:12px; grid-column:3; }
.sp-sel { justify-self:start; } .sp-next { grid-template-columns:90px 1fr; } .sp-slot { flex-direction:column; gap:3px; } .sp-bh { margin-bottom:6px; } .sp-form { list-style:none; margin:0; padding:0; } .sp-form li { display:grid; gap:8px; padding:5px 0; border-bottom:1px solid rgba(255,255,255,.06); } .sp-form li:last-child { border:0; }
.f-d { color:var(--faint); font-variant-numeric:tabular-nums; } .f-r { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .f-p { font-variant-numeric:tabular-nums; color:var(--ink2); } .f-p.w { color:#4ade80; }
.sp-attr .at { display:grid; grid-template-columns:64px 1fr 52px; gap:10px; align-items:center; padding:3px 0; font-size:13px; } .at i { height:7px; border-radius:99px; background:rgba(255,255,255,.1); overflow:hidden; display:block; } .at u { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg, #22c55e, #7f9a45); } .at b { text-align:right; font-size:12px; color:var(--ink2); }
.sp-act { display:flex; justify-content:flex-end; gap:10px; } .sp-act .btn { padding:9px 26px; font-weight:700; } .btn.gold { background:linear-gradient(180deg, #e9c46a, #b98a2e); color:#2a1a06; border-color:rgba(0,0,0,.3); }
@media (max-width:1100px) { .scene { min-height:0; } .scene-bg { position:absolute; } .scene-main { position:relative; left:auto; bottom:auto; width:62%; margin:6px auto -40px; } .scene-row { display:none; } .scene-panel { position:relative; inset:auto; width:auto; margin:0 12px 12px; } .sp-cols { grid-template-columns:1fr; } .scene-nav { top:14px; bottom:auto; } }
.rec-n { white-space:nowrap; font-size:22px; } .sp-rec { align-items:flex-end; }

.sp-box, .sp-row { padding:8px 12px; } .sp-act { margin-top:10px; }

/* ---------- Stable sidebar as a compact hot bar ---------- */
.barn-side { padding:10px; }
.side-list { gap:2px; margin-top:10px; }
.side-h { display:grid; align-items:center; border-radius:9px; }
.side-t b { line-height:1.15; } .side-t small { line-height:1.2; font-variant-numeric:tabular-nums; color:var(--faint); }
.side-s { font-size:11px; font-weight:600; letter-spacing:.02em; color:var(--mute); padding:2px 8px; border-radius:99px; background:rgba(255,255,255,.06); white-space:nowrap; }
.side-th { display:none; }
@media (max-width:900px) { .side-h { grid-template-columns:8px auto auto; } }

/* ---------- Races: search, result strip, chips, sort headings, show more ---------- */
.rl-sticky { position:sticky; z-index:25; }
.rl-sticky .tools.bar { margin:0; }
.rsearch { display:inline-flex; align-items:center; border-radius:8px; }
.rsearch input { background:none; border:0; outline:0; color:var(--ink); font:inherit; font-size:13.5px; width:150px; }
.rl-head { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:8px; font-size:12.5px; color:var(--mute); }
.rl-count b { color:var(--ink); font-size:14px; font-variant-numeric:tabular-nums; }
.fchip { display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:500; color:var(--ink); background:rgba(255,255,255,.08); border:1px solid var(--edge); transition:background var(--d2); }
.fchip:hover { background:rgba(255,255,255,.15); } .fchip span { opacity:.6; } .fchip.clear { background:none; color:var(--mute); }
.rl-sort { display:inline-flex; align-items:center; gap:4px; }
.rs-h { display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:99px; font-size:12px; font-weight:500; color:var(--mute); border:1px solid transparent; transition:color var(--d2), background var(--d2); }
.rs-h:hover { color:var(--ink); background:rgba(255,255,255,.06); } .rs-h.on { color:var(--ink); background:rgba(255,255,255,.1); border-color:var(--edge); } .rs-h i { font-style:normal; font-variant-numeric:tabular-nums; color:#4ade80; }
.rl-more { display:flex; align-items:center; gap:14px; justify-content:center; margin:14px 0 6px; }
.raceDetail th.sortable, .detail th.sortable { cursor:pointer; user-select:none; } .detail th.sortable:hover { color:var(--ink); } .detail th.sortable.on { color:var(--ink); }

/* the row heads were painted looking right; turn them to look back toward the main horse */
.row-h img:not(.fb) { transform:scaleX(-1); }
.row-h.r2 { left:43.5%; bottom:38%; width:11%; } .row-h.r3 { left:47%; bottom:41.5%; width:9%; }

/* Races filter strip: plain like the rest of the page at rest; our rounded glass panel only while it is stuck to the top */
.rl-sticky { top:70px; margin:0 0 10px; padding:0; background:none; backdrop-filter:none; border:0; border-radius:16px; transition:background var(--d2), box-shadow var(--d2); }
.rl-sticky .tools.bar { margin-bottom:0; }
.rl-sticky.stuck { padding:10px 14px 8px; background:var(--glass-2); border:1px solid var(--edge); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%); box-shadow:0 12px 30px -14px rgba(0,0,0,.5); }

/* Table boxes that scroll sideways: the cursor light is part of the box's own background, so it stays put when the table is scrolled
   (the old light was a layer inside the scrolling content and ended in a hard edge once the table moved) */
@property --ga { syntax:'<number>'; inherits:false; initial-value:0; }
.scroll::before, .scroll::after { display:none; }
.scroll { background:radial-gradient(240px circle at var(--mx) var(--my), rgba(255,255,255,var(--ga)), transparent 60%), var(--glass); transition:--ga .3s, border-color .3s; }
.scroll:hover { --ga:.07; border-color:rgba(255,255,255,.2); }
.detail .scroll { background:radial-gradient(240px circle at var(--mx) var(--my), rgba(255,255,255,var(--ga)), transparent 60%); border:0; }
.detail .scroll:hover { --ga:.06; }

/* ---------- Stable: one screen, as in the mockup ---------- */
.shell[data-tab="stable"] { padding-bottom:12px; }
.barnpage { min-height:560px; align-items:stretch; }
.barn-side { position:static; max-height:none; height:100%; display:flex; flex-direction:column; }
.barn-side .side-list { flex:1; min-height:0; overflow:auto; scrollbar-width:thin; }
.barn-main { display:flex; flex-direction:column; height:100%; min-height:0; }
.barn-top { display:flex; align-items:center; gap:6px 0; padding:0; overflow:visible; }
.bt-b { display:flex; flex-direction:row; align-items:center; }
.bt-b .bt-note { display:none; }
.bt-b:last-child { border-right:0; }
.bt-i { display:inline-grid; place-items:center; width:16px; height:16px; margin-left:-4px; border-radius:50%; border:1px solid var(--edge); color:var(--mute); font:600 10px/1 var(--sans); cursor:help; }
.bt-i:hover, .bt-i:focus-visible { color:var(--ink); border-color:rgba(255,255,255,.4); outline:0; }
.wk-cost { font-size:18px; }
.scene { flex:1; min-height:0; margin-top:10px; }
.scene-panel { overflow:auto; }
.sp-bh { display:flex; align-items:baseline; justify-content:space-between; }
.sp-all { font-size:11.5px; font-weight:600; color:#facc15; padding:0; border:0; background:none; cursor:pointer; } .sp-all:hover { text-decoration:underline; }
.modal.ppm { width:min(980px, 96vw); max-height:88vh; overflow:auto; }
@media (max-width:1100px) { .barnpage { height:auto; } .barn-side { height:auto; } .barn-main { height:auto; } .scene { min-height:640px; flex:none; } }

.bt-b { white-space:nowrap; border-right:1px solid var(--edge-soft); } .barnpage { height:calc(100vh - 100px); }
@media (max-width:1250px) { .barn-top { flex-wrap:wrap; } }

.barn-top { flex-wrap:wrap; } .barn-top .seg { flex-wrap:nowrap; flex:none; } .bt-b { padding:6px 12px; gap:8px; } .bt-t { font-size:10.5px; letter-spacing:.1em; } .barn-top .seg button { padding:5px 11px; font-size:13px; } .bt-b:last-child { margin-left:auto; }

/* the page itself never scrolls sideways: anything poking out by a few pixels is clipped (clip, unlike hidden, keeps sticky bars working) */
html, body { overflow-x:clip; max-width:100vw; }

/* the past-performances dialog scrolls up and down only */
.modal.ppm { overflow-x:hidden; overflow-y:auto; }
.modal.ppm .pp-block, .modal.ppm table { width:100%; max-width:100%; }
.modal.ppm td, .modal.ppm th { padding-left:10px; padding-right:10px; }
.modal.ppm::before, .modal.ppm::after { display:none; }   /* the cursor-light edge sticks out by a pixel and would make the dialog scroll */

/* ---------- Stable details panel: organised, and it scrolls with the trackpad ---------- */
.scene-panel { container-type:inline-size; overscroll-behavior:contain; scrollbar-width:thin; }
.sp-top { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.sp-id { min-width:0; } .sp-top .sp-act { margin:0; flex:none; display:flex; gap:8px; } .sp-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(104px, 1fr)); gap:8px; margin:6px 0 12px; }
.sp-stat { display:flex; flex-direction:column; justify-content:center; min-width:0; border-radius:12px; background:rgba(255,255,255,.045); border:1px solid rgba(255,255,255,.1); }
.sp-stat .lab { margin-bottom:2px; } .sp-stat b { letter-spacing:-.01em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .sp-stat small { color:var(--faint); font-size:11px; }
.sp-stat.rec { grid-column:span 2; } .sp-stat.earn { grid-column:span 2; } .sp-stat.cls { grid-column:span 2; }
.sp-stat .rec-e { color:#facc15; font-weight:800; }
.sp-cols { grid-template-columns:1.1fr 1fr; gap:10px; }
.sp-row { grid-template-columns:78px minmax(0, 1fr); }
.sp-row:has(> .meter) { grid-template-columns:78px minmax(0, 1fr) auto; }
.sp-row .lab { margin:0; white-space:nowrap; }
.sp-slot { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; column-gap:10px; }
.sp-slot b, .sp-slot small { grid-column:1; min-width:0; } .sp-slot .btn { grid-column:2; grid-row:1 / span 2; }
.sp-slot b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .sp-slot small { color:var(--mute); font-size:12px; }
.sp-form li { grid-template-columns:48px minmax(0, 1fr) auto; }
@container (max-width: 640px) { .sp-cols { grid-template-columns:1fr; } .sp-stat.rec, .sp-stat.earn, .sp-stat.cls { grid-column:span 2; } }

/* ---------- Stable at the mockup's scale: edge to edge, big horse, bigger type ---------- */
.shell[data-tab="stable"] { max-width:none; padding-left:20px; padding-right:20px; }
.barnpage { grid-template-columns:clamp(250px, 17vw, 330px) minmax(0, 1fr); gap:18px; }
.scene-panel { width:min(52%, 960px); right:18px; top:18px; bottom:18px; padding:22px 26px 18px; }
.sp-sub { font-size:clamp(14px, 1.1vw, 18px); margin:6px 0 16px; }
.sp-stat b { font-size:clamp(18px, 1.35vw, 24px); } .sp-stat .rec-n, .sp-stat .rec-e { font-size:clamp(24px, 2vw, 34px); }
.sp-stat { padding:12px 16px; } .lab { font-size:clamp(11px, .8vw, 13px); }
.sp-row { min-height:56px; padding:10px 16px; font-size:clamp(13px, 1vw, 16px); } .sp-slot b { font-size:clamp(14.5px, 1.1vw, 18px); }
.sp-form, .at { font-size:clamp(13px, .95vw, 15.5px); }
.side-t b { font-size:clamp(13px, .95vw, 16px); } .side-t small { font-size:clamp(11px, .8vw, 13px); }
.side-h { padding:9px 10px; }
.sp-top .sp-act .btn { padding:10px 26px; font-size:clamp(13px, 1vw, 16px); }

@container (max-width: 640px) { .sp-cols { grid-template-columns:1.1fr 1fr; } }
@container (max-width: 540px) { .sp-cols { grid-template-columns:1fr; } }
.sp-stat.cls b { font-size:clamp(15px, 1.1vw, 19px); }

/* ---------- Stable scene v2: one fixed-shape "stage" so the horse stands INSIDE the stall (door and posts drawn in front of it) ---------- */
.scene-bg { position:absolute; inset:0; z-index:0; background:url(assets/art/scene-shedrow.png) 0 0 / 100% 100% no-repeat, #3a2412; }
.fg { position:absolute; inset:0; z-index:3; pointer-events:none; background:url(assets/art/scene-shedrow.png) 0 0 / 100% 100% no-repeat; }
.scene::after { content:''; position:absolute; inset:0; z-index:3; pointer-events:none; }
.scene-row { z-index:1; }
.row-h.r0 { left:52.5%; top:30%; bottom:auto; width:18.5%; } .row-h.r1 { left:69%; top:36%; bottom:auto; width:9.5%; }
.scene-nav { z-index:6; } .scene-panel { z-index:5; }
@media (max-width:1100px) {
  .scene { container-type:normal; }
  .stage { position:relative; left:0; width:100%; }
  .scene-bg { position:absolute; } .scene-main { position:absolute; width:33.5%; left:18.2%; top:12.2%; margin:0; }
  .scene-row { display:block; }
}
/* sidebar: earnings pill (class at a glance); green when entered */
.side-s { font-variant-numeric:tabular-nums; min-width:46px; text-align:center; }
.side-s.in { color:#4ade80; background:rgba(34,197,94,.14); }

/* camera pan between horses: the whole stall scene slides a little and the new horse glides in from behind the door */
@keyframes panNextStage { from { translate:3.2% 0; } to { translate:0 0; } }
@keyframes panPrevStage { from { translate:-3.2% 0; } to { translate:0 0; } }
@keyframes panNextHorse { from { translate:26% 0; opacity:0; } 35% { opacity:1; } to { translate:0 0; opacity:1; } }
@keyframes panPrevHorse { from { translate:-26% 0; opacity:0; } 35% { opacity:1; } to { translate:0 0; opacity:1; } }
@media (prefers-reduced-motion: reduce) { .scene .stage, .scene .scene-main { animation:none !important; } }
/* short windows (laptops, browser toolbars): compact the details panel so it still fits one screen */
@media (max-height:820px) and (min-width:1101px) {
  .scene-panel { padding:12px 18px 10px; top:12px; bottom:12px; right:12px; }
  .sp-head h2 { font-size:clamp(26px, 3.6vh, 34px); } .sp-sub { margin:2px 0 8px; font-size:12.5px; }
  .sp-stats, .sp-cols, .sp-col { gap:6px; }
  .sp-stat, .sp-box, .sp-row { padding-top:5px; padding-bottom:5px; }
  .sp-stat b, .rec-n, .rec-e { font-size:clamp(18px, 2.7vh, 26px); }
  .sp-stat .lab, .lab { font-size:10px; }
  .sp-row { font-size:12.5px; } .sp-form li { padding-top:3px; padding-bottom:3px; font-size:12.5px; }
}
/* ---------- Stable scene v3: seamless straight-on panorama. The camera slides along a repeating row of stalls; the horse stands in the bay at the left, the door drawn in front. ---------- */
.scene { container-type:normal; }
.stage { position:absolute; inset:0; left:0; width:auto; aspect-ratio:auto; container-type:size; overflow:hidden; --ax:.56; animation:none !important; }
.scene.pan-next .stage, .scene.pan-prev .stage { animation:none !important; }
.strip { position:absolute; inset:0; z-index:0; background:#3a2412 url(assets/art/px/scene-panorama.png) repeat-x; background-size:auto 130%; image-rendering:pixelated;
  background-position:calc(var(--ax) * 100cqh - var(--cam, .5) * 100cqh) -8cqh; }
.strip-fg { z-index:3; pointer-events:none; clip-path:inset(62cqh 0 0 0); }
.scene.pan-next .strip, .scene.pan-prev .strip { animation:camSlide .72s cubic-bezier(.22,.8,.26,1) both; }
@keyframes camSlide {
  from { background-position:calc(var(--ax) * 100cqh - var(--cam0) * 100cqh) -8cqh; }
  to   { background-position:calc(var(--ax) * 100cqh - var(--cam) * 100cqh) -8cqh; } }
.scene-bg, .scene-row { display:none; }
.scene-main { position:absolute; z-index:2; left:calc(var(--ax) * 100cqh - 25cqh); top:13cqh; bottom:auto; width:50cqh; max-width:none; aspect-ratio:1; }
.scene.pan-next .scene-main { animation:panNextHorse .72s cubic-bezier(.22,.8,.26,1) both; }
.scene.pan-prev .scene-main { animation:panPrevHorse .72s cubic-bezier(.22,.8,.26,1) both; }
@keyframes panNextHorse { from { translate:75% 0; opacity:0; } 40% { opacity:1; } to { translate:0 0; opacity:1; } }
@keyframes panPrevHorse { from { translate:-75% 0; opacity:0; } 40% { opacity:1; } to { translate:0 0; opacity:1; } }
@media (max-width:1100px) {
  .stage { position:relative; inset:auto; width:100%; height:62vw; min-height:260px; }
  .scene-main { position:absolute; margin:0; }
}
@media (prefers-reduced-motion: reduce) { .strip, .scene-main { animation:none !important; } }
/* v3b: the strip and both horses move on the compositor with the same distance, duration and easing, so the horse is carried by the camera instead of sliding separately */
.strip { inset:0 calc(var(--e, 0) * -100cqh); will-change:translate;
  background-position:calc(var(--ax) * 100cqh - var(--cam, .5) * 100cqh + var(--e, 0) * 100cqh) -8cqh; }
.scene.pan-next .strip, .scene.pan-prev .strip { animation:camGlide .72s cubic-bezier(.22,.8,.26,1) both; }
@keyframes camGlide { from { translate:calc(var(--d) * 100cqh) 0; } to { translate:0 0; } }
.scene-main { will-change:translate; }
.scene.pan-next .scene-main, .scene.pan-prev .scene-main { animation:horseIn .72s cubic-bezier(.22,.8,.26,1) both; }
.scene.pan-next .scene-main.leaving, .scene.pan-prev .scene-main.leaving { animation:horseOut .72s cubic-bezier(.22,.8,.26,1) both; pointer-events:none; }
@keyframes horseIn { from { translate:calc(var(--d) * 100cqh) 0; opacity:1; } to { translate:0 0; opacity:1; } }
@keyframes horseOut { from { translate:0 0; } to { translate:calc(var(--d) * -100cqh) 0; } }
/* halter and mane recolouring layers (masks in assets/art/masks) */
.scene-main .art { position:absolute; inset:0; display:block; }
.scene-main .art .ov { position:absolute; inset:0; display:block; pointer-events:none; -webkit-mask-size:100% 100%; mask-size:100% 100%; -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat; }
.scene-main .art img.fb ~ .ov { display:none; }
/* ===== UI conventions (see README): spacing tokens, page head, empty state, and the small-screen rules that must come last ===== */
:root { --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; }
.empty { display:flex; flex-direction:column; gap:var(--s1); align-items:center; padding:var(--s6) var(--s3); color:var(--faint); text-align:center; }
.empty b { color:var(--mute); }
.empty span { font-size:13px; }
/* Stable at phone width: one column, the horse list a strip across the top (the desktop two-column rule further up is declared later than the 900px query that used to undo it) */
@media (max-width:900px) {
  .barnpage { grid-template-columns:minmax(0, 1fr); height:auto; min-height:0; }
  .barn-side { position:static; height:auto; max-height:none; }
  .barn-side .side-list { flex-direction:row; flex:none; overflow-x:auto; overflow-y:hidden; }
  .barn-side .side-h { flex:none; width:auto; min-width:176px; grid-template-columns:8px auto auto; }
  .barn-main { height:auto; }
}
/* race rows on a phone: the name on one line, the details under it */
@media (max-width:520px) {
  .row { flex-wrap:wrap; row-gap:var(--s1); }
  .row .title { white-space:normal; flex:1 1 0; min-width:0; }   /* spelled-out race names are long: they wrap inside their own space instead of running off the row */
  .row .meta { flex:1 0 100%; order:5; margin-left:0; }
}

/* phone header: logo and cash on one row, the tabs under them (it was three rows) */
@media (max-width:520px) {
  .nav-in { gap:var(--s2) var(--s3); padding:var(--s2) var(--s4); }
  .nav-in .brand { font-size:0; gap:0; }
  .nav-in .brand svg { width:28px; height:28px; }
  .nav-in .status { margin-left:auto; gap:var(--s3); }
  /* Run week becomes a bar along the bottom instead of a button floating over the rows */
  .go { left:var(--s3); right:var(--s3); bottom:var(--s3); justify-content:center; padding:var(--s3) var(--s4); }
  .shell { padding-bottom:88px; }
  /* Stable toolbar: each control group gets its own full-width row and the buttons share it */
  .barn-top { flex-direction:column; align-items:stretch; }
  .barn-top .bt-b { white-space:normal; flex-wrap:wrap; border-right:0; padding:var(--s2) var(--s3); margin-left:0 !important; }
  .barn-top .seg { flex:1 1 100%; }
  .barn-top .seg button { flex:1 1 0; min-width:0; padding:var(--s2) var(--s1); font-size:12px; white-space:nowrap; }
}

/* ---- how-to-play card ---- */
.intro { position:fixed; inset:0; z-index:150; display:grid; place-items:center; padding:16px; background:rgba(8,5,3,.78); overflow:auto; }
.intro-card { position:relative; width:min(660px,100%); max-height:100%; overflow:auto; padding:0 0 18px; background:var(--glass-2); border:1px solid var(--edge); animation:pop .3s var(--out); }
.intro-art { display:block; width:100%; height:150px; object-fit:cover; object-position:50% 62%; image-rendering:pixelated; border-bottom:3px solid var(--deep); }
.intro-body { padding:16px 24px 0; min-width:0; }
.intro h2 { margin:0 0 4px; font-size:18px; color:var(--gold); font-family:var(--label, inherit); line-height:1.5; text-shadow:3px 3px 0 #000; }
.intro .lede { margin:0 0 14px; color:var(--ink2); font-size:15px; line-height:1.45; }
.intro-steps { display:grid; gap:8px; margin:0 0 12px; padding:0; list-style:none; }
.intro-steps li { display:grid; grid-template-columns:34px 1fr; gap:12px; align-items:center; padding:9px 12px; background:var(--deep); border:2px solid var(--edge); }
.intro-steps li > div { min-width:0; }
.intro-steps .n { width:34px; height:34px; display:grid; place-items:center; background:var(--gold); color:var(--deep); font:400 13px var(--label, inherit); box-shadow:3px 3px 0 #000; }
.intro-steps b { display:block; font-size:15px; color:var(--ink); }
.intro-steps span:not(.n) { font-size:13.5px; color:var(--mute); line-height:1.4; }
.intro em { font-style:normal; color:var(--gold); }
.intro-goals { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:0 0 12px; }
.intro-goals div { padding:8px 12px; border:2px dashed var(--edge); font-size:13.5px; color:var(--ink2); line-height:1.4; }
.intro-goals b { display:block; color:var(--ink); font-size:13px; letter-spacing:.06em; text-transform:uppercase; }
.intro-note { margin:0 0 14px; font-size:12.5px; color:var(--faint); line-height:1.45; }
.intro-foot { display:flex; align-items:center; gap:10px; padding:0 24px; flex-wrap:wrap; }
.intro-foot .skip { margin-left:auto; font-size:13px; color:var(--mute); display:flex; gap:8px; align-items:center; cursor:pointer; }
@media (max-width:520px) { .intro h2 { font-size:13px; } .intro-goals { grid-template-columns:1fr; } .intro-art { height:110px; } .intro-body, .intro-foot { padding-left:16px; padding-right:16px; } }

/* circuit cards on the start screen: a scene across the top, name and one line below */
.start .tile.circ { padding:0 0 14px; gap:8px; min-height:0; overflow:hidden; text-align:left; }
.circ-art { display:block; width:calc(100% - 12px); margin:6px 6px 4px; aspect-ratio:16 / 7; object-fit:cover; image-rendering:pixelated; pointer-events:none; }
.start .tile.circ h3, .start .tile.circ p { margin:0; padding:0 16px; }

.start .tile.circ p.hook { color:var(--gold); font-size:13px; margin-top:-2px; }

/* track chips on the circuit cards, and the card that opens when one is hovered */
.start .tile.circ { overflow:visible; }
.start .tile.circ:hover { z-index:5; }
.trk-row { display:flex; flex-wrap:wrap; gap:6px; padding:0 16px; position:relative; }
.trk { position:relative; display:inline-block; padding:2px 8px; background:var(--deep); border:2px solid var(--edge); color:var(--ink); font:700 12px/1.5 var(--read, inherit); letter-spacing:.06em; cursor:help; }
.trk:hover { border-color:var(--gold); color:var(--gold); }
.trk-pop { display:none; position:absolute; left:-4px; bottom:calc(100% + 10px); width:max-content; max-width:min(270px, 80vw); padding:10px 12px; background:var(--deep); border:3px solid var(--edge); box-shadow:4px 4px 0 #000; text-align:left; letter-spacing:0; font-weight:400; z-index:20; cursor:default; }
.trk:hover .trk-pop { display:block; }
.trk-pop b { display:block; color:var(--gold); font-size:14px; margin-bottom:1px; }
.trk-pop .tp-loc { display:block; color:var(--faint); font-size:12px; margin-bottom:6px; }
.trk-pop .tp-r { display:block; font-size:12.5px; line-height:1.4; color:var(--ink2); margin-top:3px; }
.trk-pop .tp-r i { font-style:normal; display:inline-block; min-width:64px; color:var(--mute); }
.trk:nth-child(n+4) .trk-pop { left:auto; right:-4px; }

/* one popup per circuit: it opens from the whole chip row */
.trk { cursor:help; }
.trk:hover { border-color:var(--edge); color:var(--ink); }
.trk-row:hover .trk { border-color:var(--gold); color:var(--gold); }
.trk:hover .trk-pop { display:none; }
.trk-row:hover .trk-pop { display:block; }
.trk-pop { left:12px; right:auto; width:min(300px, 80vw); max-width:none; }
.trk-pop.wide { width:min(580px, 92vw); column-count:2; column-gap:16px; }
.start .tiles .tile:nth-child(3n) .trk-pop { left:auto; right:12px; }
.trk-pop .tp-h { display:block; column-span:all; margin-bottom:8px; padding-bottom:4px; border-bottom:2px solid var(--edge); color:var(--ink); font-size:12px; letter-spacing:.08em; text-transform:uppercase; }
.trk-pop .tp-t { display:block; break-inside:avoid; margin-bottom:10px; }
.trk-pop .tp-t b { margin-bottom:0; }
.trk-pop .tp-r i { min-width:72px; }

/* top-row cards open their popup downward so it never runs off the top of the page */
.start .tiles .tile:nth-child(-n+3) .trk-pop { bottom:auto; top:calc(100% + 10px); }

/* the circuit card is a single list of totals, so it never needs two columns */
.trk-pop, .trk-pop.wide { width:min(360px, 86vw); column-count:1; }
.trk-pop .tp-r i { min-width:72px; vertical-align:top; }
.trk-pop .tp-r { display:grid; grid-template-columns:76px 1fr; margin-top:5px; }

.trk-pop, .trk-pop.wide { width:max-content; max-width:min(480px, 90vw); }
.trk-pop .tp-nw { white-space:nowrap; }

/* the circuit picker fits one window: sizes follow the window height, and the page does not scroll when there is room */
.start:not(.setup) h1 { font-size:clamp(26px, 7vh, 60px); margin-bottom:clamp(8px, 2.4vh, 24px); }
.circ-art { aspect-ratio:auto; height:clamp(64px, 16vh, 160px); }
@media (min-width:1001px) and (min-height:720px) { html:has(.start .tile.circ), body:has(.start .tile.circ) { overflow:hidden; } }


/* no key-races line any more (they are in the hover card), so the cards are shorter and the scenes a little taller */
.circ-art { height:clamp(64px, 18vh, 175px); }
.start .tile.circ { padding-bottom:16px; }

/* wider cards so the scenes show whole (16:7) instead of being cropped at the sides */
.start:has(.tile.circ) { max-width:1120px; }
.circ-art { aspect-ratio:16 / 7; height:auto; }

.start:has(.tile.circ) .tiles { grid-template-columns:repeat(3, 1fr); }
@media (max-width:820px) { .start:has(.tile.circ) .tiles { grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); } }

.start:has(.tile.circ) { max-width:1360px; }
.start .tile.circ .trk-row { flex-wrap:nowrap; }

@media (max-width:1250px) { .start .tile.circ .trk-row { flex-wrap:wrap; } }

/* All stables sits in the top right corner of the circuit picker */
.start:has(.tile.circ) .start-saves { position:fixed; top:16px; right:20px; margin:0; z-index:20; }

/* the info card opens when the pointer is anywhere on the circuit card, not just on the chips */
.start .tile.circ:hover .trk-pop { display:block; }
.start .tile.circ:hover .trk { border-color:var(--gold); color:var(--gold); }
.start .tile.circ { cursor:pointer; }

/* the Patterns button lines up with the colour pills, not with their labels */
.swatches > .btn { align-self:flex-start; box-sizing:border-box; height:34px; margin-top:-2px; padding:0 18px; line-height:1; }

/* silks colour picker: a pill that opens a palette instead of the browser's own picker */
.swatch { position:relative; }
.swatch .pill { width:52px; height:30px; padding:0; border:2px solid var(--edge); border-radius:999px; cursor:pointer; }
.swatch .pill:hover { filter:brightness(1.12); }
.swatch .pill[aria-expanded="true"] { outline:3px solid var(--gold); outline-offset:2px; }
.cpop { position:absolute; left:0; top:62px; z-index:40; width:232px; padding:10px; background:var(--deep); border:3px solid var(--edge); box-shadow:4px 4px 0 #000; }
.cpop-grid { display:grid; grid-template-columns:repeat(8, 1fr); gap:6px; }
.cpop-c { aspect-ratio:1; padding:0; border:2px solid var(--edge); border-radius:0; cursor:pointer; }
.cpop-c:hover { border-color:var(--ink); transform:translate(1px, 1px); }
.cpop-c.on { border-color:var(--gold); box-shadow:0 0 0 2px var(--deep), 0 0 0 4px var(--gold); }


/* the name fields line up on the left */
.start.setup .field { align-items:flex-start; text-align:left; }
.start.setup .field input[type=text] { padding-left:8px; }
.start.setup .field input[type=text] { min-width:185px; width:185px; padding-top:8px; padding-bottom:8px; }

/* bankroll wheel: no glow on the selected row, no fade, no scrollbar; the mouse wheel steps through the amounts (see initWheel) */
.wheel-focus { box-shadow:none; background:rgba(255,255,255,.05); border-radius:0; }
.wheel { -webkit-mask-image:none; mask-image:none; overscroll-behavior:contain; }

/* the bankroll amount in the pixel font */
.setup-sum .cash { font-family:var(--label, inherit); font-weight:400; font-size:clamp(26px, 3vw, 38px); letter-spacing:0; line-height:1.4; text-shadow:3px 3px 0 #000; margin:2px 0 6px; }

/* bankroll summary: spread over the whole panel, bolder level line in the tier colour (as on the wheel), larger text */
.setup-sum { justify-content:space-between; padding:26px 30px; gap:0; }
.setup-sum .cash { font-size:clamp(30px, 3.6vw, 46px); margin:0; }
.setup-sum .blurb { margin:0; font-size:19px; font-weight:800; letter-spacing:.01em; color:var(--mute); }
.setup-sum .blurb.t-claiming { color:#fdba74; } .setup-sum .blurb.t-allowance { color:#86efac; } .setup-sum .blurb.t-stakes { color:#fde68a; }
.setup-sum .facts { gap:44px; margin:0; }
.setup-sum .facts dt { font-size:13px; margin-bottom:8px; }
.setup-sum .facts dd { font-size:26px; }
.setup-sum .facts dd b { font-size:26px; }
.setup-sum .facts .btn.icon { font-size:20px; padding:3px 14px; }
.setup-sum .start-go { align-self:flex-start; font-size:16px; padding:9px 24px; }


/* setup screens: a tighter header, with Back on the same line as the step tracker */
.start.setup { position:relative; padding-top:16px; }
.start.setup .setup-top { position:absolute; left:24px; top:16px; margin:0; z-index:2; }
.start.setup .steps { margin:7px 0 12px; }
.start.setup h1 { margin:0 0 2px; }
.start.setup .sub { margin:0 0 14px; }

/* circuit info rows stay on one line (a long race name is cut with an ellipsis rather than wrapping) */
.cinfo .lines li { flex-wrap:nowrap; align-items:baseline; }
.cinfo .lines li b { flex:0 1 auto; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cinfo .lines li span { flex:0 0 auto; white-space:nowrap; }


/* how-to-play card: wide, three steps across, so it fits one screen */
.intro-card { width:min(1040px, 96vw); }
.intro-art { height:clamp(90px, 17vh, 150px); object-position:50% 58%; }
.intro-body { padding:14px 28px 0; }
.intro h2 { font-size:clamp(15px, 2.4vh, 20px); }
.intro .lede { margin:0 0 12px; font-size:clamp(13px, 1.9vh, 16px); }
.intro-steps { grid-template-columns:repeat(3, 1fr); gap:12px; margin:0 0 12px; }
.intro-steps li { grid-template-columns:1fr; gap:8px; align-items:start; padding:12px 14px; }
.intro-steps li > div { min-width:0; }
.intro-steps .n { width:30px; height:30px; font-size:12px; }
.intro-steps b { font-size:15px; margin-bottom:2px; }
.intro-steps span:not(.n) { font-size:13.5px; line-height:1.4; }
.intro-goals { margin:0 0 10px; }
.intro-goals div { padding:8px 14px; }
.intro-note { margin:0 0 12px; }
.intro-foot { padding:0 28px; }
.intro-card { padding-bottom:16px; }
@media (max-width:820px) { .intro-steps { grid-template-columns:1fr; } .intro-steps li { grid-template-columns:34px 1fr; align-items:center; } .intro-body, .intro-foot { padding-left:16px; padding-right:16px; } }

.intro-art { height:clamp(100px, 21vh, 190px); object-position:50% 82%; }
.intro-steps li { align-content:start; }

/* the tour card stays in front of (and not dimmed by) the dialog backdrop */
.coach { z-index:90; }

/* preferred distance and surface in the scouting report */
.sp-attr .at.pf { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:3px 0; }
.sp-attr .at.pf b { font-size:13px; color:var(--ink); font-weight:700; }

/* the Next race text wraps instead of being cut to 'None ...' */
.sp-slot b { white-space:normal; overflow:visible; text-overflow:clip; }
.sp-slot .btn { grid-row:auto; }
.sp-next:has(.sp-target) { grid-template-columns:max-content minmax(0, 1fr); column-gap:8px; }
.sp-slot:has(> .sp-target:first-child) { grid-template-columns:minmax(max-content, 1fr) auto; column-gap:6px; }
.sp-slot b.sp-target { white-space:nowrap; font-size:clamp(12px, 1vw, 15px); }
.sp-next:has(.sp-target) .sp-slot .btn { padding-inline:6px; font-size:12px; }
.pk-target { margin:8px 0 12px; }


/* the tour highlight must not turn the fixed Run week button into a relative one (it jumped to the bottom left) */
.go.coach-hl { position:fixed; z-index:40; }

/* the entries list on the home tile has no box of its own */
.split .lines { padding:0; background:none; border:0; border-radius:0; }

/* circuit info: columns may shrink so long names are cut with an ellipsis instead of running out of the box */
.cinfo { grid-template-columns:repeat(auto-fit, minmax(min(300px,100%), 1fr)); overflow:hidden; }
.cinfo > div, .cinfo .lines, .cinfo .lines li { min-width:0; }
.cinfo .lines li b { flex:1 1 0; }
.cinfo .lines li span { max-width:60%; overflow:hidden; text-overflow:ellipsis; }
