/* ================================================================
   TGR TOURNAMENT — Design System
   Dark esports theme · black / gold / crimson / chrome
   Mobile-first · APK/WebView ready
   ================================================================ */

:root {
  /* base surfaces */
  --bg:        #08080b;
  --bg-2:      #0d0d12;
  --surface:   #14141c;
  --surface-2: #1b1b26;
  --surface-3: #23232f;
  --line:      #2a2a38;
  --line-2:    #363648;

  /* brand */
  --gold:      #e8b923;
  --gold-2:    #f4d35e;
  --gold-deep: #b8860b;
  --red:       #e01e2b;
  --red-2:     #ff3b47;
  --red-deep:  #9c1119;
  --silver:    #c7ccd1;
  --silver-2:  #eef1f4;

  /* text */
  --text:      #f5f6f8;
  --muted:     #9096a2;
  --muted-2:   #626878;

  /* status */
  --green:     #21c17a;
  --blue:      #3d8bff;
  --amber:     #f0a92b;

  /* gradients */
  --grad-gold: linear-gradient(135deg, #f4d35e 0%, #e8b923 45%, #b8860b 100%);
  --grad-red:  linear-gradient(135deg, #ff3b47 0%, #e01e2b 55%, #9c1119 100%);
  --grad-dark: linear-gradient(180deg, #14141c 0%, #0d0d12 100%);

  /* shape */
  --r-sm: 8px;  --r: 14px;  --r-lg: 20px;  --r-xl: 28px;
  --shadow:    0 8px 30px rgba(0,0,0,.45);
  --shadow-gold: 0 6px 24px rgba(232,185,35,.25);
  --shadow-red:  0 6px 24px rgba(224,30,43,.28);

  --nav-h: 64px;
  --top-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Orbitron', 'Inter', system-ui, sans-serif;
}

/* ---------------- reset ---------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
body::before {
  /* ambient arena glow */
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(224,30,43,.14), transparent 60%),
    radial-gradient(760px 460px at 10% 8%, rgba(232,185,35,.10), transparent 62%),
    radial-gradient(600px 600px at 50% 120%, rgba(61,139,255,.05), transparent 60%);
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

h1,h2,h3,h4 { line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.display { font-family: var(--font-display); letter-spacing: .02em; }
small { font-size: .8rem; }

/* ---------------- helpers ---------------- */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-red { color: var(--red-2); }
.text-green { color: var(--green); }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
/* Wraps instead of overflowing: filter strips and button rows must stay inside
   the screen on small phones. */
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.between.nowrap { flex-wrap: nowrap; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.full { width: 100%; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.upper { text-transform: uppercase; letter-spacing: .08em; }
.eyebrow { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }

/* ================= APP SHELL ================= */
#app { min-height: 100%; }
.app-shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--top-h) + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 12px;
  padding-left: 16px; padding-right: 16px;
  background: rgba(10,10,14,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 34px; width: 34px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(224,30,43,.4)); }
.topbar .brand b { font-family: var(--font-display); font-size: 1.02rem; letter-spacing: .06em; }
.topbar .brand b span { color: var(--gold); }
.topbar .spacer { flex: 1; }

.coin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, rgba(232,185,35,.16), rgba(232,185,35,.06));
  border: 1px solid rgba(232,185,35,.4); color: var(--gold-2);
  padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .9rem;
}
.coin-pill .ic { font-size: 1rem; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); font-size: 1.05rem;
  transition: .18s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn .dot {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; font-size: .62rem; font-weight: 800;
  border-radius: 999px; display: grid; place-items: center; border: 2px solid var(--bg);
}

/* page container */
.page { max-width: 1120px; margin: 0 auto; padding: 18px 16px 8px; animation: fade .3s ease; }
.page-title { font-size: 1.5rem; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* bottom nav (mobile) — Gamerji-style with elevated circular center action */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: rgba(13,13,18,.96); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 28px rgba(0,0,0,.45);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted-2); font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  transition: color .16s; position: relative; text-transform: uppercase;
}
.bottom-nav a .ic { font-size: 1.32rem; line-height: 1; position: relative; }
.bottom-nav a.active { color: var(--gold); }
.bottom-nav a.active:not(.center)::before {
  content: ''; position: absolute; top: 0; width: 30px; height: 3px; border-radius: 0 0 6px 6px;
  background: var(--grad-gold); box-shadow: var(--shadow-gold);
}
/* elevated circular center button (notifications) */
.bottom-nav a.center { color: #fff; }
.bottom-nav a.center .ic {
  width: 58px; height: 58px; margin-top: -30px; margin-bottom: 2px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.5rem;
  background: var(--grad-red); color: #fff;
  border: 4px solid var(--bg);
  box-shadow: 0 6px 18px rgba(239,68,68,.5), 0 0 0 1px rgba(255,255,255,.06) inset;
}
.bottom-nav a.center:active .ic { transform: scale(.94); }
.bottom-nav a.center .ic .dot {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--gold); color: #1a1400; font-size: .6rem; font-weight: 800;
  border-radius: 999px; display: grid; place-items: center; border: 2px solid var(--bg);
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--r); font-weight: 700; font-size: .92rem;
  transition: transform .12s, box-shadow .2s, filter .2s; white-space: nowrap;
  border: 1px solid transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-gold { background: var(--grad-gold); color: #1a1400; box-shadow: var(--shadow-gold); }
.btn-red  { background: var(--grad-red); color: #fff; box-shadow: var(--shadow-red); }
.btn-ghost { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.btn-outline { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red-2); }
.btn-sm { padding: 8px 13px; font-size: .82rem; border-radius: 10px; }
.btn-lg { padding: 15px 22px; font-size: 1rem; }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: .82rem; font-weight: 600;
  color: var(--muted); transition: .15s; white-space: nowrap;
}
.chip.active { background: rgba(232,185,35,.14); border-color: var(--gold); color: var(--gold-2); }
.chip-row { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* ================= CARDS ================= */
.card {
  background: var(--grad-dark); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }

.grid { display: grid; gap: 14px; }
/* Phones get one column; minmax(0,1fr) stops long selects/inputs from widening
   a track past the screen (which used to make forms scroll sideways). */
.grid-2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* auto-fill + a percentage min would collapse every track to 0 (Chrome treats
   the percentage as indefinite here), so keep a fixed min and switch to a
   single column on small phones instead. */
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 460px) { .grid-auto { grid-template-columns: minmax(0, 1fr); } }

/* stat cards */
.stat {
  background: var(--grad-dark); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; position: relative; overflow: hidden; min-width: 0;
  transition: border-color .16s, transform .16s;
}
a.stat:active { transform: scale(.985); }
a.stat:hover { border-color: var(--line-2); }
.stat::after { content: ''; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px; border-radius: 50%; background: var(--grad-gold); opacity: .08; }
/* Labels wrap to two lines on narrow phones instead of being clipped. */
.stat .k { font-size: .68rem; line-height: 1.25; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; padding-right: 26px; overflow-wrap: anywhere; }
/* Value scales with the card so big amounts (₹1,25,000) stay inside it. */
.stat .v { font-size: clamp(1.1rem, 5.4vw, 1.5rem); line-height: 1.2; font-weight: 800; margin-top: 5px; font-family: var(--font-display); overflow-wrap: anywhere; }
.stat .ic { position: absolute; right: 11px; top: 11px; font-size: 1.1rem; opacity: .45; }
/* Accent variants: draw the eye to things that need action. */
.stat-warn { border-color: rgba(240,169,43,.35); }
.stat-warn .v { color: var(--amber); }
.stat-warn::after { background: var(--amber); opacity: .1; }
.stat-live { border-color: rgba(255,59,71,.35); }
.stat-live .v { color: var(--red-2); }
.stat-live::after { background: var(--red-2); opacity: .1; }
.stat-good .v { color: var(--green); }
@media (min-width: 720px) { .stat .v { font-size: 1.5rem; } }

/* section header */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 12px; }
.sec-head h3 { font-size: 1.12rem; }
.sec-head a { color: var(--gold); font-size: .82rem; font-weight: 700; }

