:root {
  --ink: #0a0e14;
  --panel: #141a23;
  --panel-2: #1c242f;
  --panel-3: #253040;
  --line: #27313e;
  --gold: #ffb020;
  --gold-dim: #a86f0d;
  --win: #34d399;
  --lose: #f87171;
  --text: #eaf0f7;
  --muted: #8695a8;
  --radius: 10px;
  --shell: 560px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

.num { font-variant-numeric: tabular-nums; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  max-width: var(--shell);
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 7px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--gold);
  color: #10141b;
  border-radius: 7px;
  font-family: Archivo, sans-serif;
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
}

.brand-word {
  font-family: Archivo, sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.topbar-right { display: flex; align-items: center; gap: 7px; }

.balance-chip {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13.5px;
}
.balance-chip small { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; }

.btn {
  padding: 7px 13px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: filter .12s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--gold); color: #10141b; border-color: var(--gold); }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 15px; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--lose); border-color: #43272b; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- sport tabs ---------- */

.sports {
  position: sticky;
  top: 52px;
  z-index: 35;
  display: flex;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  max-width: var(--shell);
  margin: 0 auto;
}

.sport {
  flex: 1;
  padding: 11px 4px 9px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.sport[aria-current="true"] { color: var(--text); border-bottom-color: var(--gold); }

.view { max-width: var(--shell); margin: 0 auto; padding: 10px 10px 24px; }

.loading, .empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* ---------- filter chips ---------- */

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--panel-3); color: var(--text); border-color: var(--panel-3); }
.chip .dot { color: var(--lose); margin-right: 4px; }

/* ---------- match list ---------- */

.league-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.match {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 7px;
}

.match-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #37181b;
  color: var(--lose);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .05em;
}
.live-tag::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--lose);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

.match-teams { margin-bottom: 9px; }
.match-team {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  padding: 1px 0;
}

/* The price rail — three cells, one row, the memorable part of the page. */
.rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}
.rail.two { grid-template-columns: repeat(2, 1fr); }

.price {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 4px 7px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background .12s ease, color .12s ease, transform .1s ease;
}
.price:active { transform: scale(.97); }
.price .k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.price .v {
  font-family: Archivo, sans-serif;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.price[aria-pressed="true"] { background: var(--gold); color: #10141b; }
.price[aria-pressed="true"] .k { color: #4a3a12; }
.price.dead { opacity: .35; pointer-events: none; }

.market-label {
  margin: 9px 0 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- betslip ---------- */

.slipbar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  z-index: 38;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 10px 8px;
}

.slipbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: var(--gold);
  color: #10141b;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.slipbar-count {
  display: grid;
  place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  background: #10141b;
  color: var(--gold);
  border-radius: 999px;
  font-size: 12.5px;
}
.slipbar-label { flex: 1; text-align: left; font-size: 14px; }
.slipbar-odds { font-family: Archivo, sans-serif; font-variant-numeric: tabular-nums; font-size: 15px; }

.slip-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 7px;
}
.slip-item-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.slip-pick { font-weight: 600; font-size: 14px; }
.slip-match { font-size: 12px; color: var(--muted); margin-top: 2px; }
.slip-odds { font-family: Archivo, sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; }
.slip-remove { color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 4px; }

.stake-row { display: flex; gap: 7px; margin: 12px 0 8px; }
.stake-row input {
  flex: 1;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quick { display: flex; gap: 6px; margin-bottom: 12px; }
.quick button {
  flex: 1;
  padding: 8px 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 12px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.summary-row.total { color: var(--text); font-weight: 700; font-size: 16px; padding-top: 8px; margin-top: 5px; border-top: 1px solid var(--line); }
.summary-row.total b { color: var(--gold); font-family: Archivo, sans-serif; }

/* ---------- bets & wallet lists ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card h3 { margin: 0 0 8px; font-size: 15px; font-family: Archivo, sans-serif; }

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--panel-3);
  color: var(--muted);
}
.tag.won { background: #12352a; color: var(--win); }
.tag.lost { background: #35191c; color: var(--lose); }
.tag.open { background: #33290f; color: var(--gold); }
.tag.void, .tag.pending { background: var(--panel-3); color: var(--muted); }

.leg {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.leg:first-of-type { border-top: none; }
.leg small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.leg-odds { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.leg.won .leg-odds { color: var(--win); }
.leg.lost .leg-odds { color: var(--lose); }

.kv { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.kv span:first-child { color: var(--muted); }

.section-title {
  margin: 18px 0 8px;
  font-family: Archivo, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-balance {
  background: linear-gradient(150deg, #1d2634, var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
}
.hero-balance .label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero-balance .amount {
  font-family: Archivo, sans-serif;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 14px;
}
.hero-balance .amount small { font-size: 15px; color: var(--muted); margin-left: 6px; }
.hero-actions { display: flex; gap: 8px; }
.hero-actions .btn { flex: 1; text-align: center; }

/* ---------- forms ---------- */

.field { margin-bottom: 12px; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
}
.field .hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.4; }

.form-error {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #35191c;
  border: 1px solid #4a2328;
  border-radius: 8px;
  color: #fca5a5;
  font-size: 13.5px;
}
.form-note {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--panel-2);
  border-left: 2px solid var(--gold);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.switch-line { margin-top: 14px; text-align: center; font-size: 13.5px; color: var(--muted); }
.switch-line button { color: var(--gold); font-weight: 600; }

/* ---------- deposit invoice ---------- */

.invoice { text-align: center; }
.invoice img {
  width: 190px; height: 190px;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  margin: 6px 0 14px;
}
.addr {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  word-break: break-all;
  text-align: left;
  line-height: 1.5;
}
.pay-amount {
  font-family: Archivo, sans-serif;
  font-weight: 800;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  margin: 4px 0;
}

/* ---------- bottom nav ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 39;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel);
  border-top: 1px solid var(--line);
  max-width: var(--shell);
  margin: 0 auto;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}
.tabbar a .ico { font-size: 15px; line-height: 1; }
.tabbar a[aria-current="page"] { color: var(--gold); }

/* ---------- sheet & toast ---------- */

.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(4, 7, 11, .72); }
.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: var(--shell);
  margin: 0 auto;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(16px); opacity: .6 } }
