/* One stylesheet, no CDN, no font download: the page must render identically
   on a phone in a betting shop with two bars of signal. Everything below is
   sized for a thumb first — the reader is standing up, two apps open, and has
   about fifteen seconds. */

:root {
  --bg: #0a0e13;
  --panel: #131b24;
  --panel-2: #182231;
  --line: #22303f;
  --ink: #e8eef5;
  --muted: #8fa3b8;
  --green: #23ec91;
  --gold: #f6c452;
  --red: #ff6b6b;
  --live: #ff4d4d;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* The browser's own [hidden] rule loses to ANY author `display`, so a banner
   styled `display: flex` stays on screen after the script hides it — which is
   how the free board came to advertise "0 PRO arbs you cannot see". Author-level
   and !important, so `hidden` means hidden for every element on this page,
   including ones added later by someone who never reads this comment. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: env(safe-area-inset-bottom); }

/* ---------- top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(10, 14, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.2px; }
.brand .mark { color: var(--green); }
.brand .name { white-space: nowrap; }

.tier {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.tier-free { color: var(--muted); }
.tier-pro { color: #1a1206; background: var(--gold); border-color: var(--gold); }

.bar-right { display: flex; align-items: center; gap: 12px; }

.stake {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.stake input {
  width: 84px;
  padding: 6px 8px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: right;
}
.stake input:focus { outline: 2px solid var(--green); outline-offset: -1px; }

.link { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.link .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.link-ok .dot { background: var(--green); box-shadow: 0 0 0 0 rgba(35, 236, 145, 0.6); animation: pulse 2.4s infinite; }
.link-ok { color: var(--green); }
.link-down .dot { background: var(--red); }
.link-down { color: var(--red); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(35, 236, 145, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(35, 236, 145, 0); }
  100% { box-shadow: 0 0 0 0 rgba(35, 236, 145, 0); }
}

/* ---------- banners ---------- */

main { padding: 12px 14px 28px; max-width: 980px; margin: 0 auto; }

.pairing, .locked {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pairing p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.locked { border-color: rgba(246, 196, 82, 0.35); background: rgba(246, 196, 82, 0.06); }
.locked strong { font-size: 26px; color: var(--gold); line-height: 1; }
.locked span { flex: 1; color: var(--muted); font-size: 13px; }

.cta {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--green);
  color: #04150c;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.cta-pro { background: var(--gold); color: #1a1206; }

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty p { margin: 6px 0; }
.empty strong { color: var(--ink); }

/* ---------- cards ---------- */

.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  animation: enter 220ms ease-out;
}
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card.leaving { animation: leave 200ms ease-in forwards; }
@keyframes leave { to { opacity: 0; transform: scale(0.985); } }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px 10px;
}

.card-head { flex: 1; min-width: 0; }

.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.tag {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.tag-live { color: #fff; background: var(--live); border-color: var(--live); font-weight: 700; }
.tag-pro { color: #1a1206; background: var(--gold); border-color: var(--gold); font-weight: 800; }
.tag-boost { color: var(--gold); border-color: rgba(246, 196, 82, 0.5); }

.event { margin-top: 6px; font-size: 16px; font-weight: 700; line-height: 1.25; }
.market { margin-top: 2px; font-size: 13px; color: var(--muted); }

.card-figure { text-align: right; flex-shrink: 0; }
.margin { font-size: 24px; font-weight: 800; color: var(--green); line-height: 1; }
.profit { margin-top: 3px; font-size: 13px; font-weight: 700; color: var(--ink); }
.profit small { color: var(--muted); font-weight: 500; }

/* ---------- legs ---------- */

.legs { border-top: 1px solid var(--line); }

.leg {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid rgba(34, 48, 63, 0.55);
}
.leg:first-child { border-top: none; }

.leg-what { min-width: 0; }
.leg-bet { font-weight: 600; font-size: 14px; }
.leg-venue { margin-top: 2px; font-size: 12px; color: var(--muted); }
.leg-venue a { color: var(--green); text-decoration: none; border-bottom: 1px dotted rgba(35, 236, 145, 0.5); }
.leg-venue a:active { opacity: 0.6; }
.leg-venue .nolink { color: var(--muted); border-bottom: 1px dotted var(--line); }

.leg-price { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; }
.leg-stake {
  min-width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--green);
}
.leg-stake small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }

.flash { animation: flash 900ms ease-out; }
@keyframes flash { from { background: rgba(35, 236, 145, 0.16); } to { background: transparent; } }

/* ---------- footer of a card ---------- */

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.note { color: var(--gold); }
.movement { color: var(--gold); }
.age { font-variant-numeric: tabular-nums; white-space: nowrap; }

.foot {
  padding: 18px 14px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  max-width: 980px;
  margin: 0 auto;
}
.foot .sep { opacity: 0.4; margin: 0 6px; }

@media (max-width: 560px) {
  .bar { flex-wrap: wrap; }
  .bar-right { width: 100%; justify-content: space-between; }
  .leg { grid-template-columns: 1fr auto; }
  .leg-stake { grid-column: 2; }
  .leg-price { grid-row: 1; grid-column: 2; }
  .margin { font-size: 21px; }
}

/* --- the ledger ---------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  max-width: 980px;
  margin: 0 auto;
}
.tabs button {
  flex: 1 1 auto;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.tabs button.on { background: var(--panel-2); color: var(--ink); }

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  max-width: 980px;
  margin: 0 auto;
}
.total {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.total-label { display: block; color: var(--muted); font-size: 12px; }
.total-value { font-size: 20px; font-weight: 800; }
.pos { color: var(--green); }
.neg { color: var(--red); }

.accounts { max-width: 980px; margin: 0 auto; padding: 0 14px 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head h2, .cards h2 { font-size: 15px; margin: 12px 0 8px; }
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.account-name { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.account-balance { font-weight: 800; font-variant-numeric: tabular-nums; }
.chip {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
/* The only call to action on the page: the ledger and the book disagree. */
.chip-warn { color: var(--gold); border-color: var(--gold); }

.ghost, .placed {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.placed { color: var(--ink); border-color: var(--green); }

.ticket .margin.pending { color: var(--muted); font-size: 15px; font-weight: 700; }
.leg-verdict { display: flex; gap: 6px; align-items: center; }
.grade {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.grade-won { border-color: var(--green); color: var(--green); }
.grade-lost { border-color: var(--red); color: var(--red); }
.verdict { font-size: 12px; font-weight: 700; }
.v-won { color: var(--green); }
.v-lost { color: var(--red); }
.v-void { color: var(--muted); }
.leg-open { opacity: 1; }

.sheet {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 460px;
  width: calc(100% - 28px);
  padding: 16px;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet h3 { margin: 0 0 6px; font-size: 16px; }
.sheet menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 14px 0 0; }
.place-leg { border-top: 1px solid var(--line); padding: 10px 0; }
.place-bet { font-weight: 700; margin-bottom: 6px; }
.place-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.num, .acc {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  min-width: 96px;
}
.hint { color: var(--muted); font-size: 12px; }
.err { color: var(--red); font-size: 12px; min-height: 16px; }
