/* Balageru Betting.
   Telegram supplies the page background and text colour so the app belongs in
   whatever theme the user runs; everything on top of that is ours - a green
   for money, gold for the prize, and a colour per competition so the board
   reads at a glance instead of as a wall of grey rows. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #f4f6f8);
  --text: var(--tg-theme-text-color, #14181f);
  --muted: var(--tg-theme-hint-color, #79828d);
  --link: var(--tg-theme-link-color, #1f8fff);
  --btn: var(--tg-theme-button-color, #12b76a);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--muted) 22%, transparent);

  --brand: #12b76a;
  --brand-dark: #0b8a50;
  --brand-soft: color-mix(in srgb, var(--brand) 14%, transparent);
  --gold: #f5a524;
  --gold-soft: color-mix(in srgb, var(--gold) 16%, transparent);
  --win: #12b76a;
  --lose: #f04438;
  --warn: #f79009;
  --info: #4b7bec;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 16px -8px rgba(16, 24, 40, .18);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, .07), 0 12px 28px -12px rgba(16, 24, 40, .28);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);

  /* No web font on purpose: a face fetched from a CDN is a blank screen on a
     bad connection, and this app has to open on one. The character comes from
     using the system stack properly - a scale that steps, weight doing the
     work, and lining figures anywhere numbers are compared down a column. */
  --font: system-ui, -apple-system, "Segoe UI Variable Display", "Segoe UI",
          Roboto, "Helvetica Neue", sans-serif;
  --step-0: 15px;
  --step-1: 17px;
  --step-2: 21px;
  --step-3: 27px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-bg-color, #10161f);
    --card: var(--tg-theme-secondary-bg-color, #1a2330);
    --text: var(--tg-theme-text-color, #f2f5f8);
    --muted: var(--tg-theme-hint-color, #8b97a5);
    --brand: #2ed58a;
    --brand-dark: #14b06b;
    --gold: #ffc14d;
    --win: #2ed58a;
    --lose: #ff6b5e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -10px rgba(0, 0, 0, .6);
  }
}

/* one hue per competition - the board becomes scannable by colour */
.lg-PL  { --lg: #6d28d9; }
.lg-PD  { --lg: #d92d20; }
.lg-BL1 { --lg: #d3212c; }
.lg-SA  { --lg: #0a58ca; }
.lg-FL1 { --lg: #1e3a8a; }
.lg-CL  { --lg: #1c2f6b; }
.lg-EL  { --lg: #f7861f; }
.lg-DED { --lg: #e8720c; }
.lg-PPL { --lg: #046a38; }
.lg-ELC { --lg: #1a7f5a; }
.lg-BSA { --lg: #0a8f3c; }
.lg-ETH { --lg: #078930; }
.lg-CAF { --lg: #b07d2b; }
.lg-INT { --lg: #4b7bec; }
.lg-OTH { --lg: #79828d; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font: var(--step-0)/1.5 var(--font);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}

/* ---------------------------------------------------------------- header */
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 30px;
  background:
    radial-gradient(120% 90% at 82% -10%, rgba(255, 255, 255, .28) 0%, transparent 55%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 55%, #07603a 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow-lift);
}
.bal .label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255, 255, 255, .72);
}
.bal strong {
  font-size: var(--step-3); font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums lining-nums;
  display: block; line-height: 1.12;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
button.ghost {
  background: rgba(255, 255, 255, .18); border: 0; color: #fff;
  width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
button.ghost:active { transform: rotate(180deg) scale(.92); background: rgba(255, 255, 255, .3); }
.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
/* The language switch names the other language, in that language. */
button.lang-btn {
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35); color: #fff;
  min-width: 44px; height: 38px; padding: 0 12px; border-radius: 19px;
  font-size: 13px; font-weight: 800; letter-spacing: .02em; cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
button.lang-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .3); }
button.lang-btn:focus-visible, button.ghost:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

main { padding: 0 16px 24px; margin-top: -14px; }
.tab { display: none; animation: rise .18s ease both; }
.tab.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); }
.good { color: var(--win); }
.bad { color: var(--lose); }
.empty { color: var(--muted); text-align: center; padding: 44px 12px; line-height: 1.7; }
.list { display: flex; flex-direction: column; gap: 10px; }

/* ------------------------------------------------------------ dashboard */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat.accent {
  background:
    radial-gradient(120% 100% at 80% 0%, rgba(255, 255, 255, .3) 0%, transparent 60%),
    linear-gradient(135deg, var(--gold) 0%, #e8890b 100%);
  color: #241a02; border-color: transparent;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--gold) 70%, transparent);
}
.stat.accent .stat-label, .stat.accent .stat-sub { color: rgba(36, 26, 2, .7); }
.stat-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.stat strong {
  font-size: var(--step-2); font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums lining-nums; line-height: 1.15;
}
.stat-sub { font-size: 11px; color: var(--muted); }

.banner {
  background: var(--gold-soft);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  border-radius: 14px; padding: 11px 13px; font-size: 13px; margin: 14px 0;
}

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 10px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
button.link {
  background: none; border: 0; color: var(--brand); font-size: 12px;
  font-weight: 700; cursor: pointer; padding: 2px 0;
}

/* --------------------------------------------------------------- matches */
.match {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); padding: 13px 13px 13px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: box-shadow .2s ease, transform .2s ease;
}
/* the competition colour, as an edge that fades rather than a printed rule */
.match::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--lg, var(--brand)) 0%,
              color-mix(in srgb, var(--lg, var(--brand)) 25%, transparent) 100%);
}
.match:active { transform: translateY(1px); box-shadow: var(--shadow); }
/* each card arrives just after the one above it, so the board reads as a list
   being dealt rather than a block that blinks into place */
.match { animation: deal .34s cubic-bezier(.22, 1, .36, 1) both;
         animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes deal {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.match .meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted); margin-bottom: 8px;
}
.match .league-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; color: var(--lg, var(--brand));
}
.kick {
  background: var(--brand-soft); color: var(--brand-dark);
  padding: 3px 9px; border-radius: 999px; font-weight: 700; font-size: 11px;
  font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.01em;
  white-space: nowrap;
}
.kick.soon { background: color-mix(in srgb, var(--lose) 15%, transparent); color: var(--lose); }
@media (prefers-color-scheme: dark) { .kick { color: var(--brand); } }

.match .teams {
  font-weight: 700; font-size: var(--step-1); margin-bottom: 12px;
  letter-spacing: -.02em; line-height: 1.25; text-wrap: balance;
}
.match .teams .v {
  color: var(--muted); font-weight: 600; font-size: 11px; margin: 0 6px;
  text-transform: uppercase; letter-spacing: .08em;
}

.odds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.odds button {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--text) 3%, var(--bg)) 0%, var(--bg) 100%);
  color: var(--text);
  border: 1.5px solid var(--line); border-radius: 13px; padding: 10px 4px;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px; align-items: center;
  /* the press is the one place a spring earns its keep */
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1),
              box-shadow .18s ease, border-color .18s ease, background .18s ease;
}
.odds button:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.odds button:active { transform: scale(.94); }
.odds button:focus-visible { outline: none; box-shadow: var(--ring); }
.odds button .k {
  font-size: 9px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.odds button .price {
  font-size: var(--step-1); font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
}
.odds button.on {
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(255, 255, 255, .22) 0%, transparent 60%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--brand) 78%, transparent);
}
.odds button.on .k, .odds button.on .price { color: #fff; }

.odds.n2 { grid-template-columns: repeat(2, 1fr); }

/* The extra markets. They sit under the 1X2 on a card that is already the
   busiest thing on the page, so they are quieter than it by design: a hairline
   above, a small caps name, and the same buttons a size down. */
.market { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.market-name {
  font-size: 9px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.market .odds button { padding: 8px 4px; border-radius: 11px; }
.market .odds button .price { font-size: var(--step-0); }

/* the tighter cards the dashboard shows under "Next up" and "Your latest" */
.match.compact, .bet.compact { padding: 11px 12px; margin-bottom: 0; }
.match.compact .teams { font-size: 14px; margin-bottom: 9px; }
.match.compact .meta { margin-bottom: 6px; }
/* "Next up" on the home tab is a glance, not a board - the extra markets are
   one tap away on the Matches tab and would drown it. */
.match.compact .market { display: none; }
.bet.compact .head { margin-bottom: 4px; }

.league-head {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--lg, var(--muted)); margin: 18px 0 8px;
  display: flex; align-items: center; gap: 7px;
}
.league-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.league-head:first-child { margin-top: 0; }

/* placeholder cards while the first request is in flight */
.skeleton { pointer-events: none; border-left-color: var(--line); }
.skeleton span {
  display: block; height: 12px; border-radius: 7px; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--line), transparent, var(--line));
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear;
}
.skeleton span:nth-child(1) { width: 38%; }
.skeleton span:nth-child(2) { width: 72%; }
.skeleton span:nth-child(3) { width: 100%; height: 38px; margin-bottom: 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .tab, .skeleton span, .match { animation: none; }
  .match { animation-delay: 0s; }
}

/* ------------------------------------------------------------------ chips */
.chips { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.chips button {
  flex: 1 1 auto; min-width: 56px; padding: 9px 11px; font-size: 13px; font-weight: 700;
  background: var(--bg); color: var(--text);
  border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: transform .08s ease;
}
.chips button:active { transform: scale(.95); }
/* Telebirr / bank switch on the deposit card */
.chips.pay-methods { margin: 4px 0 10px; }
.chips.pay-methods button { flex: 1 1 0; min-height: 44px; font-weight: 700; }
.chips.pay-methods button.on {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-color: transparent;
}

.chips.leagues {
  margin: 14px 0 4px; overflow-x: auto; flex-wrap: nowrap;
  padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chips.leagues::-webkit-scrollbar { display: none; }
.chips.leagues button { flex: 0 0 auto; white-space: nowrap; font-size: 12.5px; }
.chips.leagues button.on {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px -5px color-mix(in srgb, var(--brand) 70%, transparent);
}
.chips.leagues button i { font-style: normal; opacity: .55; font-size: 11px; font-weight: 700; }
.chips.leagues button.on i { opacity: .85; }

/* -------------------------------------------------------------- bet slip */
.slip-row {
  background: var(--card); border-radius: 14px; padding: 11px 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  box-shadow: var(--shadow);
}
.slip-row .x {
  background: none; border: 0; color: var(--muted); font-size: 17px;
  cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.slip-row .x:active { background: var(--line); }

.payout-hero {
  background: linear-gradient(135deg, var(--gold) 0%, #e8890b 55%, #cf7208 100%);
  color: #241a02; border-radius: var(--radius); padding: 17px;
  margin-bottom: 10px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 8px 22px -10px rgba(232, 137, 11, .8);
}
.payout-hero .stat-label { color: rgba(36, 26, 2, .72); }
.payout-hero strong {
  font-size: 33px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.payout-hero .stat-sub { color: rgba(36, 26, 2, .68); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- forms */
.card {
  background: var(--card); border-radius: var(--radius); padding: 15px;
  margin-bottom: 14px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h2 { margin: 0 0 11px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }

label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); margin: 12px 0 5px;
}
input {
  width: 100%; padding: 13px; font-size: 16px; color: var(--text);   /* 16px: iOS will not zoom */
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}

.row { display: flex; justify-content: space-between; padding: 7px 0; align-items: center; }
.row strong { font-variant-numeric: tabular-nums; }
.win-row { border-top: 1px solid var(--line); margin-top: 7px; padding-top: 11px; }
.win-row strong { color: var(--win); font-size: 17px; font-weight: 800; }
#wallet-summary .row { padding: 7px 0; }

/* The limits card. Each row is a cap on the left and the box to change it on
   the right, so the number in force and the number being typed stay side by
   side - .secondary is full-width by default, which would swamp the row. */
#limits-rows .slip-row { align-items: flex-start; }
#limits-rows .slip-row > div:last-child {
  display: flex; gap: 6px; align-items: center; flex: 0 0 auto;
}
.lim-input { width: 96px; padding: 9px 10px; font-size: 15px; }
.lim-set {
  display: inline-block; width: auto; margin-top: 0; padding: 9px 14px;
  font-size: 14px; white-space: nowrap;
}

/* Class-based, not button.primary - the "open in Telegram" control is an <a>,
   and a tag-qualified selector silently left it looking like a bare link. */
.primary, .secondary {
  display: block; width: 100%; margin-top: 15px; padding: 14px;
  font-size: 15px; font-weight: 800; font-family: inherit;
  border: 0; border-radius: 13px; cursor: pointer; letter-spacing: -.01em;
  text-align: center; text-decoration: none; box-sizing: border-box;
  transition: transform .08s ease, opacity .15s ease;
}
.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 75%, transparent);
}
.secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--line); }
.primary:active, .secondary:active { transform: scale(.985); }
.primary:focus-visible, .secondary:focus-visible, .chips button:focus-visible {
  outline: none; box-shadow: var(--ring);
}
.primary:visited, .primary:hover { color: #fff; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }

button.copy {
  background: var(--brand-soft);
  border: 1.5px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-radius: 9px; padding: 3px 9px; font: inherit; font-weight: 800;
  color: var(--brand-dark); cursor: pointer; font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) { button.copy { color: var(--brand); } }

.steps { margin: 0 0 6px; padding-left: 19px; }
.steps li { margin-bottom: 7px; }

/* -------------------------------------------------------------- my bets */
.bet {
  background: var(--card); border-radius: var(--radius); padding: 13px;
  border: 1px solid var(--line); border-left: 4px solid var(--muted);
  box-shadow: var(--shadow);
}
.bet.is-open { border-left-color: var(--info); }
.bet.is-won { border-left-color: var(--win); }
.bet.is-lost { border-left-color: var(--lose); }
.bet .head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted); margin-bottom: 7px; font-weight: 600;
}
.bet .leg { font-size: 13px; padding: 3px 0; }
.status-won { color: var(--win); font-weight: 800; }
.status-lost { color: var(--lose); font-weight: 800; }
.status-open { color: var(--info); font-weight: 800; }
.status-void { color: var(--muted); font-weight: 800; }

/* ------------------------------------------------------------------- nav */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  /* one column per visible tab: Bingo comes and goes with BINGO_MODE */
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 9px 0 11px; font-size: 17px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: color .15s ease, transform .1s ease;
}
/* One line always: "Play Bingo" / "ቢንጎ ተጫወት" on six tabs at 320px. */
nav button span { font-size: clamp(9.5px, 3vw, 11px); font-weight: 700; white-space: nowrap; }
nav button.active, nav button.active span { color: var(--brand); }
nav button:active { transform: scale(.92); }
nav button:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 12px; }
/* a short bar over the active tab - the one piece of chrome that says where
   you are without reading the label */