/* ================= TOURNAMENT CARD ================= */
.tcard {
  background: var(--grad-dark); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, border-color .18s;
}
.tcard:active { transform: scale(.99); }
.tcard .banner {
  height: 130px; position: relative; background-size: cover; background-position: center;
  background-color: var(--surface-2);
}
.tcard .banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,8,11,.1), rgba(8,8,11,.92)); }
/* Wraps so a long phase label ("Credentials Available") plus "✓ Joined" can never
   push a badge outside the card on narrow phones. */
.tcard .banner .top { position: absolute; inset: 10px 10px auto 10px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; z-index: 2; }
/* No overflow:hidden here — it would clip the LIVE badge's pulse glow; wrapping
   plus max-width is enough to keep every phase label inside the card. */
.tcard .banner .top > * { max-width: 100%; }
.tcard .banner .gname { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2; font-weight: 800; font-size: 1.05rem; text-shadow: 0 2px 8px #000; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard .banner .gname img { flex: none; }
.tcard .body { padding: 13px 15px 15px; }
.tcard .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 12px; }
.tcard .meta .m { display: flex; flex-direction: column; }
.tcard .meta .m span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tcard .meta .m b { font-size: .92rem; font-weight: 700; }
.tcard .prize b { color: var(--gold-2); }

