/* Pixel theme (prototype). Loaded after ui.css: it only overrides, so deleting the <link> in index.html restores the Aurora look.
   Direction: a 16-bit management-game menu. Dark turf with mowing stripes, dirt-brown panels with cream pixel borders, hard offset shadows,
   no blur / glow / gradients / rounded corners, stepped (not smooth) motion, segmented meters. Headings use Press Start 2P,
   everything else Pixelify Sans so the stat tables stay readable. */
:root {
  --night:#0b1f15; --c1:#4cd964; --c2:#e8463c; --c3:#ffd447; --c-dirt:#8a5a2b;
  --cream:#f4ecd8; --ink:#f4ecd8; --ink2:#e6dcc3; --mute:#b9ad92; --faint:#8f8470;
  --panel:#2a1c12; --panel-2:#3a2818; --deep:#140d08;
  --glass:var(--panel); --glass-2:var(--panel-2); --edge:#6b5238; --edge-soft:rgba(244,236,216,.16); --hover:rgba(255,212,71,.1);
  --gold:#ffd447; --silver:#d5dbe3; --bronze:#d98a4a; --good:#4cd964; --bad:#ff6b5e; --mine:rgba(255,212,71,.12);
  --aurora:var(--gold);
  --d1:0ms; --d2:0ms; --d3:0ms;
}
*, *::before, *::after { border-radius:0 !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; }
html { background:var(--night); scroll-behavior:auto; }
body { font:17px/1.3 var(--pix-body);
  background:repeating-linear-gradient(90deg, #0e2a1b 0 72px, #0b2216 72px 144px); }   /* mowed-turf stripes */
.aurora { display:none; }

/* type */
.glow { background:none; -webkit-background-clip:border-box; background-clip:border-box; color:var(--gold); filter:none; text-shadow:4px 4px 0 #000; }
.hero h1, .start h1 { font-weight:400; letter-spacing:0; line-height:1.35; text-shadow:4px 4px 0 #000; font-size:clamp(22px, 3.4vw, 44px); }
.start h1 { font-size:clamp(28px, 5vw, 64px); line-height:1.3; }
.hero h1 .glow { filter:none; padding:0; margin:0; }

/* panels: the one look every container shares */
:is(.tile, .scroll, .banner, .hub, .farm-head, .modal, .wk-card, .rs-band, .bb, .card, .dd-menu, .toast, .wheel-wrap, .setup-sum, .cinfo) {
  background:var(--panel); }
:is(.tile, .scroll, .banner, .hub, .farm-head, .modal, .wk-card, .rs-band, .bb)::before,
:is(.tile, .scroll, .banner, .hub, .farm-head, .modal, .wk-card, .rs-band, .bb)::after,
.row::before, .row::after { display:none; }
.tile { transform:none !important; transition:none; padding:22px 24px; min-height:150px; }
.tile:hover { background:var(--panel-2); }
.tile:active { transform:translate(3px, 3px) !important; }
.tiles { perspective:none; gap:20px; }
.scroll { margin-bottom:22px; }
tr.win td:first-child { text-shadow:2px 2px 0 #000; }
.detail { background:var(--deep); }

/* list rows: a menu with a cursor */
.row { background:var(--panel); transition:none; }
button.row:hover { background:var(--panel-2); transform:none; }
button.row:hover .title::before { content:""; display:inline-block; margin-right:8px; vertical-align:-1px; border-style:solid; border-width:6px 0 6px 9px; border-color:transparent transparent transparent var(--gold); }
.row[data-g], .row[data-g=G2], .row[data-g=G3] { box-shadow:3px 3px 0 #000; }
.detail .row { background:transparent; border:0; border-bottom:2px dashed var(--edge-soft); box-shadow:none; }

/* nav: a title bar and a tab strip, the current tab lit gold */
.nav-in { padding:10px 24px; }
.brand svg { filter:none; }
.tabs { background:none; border:0; padding:0; }
.tab { transition:none; }
.dot { box-shadow:none; background:var(--gold); }

/* buttons and controls */
.btn { padding:8px 14px; transition:none; }
.btn.sm { padding:3px 10px; }
.go { padding:14px 22px; animation:bob 1s steps(2) infinite; transition:none; }
.go:hover { transform:none; animation:none; }
.go span { opacity:1; }
@keyframes bob { 0% { transform:translateY(0); } 100% { transform:translateY(-3px); } }
.seg { padding:3px; gap:3px; }
select, input[type=number], input[type=text], input:not([type]), input[type=search] { background:var(--deep); color:var(--ink); padding:6px 10px; }
select option { background:var(--deep); }
:focus-visible { outline-offset:2px; }

/* small parts */
.chip { background:var(--deep); line-height:17px; }
.chip.g1 { background:var(--gold); color:#2a1d00; border-color:#000; box-shadow:none; }
.chip.g2 { background:var(--silver); color:#1c2228; border-color:#000; box-shadow:none; }
.chip.g3 { background:var(--bronze); color:#241200; border-color:#000; box-shadow:none; }
.chip.mine { border-color:#000; }
.cloth { border:2px solid #000; }
.meter { width:80px; height:12px; }
.meter i { box-shadow:none; -webkit-mask:repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); mask:repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); }
.surf { width:8px; height:8px; }
.tip { background:var(--deep); }
.coach { background:rgba(20, 13, 8, .72); }   /* the tour card is translucent, so the page shows through a little */
.coach { animation:none; }
.coach-hl { animation:none; }
.toast { box-shadow:inset 0 0 0 3px var(--deep), 4px 4px 0 #000; }

/* stepped motion: things pop in on a few frames instead of gliding */
.enter .hero h1, .enter .hero p, .enter .tiles > *, .enter > .hub, .enter > .tools, .enter > .scroll, .enter > .row, .enter > .card, .enter > .banner, .enter > h1, .enter > .stats { animation-timing-function:steps(4, end) !important; animation-duration:.32s !important; }

/* readability pass: Press Start 2P is kept only for the big titles; everything else is Pixelify Sans, larger and bolder */
:root { --pix-title:"Press Start 2P", ui-monospace, monospace; }
body { font-smooth:auto; }
.tab[aria-current="page"] { font-weight:700; }
.btn { font-size:16px; }
.btn.sm, .seg button, select, input { font-size:16px; }

/* hybrid: pixel for the frame (nav, titles, buttons, labels), a clean font for anything you read or compare (rows, tables, stats, tooltips) */
/* one pixel font throughout; set back to Inter here for a clean data font */
.tip, .coach { font-size:16px; }
/* quieter lists: no stacked double borders and shadows on every row, so long pages are easier to scan */
.row { margin-bottom:6px; padding:11px 16px; }
.row[data-g=G2] { border-left:8px solid var(--silver); } .row[data-g=G3] { border-left:8px solid var(--bronze); }

/* replay strip */
.track { background:#0f5132; }
.lane { border-bottom:2px dashed rgba(244,236,216,.25); }
.hr { border:2px solid #000; font-weight:700; }

/* legibility pass 2: DotGothic16 has clearly different 2/3/8 and C/O. It has one weight, so no bold (a faked bold blurs it); emphasis comes from colour and size. */
:root { --pix-head:"DotGothic16", ui-sans-serif, system-ui, sans-serif; }
*, *::before, *::after { font-synthesis:none; }
body, button, select, input, td, th, h2, h3, b, strong, .tab, .brand, .btn, .chip, .row, .tile, .go, .status, .count, .tile dd, .stats b, .seg button { font-weight:400 !important; }

/* a touch bolder: DotGothic16 has one weight, so thicken the strokes by 0.5px (a stroke in the text colour) instead of a blurry faux-bold */

/* the old neon ring that traced around the Run week button: the pixel button already bobs, so the ring goes */
.go-ring { display:none; }

/* toggles: a square two-state switch that snaps (no slide), green when on */
label.check input[type="checkbox"] { width:48px; height:26px; background:var(--deep); transition:none; }
label.check input[type="checkbox"]::before { left:3px; width:14px; height:14px; background:var(--mute); border:0; box-shadow:none; transition:none; }
label.check input[type="checkbox"]:hover { border-color:var(--gold); }
label.check input[type="checkbox"]:checked { border-color:var(--cream); }
label.check input[type="checkbox"]:checked::before { left:25px; }
label.check input[type="checkbox"]:active { transform:translate(2px, 2px); box-shadow:1px 1px 0 #000; }
label.check input[type="checkbox"]:focus-visible { outline:3px solid var(--gold); outline-offset:2px; box-shadow:3px 3px 0 #000; }
.swatch input { border:0; background:transparent; padding:0; }

/* selectors and tabs: the sliding blob / indicator behind the active item is hidden; the active button itself lights up and snaps */
.seg-blob, .tab-ind { display:none !important; }
.seg button { transition:none; padding:5px 12px; }
.seg button:hover:not([aria-pressed="true"]) { background:var(--hover); color:var(--ink); }
.seg { flex-wrap:nowrap; }

/* replay: drawn at ~400px across (see Replay3DPixelWidth in index.html, 0 turns it off), scaled with hard edges, colours cut to 8 levels per channel */
.r3d-canvas { image-rendering:pixelated; filter:url(#px-post); }

/* stall prev/next arrows: square pixel buttons with drawn triangles instead of the â€¹ â€º text characters (which the pixel font centres badly) */
.shed-arrow, .scene-nav .shed-arrow { width:44px; height:44px; padding:0; font-size:0; line-height:0; display:inline-grid; place-items:center; background:var(--panel); transition:none; color:transparent; }
.shed-arrow::before { display:block; }
.shed-arrow[data-a="-1"]::before { border-width:9px 11px 9px 0; border-color:transparent var(--cream) transparent transparent; margin-right:3px; }
.shed-arrow[data-a="1"]::before { border-width:9px 0 9px 11px; border-color:transparent transparent transparent var(--cream); margin-left:3px; }
.shed-arrow:hover:not(:disabled) { background:var(--panel-2); }
.shed-arrow[data-a="-1"]:hover:not(:disabled)::before { border-right-color:var(--gold); }
.shed-arrow[data-a="1"]:hover:not(:disabled)::before { border-left-color:var(--gold); }
.shed-arrow:active:not(:disabled), .scene-nav .shed-arrow:active:not(:disabled) { transform:translate(3px, 3px); box-shadow:0 0 0 #000; }
.shed-arrow:disabled { opacity:.35; box-shadow:none; border-color:var(--edge); }
.scene-nav { gap:10px; }

/* arrows, take 2: the triangle is absolutely centred in the button (clip-path shape, no border tricks or margins) so it cannot drift */
.scene-nav .shed-arrow { position:relative; }
.shed-arrow { display:block; }
.shed-arrow::before { content:""; position:absolute; left:50%; top:50%; width:14px; height:18px; margin:0 !important; border:0 !important; background:var(--cream); }
.shed-arrow[data-a="-1"]::before { transform:translate(-50%, -50%) translateX(-1px); clip-path:polygon(100% 0, 0 50%, 100% 100%); }
.shed-arrow[data-a="1"]::before { transform:translate(-50%, -50%) translateX(1px); clip-path:polygon(0 0, 100% 50%, 0 100%); }
.shed-arrow:hover:not(:disabled)::before { background:var(--gold); }

/* cash readout: the number that matters most, so it reads as a gold badge */
.status .money { padding:3px 14px; border:2px solid rgba(246,201,69,.55); border-radius:8px; background:rgba(246,201,69,.1); }
.status .money.bad { color:var(--bad); border-color:var(--bad); background:rgba(220,60,60,.12); }

/* Pixel theme, part 2 (was theme-pixel2.css; it is now the second half of this file and must stay below part 1).
   What changes:
   1. Reading text (rows, tables, paragraphs, buttons) is Atkinson Hyperlegible, a font made for legibility. Press Start 2P stays only on short labels, tab names, brand and big numbers.
   2. Panels are beveled: light top-left edge, dark bottom-right edge, recessed inner line.
   3. Tabs are plain words split by "//", the active one is gold with a pointer.
   4. One accent colour (gold). Green and red are kept for status only. */

:root {
  --label:"Press Start 2P", ui-monospace, monospace;
  --read:"IBM Plex Sans", "Atkinson Hyperlegible", ui-sans-serif, system-ui, "Segoe UI", sans-serif;   /* plain zeros (Atkinson's slashed zero looks like a strikethrough in prices) */
  --pix-head:var(--read); --pix-body:var(--read); --data:var(--read); --sans:var(--read);
  --bevL:#8a6a46; --bevD:#0d0703; --bevD2:#1d130b;
  --acc:#ffd447; --acc-d:#c9a227; --acc-dd:#8f7016; --acc-l:#ffe27a;
  --bevel:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), inset 0 0 0 6px var(--deep), 5px 5px 0 #000;
  --bevel-s:inset 2px 2px 0 var(--bevL), inset -2px -2px 0 var(--bevD2);
}

/* ---- type: clean body, no stroke, real bold ---- */
body, button, select, input, td, th, h2, h3, b, strong, .row, .tile, .chip, .status, .seg button, .btn, .go { font-family:var(--read); }
body { font-size:17px; line-height:1.4; -webkit-text-stroke:0; font-synthesis:weight; -webkit-font-smoothing:auto; }
body, td, .row, .row .title, .row .meta, .tile p, .tile .sub, .tile .name, .tile .meta, .lines li, .chip, .cloth, .tip, .coach, .detail, .pp-head, .banner, .toast, .empty,
select, input, .seg button, .status, .btn.sm { font-family:var(--read); font-weight:400 !important; letter-spacing:0; }
.row .title, td b, .lines li b, .tile .name, b, strong { font-weight:700 !important; }
.btn, .seg button, .chip, .status, .row .lead { font-weight:700 !important; }
td, .row .meta, .tile p, .tile .sub, .lines li { font-size:16px; }
.chip { font-size:13px; }
td { font-variant-numeric:tabular-nums; }
.row .title, td b { color:var(--cream); }
.hero h1, .start h1, .tile dd, .stats b { -webkit-text-stroke:0; }

/* labels, titles, numbers stay pixel */
.brand { font:400 10px/1.4 var(--label); letter-spacing:0; color:var(--acc); text-shadow:2px 2px 0 #000; -webkit-text-stroke:0; }
h2 { font:400 14px/1.6 var(--label); letter-spacing:0; color:var(--cream); text-shadow:3px 3px 0 #000; margin:34px 0 14px; display:flex; align-items:center; }
h2::before { content:""; flex:none; width:10px; height:10px; margin-right:10px; background:var(--acc); box-shadow:3px 3px 0 #000; }
.sp-head h2 { font:400 clamp(16px, 1.7vw, 20px)/1.5 var(--label); margin:0 0 8px; display:block; }
.sp-head h2::before { display:none; }
.hero p { font:400 10px/1.6 var(--label); letter-spacing:0; color:var(--acc); }
.hero h1, .start h1 { font-family:var(--label); }
.tile h3 { font:400 12px/1.5 var(--label); color:var(--acc); letter-spacing:0; }
.tile .label, .tile dt, .stats span { font:400 8px/1.8 var(--label); letter-spacing:0; text-transform:uppercase; color:var(--faint); }
.tile dd { font:400 20px/1.3 var(--label); letter-spacing:0; color:var(--cream); text-shadow:3px 3px 0 #000; }
.tiles.res .tile h3, .tiles.res .tile h2 { font:400 clamp(14px, 1.7vw, 20px)/1.4 var(--label); }
.tile dd small { font:700 15px var(--read); text-shadow:none; }
.stats b { font:400 clamp(20px, 2.6vw, 30px)/1.3 var(--label); letter-spacing:0; text-shadow:3px 3px 0 #000; }
th { font:700 12px/1.4 var(--read) !important; letter-spacing:.08em; text-transform:uppercase; color:var(--faint); background:var(--deep); padding:12px 10px; border-bottom:3px solid var(--bevD); box-shadow:inset 0 -2px 0 var(--bevL); }
.go { font:400 12px/1.4 var(--label); letter-spacing:0; }
.go span { font:700 15px var(--read); }
.row .lead { font:400 9px var(--label); color:var(--acc); }
.status .money { color:var(--acc); }
.status { font-size:15px; }
.count { font:400 8px var(--label); background:var(--acc); color:var(--deep); }

/* ---- panels: beveled ---- */
:is(.tile, .scroll, .banner, .hub, .farm-head, .modal, .wk-card, .rs-band, .bb, .card, .dd-menu, .toast, .wheel-wrap, .setup-sum, .cinfo) {
  border:4px solid var(--bevD); box-shadow:var(--bevel); }
.tile:hover { box-shadow:var(--bevel), 0 0 0 3px var(--acc); }
/* clickable cards (circuit, scenario and similar choices): no outline; hover presses the card into its shadow, like the buttons */
button.tile:hover { background:var(--panel-2); transform:translate(3px, 3px); box-shadow:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), inset 0 0 0 6px var(--deep), 2px 2px 0 #000; }
.tile:active { box-shadow:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), 2px 2px 0 #000; }
.detail { border:3px solid var(--bevD); border-top:0; box-shadow:inset 2px 0 0 var(--bevL), inset -2px 0 0 var(--bevD2); }
.tip, .coach { border:3px solid var(--bevD); box-shadow:var(--bevel-s), 4px 4px 0 #000; }
.coach { border-color:var(--acc); box-shadow:4px 4px 0 #000; }
.coach-hl { outline:0; }   /* the tour card names the button to press; no yellow box around it */
.row { border:3px solid var(--bevD); box-shadow:var(--bevel-s); }
button.row:hover { border-color:var(--bevD); box-shadow:var(--bevel-s), 0 0 0 3px var(--acc); }
.row[data-g] { border-left:8px solid var(--acc); }
td { border-bottom:1px solid var(--edge-soft); }
tbody tr:hover td { background:rgba(255,212,71,.1); }
tr.pp > td { background:var(--deep); }

/* ---- toggle: knob centred vertically in its track ---- */
label.check input[type="checkbox"]::before { top:50%; margin-top:-7px; }

/* ---- race search: one beveled field (the box had its own border and the input inside had another) ---- */
.rsearch { height:38px; padding:0 12px; gap:8px; border:3px solid var(--bevD); background:var(--deep); box-shadow:var(--bevel-s); color:var(--mute); }
.rsearch:focus-within { border-color:var(--bevD); box-shadow:var(--bevel-s), 0 0 0 3px var(--acc); color:var(--cream); }
.rsearch input[type="search"] { border:0; box-shadow:none; background:none; padding:0; height:auto; outline:0; font-size:15px; color:var(--cream); }
.rsearch input[type="search"]::placeholder { color:var(--faint); }
.rsearch input[type="search"]::-webkit-search-cancel-button { filter:invert(.8); }

/* ---- stable list All / Fit / Farm switch: the buttons share the full width (no empty strip after the last one) ---- */
.barn-side > .seg { display:flex; }
.barn-side > .seg button { flex:1 1 auto; white-space:nowrap; text-align:center; justify-content:center; padding-left:8px; padding-right:8px; }

/* ---- Races list: each race is its own panel that pops in one after another, like the Calendar rows.
        (the list used to sit inside one big container panel that animated as a single block) ---- */
.page > .card:has(> .row) { background:none; border:0; box-shadow:none; padding:0; animation:none; }
.enter > .card:has(> .row) > .row { animation:rise .42s var(--ease-emph) backwards; animation-timing-function:steps(4, end); animation-duration:.32s; }
.enter > .card:has(> .row) > .row:nth-child(1) { animation-delay:.04s; }
.enter > .card:has(> .row) > .row:nth-child(2) { animation-delay:.08s; }
.enter > .card:has(> .row) > .row:nth-child(3) { animation-delay:.12s; }
.enter > .card:has(> .row) > .row:nth-child(4) { animation-delay:.16s; }
.enter > .card:has(> .row) > .row:nth-child(5) { animation-delay:.2s; }
.enter > .card:has(> .row) > .row:nth-child(6) { animation-delay:.24s; }
.enter > .card:has(> .row) > .row:nth-child(7) { animation-delay:.28s; }
.enter > .card:has(> .row) > .row:nth-child(n+8) { animation-delay:.32s; }

/* ---- nav: flat title bar, // dividers, gold pointer on the active tab ---- */
.nav, body.scrolled .nav { background:var(--deep); border-bottom:4px solid var(--bevD); box-shadow:inset 0 -3px 0 var(--bevL); }
.tabs { gap:0; align-items:center; }
.tab { border:0; background:none; box-shadow:none; color:var(--mute); padding:9px 5px; font:400 9px/1 var(--label); letter-spacing:-.02em; text-transform:uppercase; -webkit-text-stroke:0; }
.tab + .tab::before { content:"//"; color:#5c4630; margin-right:8px; }
.tab:hover { color:var(--cream); border:0; }
.tab[aria-current="page"] { color:var(--acc); background:none; border:0; box-shadow:none; text-shadow:2px 2px 0 #000; -webkit-text-stroke:0; }
/* the active tab has a pointer on each side (left one replaces the // divider); the first tab has no left pointer, the last no right one */
.tab[aria-current="page"]::before { content:""; display:inline-block; margin:0 7px 0 0; border-style:solid; border-width:5px 7px 5px 0; border-color:transparent var(--acc) transparent transparent; }
.tab[aria-current="page"]:first-of-type::before, .tab[aria-current="page"]:last-of-type::after { display:none; }
.tab[aria-current="page"]::after { content:""; display:inline-block; margin-left:7px; border-style:solid; border-width:5px 0 5px 7px; border-color:transparent transparent transparent var(--acc); }

/* ---- controls: gold, beveled ---- */
.btn { background:var(--panel-2); border:3px solid var(--bevD); box-shadow:var(--bevel-s), 3px 3px 0 #000; color:var(--cream); }
.btn:hover { background:#4a3420; border-color:var(--bevD); transform:translate(3px, 3px); box-shadow:var(--bevel-s); }   /* hover presses the button into its shadow (no outline) */
.btn:active { transform:translate(3px, 3px); box-shadow:none; }
.btn.primary, .go { background:var(--acc-d); color:var(--deep); border:3px solid var(--bevD); box-shadow:inset 3px 3px 0 var(--acc-l), inset -3px -3px 0 var(--acc-dd), 4px 4px 0 #000; }
.btn.primary:hover, .go:hover { background:var(--acc); }
.go:active { box-shadow:none; transform:translate(4px, 4px); }
.btn.mytargets { background:var(--acc-d); color:var(--deep); }
.seg { background:var(--deep); border:3px solid var(--bevD); box-shadow:var(--bevel-s); }
.seg button[aria-pressed="true"], .seg.liq button[aria-pressed="true"] { background:var(--acc-d); color:var(--deep); -webkit-text-stroke:0; box-shadow:inset 2px 2px 0 var(--acc-l), inset -2px -2px 0 var(--acc-dd); }
select, input[type=number], input[type=text], input:not([type]), input[type=search] { border:3px solid var(--bevD); box-shadow:var(--bevel-s); font-size:15px; }
.chip { border:2px solid var(--bevD); }
.chip.mine { background:var(--acc-d); color:var(--deep); }
.meter { border:2px solid var(--bevD); box-shadow:var(--bevel-s); background:#150e08; }
.meter i { background:var(--acc-d) !important; }
.shed-arrow, .scene-nav .shed-arrow { border:3px solid var(--bevD); box-shadow:var(--bevel-s), 3px 3px 0 #000; }
.shed-arrow:hover:not(:disabled) { border-color:var(--bevD); transform:translate(3px, 3px); box-shadow:var(--bevel-s); }
label.check input[type="checkbox"] { border:3px solid var(--bevD); box-shadow:var(--bevel-s), 3px 3px 0 #000; }
label.check input[type="checkbox"]:checked { background:var(--acc-d); }
label.check input[type="checkbox"]:checked::before { background:var(--deep); }
.track { border:4px solid var(--bevD); box-shadow:var(--bevel); }
:focus-visible { outline:3px solid var(--acc); }

/* Top Performance: the big Beyer matches the other big numbers (pixel font, no squeezed heavy sans) */
.headline b, .headline b.glow { font:400 56px/1.1 var(--label) !important; letter-spacing:0 !important; color:var(--acc); text-shadow:4px 4px 0 #000; }
/* cash badge in the header, last in the cascade so no earlier theme rule shrinks it */
.status .money { font:700 24px/1.15 var(--read) !important; letter-spacing:0; text-shadow:none; }

/* Home leaderboard: no dark slab behind the column headings, just a gold rule under them */
.tile table.board th { background:transparent !important; box-shadow:none !important; border-bottom:2px solid var(--acc-d) !important; padding:8px 4px 6px; }

/* count badges (My targets, Races tab): the pixel font sits low in its line box, so centre the digits explicitly */
.count, .btn.mytargets .count { display:inline-flex !important; align-items:center; justify-content:center; line-height:1 !important; height:18px; min-width:20px; padding:1px 6px 0 !important; vertical-align:middle; box-sizing:border-box; }

/* ---------- Stable scene in pixel art (assets/art/px): the horse looks out over a painted half-door in a pixel shedrow ---------- */
.scene { border-radius:0; border:3px solid var(--bevD); box-shadow:var(--bevel-s), 5px 5px 0 #000; background:var(--deep); }
.scene::after { background:linear-gradient(180deg, rgba(10,6,3,.35), rgba(10,6,3,0) 22%, rgba(10,6,3,0) 76%, rgba(10,6,3,.45)); }
.scene-main { image-rendering:pixelated; filter:drop-shadow(6px 6px 0 rgba(0,0,0,.45)); }
.scene-main .art, .scene-main img { image-rendering:pixelated; }
.scene-main img { object-fit:contain; object-position:50% 100%; }
.scene-main img.fb { inset:0; width:100%; height:100%; object-fit:contain; }
.scene-main.tired { transform:translateY(6%); }
.scene-main.tired img { filter:brightness(.88) saturate(.85); }
/* sidebar thumbnails: just the face, cropped from the front-facing head */
.side-h { gap:10px; }
.side-hd { flex:0 0 auto; width:40px; height:50px; overflow:hidden; background:var(--deep); box-shadow:var(--bevel-s); display:block; }
.side-hd img { display:block; width:100%; height:100%; object-fit:contain; object-position:50% 100%; image-rendering:pixelated; }
.side-h { grid-template-columns:40px minmax(0, 1fr) auto !important; }
.side-dot { position:absolute; left:6px; top:6px; z-index:2; width:10px; height:10px; border-radius:0; box-shadow:0 0 0 2px #000; }

/* season grade over the shedrow */
.scene .strip::after { content:''; position:absolute; inset:0; pointer-events:none; }
.scene.sea-snow .strip { filter:saturate(.7) brightness(1.04); }
.scene.sea-snow .strip::after { background:rgba(150,190,255,.3); mix-blend-mode:soft-light; }
.scene.sea-dawn .strip::after { background:rgba(255,150,190,.16); mix-blend-mode:soft-light; }
.scene.sea-dusk .strip::after { background:rgba(255,120,40,.2); mix-blend-mode:soft-light; }
.scene.sea-summer .strip { filter:saturate(1.15) brightness(1.06); }
/* Stable panel: a dropdown (Training) opens upward, so the menu never hangs past the panel's bottom edge and adds a scrollbar that reflows everything */
.scene-panel .dd-menu { top:auto; bottom:calc(100% + 6px); }

/* page head: the tab's name in the title font, one quiet line under it */
.empty b { font:700 14px var(--read); }

@media (max-width:520px) { .status .money { font-size:18px !important; padding:2px 8px; } }

/* ---------- Results landing: a stats band over two short boxes, no stretched empty panels ---------- */
.tiles.res { grid-template-columns:repeat(12, minmax(0, 1fr)); align-items:stretch; align-content:start; grid-auto-rows:auto; height:auto; }
.tiles.res > .tile { min-height:0; align-self:stretch; padding:18px 22px 20px; gap:8px; }
.tiles.res > .res-mine { grid-column:span 7; } .tiles.res > .res-around { grid-column:span 5; }
.tiles.res .tile h3 { margin-bottom:2px; } .tiles.res .tile h3::after { width:32px; height:32px; font-size:22px; padding-bottom:2px; border-radius:0; box-shadow:var(--bevel-s); }
.tiles.res .tile .label { margin:10px 0 0; }
.tiles.res .tile .lines li { font-size:15px; padding:5px 0; }
.rs-two { display:grid; grid-template-columns:1fr 1fr; gap:0 22px; }
.tiles.res .rs-chips { margin-top:auto; padding-top:10px; }
@media (max-width:1100px) { .tiles.res > .res-mine, .tiles.res > .res-around { grid-column:1 / -1; } }

.rs-h { display:flex; justify-content:space-between; }
.tiles.res .tile .rs-h { display:flex; justify-content:space-between; padding:0 !important; margin-left:0 !important; margin-right:0 !important; text-indent:0; }
.tiles.res .tile .rs-h span { padding:0; margin:0; }
.tiles.res .tile .rs-h span:last-child { text-align:right; }

/* Results landing fits one screen: fixed-height grid (set in ui.js fitResults), boxes clip instead of growing */
.tiles.res { grid-template-rows:auto minmax(0, 1fr); }
.tiles.res > .tile { overflow:hidden; min-height:0; }
.shell:has(.tiles.res) { padding-top:8px; }

/* Results boxes: headings sit close to their lists, the same distance everywhere */
.tiles.res > .tile { gap:0; padding-top:16px; padding-bottom:14px; }
.tiles.res .tile .label { margin:11px 0 2px !important; }
.tiles.res .tile .lines li { padding:4px 0; }
.tiles.res .tile .meta { margin:3px 0 0; }
.tiles.res .tile .rs-two .label { margin-top:11px !important; }
.tiles.res .tile h3 { margin-bottom:0 !important; }

/* My Results: the sections are spread evenly from the title to the bottom edge */
.tiles.res > .res-mine { display:flex; flex-direction:column; justify-content:space-between; }
.tiles.res > .res-mine .rs-sec { display:block; }
.tiles.res > .res-mine .rs-sec .label { margin-top:0 !important; }

/* My Results page stats strip: eleven equal columns, every number and label centred on the same lines */

/* My Results strip, take 2: equal gaps between the visible text (not just between column centres): cells are as wide as their own text and the free space is shared out evenly */

/* One record strip for the Results landing and the My Results page: pixel-font numbers, plain small caps labels, every number and label on the same lines, equal gaps between the visible text */
.rs-band { display:flex; justify-content:space-between; flex-wrap:wrap; gap:14px 10px; padding:16px 22px 14px; }
.tiles.res > .res-stats { grid-column:1 / -1; }
.rs-band .rs-c { flex:0 0 auto; position:relative; align-items:center; text-align:center; gap:4px; padding-bottom:18px; }
.rs-band .rs-c b { font:400 clamp(16px, 1.5vw, 22px)/1.3 var(--label); letter-spacing:0; color:var(--cream); text-shadow:3px 3px 0 #000; overflow:visible; }
.rs-band .rs-c span { font:700 10px/1.4 var(--read); letter-spacing:.08em; white-space:nowrap; color:var(--faint); text-transform:uppercase; }
.rs-band .rs-c small { position:absolute; left:50%; bottom:0; transform:translateX(-50%); white-space:nowrap; font:400 13px var(--read); color:var(--mute); }
.tiles.res .rs-band .rs-c b { font-size:clamp(16px, 1.5vw, 22px); }
.tiles.res .rs-band .rs-c span { font-size:10px; }

.btn.primary:hover, .go:hover { transform:translate(3px, 3px); box-shadow:inset 3px 3px 0 var(--acc-l), inset -3px -3px 0 var(--acc-dd), 1px 1px 0 #000; }

/* My targets: no glow or pale border (ui.css gave it an orange glow); it is a normal pixel button with the count in parentheses */
.btn.mytargets { border-color:var(--bevD); box-shadow:var(--bevel-s), 3px 3px 0 #000; padding:8px 18px; }
.btn.mytargets:hover { box-shadow:var(--bevel-s); }
.btn.mytargets:active { box-shadow:none; }

/* the door rail starts at 63.5cqh in the panorama art; the foreground used to start 1.5cqh higher and showed a dark strip of wall between the horse and the rail. Starting it at the rail makes the horse flush with the door */
.strip-fg { clip-path:inset(63.5cqh 0 0 0); }

/* the count next to a tab name (Races 4): plain yellow text, no box, on the same line as the tab name */
.tab .count { background:none !important; box-shadow:none !important; color:var(--gold) !important; font:inherit !important; font-weight:400 !important; height:auto !important; min-width:0 !important; padding:0 !important; margin-left:7px; line-height:inherit !important; display:inline !important; vertical-align:baseline !important; border:0 !important; }

.tab .count { margin-left:3px; }

/* the record strip only leaves room under a figure when that cell has a note (graded wins), so the tile fits the text */
.rs-band .rs-c { padding-bottom:0; }
.rs-band .rs-c:has(small) { padding-bottom:18px; }
.rs-band { padding:16px 22px; }

/* recent form chips: pixel font, and no glow on the win */
.fin { font:400 11px/1.4 var(--label); letter-spacing:0; }
.fin.won { box-shadow:none; }

/* recent form chips: smaller, text centred, solid fills (gold, silver, bronze for the top three) */
.fin { display:inline-flex; align-items:center; justify-content:center; min-width:44px; padding:7px 8px 6px 10px; font-size:9px; line-height:1; background:#3a2a1c; border:0; color:var(--cream); }
.fin.p1, .fin.won { background:#e6b422; color:#2a1d00; }
.fin.p2 { background:#b9bcc2; color:#23262b; }
.fin.p3 { background:#b0753a; color:#2a1608; }

/* Stable top bar: three even cells (assistant, approach, weekly cost), everything centred on one line */
.barn-top { display:grid; grid-template-columns:1fr 1fr auto; align-items:stretch; gap:0; flex-wrap:nowrap; }
.barn-top .bt-b { display:flex; flex-direction:row; align-items:center; justify-content:flex-start; gap:10px; min-height:54px; padding:8px 18px; margin:0; box-sizing:border-box; }
.barn-top .bt-b:last-child { margin-left:0; justify-content:flex-end; border-right:0; padding-left:26px; }
.barn-top .bt-t { line-height:1; margin:0; padding-top:1px; white-space:nowrap; }
.barn-top .bt-b > .info, .barn-top .bt-b > [class*="info"] { flex:none; align-self:center; }
.barn-top .seg { margin-left:auto; align-self:center; }
.barn-top .bt-cost .bt-t { margin-right:2px; }
.barn-top .bt-cost .wk-cost { display:inline-flex; align-items:center; gap:8px; line-height:1; }
.barn-top .bt-cost .wk-cost i { display:inline-flex; align-items:center; font-style:normal; line-height:1; }

.barn-top .seg { margin-left:6px; }

/* race list: the white race condition in the pixel font, squeezed 80% narrower (the squeeze is done by squeezeTitles() in ui.js so the gap closes too) */
@media (min-width:521px) { .row:not(.rrow) > .surf + .title > .tx, .row.cal > .title > .tx, .row > .title > .tx { display:inline-block; font:400 12px/1.5 var(--label) !important; letter-spacing:0; white-space:nowrap; transform:scaleX(.8); transform-origin:left center; vertical-align:middle; } }

/* Career and Results tiles: the same beveled box as the Home tiles (the old glass border and glow are gone) */
.tiles.res .tile { border:4px solid var(--bevD); box-shadow:var(--bevel); transition:none; }
.tiles.res .tile:hover { border-color:var(--bevD); box-shadow:var(--bevel), 0 0 0 3px var(--acc); }
.tiles.res .tile:active { box-shadow:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), 2px 2px 0 #000; }

/* Stable tab: the horse list and the assistant bar get the Home tile bevel */
.barn-side, .barn-top { border:4px solid var(--bevD); box-shadow:var(--bevel); background:var(--panel, #2a1c12); }

/* winner's circle photo in the week review */
.wc { margin:12px 0 10px; border:4px solid var(--bevD); box-shadow:var(--bevel); background:#000; }
.wc-cv { display:block; width:100%; height:auto; image-rendering:pixelated; min-height:60px; }
.wc figcaption { padding:6px 10px; font:400 9px/1.4 var(--label); letter-spacing:.04em; color:var(--faint); background:var(--panel); text-transform:uppercase; }

/* Career tab photo wall */
.tile.wall { display:block; width:100%; text-align:left; margin:0 0 12px; cursor:pointer; }
.wall-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:8px; }
.wall-grid.big { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px; }
.wall-fig { margin:0 !important; border-width:3px; }
.wall-fig figcaption { display:flex; flex-direction:column; gap:2px; padding:4px 6px; font-size:7px; }
.wall-fig figcaption b { font-weight:400; color:var(--text, #fff); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wall-fig figcaption span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wall-grid.big .wall-fig figcaption { font-size:9px; padding:6px 8px; }
.wall-n { margin:8px 0 0; font-size:11px; }
@media (max-width:620px) { .wall-grid:not(.big) { grid-template-columns:repeat(2,1fr); } }
.rec-chart .cc.big .cc-plot { height:84px; }
.rec-chart .cc { margin:8px 0 0; }
.rec-chart .cc.big .cc-val { font-size:18px; }
.rec-top + .tile.wall, .rec-page > .tile.wall { margin-top:12px; }

/* Stable record headline numbers: shrink to fit the box, even at $10,000,000+ (11 characters of Press Start 2P are 11em wide) */
.rec-big, .tile.rec > dl { container-type:inline-size; width:100%; flex-wrap:wrap; }
.rec-big dd, .tile.rec > dl dd { font-size:min(30px, 14cqw) !important; white-space:nowrap; }
.rec-big > div:nth-child(3), .tile.rec > dl > div:nth-child(3) { flex-basis:100%; }
.rec-big > div:nth-child(3) dd, .tile.rec > dl > div:nth-child(3) dd { font-size:min(30px, 7.5cqw) !important; }

.rec-band { margin-bottom:12px; }

/* Career tiles: centred in the page, and the hover is the button press (no yellow ring) */
.tiles.res.car { align-content:center; }
.tiles.res .tile:hover { border-color:var(--bevD); box-shadow:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), inset 0 0 0 6px var(--deep), 2px 2px 0 #000; transform:translate(3px, 3px); }
.tiles.res .tile.rec:hover { transform:none; box-shadow:var(--bevel); }

/* horse card footer + rename box */
.sp-foot { display:flex; justify-content:flex-start; align-items:center; gap:10px; margin-top:10px; font-size:12px; }
.rn-msg { min-height:1.4em; } .rn-msg.bad { color:#ff7b6b; }

/* Where you race: long meet dates wrap onto a second line instead of being cut off */
.cinfo .lines li { align-items:flex-start; }
.cinfo .lines li span { white-space:normal; overflow:visible; text-overflow:clip; max-width:68%; }

/* sidebar horse names: one line, sized to fit (ui.js fitSideNames) */
.side-t b { white-space:nowrap; overflow:hidden; text-overflow:clip; }

/* No yellow boxes: hover and focus press the row, tile or field into its shadow like the buttons do */
.tile:hover { box-shadow:var(--bevel); }
button.row:hover, a.row:hover, .row[data-act]:hover { border-color:var(--bevD); background:var(--panel-2); transform:translate(3px, 3px); box-shadow:inset 3px 3px 0 var(--bevL), inset -3px -3px 0 var(--bevD2), 2px 2px 0 #000; }
button.row:active, .row[data-act]:active { transform:translate(3px, 3px); box-shadow:inset 3px 3px 0 var(--bevD2), inset -3px -3px 0 var(--bevL), 1px 1px 0 #000; }
.rsearch:focus-within { box-shadow:inset 3px 3px 0 var(--bevD2), inset -3px -3px 0 var(--bevL); }
:focus-visible { outline:3px dotted var(--cream); outline-offset:-7px; }
label.check input[type="checkbox"]:focus-visible { outline:3px dotted var(--cream); outline-offset:2px; }