/* The active marker hangs from the top edge of the bar. It used to sit in the
   flex column after the label and be pulled up 11px - onto the label itself. */
nav button { position: relative; }
nav button::after {
  content: ""; position: absolute; top: 0; left: 50%;
  height: 2.5px; width: 20px; margin-left: -10px; border-radius: 0 0 3px 3px;
  background: var(--brand); opacity: 0; transform: scaleX(.3);
  transition: opacity .2s ease, transform .24s cubic-bezier(.34, 1.4, .64, 1);
}
nav button.active::after { opacity: 1; transform: scaleX(1); }
nav i {
  font-style: normal; background: var(--lose); color: #fff;
  border-radius: 999px; padding: 0 5px; font-size: 9px; font-weight: 800; margin-left: 2px;
}
nav i:empty { display: none; }

/* the screen someone lands on when they open the address in a browser */
.gate {
  min-height: 54vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 40px 10px 30px; max-width: 380px;
  margin: 0 auto; min-height: 60vh;
  display: flex; flex-direction: column; justify-content: center;
}
.gate-mark {
  font-size: 46px; line-height: 1; margin-bottom: 14px;
  filter: drop-shadow(0 6px 14px rgba(18, 183, 106, .35));
}
.gate h2 { margin: 0 0 8px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.gate p { margin: 0 0 6px; line-height: 1.6; }
.gate-btn { margin-top: 22px; max-width: 320px; }
.gate-note { margin-top: 22px; opacity: .8; line-height: 1.6; }
header.bare { justify-content: center; padding-bottom: 26px; }
header.bare .bal { align-items: center; }
header.bare .brandname { font-size: 16px; font-weight: 800; opacity: 1; }
header.bare .sep, header.bare #balance, header.bare #refresh { display: none; }

/* ------------------------------------------------------- slip bar ----- */
/* Sits above the tab bar while a slip is unplaced. Real books all have one,
   because the moment between "I like that price" and "placed" is where bets
   are lost. */
#slip-bar {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 6; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 15px; border-radius: 15px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; box-shadow: 0 10px 26px -10px color-mix(in srgb, var(--brand) 85%, black);
  animation: slipIn .22s cubic-bezier(.2, .8, .3, 1.2) both;
}
#slip-bar:active { transform: scale(.985); }
@keyframes slipIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sb-left, .sb-right { display: flex; align-items: center; gap: 8px; }
.sb-count {
  background: rgba(255, 255, 255, .22); border-radius: 999px;
  min-width: 26px; height: 26px; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13px;
}
.sb-label { font-size: 13px; opacity: .9; }
.sb-odds { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.sb-go { font-size: 12px; opacity: .85; font-weight: 700; }

/* ---------------------------------------------------------- toast ------ */
/* Reassurance should not need dismissing. */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(-14px);
  top: calc(12px + env(safe-area-inset-top)); z-index: 20;
  max-width: min(92vw, 420px); padding: 11px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 13px; font-weight: 600; text-align: center;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: .96; transform: translateX(-50%) translateY(0); }