/* progress bar */
.prog { height: 7px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 4px 0 10px; }
.prog > i { display: block; height: 100%; background: var(--grad-gold); border-radius: 999px; }

/* phase badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted);
  white-space: nowrap; min-width: 0;
}
.badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; }
.badge-live { color: var(--red-2); border-color: rgba(255,59,71,.4); background: rgba(224,30,43,.12); }
.badge-live .pulse { animation: pulse 1.4s infinite; }
.badge-soon { color: var(--amber); border-color: rgba(240,169,43,.4); background: rgba(240,169,43,.12); }
.badge-open, .badge-upcoming { color: var(--green); border-color: rgba(33,193,122,.4); background: rgba(33,193,122,.1); }
.badge-creds { color: var(--gold-2); border-color: rgba(232,185,35,.4); background: rgba(232,185,35,.12); }
.badge-closed, .badge-completed { color: var(--muted); }
.badge-cancelled { color: var(--red-2); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(255,59,71,.6);} 70%{box-shadow:0 0 0 7px rgba(255,59,71,0);} 100%{box-shadow:0 0 0 0 rgba(255,59,71,0);} }
/* Badges sit on top of a bright map banner, so lay a dark plate under the tint —
   otherwise UPCOMING / ✓ JOINED wash out over light artwork. */
.tcard .banner .badge, .tcard .banner .pill {
  background-image: linear-gradient(rgba(8,8,11,.78), rgba(8,8,11,.78));
  backdrop-filter: blur(3px); box-shadow: 0 2px 10px rgba(0,0,0,.4);
}

