/* ═══════════════════════════════════════════════════════════
   THE RACING PUZZLE — app.css
   Light theme · Outfit body / Bebas Neue display · Navy header
═══════════════════════════════════════════════════════════ */

:root {
  --sat: env(safe-area-inset-top, 0px);

  /* ── Brand ── */
  --navy:    #1e3a5f;
  --navy2:   #16305a;   /* darker shade for active states */
  --navy-t:  rgba(30,58,95,.08);

  /* ── Light surface ── */
  --bg:    #f0f2f5;
  --sur:   #ffffff;
  --sur2:  #f5f6f8;
  --bdr:   #e2e6eb;

  /* ── Text ── */
  --txt:   #111827;
  --mut:   #6b7280;
  --dim:   #d1d5db;

  /* ── Vibrant accents ── */
  --gld:   #d97706;   /* amber */
  --gld2:  #f59e0b;
  --grn:   #16a34a;   /* green */
  --red:   #dc2626;   /* red */
  --blu:   #2563eb;   /* blue */
  --pur:   #7c3aed;   /* purple */
  --ora:   #ea580c;   /* orange */

  /* ── Card accent colours — change here to retheme a card everywhere ── */
  --clr-today:   #ef4444;
  --clr-races:   #93c5fd;
  --clr-results: #fb923c;
  --clr-watch:   #f59e0b;   /* Puzzle Profiler / Tracker — change this one value to retheme */
  --clr-watch-a1: rgba(245,158,11,.06);
  --clr-watch-a2: rgba(245,158,11,.1);
  --clr-watch-a3: rgba(245,158,11,.15);
  --clr-watch-a4: rgba(245,158,11,.2);
  --clr-watch-a5: rgba(245,158,11,.3);
  --clr-watch-a6: rgba(245,158,11,.35);
  --clr-watch-a7: rgba(245,158,11,.4);
  --clr-watch-a8: rgba(245,158,11,.5);

  /* ── Fonts ── */
  --font:         'Outfit', sans-serif;
  --font-display: 'Bebas Neue', sans-serif;

  /* ── Misc ── */
  --card-r: 14px;
}

/* ── Dark mode variables ── */
body.dark {
  --bg:   #0d1b2a;
  --sur:  #152132;
  --sur2: #111c29;
  --bdr:  rgba(255,255,255,.1);
  --txt:  #e8edf3;
  --mut:  rgba(232,237,243,.45);
  --dim:  rgba(232,237,243,.2);
}

/* Dark mode card overrides */
body.dark .card         { background: var(--sur); border-color: var(--bdr); box-shadow: 0 2px 16px rgba(0,0,0,.4); }
body.dark .cT           { background: var(--sur); }
body.dark .card-hdr-std { border-bottom-color: var(--bdr); }
body.dark .card-title-std { color: var(--txt); }
body.dark .card-sec-divider { color: var(--mut); border-top-color: var(--bdr); }
body.dark .mb           { background: rgba(255,255,255,.05) !important; border-color: var(--bdr) !important; }
body.dark .mh           { color: var(--txt); }
body.dark .mm           { color: var(--mut); }
body.dark input, body.dark textarea, body.dark select {
  background: rgba(255,255,255,.06); color: var(--txt); border-color: var(--bdr);
}
body.dark input::placeholder, body.dark textarea::placeholder { color: var(--mut); }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--txt); font-family: var(--font); font-size: 16px; -webkit-font-smoothing: antialiased; }
/* 100% (not 100vh) against the initial containing block is usually safe-area
   aware, but 100dvh is the unit WebKit specifically keeps in sync with the
   true visible viewport — including standalone-mode sizing quirks that a
   plain percentage height can miss. Layered on top of height:100% so it only
   takes effect where dvh is supported (iOS 15.4+), never a regression. */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