.toast.warn { background: var(--warn); color: #241a02; }
.toast.bad { background: var(--lose); color: #fff; }

/* a balance that changed should catch the eye once, then settle */
.bal strong.bump { animation: bump .5s ease; }
@keyframes bump {
  0% { transform: none; }
  30% { transform: scale(1.13); }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #slip-bar, .bal strong.bump { animation: none; }
  .toast { transition: none; }
}


/* --------------------------------------------------- wide screens
   The Mini App is a phone layout, and most people meet it on a phone.
   Someone who opens the address in a desktop browser should still see
   something that looks deliberate, not a stretched-out one. */
@media (min-width: 560px) {
  header { border-radius: 0 0 26px 26px; }
  header > *, main > * { max-width: 480px; margin-left: auto; margin-right: auto; }
  header { padding-left: max(16px, calc(50vw - 248px)); padding-right: max(16px, calc(50vw - 248px)); }
  main { max-width: 512px; margin-left: auto; margin-right: auto; }
  /* Centre these with margins, never with a transform: the slip bar animates
     in on transform and the toast already carries its own translateX(-50%),
     so a centring transform here would be overwritten the moment either
     moved - and the bar would snap back to the left edge mid-animation. */
  #slip-bar { max-width: 480px; left: 0; right: 0; margin-inline: auto; }
  #toast { max-width: 480px; }
  nav { max-width: 512px; left: 0; right: 0; margin-inline: auto;
        border-radius: 18px 18px 0 0; }
}

/* ================================================================= Bingo */
.col0 { --col: #15803d; --ink: #fff; }
.col1 { --col: #e0a800; --ink: #1d1500; }
.col2 { --col: #d62839; --ink: #fff; }
.col3 { --col: #2563eb; --ink: #fff; }
.col4 { --col: #ea6a0a; --ink: #1f0d00; }

.bingo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 26px 2px 12px; }
.bingo-head h2 { margin: 0; font-size: 22px; }
.bingo-head p { margin: 2px 0 0; }
.bingo-tools { display: flex; gap: 6px; }
.bingo-tools button { min-width: 44px; min-height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 700; }
.bingo-closed { text-align: center; padding: 28px 18px; }
.bingo-hero-ball { font-size: 54px; }

.b-rooms { display: grid; gap: 12px; }
.b-room { position: relative; display: grid; gap: 6px; text-align: start; width: 100%; padding: 16px 16px 14px 20px;
  border-radius: 18px; border: 1px solid var(--line); color: var(--text); overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--card)), var(--card) 60%); }
.b-room::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px;
  background: linear-gradient(#15803d 0 33%, #f5c518 33% 66%, #d62839 66%); }
.b-room:active { transform: scale(.985); }
.b-room-price { font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.b-room-stats, .b-room-mine { font-size: 13px; color: var(--muted); }
.b-room-prize { font-size: 15px; }
.b-room-prize b { color: var(--win); font-size: 18px; }
.b-room-go { position: absolute; right: 14px; bottom: 12px; font-weight: 800; color: var(--brand); }
.b-badge { justify-self: start; font-size: 12.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--text); }
.b-badge.wait { background: var(--gold-soft); }
.b-badge.live { background: color-mix(in srgb, var(--lose) 16%, transparent); color: var(--lose); }
.b-badge.won { background: var(--gold-soft); }
.b-how summary, .b-board summary, .b-fair summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.b-how, .b-board, .b-fair { margin-top: 12px; }

.b-room-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 12px; }
.b-back { min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; }
.b-room-title { font-size: 17px; min-width: 0; }
.b-room-title .muted { white-space: nowrap; }
.b-prize { text-align: end; line-height: 1.15; }
.b-prize span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.b-prize b { font-size: 20px; color: var(--win); }

.b-countdown { display: flex; align-items: baseline; justify-content: center; gap: 10px; padding: 14px; border-radius: 16px;
  background: var(--brand-soft); margin-bottom: 12px; }
.b-countdown b { font-size: 30px; font-variant-numeric: tabular-nums; }
.b-countdown.wait { background: var(--gold-soft); }
.b-sub { margin: 14px 2px 8px; font-size: 15px; }

.b-buy h3 { margin: 0; }
.b-nums { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; margin: 10px 0; max-height: 340px; overflow-y: auto; padding: 2px; }
.b-num { aspect-ratio: 1; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0; }
.b-num.sel { background: #f5c518; color: #1d1500; border-color: transparent; transform: scale(1.06); }
.b-num.mine { background: var(--brand); color: #fff; border-color: transparent; }
.b-num.taken { opacity: .32; text-decoration: line-through; }
/* a phone gets six to a row so every number is a full 44px thumb target */
@media (max-width: 520px) { .b-nums { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; } .b-num { font-size: 15px; } }
.b-buy-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.b-buy-row button { min-height: 50px; }
.b-preview { margin: 6px 0 10px; }

.b-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.b-card { border-radius: 18px; padding: 10px; background: var(--card); border: 1px solid var(--line); transition: box-shadow .3s; }
.b-card.hot { box-shadow: 0 0 0 2px #f5c518, 0 8px 26px -10px #f5c518; }
.b-card.winner { box-shadow: 0 0 0 3px var(--win), 0 10px 30px -10px var(--win); }
.b-card-head { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 8px; font-size: 14px; }
.b-togo { font-size: 12.5px; font-weight: 800; color: var(--muted); }
.b-togo.hot { color: #b45309; }
.b-togo.win { color: var(--win); }
.b-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.b-grid .h { text-align: center; padding: 4px 0; border-radius: 8px; background: var(--col); color: var(--ink); font-weight: 800; font-size: 15px; }
.b-grid .cell { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; background: var(--bg);
  border: 1px solid var(--line); font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.b-grid .cell.free { background: #f5c518; color: #1d1500; font-size: 12px; border-color: transparent; }
.b-grid .cell.on { background: radial-gradient(circle, var(--col) 0 58%, color-mix(in srgb, var(--col) 50%, transparent) 60% 66%, var(--bg) 68%);
  color: var(--ink); border-color: transparent; animation: b-stamp .35s ease-out; }
.b-grid .cell.hl { box-shadow: 0 0 0 3px #f5c518 inset; }
.b-grid .cell.last { animation: b-stamp .35s ease-out, b-pulse 1.4s ease-in-out infinite; }

.b-live { display: grid; gap: 10px; }
.b-stage { display: grid; justify-items: center; gap: 4px; padding: 16px 10px 12px; border-radius: 22px;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%), var(--card); }
.b-call { font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.b-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-recent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.b-recent > span { width: 100%; text-align: center; }

.b-ball { --size: 50px; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 32% 28%, #fff 0 7%, var(--col, #888) 44%, color-mix(in srgb, var(--col, #888) 55%, #000));
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45); }
.b-ball.big { --size: min(46vw, 190px); }
.b-ball.empty { background: var(--bg); border: 3px dashed var(--line); color: var(--muted); font-size: 28px; font-weight: 800; }
.b-ball-face { width: 70%; height: 70%; border-radius: 50%; background: #fff; color: #111; display: grid; place-content: center; text-align: center; line-height: 1; }
.b-ball-face i { font-style: normal; font-weight: 800; font-size: max(9px, calc(var(--size) * .16)); color: var(--col); }
.b-ball.col1 .b-ball-face i { color: #7a5600; }
.b-ball-face b { font-size: calc(var(--size) * .34); font-weight: 900; font-variant-numeric: tabular-nums; }
.b-ball.drop { animation: b-drop .75s cubic-bezier(.2, 1.3, .4, 1); }

.b-board .b-board-row { display: grid; grid-template-columns: 1.4fr repeat(15, minmax(0, 1fr)); gap: 2px; margin-top: 3px; }
.b-board-row span { display: grid; place-items: center; aspect-ratio: 1; border-radius: 5px; font-size: 11px; font-weight: 700; background: var(--bg); color: var(--muted); }
.b-board-row .h { background: var(--col); color: var(--ink); aspect-ratio: auto; font-size: 11px; }
.b-board-row .on { background: var(--col); color: var(--ink); }
.b-board-row .last { box-shadow: 0 0 0 2px #f5c518; }

.b-result { position: relative; overflow: hidden; display: grid; gap: 4px; text-align: center; padding: 18px 14px; border-radius: 20px;
  background: var(--gold-soft); margin-bottom: 10px; font-size: 17px; }
.b-result span { color: var(--win); font-weight: 800; font-size: 22px; }
.b-result.you { background: linear-gradient(135deg, #15803d, #0f8a4c 55%, #946700); color: #fff; font-size: 24px; animation: b-pop .6s ease-out; }
.b-result.void { background: var(--card); color: var(--muted); }
.b-confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: b-fall 2.6s ease-in forwards; }
.b-confetti i:nth-child(5n+1) { background: #15803d; }
.b-confetti i:nth-child(5n+2) { background: #f5c518; }
.b-confetti i:nth-child(5n+3) { background: #d62839; }
.b-confetti i:nth-child(5n+4) { background: #2563eb; }
.b-confetti i:nth-child(5n) { background: #fff; }
.b-confetti i:nth-child(odd) { animation-duration: 3.1s; }
.b-confetti i:nth-child(3n) { animation-delay: .25s; }
.b-confetti i:nth-child(1) { left: 0%; }
.b-confetti i:nth-child(2) { left: 37%; }
.b-confetti i:nth-child(3) { left: 74%; }
.b-confetti i:nth-child(4) { left: 11%; }
.b-confetti i:nth-child(5) { left: 48%; }
.b-confetti i:nth-child(6) { left: 85%; }
.b-confetti i:nth-child(7) { left: 22%; }
.b-confetti i:nth-child(8) { left: 59%; }
.b-confetti i:nth-child(9) { left: 96%; }
.b-confetti i:nth-child(10) { left: 33%; }
.b-confetti i:nth-child(11) { left: 70%; }
.b-confetti i:nth-child(12) { left: 7%; }
.b-confetti i:nth-child(13) { left: 44%; }
.b-confetti i:nth-child(14) { left: 81%; }
.b-confetti i:nth-child(15) { left: 18%; }
.b-confetti i:nth-child(16) { left: 55%; }
.b-confetti i:nth-child(17) { left: 92%; }
.b-confetti i:nth-child(18) { left: 29%; }
.b-confetti i:nth-child(19) { left: 66%; }
.b-confetti i:nth-child(20) { left: 3%; }
.b-confetti i:nth-child(21) { left: 40%; }
.b-confetti i:nth-child(22) { left: 77%; }
.b-confetti i:nth-child(23) { left: 14%; }
.b-confetti i:nth-child(24) { left: 51%; }
.b-confetti i:nth-child(25) { left: 88%; }
.b-confetti i:nth-child(26) { left: 25%; }
.b-confetti i:nth-child(27) { left: 62%; }
.b-confetti i:nth-child(28) { left: 99%; }
.b-fair code { word-break: break-all; font-size: 11.5px; }
.b-fair .good { color: var(--win); }
.b-fair .bad { color: var(--lose); }
.center { text-align: center; }

@keyframes b-drop { 0% { transform: translateY(-120%) rotate(-200deg) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes b-stamp { 0% { transform: scale(1.5) rotate(-12deg); opacity: .4; } 100% { transform: none; opacity: 1; } }
@keyframes b-pulse { 50% { box-shadow: 0 0 0 3px #f5c518; } }
@keyframes b-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.04); } 100% { transform: none; } }
@keyframes b-fall { to { transform: translateY(220px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .b-ball.drop, .b-grid .cell.on, .b-grid .cell.last, .b-result.you, .b-confetti i { animation: none !important; }
}

/* Amharic. Ethiopic has no capitals, so the small spaced-out caps used for
   labels only pull its syllables apart; the letters keep their natural
   spacing and get a touch more size and line height to stay legible. */
html[lang="am"] .bal .label, html[lang="am"] .stat-label, html[lang="am"] .odds button .k,
html[lang="am"] .market-name, html[lang="am"] .league-head, html[lang="am"] label {
  letter-spacing: normal;
}
html[lang="am"] .stat-label, html[lang="am"] .market-name, html[lang="am"] .odds button .k {
  font-size: 12px; line-height: 1.35;
}