/* ================= FORMS ================= */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); color: var(--text); font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,185,35,.14); outline: none; }
.textarea { min-height: 96px; resize: vertical; }
.select-sm, .input.select-sm { width: auto; padding: 7px 10px; font-size: .82rem; border-radius: 9px; }
.game-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 84px; padding: 10px 14px; cursor: pointer;
  background: var(--surface, #16181d); border: 2px solid var(--line, #2a2d35); border-radius: 12px; color: var(--text, #e8e8ea); transition: .15s; }
.game-tile:hover { border-color: var(--gold, #f5c451); }
.game-tile.sel { border-color: var(--gold, #f5c451); box-shadow: 0 0 0 2px rgba(245,196,81,.25) inset; background: rgba(245,196,81,.08); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.field .hint { font-size: .74rem; color: var(--muted-2); margin-top: 5px; }
.field .err { font-size: .76rem; color: var(--red-2); margin-top: 5px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: .86rem; color: var(--muted); }
.checkbox input { width: 18px; height: 18px; accent-color: var(--gold); margin-top: 1px; flex: none; }

/* ================= AUTH ================= */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 20px calc(32px + var(--safe-b)); max-width: 460px; margin: 0 auto; }
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo img { height: 96px; width: 96px; margin: 0 auto 10px; object-fit: contain; filter: drop-shadow(0 6px 20px rgba(224,30,43,.4)); }
.auth-logo h1 { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .08em; }
.auth-logo h1 span { color: var(--gold); }
.auth-logo p { color: var(--muted); font-size: .86rem; margin-top: 4px; }
.auth-card { background: var(--grad-dark); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 24px 20px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-card .lead { color: var(--muted); font-size: .88rem; margin-bottom: 20px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: .88rem; }
.auth-switch a { color: var(--gold); font-weight: 700; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted-2); font-size: .76rem; margin: 18px 0; }
.divider::before, .divider::after { content: ''; height: 1px; background: var(--line); flex: 1; }

/* OTP inputs — the row must survive a 320px phone, so the boxes flex down
   instead of overflowing the auth card. */
.otp-badge {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem;
  background: rgba(232,185,35,.12); border: 1px solid rgba(232,185,35,.28);
  box-shadow: 0 6px 20px rgba(232,185,35,.14);
}
.otp-row { display: flex; gap: 9px; justify-content: center; margin: 16px 0 6px; }
.otp-row input {
  flex: 1 1 0; min-width: 0; max-width: 52px; height: 56px;
  text-align: center; font-size: 1.4rem; font-weight: 800;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--text);
}
.otp-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232,185,35,.14); outline: none; }
.dev-otp { text-align: center; font-size: .78rem; color: var(--amber); margin-top: 10px; }
@media (max-width: 360px) { .otp-row { gap: 6px; } .otp-row input { height: 50px; font-size: 1.2rem; } }

/* Ranked horizontal meters — the phone-friendly stand-in for a bar chart whenever
   the labels are words rather than dates. */
.meters { display: flex; flex-direction: column; gap: 11px; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: .8rem; }
.meter-top span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-top b { flex: none; font-size: .84rem; }
.meter-bar { height: 7px; margin-top: 5px; border-radius: 99px; background: var(--surface-2, rgba(255,255,255,.06)); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 99px; opacity: .9; }

/* ================= GAME / LIST / WALLET ================= */
.game-card {
  background: var(--grad-dark); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 12px; text-align: center; transition: transform .15s, border-color .15s;
}
.game-card:active { transform: scale(.96); }
.game-card .emoji { font-size: 2rem; }
.game-card b { display: block; margin-top: 8px; font-size: .9rem; }
.game-card small { color: var(--muted); font-size: .72rem; }

.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); font-size: 1.1rem; flex: none; border: 1px solid var(--line); }
.list-item .t { flex: 1; min-width: 0; }
.list-item .t b { display: block; font-size: .92rem; }
.list-item .t small { color: var(--muted); font-size: .76rem; }
.list-item .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.amt.plus { color: var(--green); } .amt.minus { color: var(--red-2); }

.wallet-hero {
  background: radial-gradient(120% 140% at 100% 0%, rgba(224,30,43,.28), transparent 55%), var(--grad-dark);
  border: 1px solid rgba(232,185,35,.3); border-radius: var(--r-xl); padding: 22px; position: relative; overflow: hidden;
}
.wallet-hero::after { content: '₹'; position: absolute; right: 6px; bottom: -34px; font-size: 8rem; opacity: .06; font-weight: 800; }
.wallet-hero .lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.wallet-hero .bal { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; color: var(--gold-2); margin: 4px 0 2px; }
.wallet-hero .sub { display: flex; gap: 22px; margin-top: 12px; }
.wallet-hero .sub div span { font-size: .72rem; color: var(--muted); display: block; }
.wallet-hero .sub div b { font-size: 1rem; }