@media (prefers-reduced-motion: reduce) {
  .sheet-panel { animation: none; }
  .live-tag::before { animation: none; }
  .price:active { transform: none; }
}

.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-family: Archivo, sans-serif; font-size: 17px; }
.sheet-close { color: var(--muted); font-size: 16px; padding: 4px 6px; }
.sheet-body { padding: 14px 16px 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 74px);
  transform: translateX(-50%);
  z-index: 80;
  max-width: 90vw;
  padding: 11px 16px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
.toast.bad { background: #3a1a1e; border-color: #55262c; color: #fecaca; }
.toast.good { background: #12352a; border-color: #1d4d3c; color: #a7f3d0; }

.footnote {
  margin: 24px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

@media (min-width: 600px) {
  body { background: #06090d; }
  .topbar, .sports, .tabbar { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ---------- search ---------- */

.searchwrap {
  position: sticky;
  top: 52px;
  z-index: 36;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.searchbox:focus-within { border-color: var(--gold); }
.search-ico { color: var(--muted); font-size: 17px; line-height: 1; }
.searchbox input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  background: none;
  border: none;
  font-size: 15px;
  outline: none;
}
.searchbox input::-webkit-search-cancel-button { display: none; }
.search-clear { color: var(--muted); font-size: 14px; padding: 4px 2px; }

/* When search is active the sport tabs act as result filters */
.sports.filtering .sport[aria-current="true"] { border-bottom-color: var(--gold); }

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 4px 6px;
  font-size: 12px;
  color: var(--muted);
}
.result-head b { color: var(--text); font-size: 13px; }

/* ---------- match card additions ---------- */

.match-tap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 0;
}
.more-markets {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 10px;
  width: 100%;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.more-markets b { color: var(--gold); }

.sport-pill {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- event detail ---------- */

.event-head {
  background: linear-gradient(150deg, #1d2634, var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.event-head .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 7px; align-items: center; }
.event-head .teams { font-family: Archivo, sans-serif; font-size: 18px; font-weight: 700; line-height: 1.35; }

.market-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.market-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
}
.market-toggle .caret { color: var(--muted); font-size: 11px; transition: transform .15s ease; }
.market-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.market-body { padding: 0 12px 12px; }
.market-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 5px;
}
.rail.stack { grid-template-columns: 1fr; }
.rail.wide .price { flex-direction: row; justify-content: space-between; padding: 10px 12px; }
.rail.wide .price .k { font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 500; }
.rail.wide .price[aria-pressed="true"] .k { color: #10141b; }

/* ---------- league browser ---------- */

.league-search {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}
.league-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  text-align: left;
}
.league-row[aria-pressed="true"] { border-color: var(--gold); }
.league-row .star { color: var(--gold); font-size: 11px; }

/* ---------- live scores ---------- */

.match-team { align-items: center; }
.match-team .score {
  font-family: Archivo, sans-serif;
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  min-width: 18px;
  text-align: right;
}

.score-line {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--gold);
  font-weight: 800;
  font-size: 11px;
}

.live-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--lose);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.event-head .team-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}
.event-head .team-line b {
  font-family: Archivo, sans-serif;
  font-size: 22px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.live-note {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