/* ═══════════════════════════════════════════════════════════
   HEADER — navy
═══════════════════════════════════════════════════════════ */
.hdr {
  min-height: 56px;
  padding-top: env(safe-area-inset-top, 0px);
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  padding: env(safe-area-inset-top,0px) 14px 10px;
  background: var(--navy);
  position: relative; z-index: 80; flex-shrink: 0; box-sizing: content-box;
}
.hdr-top  { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: nowrap; }
.logo     { font-size: 16px; font-weight: 800; cursor: pointer; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; white-space: nowrap; color: #fff; text-transform: uppercase; flex-shrink: 0; order: 1; }
.logo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gld2); }
.hdr-r    { display: flex; align-items: center; gap: 6px; }
.hdr-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
/* Icons group (coach, profile) */
.hdr-icons { display: flex; align-items: center; gap: 6px; flex-shrink: 0; order: 3; }
/* Balances — stay in the top row at every width */
.hdr-bal   { display: flex; align-items: center; gap: 2px; order: 2; flex: 1; justify-content: flex-end; margin: 0 4px; }
.hdr-bal-pill { display: flex; align-items: center; gap: 3px; padding: 2px 0; }
.hdr-bal-lbl  { display: none; }
.hdr-bal-val  { font-size: 13px; font-weight: 700; white-space: nowrap; }
.hdr-bal-arrow { margin-left: 1px; }
.hdr-bal-sep  { color: rgba(255,255,255,.2); font-size: 12px; margin: 0 3px; line-height: 1; }
/* Profile icon button */
.hdr-profile-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: rgba(255,255,255,.8); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; -webkit-tap-highlight-color: transparent; }
.hdr-profile-btn:active { background: rgba(255,255,255,.18); }
#coach-drawer { transform: translateY(100%); }