/* status pill (generic) */
.pill { padding: 3px 9px; border-radius: 999px; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.pill.pending { background: rgba(240,169,43,.15); color: var(--amber); }
.pill.approved, .pill.completed, .pill.active, .pill.resolved { background: rgba(33,193,122,.15); color: var(--green); }
.pill.rejected, .pill.banned, .pill.cancelled { background: rgba(224,30,43,.15); color: var(--red-2); }
.pill.open, .pill.registered { background: rgba(61,139,255,.15); color: var(--blue); }

/* leaderboard */
.rank { width: 30px; text-align: center; font-weight: 800; font-family: var(--font-display); color: var(--muted); }
.rank.g1 { color: var(--gold); } .rank.g2 { color: var(--silver); } .rank.g3 { color: #cd7f32; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad-red); display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }

/* ================= MODAL / SHEET ================= */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(4,4,7,.7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s;
}
.modal {
  width: 100%; max-width: 480px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 20px 18px calc(20px + var(--safe-b));
  box-shadow: var(--shadow); animation: sheetUp .28s cubic-bezier(.2,.8,.2,1); max-height: 92vh; overflow-y: auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.modal .grip { width: 40px; height: 4px; border-radius: 3px; background: var(--line-2); margin: 0 auto 14px; }
.modal h3 { font-size: 1.2rem; margin-bottom: 6px; }
.modal .lead { color: var(--muted); font-size: .88rem; margin-bottom: 16px; }

/* credentials box */
.cred-box { background: linear-gradient(135deg, rgba(232,185,35,.12), rgba(224,30,43,.08)); border: 1px solid rgba(232,185,35,.4); border-radius: var(--r); padding: 16px; }
.cred-box.locked { background: var(--surface); border-color: var(--line-2); }
.cred-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.cred-row:last-child { border-bottom: none; }
.cred-row .val { font-family: var(--font-display); font-weight: 800; letter-spacing: .05em; color: var(--gold-2); font-size: 1.05rem; }
.copy-btn { font-size: .74rem; color: var(--gold); font-weight: 700; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: 8px; }
.lock-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; }

/* ================= TOAST ================= */
#toasts { position: fixed; top: calc(var(--safe-t) + 10px); left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; max-width: 440px; width: 100%; background: var(--surface-2); border: 1px solid var(--line-2);
  border-left: 4px solid var(--gold); border-radius: var(--r-sm); padding: 12px 14px; box-shadow: var(--shadow);
  font-size: .88rem; font-weight: 600; animation: toastIn .3s; display: flex; gap: 10px; align-items: center;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================= EMPTY / LOADER ================= */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .em { font-size: 2.6rem; margin-bottom: 10px; opacity: .7; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-3) 37%, var(--surface) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line-2); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.center { margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= INLINE SVG GLYPHS ================= */
/* `sicon()` in js/api.js renders these in place of the emoji the UI used to use:
   plenty of Android WebViews ship without an emoji font and drew every one of them
   as a tofu box. They inherit the surrounding text colour, so each host only has to
   fix the baseline gap an inline <svg> would otherwise leave. */
svg.si { flex: none; }
.stat .ic svg, .empty .em svg, .icon-btn svg, .list-item .ico svg,
.bottom-nav a .ic svg, .rank svg { display: block; }
.badge svg, .chip svg, .btn svg, .pill svg, b svg, .lock-note svg,
.sec-head svg, td svg, .kv svg { display: inline-block; vertical-align: -.15em; }
.empty .em svg { margin: 0 auto; }
.bottom-nav a .ic svg { margin: 0 auto; }

/* ================= ADMIN ================= */
.admin { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding-top: var(--safe-t);
}
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.sidebar .logo img { height: 34px; width: 34px; object-fit: contain; }
.sidebar .logo b { font-family: var(--font-display); font-size: .96rem; letter-spacing: .04em; }
.sidebar .logo b span { color: var(--gold); }
.sidebar nav { padding: 10px 10px; flex: 1; }
.sidebar .grp { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 800; padding: 14px 10px 6px; }
.sidebar a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--muted);
  font-size: .88rem; font-weight: 600; margin-bottom: 2px; transition: .14s;
}
.sidebar a .ic { font-size: 1.05rem; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.sidebar a .ic svg { display: block; }
.sidebar a:hover { background: var(--surface); color: var(--text); }
.sidebar a.active { background: rgba(232,185,35,.12); color: var(--gold-2); }
.sidebar .who { padding: 14px 16px; border-top: 1px solid var(--line); font-size: .8rem; }
.sidebar .who b { display: block; } .sidebar .who small { color: var(--muted); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top {
  height: calc(60px + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 14px; padding-left: 22px; padding-right: 22px;
  border-bottom: 1px solid var(--line); background: rgba(10,10,14,.8); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 30;
}
.admin-top .menu-btn { display: none; }
.admin-content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; animation: fade .3s; }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
table.tbl th { text-align: left; padding: 12px 14px; color: var(--muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl .u { display: flex; align-items: center; gap: 9px; }
.tbl .u .avatar { width: 30px; height: 30px; font-size: .8rem; }

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 25; display: none; }

/* ================= RESPONSIVE ================= */
@media (min-width: 860px) {
  .bottom-nav { display: none; }
  .app-shell { padding-bottom: 30px; }
  .topbar { padding-left: 26px; padding-right: 26px; }
  .topbar .nav-links { display: flex; gap: 6px; margin-left: 14px; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 26px 26px 20px; }
}
@media (max-width: 859px) {
  .topbar .nav-links { display: none; }
}
.topbar .nav-links a { padding: 8px 14px; border-radius: 10px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.topbar .nav-links a.active { background: var(--surface-2); color: var(--gold-2); }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 26; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .admin-top .menu-btn { display: grid; }
  .admin.nav-open .backdrop { display: block; }
}
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ================= UPI / QR (add-money gateway + admin payment preview) ================= */
.qr-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: #fff; border-radius: var(--r); padding: 14px; margin: 4px auto 0; width: fit-content;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
}
.qr-img { width: 220px; height: 220px; max-width: 60vw; max-height: 60vw; object-fit: contain; display: block; image-rendering: pixelated; }
.qr-cap { color: #1a1400; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

/* ================= APK / WEBVIEW-SAFE LAYOUT GUARDS =================
   Prevent long unbroken strings (UPI ids, txids, emails, receipts) from
   forcing horizontal overflow inside cards, lists and modals. */
.card, .modal, .list-item .t, .cred-row, .stat, .tcard .body { min-width: 0; }
.card, .modal, .list-item .t b, .list-item .t small, .cred-row .val, .page-sub, .lead {
  overflow-wrap: anywhere; word-break: break-word;
}
.cred-row { gap: 10px; }
.cred-row .val { text-align: right; }
.list-item .t b, .list-item .t small { overflow: hidden; text-overflow: ellipsis; }
/* horizontal chip strips never break the page width */
.page, .admin-content { overflow-x: clip; }
/* chip strips that must show every option without sideways scrolling */
.chip-row.wrap { flex-wrap: wrap; overflow-x: visible; padding-bottom: 0; }

/* ================= PHONE / TABLET: TABLES BECOME STACKED CARDS =================
   A wide table would need horizontal scrolling on a narrow screen, which hides
   columns (name, actions) off-screen. Up to 900px — the same width where the
   admin sidebar collapses — every row is re-drawn as a self-contained card: the
   first cell is the card title and every other cell shows its column name
   (injected as data-l) beside its value. Nothing is clipped, so the whole
   record is readable inside the page width. */
@media (max-width: 900px) {
  .table-wrap { overflow-x: visible; border: 0; background: transparent; border-radius: 0; }
  table.tbl { display: block; width: 100%; min-width: 0 !important; font-size: .87rem; }
  table.tbl thead { display: none; }
  table.tbl tbody { display: block; }
  table.tbl tr {
    display: block; background: var(--bg-2); border: 1px solid var(--line);
    border-radius: var(--r); margin-bottom: 10px; overflow: hidden;
  }
  table.tbl tr:last-child { margin-bottom: 0; }
  table.tbl tr:hover td { background: none; }
  table.tbl td {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: auto; min-width: 0; padding: 9px 13px; text-align: right;
    border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
  }
  table.tbl tr td:last-child { border-bottom: 0; }
  table.tbl td::before {
    content: attr(data-l); flex: 0 0 auto; color: var(--muted); text-align: left;
    font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  }
  /* first cell = card title: full width, left aligned, no column label */
  table.tbl tr td:first-child { display: block; text-align: left; background: var(--surface); }
  table.tbl tr td:first-child::before { display: none; }
  /* action buttons get their own full-width strip under the label */
  table.tbl td[data-act] { display: block; text-align: left; }
  table.tbl td[data-act]::before { display: block; margin-bottom: 7px; }
  table.tbl td[data-act][data-l=""]::before { display: none; }
  table.tbl td[data-act] .row { display: flex; flex-wrap: wrap; gap: 8px; }
  table.tbl td[data-act] .btn { flex: 1 1 auto; }
  /* empty-state row spans the whole card */
  table.tbl td[colspan] { display: block; text-align: center; }
  table.tbl td[colspan]::before { display: none; }
  table.tbl td .u, table.tbl td .row { min-width: 0; flex-wrap: wrap; }
  table.tbl td .input { width: 100% !important; max-width: 150px; }
}