/* Header pills & balance */
.spill  { font-size: 12px; font-weight: 700; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 4px 10px; color: #fff; letter-spacing: .04em; }
.bpill  { font-size: 12px; color: rgba(255,255,255,.6); }
.bpill span { color: #fff; font-weight: 700; }

/* Mode toggle in header */
/* mtog hidden — replaced by bottom nav */
.mtog { display: none; }
.mbtn { display: none; }

/* ═══════════════════════════════════════════════════════════
   SWIPE SHELL & CARDS
═══════════════════════════════════════════════════════════ */
.sw-shell { height: var(--shell-h); display: flex !important; flex-direction: column; overflow: hidden; user-select: none; }
.sw-shell.gone { display: none !important; }
.cmd-shell { display: none !important; height: var(--shell-h); flex-direction: column; overflow: hidden; background: var(--bg); }
.cmd-shell.on { display: flex !important; }

/* Mobile: size the shell with flexbox instead of a JS-measured pixel height.
   The app no longer requests viewport-fit:cover (see index.html), so iOS
   reserves the status bar and home-indicator areas outside the page's own
   viewport automatically — the bottom nav stays in normal document flow
   and flexbox gives the shell exactly the space between header and nav,
   no safe-area arithmetic required. */
@media (max-width: 767.98px) {
  body { display: flex; flex-direction: column; background: var(--navy); }
  .sw-shell, .cmd-shell { height: auto; flex: 1 1 auto; min-height: 0; }
}

.deck { position: relative; flex: 1; overflow: hidden; min-height: 0; }
.card {
  position: absolute; top: 10px; bottom: 10px;
  width: calc(100% - 24px); left: 12px;
  border-radius: var(--card-r);
  will-change: transform; overflow: hidden;
  background: var(--sur); border: 1px solid var(--bdr);
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  opacity: 0;
}
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 2; }
.cT::before  { background: #ef4444; }
.cP::before  { background: var(--grn); }
.cL::before  { background: var(--blu); }
.cI::before  { background: var(--red); }
.cB::before  { background: var(--gld2); }
.cC::before  { background: var(--gld2); }
.cW::before  { background: var(--clr-watch); }
.cST::before { background: #60a5fa; }
.cSE::before { background: #94a3b8; }
.cRC::before { background: var(--blu); }
.cRS::before { background: var(--ora); }

/* All pages — full bleed, no floating card chrome */
#c0, #c1, #c2, #c3, #c4, #c5, #c6 {
  top: 0; bottom: 0;
  left: 0; width: 100%;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
#c0::before, #c1::before, #c2::before, #c3::before,
#c4::before, #c5::before, #c6::before { display: none; }

/* Card backgrounds — use theme surface */
.cT  { background: var(--sur); }
.cRC { background: var(--sur); }
.cRS { background: var(--sur); }
.cC  { background: #fff; }
.cB  { background: #fff; }
.cW  { background: #fff; }
.cST { background: #fff; }
.cSE { background: #fff; }

.cin { height: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 18px 17px 24px; touch-action: pan-y; }
.cin::-webkit-scrollbar { display: none; }

/* Card label + title */
.clbl  { font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--mut); margin-bottom: 4px; }
.cttl  { font-family: var(--font-display); font-size: 26px; font-weight: 400; margin-bottom: 16px; letter-spacing: .03em; }
.cT  .cttl { color: #ef4444; }
.cP  .cttl { color: var(--grn); }
.cL  .cttl { color: var(--blu); }
.cB  .cttl { color: var(--gld); }
.cC  .cttl { color: var(--gld2); }

/* Shared card header for Stats + Settings swipe cards */
.card-hdr-std  { margin: -18px -17px 16px; padding: 14px 17px; border-bottom: 1px solid var(--bdr); }
.card-title-std { font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 3px; }
.card-sec-divider { font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--mut); margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--bdr); }

/* ═══════════════════════════════════════════════════════════
   BOTTOM NAV
═══════════════════════════════════════════════════════════ */
/* ─── BOTTOM NAV ─── */
.bnav {
  display: flex; align-items: flex-start;
  /* min-height = tap target; padding-bottom extends into safe area on iOS PWA */
  min-height: 72px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--navy);
  flex-shrink: 0;
  touch-action: none;
  border-top: 1px solid rgba(255,255,255,.08);
}
/* Hidden on mobile — only shown on desktop via media query */
.bnav-collapse-btn { display: none; }
.bnav-logo { display: none; }

.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4px; border: none; background: none; cursor: pointer;
  color: rgba(255,255,255,.38); transition: color .15s;
  -webkit-tap-highlight-color: transparent; padding: 12px 0 0;
  height: 72px; /* fixed tap-target height, independent of safe-area padding below */
  position: relative;
}
.bnav-item.on { color: var(--accent, #fff); }
.bnav-item.on::before {
  content: ''; position: absolute; top: 0; left: 18%; right: 18%;
  height: 2px; border-radius: 0 0 2px 2px;
  background: var(--accent, #fff);
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-lbl {
  font-family: var(--font);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
/* keep snav hidden but in DOM (JS references it) */
.snav { display: none; }
.dots { display: none; }
.cnlbl { display: none; }

/* ═══════════════════════════════════════════════════════════
   COMMAND CENTRE TABS
═══════════════════════════════════════════════════════════ */
.ctabs { display: flex; overflow-x: auto; background: var(--navy); flex-shrink: 0; }
.ctabs::-webkit-scrollbar { display: none; }
.ctab {
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 13px 16px; border: none; background: transparent; color: rgba(255,255,255,.5);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0;
  transition: all .15s;
}
.ctab.on  { color: #fff; border-bottom-color: var(--gld2); }
.ctab:hover { color: rgba(255,255,255,.8); }

.cpane-wrap { flex: 1; overflow-y: auto; padding: 16px 14px 32px; background: var(--bg); }
.cpane-wrap::-webkit-scrollbar { width: 4px; }
.cpane-wrap::-webkit-scrollbar-thumb { background: var(--bdr); border-radius: 2px; }
.cpane { display: none; }
.cpane.on { display: block; }

/* ═══════════════════════════════════════════════════════════
   SHARED COMPONENTS
═══════════════════════════════════════════════════════════ */

/* Page title / subtitle */
.ptitle { font-family: var(--font-display); font-size: 24px; font-weight: 400; margin-bottom: 3px; letter-spacing: .03em; color: var(--navy); }
.psub   { font-size: 14px; font-weight: 400; font-style: italic; color: var(--mut); margin-bottom: 16px; }

/* Block / panel */
.blk  { background: var(--sur); border: 1px solid var(--bdr); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bttl { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--bdr); }

/* Stat grid */
.sg  { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 9px; margin-bottom: 14px; }
.sc2 { background: var(--sur); border: 1px solid var(--bdr); border-radius: 11px; padding: 14px 12px; position: relative; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.sc2::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--navy); opacity: .15; }
.sc2.pc::before { background: var(--grn); opacity: 1; }
.sc2.nc::before { background: var(--red);  opacity: 1; }

.sv     { font-family: var(--font-display); font-size: 22px; font-weight: 400; margin-bottom: 2px; line-height: 1; }
.sv.pos { color: var(--grn); } .sv.neg { color: var(--red); } .sv.gld { color: var(--gld); }
.sl     { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.sbig   { font-family: var(--font-display); font-size: 32px; font-weight: 400; letter-spacing: .02em; line-height: 1; }
.pos    { color: var(--grn); } .neg { color: var(--red); } .gld { color: var(--gld); }

/* Section divider */
.sdiv { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--mut); border-bottom: 1px solid var(--bdr); padding-bottom: 6px; margin: 15px 0 10px; }

/* Settings row */
.srow { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--bdr); }
.srow:last-child { border-bottom: none; }
.srl  { font-size: 14px; color: var(--mut); }
.srv  { font-size: 14px; font-weight: 600; }

/* Form */
.fg    { margin-bottom: 10px; }
label  { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mut); margin-bottom: 4px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; background: var(--sur2); border: 1px solid var(--bdr); border-radius: 9px;
  color: var(--txt); font-family: var(--font); font-size: 15px; font-weight: 500;
  padding: 11px 13px; outline: none; appearance: none; touch-action: manipulation;
  transition: border-color .2s, background .2s;
}
input[type=checkbox], input[type=radio] {
  width: auto; appearance: auto; padding: 0; border: none; background: none;
  touch-action: manipulation;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy); background: #fff; }
select option { background: var(--sur); }
textarea { resize: vertical; min-height: 56px; }
.g2    { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.gfull { grid-column: 1 / -1; }

/* Buttons */
button { -webkit-appearance: none; appearance: none; }
.btn { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 12px 18px; border-radius: 9px; border: none; cursor: pointer; transition: all .12s; }
.btn:active { transform: scale(.97); }
.bgld  { background: var(--gld); color: #fff; }
.bgld:hover { background: var(--gld2); }
.bgrn  { background: var(--grn); color: #fff; }
.bgrn:hover { filter: brightness(1.08); }
.bout  { background: transparent; border: 1px solid var(--bdr); color: var(--mut); }
.bout:hover { border-color: var(--navy); color: var(--navy); }
.bblu  { background: var(--blu); color: #fff; }
.bblu:hover { filter: brightness(1.1); }
.bdng  { background: var(--red); color: #fff; border: none; }
.bdng:hover { filter: brightness(1.08); }
.bvirt { background: var(--ora); color: #fff; }
.bvirt:hover { background: #fb923c; }
.bnavy { background: var(--navy); color: #fff; }
.bnavy:hover { background: var(--navy2); }
.bsm   { padding: 5px 10px; font-size: 11px; }
.bw    { width: 100%; }

/* Two-col layout */
.tc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 580px) { .tc { grid-template-columns: 1fr; } }

/* Bet row */
.mb { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--sur); border: 1px solid var(--bdr); margin-bottom: 7px; transition: background .15s; border-left-width: 3px; }
.mb:hover { background: var(--sur2); cursor: pointer; }
.mb.win     { border-left-color: var(--grn); }
.mb.loss    { border-left-color: var(--red); }
.mb.place   { border-left-color: var(--blu); }
.mb.pending { border-left-color: var(--gld2); }
.mbl { flex: 1; }
.mh  { font-weight: 700; font-size: 16px; color: var(--txt); }
.mm  { font-size: 12px; font-weight: 600; color: var(--mut); margin-top: 2px; letter-spacing: .03em; }
.mbr { text-align: right; flex-shrink: 0; margin-left: 8px; }
.mp  { font-size: 13px; font-weight: 700; }

/* Badges */
.bdg  { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; }
.bw1  { background: rgba(22,163,74,.12);  color: var(--grn); border: 1px solid rgba(22,163,74,.25); }
.bp1  { background: rgba(37,99,235,.12);  color: var(--blu); border: 1px solid rgba(37,99,235,.25); }
.bl1  { background: rgba(220,38,38,.12);  color: var(--red); border: 1px solid rgba(220,38,38,.25); }
.bpend{ background: rgba(217,119,6,.12);  color: var(--gld); border: 1px solid rgba(217,119,6,.25); }
.bpend-neu { background: rgba(148,163,184,.1); color: var(--mut); border: 1px solid rgba(148,163,184,.25); }
.bnr, .bvd { background: var(--sur2); color: var(--mut); border: 1px solid var(--bdr); }

/* Success alert */
.aok { background: rgba(22,163,74,.08); border: 1px solid var(--grn); color: var(--grn); border-radius: 9px; padding: 10px 13px; font-size: 12px; font-weight: 700; margin-bottom: 10px; display: none; letter-spacing: .04em; }
.aok.show { display: block; }

/* Table */
.twrap { overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; font-size: 14px; }
th { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); padding: 8px 9px; text-align: left; border-bottom: 2px solid var(--bdr); }
td { padding: 9px; border-bottom: 1px solid var(--bdr); vertical-align: middle; }
tr:hover td { background: var(--sur2); }

/* Bar chart */
.barchart { display: flex; flex-direction: column; gap: 6px; }
.brow { display: flex; align-items: center; gap: 8px; }
.blbl { font-size: 11px; font-weight: 600; color: var(--mut); width: 78px; flex-shrink: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btrk { flex: 1; height: 18px; background: var(--sur2); border-radius: 3px; overflow: hidden; border: 1px solid var(--bdr); }
.bfil { height: 100%; border-radius: 3px; display: flex; align-items: center; padding-left: 5px; transition: width .5s; }
.bfil.pb { background: var(--grn); } .bfil.nb { background: var(--red); }
.bval { font-size: 9px; font-weight: 700; color: #fff; white-space: nowrap; }

/* Progress bar */
.prog  { background: var(--bdr); border-radius: 100px; height: 7px; overflow: hidden; margin-top: 5px; }
.progf { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--navy), var(--blu)); transition: width .5s; }
.progf.lp { background: linear-gradient(90deg, var(--red), #f87171); }

/* Stake display */
.stkr { background: var(--sur2); border: 2px solid var(--gld); border-radius: 9px; padding: 13px; text-align: center; margin-top: 9px; }
.stka { font-size: 30px; font-weight: 800; color: var(--gld); }

/* Rules list */
.ri { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--bdr); }
.ri:last-child { border-bottom: none; }
.rn  { font-size: 13px; font-weight: 900; color: var(--navy); width: 18px; flex-shrink: 0; padding-top: 2px; }
.rt  { font-size: 14px; line-height: 1.5; color: var(--mut); flex: 1; }
.rt strong { color: var(--txt); }
.manif { border-top: 1px solid var(--bdr); margin-top: 16px; padding-top: 13px; font-style: italic; font-size: 14px; line-height: 1.8; color: var(--mut); }
.manif em { color: var(--navy); font-style: normal; font-weight: 700; }

/* Checklist */
.cki  { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--bdr); margin-bottom: 4px; cursor: pointer; background: var(--sur); transition: all .15s; }
.cki.done { border-color: var(--grn); background: rgba(22,163,74,.05); }
.ckb  { width: 18px; height: 18px; flex-shrink: 0; border-radius: 5px; border: 2px solid var(--bdr); display: flex; align-items: center; justify-content: center; font-size: 11px; color: transparent; }
.cki.done .ckb { background: var(--grn); border-color: var(--grn); color: #fff; }
.ckt  { font-size: 14px; line-height: 1.35; font-weight: 600; }
.cks  { font-size: 12px; color: var(--mut); font-style: italic; margin-top: 1px; }
.csbox{ padding: 11px; border-radius: 9px; text-align: center; margin-bottom: 12px; }
.csnum{ font-size: 36px; font-weight: 900; }
.cslbl{ font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-top: 1px; }

/* Modal */
.mov  { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; align-items: center; justify-content: center; padding: 14px; }
.mov.open { display: flex; }
.mbox { background: var(--sur); border: 1px solid var(--bdr); border-radius: 14px; padding: 18px; max-width: 440px; width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,.18); }
.mttl { font-size: 20px; font-weight: 900; color: var(--navy); margin-bottom: 3px; }
.msub { font-size: 12px; font-weight: 700; letter-spacing: .07em; color: var(--mut); margin-bottom: 12px; text-transform: uppercase; }

/* Utility */
.es   { text-align: center; padding: 30px 14px; color: var(--mut); font-style: italic; font-size: 14px; }
.mt8  { margin-top: 8px; } .mt12 { margin-top: 12px; }

/* Header bank pulse */
@keyframes pg { 0%,100%{ box-shadow: 0 4px 14px rgba(0,0,0,.15), 0 0 0 0 rgba(30,58,95,.4); } 50%{ box-shadow: 0 4px 14px rgba(0,0,0,.15), 0 0 0 7px rgba(30,58,95,0); } }
@keyframes lg-spin { to { transform: rotate(360deg); } }
#hbtn.vis { opacity: 1; pointer-events: auto; animation: pg 2.5s ease-in-out infinite; }
#hbtn.vis:active { transform: scale(.9); }

/* Racecard pills */
.rc-pill   { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid; }
.rc-g1, .rc-g2  { background: rgba(245,158,11,.1);  color: #d97706; border-color: rgba(245,158,11,.25); }
.rc-g3, .rc-listed { background: rgba(245,158,11,.1); color: var(--gld2); border-color: rgba(245,158,11,.2); }
.rc-cls    { background: var(--sur2); color: var(--mut); border-color: var(--bdr); }
.rc-going  { background: rgba(22,163,74,.08); color: var(--grn); border-color: rgba(22,163,74,.2); }
.rc-race-row    { background: var(--sur); border: 1px solid var(--bdr); border-radius: 12px; margin-bottom: 7px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.rc-race-header { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; transition: background .1s; }
.rc-race-header:active { background: var(--sur2); }
.rc-runners-inline { border-top: 1px solid var(--bdr); }

/* Log Bet overlay overrides */
#logbet-overlay .cin    { height: auto; overflow: visible; padding: 0; }
#logbet-overlay input,
#logbet-overlay select,
#logbet-overlay textarea { font-size: 16px; padding: 13px 14px; border-radius: 10px; }
#logbet-overlay .fg     { margin-bottom: 14px; }
#logbet-overlay .fg label { font-size: 11px; letter-spacing: .15em; }
#logbet-overlay .g2     { gap: 12px; }
#logbet-overlay .btn    { width: 100%; padding: 16px; font-size: 13px; border-radius: 12px; margin-top: 4px; }
#logbet-overlay .sdiv   { margin: 18px 0 12px; }
#logbet-overlay::-webkit-scrollbar { display: none; }

/* ── Index.html utility classes ── */

/* Header extras */
.hdr-sep   { color: rgba(255,255,255,.3); font-size: 12px; margin: 0 2px; }
.supa-dot  { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.4); flex-shrink: 0; cursor: pointer; }
.supa-banner { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 999; padding: 8px 14px; font-size: 12px; font-weight: 700; text-align: center; }

/* Card headers (Today / Racecards / Results top strip) */
.card-hdr  { margin: -18px -17px 0; padding: 14px 17px 13px; }
.card-hdr-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* Section label — small caps muted */
.lbl       { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--mut); margin-bottom: 3px; }
.lbl-sm    { margin-bottom: 0; }
.lbl-8     { font-size: 10px; letter-spacing: 1.5px; }

/* Card title (large coloured heading) */
.card-title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }

/* Refresh button */
.btn-refresh { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--bdr); background: var(--sur); color: var(--mut); cursor: pointer; }

/* Stat tile (white box) */
.tile      { background: var(--sur); border: 1px solid var(--bdr); border-radius: 9px; padding: 9px 11px; }
.tile-lbl  { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--mut); margin-bottom: 3px; }
.tile-val  { font-size: 17px; font-weight: 700; }

/* Mood / emoji buttons */
.mood-btn    { flex: 1; padding: 7px 4px; border-radius: 8px; border: 1px solid var(--bdr); background: transparent; font-size: 15px; cursor: pointer; }
.mood-btn-sm { padding: 2px 3px; border-radius: 5px; border: 1px solid transparent; background: transparent; font-size: 16px; cursor: pointer; line-height: 1; flex-shrink: 0; transition: border-color .1s, background .1s; }

/* Check-in / alert box */
.alert-box { border-radius: 11px; padding: 12px 14px; }

/* cin strip with touch-action */
.cin-touch { touch-action: pan-y; }

/* rc/results card inner */
.rc-cin    { touch-action: pan-y; background: var(--sur2); padding: 14px 14px 24px; }

/* Card overlay (loading / empty state) */
.card-overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(240,242,245,.92); backdrop-filter: blur(4px); border-radius: inherit; }

/* Status text (italic muted) */
.status-txt { color: var(--mut); font-style: italic; font-size: 14px; }

/* History toggle (Real / Virtual) */
.hist-tog  { display: flex; background: var(--sur2); border: 1px solid var(--bdr); border-radius: 9px; overflow: hidden; margin-bottom: 16px; width: fit-content; }
.hist-tog-btn { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; padding: 8px 18px; border: none; cursor: pointer; }
.hist-tog-btn.on  { background: var(--navy); color: #fff; }
.hist-tog-btn.off { background: transparent; color: var(--mut); }

/* Inline flex gap helpers */
.row       { display: flex; align-items: center; }
.row-sb    { display: flex; align-items: center; justify-content: space-between; }
.row-g8    { display: flex; align-items: center; gap: 8px; }
.row-g7    { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.col       { display: flex; flex-direction: column; }
.g2-8      { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.g3        { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Purple beta/tag pill */
.pill-pur  { font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--navy); border: 1px solid var(--navy); padding: 5px 16px; border-radius: 20px; margin-bottom: 10px; }
.pill-lbl  { font-family: monospace; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--mut); display: block; margin-bottom: 5px; }

/* Body copy */
.body-txt  { font-size: 14px; color: var(--txt); line-height: 1.7; }
.body-mut  { font-size: 14px; color: var(--mut); line-height: 1.6; margin-bottom: 12px; }
.body-sm   { font-size: 13px; color: var(--mut); line-height: 1.5; margin-top: 10px; }
.body-it   { font-size: 13px; color: var(--mut); font-style: italic; margin-bottom: 10px; }
.body-c    { font-size: 14px; color: var(--mut); text-align: center; max-width: 220px; line-height: 1.6; }
.lbl-mut   { font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px; }

/* Emoji / icon large */
.ico-xl    { font-size: 32px; margin-bottom: 12px; }
.mt20      { margin-top: 20px; }
.mb12      { margin-bottom: 12px; }

/* Input width override */
.inp-110   { width: 110px; font-size: 13px; }
.inp-flex  { flex: 1; min-width: 140px; font-size: 14px; }

/* ── Edit Bet Full-Screen ── */
.em-screen { position:fixed; inset:0; z-index:500; background:var(--bg); overflow-y:auto; -webkit-overflow-scrolling:touch; }
.em-nav { display:flex; align-items:center; justify-content:space-between; padding:max(14px,env(safe-area-inset-top,14px)) 16px 12px; background:var(--navy); position:sticky; top:0; z-index:10; }
.em-nav-title { font-size:16px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase; color:#fff; }
.em-del-btn { padding:6px 12px; border-radius:8px; border:1px solid rgba(248,113,113,.4); background:rgba(248,113,113,.1); color:var(--red); font-size:12px; font-weight:800; letter-spacing:1px; text-transform:uppercase; cursor:pointer; }
.em-close-btn { width:34px; height:34px; border-radius:50%; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.2); color:#fff; font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.em-hero { background:var(--navy); border-bottom:3px solid var(--gld2); padding:14px 16px 18px; }
.em-hero-title { font-size:28px; font-weight:900; letter-spacing:.5px; color:#fff; line-height:1; margin-bottom:4px; }
.em-hero-sub { font-size:12px; font-weight:700; letter-spacing:1px; text-transform:uppercase; color:rgba(255,255,255,.4); }
.em-body { max-width:520px; margin:0 auto; padding:0 12px 40px; }
.em-section { background:var(--sur); border:1px solid var(--bdr); border-radius:13px; margin-top:12px; overflow:hidden; }
.em-sec-hdr { display:flex; align-items:center; gap:9px; padding:11px 14px; border-bottom:1px solid var(--bdr); background:var(--sur2); }
.em-sec-num { width:22px; height:22px; border-radius:50%; background:var(--gld2); color:#fff; font-size:12px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.em-sec-title { font-size:14px; font-weight:700; color:var(--txt); letter-spacing:.3px; }
.em-sec-body { padding:14px; display:flex; flex-direction:column; gap:10px; }
.em-actions { display:flex; gap:8px; margin-top:16px; }
.em-save-btn { flex:1; padding:13px; border-radius:10px; border:none; background:var(--gld2); color:#fff; font-size:14px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase; cursor:pointer; }
.em-cancel-btn { padding:13px 20px; border-radius:10px; border:1px solid var(--bdr); background:var(--sur); color:var(--mut); font-size:14px; font-weight:700; cursor:pointer; }

/* ═══════════════════════════════════════════════════════════
   DESKTOP LAYOUT — left sidebar nav (768px+)
═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  body {
    display: block;
    overflow: hidden;
  }

  /* Header — full width, always on top */
  .hdr {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 80;
  }

  /* Sidebar nav — sits below header */
  .bnav {
    flex-direction: column;
    align-items: stretch;
    width: 200px;
    height: calc(100vh - 56px);
    min-height: 0;
    border-top: none;
    border-right: 1px solid rgba(255,255,255,.08);
    padding-bottom: 0;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    justify-content: flex-start;
    padding-top: 8px;
    position: fixed;
    top: 56px;
    left: 0;
    z-index: 70;
    transition: width .22s cubic-bezier(.4,0,.2,1);
  }

  .bnav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 10px;
    cursor: pointer;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    margin-bottom: 4px;
  }
  .bnav-logo-img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
  }
  .bnav-logo-lbl {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255,255,255,.75);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity .2s, width .22s;
  }
  body.nav-collapsed .bnav-logo-lbl { opacity: 0; width: 0; overflow: hidden; }
  body.nav-collapsed .bnav-logo { justify-content: center; padding: 10px 0; }

  /* Collapse toggle button */
  .bnav-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 36px;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
    color: rgba(255,255,255,.3);
    cursor: pointer;
    margin-bottom: 4px;
    flex-shrink: 0;
    transition: color .15s;
  }
  .bnav-collapse-btn:hover { color: rgba(255,255,255,.7); }

  .bnav-item {
    flex: 0 0 auto !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: auto;
    padding: 13px 18px;
    gap: 12px;
    border-radius: 0;
    white-space: nowrap;
    overflow: hidden;
  }

  /* Active indicator — left bar instead of top bar */
  .bnav-item.on::before {
    top: 12%; bottom: 12%;
    left: 0; right: auto;
    width: 3px; height: auto;
    border-radius: 0 2px 2px 0;
  }

  .bnav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

  .bnav-lbl {
    font-size: 13px;
    letter-spacing: .06em;
    transition: opacity .15s;
  }

  /* Main content — offset by sidebar */
  .sw-shell {
    margin-left: 200px;
    margin-top: 56px;
    height: calc(100vh - 56px) !important;
  }

  :root { --shell-h: calc(100vh - 56px) !important; }

  /* ── Collapsed state ── */
  body.nav-collapsed .bnav { width: 56px; }
  body.nav-collapsed .bnav-lbl { opacity: 0 !important; width: 0 !important; overflow: hidden !important; pointer-events: none; }
  body.nav-collapsed .bnav-item { padding: 0 !important; justify-content: center !important; align-items: center !important; width: 56px !important; height: 46px !important; }
  body.nav-collapsed .bnav-collapse-btn { width: 56px !important; justify-content: center !important; }
  body.nav-collapsed .sw-shell { margin-left: 56px; }
  body.nav-collapsed #rg-strip { left: 56px; }
  body.nav-collapsed #bnav-collapse-icon { transform: rotate(180deg); }
}

/* ── Gamble Aware footer — desktop only ── */
@media (min-width: 768px) {
  #rg-strip {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 200px;
    right: 0;
    z-index: 50;
    transition: left .22s cubic-bezier(.4,0,.2,1);
  }
  .sw-shell {
    margin-bottom: 34px;
  }
  :root { --shell-h: calc(100vh - 56px - 34px) !important; }
}

/* ── Settings Tabs ─────────────────────────────────────────────────────────── */
.set-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.set-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--bdr);
  background: var(--sur2);
  color: var(--mut);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.set-tab svg { opacity: .6; transition: opacity .15s; }
.set-tab.on {
  background: rgba(148,163,184,.12);
  border-color: rgba(148,163,184,.4);
  color: #94a3b8;
}
.set-tab.on svg { opacity: 1; }

.set-panel { display: none; }
.set-panel.on { display: block; }

/* ── Stats icon tiles ── */
.stats-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--bdr);
  background: var(--sur2);
  color: var(--mut);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  text-align: center;
}
.stats-tile:active { transform: scale(.97); }
.stats-tile-icon { opacity: .45; transition: opacity .15s; }
.stats-tile-icon svg { width: 16px; height: 16px; }
.stats-tile-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mut);
  transition: color .15s;
}
.stats-tile-sub {
  font-size: 9px;
  color: var(--mut);
  opacity: .55;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
/* Active state — strong blue highlight */
.stats-tile.on {
  background: rgba(59,130,246,.12);
  border: 2px solid #3b82f6;
  color: #60a5fa;
}
.stats-tile.on .stats-tile-icon { opacity: 1; }
.stats-tile.on .stats-tile-icon svg { stroke: #60a5fa; }
.stats-tile.on .stats-tile-label { color: #60a5fa; }
.stats-tile.on .stats-tile-sub { color: rgba(96,165,250,.7); opacity: 1; }
